chore: add shortcut space routes

This commit is contained in:
Steven
2023-12-17 23:27:01 +08:00
parent 43cda4e2fb
commit fb7fc2443f
21 changed files with 647 additions and 493 deletions

View File

@@ -21,6 +21,7 @@ const _ = grpc.SupportPackageIsVersion7
const (
ShortcutService_ListShortcuts_FullMethodName = "/slash.api.v2.ShortcutService/ListShortcuts"
ShortcutService_GetShortcut_FullMethodName = "/slash.api.v2.ShortcutService/GetShortcut"
ShortcutService_GetShortcutById_FullMethodName = "/slash.api.v2.ShortcutService/GetShortcutById"
ShortcutService_CreateShortcut_FullMethodName = "/slash.api.v2.ShortcutService/CreateShortcut"
ShortcutService_UpdateShortcut_FullMethodName = "/slash.api.v2.ShortcutService/UpdateShortcut"
ShortcutService_DeleteShortcut_FullMethodName = "/slash.api.v2.ShortcutService/DeleteShortcut"
@@ -33,13 +34,15 @@ const (
type ShortcutServiceClient interface {
// ListShortcuts returns a list of shortcuts.
ListShortcuts(ctx context.Context, in *ListShortcutsRequest, opts ...grpc.CallOption) (*ListShortcutsResponse, error)
// GetShortcut returns a shortcut by id.
// GetShortcut returns a shortcut by name.
GetShortcut(ctx context.Context, in *GetShortcutRequest, opts ...grpc.CallOption) (*GetShortcutResponse, error)
// GetShortcutById returns a shortcut by id.
GetShortcutById(ctx context.Context, in *GetShortcutByIdRequest, opts ...grpc.CallOption) (*GetShortcutByIdResponse, error)
// CreateShortcut creates a shortcut.
CreateShortcut(ctx context.Context, in *CreateShortcutRequest, opts ...grpc.CallOption) (*CreateShortcutResponse, error)
// UpdateShortcut updates a shortcut.
UpdateShortcut(ctx context.Context, in *UpdateShortcutRequest, opts ...grpc.CallOption) (*UpdateShortcutResponse, error)
// DeleteShortcut deletes a shortcut by id.
// DeleteShortcut deletes a shortcut by name.
DeleteShortcut(ctx context.Context, in *DeleteShortcutRequest, opts ...grpc.CallOption) (*DeleteShortcutResponse, error)
// GetShortcutAnalytics returns the analytics for a shortcut.
GetShortcutAnalytics(ctx context.Context, in *GetShortcutAnalyticsRequest, opts ...grpc.CallOption) (*GetShortcutAnalyticsResponse, error)
@@ -71,6 +74,15 @@ func (c *shortcutServiceClient) GetShortcut(ctx context.Context, in *GetShortcut
return out, nil
}
func (c *shortcutServiceClient) GetShortcutById(ctx context.Context, in *GetShortcutByIdRequest, opts ...grpc.CallOption) (*GetShortcutByIdResponse, error) {
out := new(GetShortcutByIdResponse)
err := c.cc.Invoke(ctx, ShortcutService_GetShortcutById_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *shortcutServiceClient) CreateShortcut(ctx context.Context, in *CreateShortcutRequest, opts ...grpc.CallOption) (*CreateShortcutResponse, error) {
out := new(CreateShortcutResponse)
err := c.cc.Invoke(ctx, ShortcutService_CreateShortcut_FullMethodName, in, out, opts...)
@@ -113,13 +125,15 @@ func (c *shortcutServiceClient) GetShortcutAnalytics(ctx context.Context, in *Ge
type ShortcutServiceServer interface {
// ListShortcuts returns a list of shortcuts.
ListShortcuts(context.Context, *ListShortcutsRequest) (*ListShortcutsResponse, error)
// GetShortcut returns a shortcut by id.
// GetShortcut returns a shortcut by name.
GetShortcut(context.Context, *GetShortcutRequest) (*GetShortcutResponse, error)
// GetShortcutById returns a shortcut by id.
GetShortcutById(context.Context, *GetShortcutByIdRequest) (*GetShortcutByIdResponse, error)
// CreateShortcut creates a shortcut.
CreateShortcut(context.Context, *CreateShortcutRequest) (*CreateShortcutResponse, error)
// UpdateShortcut updates a shortcut.
UpdateShortcut(context.Context, *UpdateShortcutRequest) (*UpdateShortcutResponse, error)
// DeleteShortcut deletes a shortcut by id.
// DeleteShortcut deletes a shortcut by name.
DeleteShortcut(context.Context, *DeleteShortcutRequest) (*DeleteShortcutResponse, error)
// GetShortcutAnalytics returns the analytics for a shortcut.
GetShortcutAnalytics(context.Context, *GetShortcutAnalyticsRequest) (*GetShortcutAnalyticsResponse, error)
@@ -136,6 +150,9 @@ func (UnimplementedShortcutServiceServer) ListShortcuts(context.Context, *ListSh
func (UnimplementedShortcutServiceServer) GetShortcut(context.Context, *GetShortcutRequest) (*GetShortcutResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetShortcut not implemented")
}
func (UnimplementedShortcutServiceServer) GetShortcutById(context.Context, *GetShortcutByIdRequest) (*GetShortcutByIdResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetShortcutById not implemented")
}
func (UnimplementedShortcutServiceServer) CreateShortcut(context.Context, *CreateShortcutRequest) (*CreateShortcutResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateShortcut not implemented")
}
@@ -197,6 +214,24 @@ func _ShortcutService_GetShortcut_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _ShortcutService_GetShortcutById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetShortcutByIdRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ShortcutServiceServer).GetShortcutById(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ShortcutService_GetShortcutById_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ShortcutServiceServer).GetShortcutById(ctx, req.(*GetShortcutByIdRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ShortcutService_CreateShortcut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateShortcutRequest)
if err := dec(in); err != nil {
@@ -284,6 +319,10 @@ var ShortcutService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetShortcut",
Handler: _ShortcutService_GetShortcut_Handler,
},
{
MethodName: "GetShortcutById",
Handler: _ShortcutService_GetShortcutById_Handler,
},
{
MethodName: "CreateShortcut",
Handler: _ShortcutService_CreateShortcut_Handler,