first commit
Some checks failed
Backend Tests / Static Checks (push) Has been cancelled
Backend Tests / Tests (other) (push) Has been cancelled
Backend Tests / Tests (plugin) (push) Has been cancelled
Backend Tests / Tests (server) (push) Has been cancelled
Backend Tests / Tests (store) (push) Has been cancelled
Build Canary Image / build-frontend (push) Has been cancelled
Build Canary Image / build-push (linux/amd64) (push) Has been cancelled
Build Canary Image / build-push (linux/arm64) (push) Has been cancelled
Build Canary Image / merge (push) Has been cancelled
Frontend Tests / Lint (push) Has been cancelled
Frontend Tests / Build (push) Has been cancelled
Proto Linter / Lint Protos (push) Has been cancelled
Some checks failed
Backend Tests / Static Checks (push) Has been cancelled
Backend Tests / Tests (other) (push) Has been cancelled
Backend Tests / Tests (plugin) (push) Has been cancelled
Backend Tests / Tests (server) (push) Has been cancelled
Backend Tests / Tests (store) (push) Has been cancelled
Build Canary Image / build-frontend (push) Has been cancelled
Build Canary Image / build-push (linux/amd64) (push) Has been cancelled
Build Canary Image / build-push (linux/arm64) (push) Has been cancelled
Build Canary Image / merge (push) Has been cancelled
Frontend Tests / Lint (push) Has been cancelled
Frontend Tests / Build (push) Has been cancelled
Proto Linter / Lint Protos (push) Has been cancelled
This commit is contained in:
236
proto/gen/api/v1/apiv1connect/shortcut_service.connect.go
Normal file
236
proto/gen/api/v1/apiv1connect/shortcut_service.connect.go
Normal file
@@ -0,0 +1,236 @@
|
||||
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
||||
//
|
||||
// Source: api/v1/shortcut_service.proto
|
||||
|
||||
package apiv1connect
|
||||
|
||||
import (
|
||||
connect "connectrpc.com/connect"
|
||||
context "context"
|
||||
errors "errors"
|
||||
v1 "github.com/usememos/memos/proto/gen/api/v1"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
http "net/http"
|
||||
strings "strings"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file and the connect package are
|
||||
// compatible. If you get a compiler error that this constant is not defined, this code was
|
||||
// generated with a version of connect newer than the one compiled into your binary. You can fix the
|
||||
// problem by either regenerating this code with an older version of connect or updating the connect
|
||||
// version compiled into your binary.
|
||||
const _ = connect.IsAtLeastVersion1_13_0
|
||||
|
||||
const (
|
||||
// ShortcutServiceName is the fully-qualified name of the ShortcutService service.
|
||||
ShortcutServiceName = "memos.api.v1.ShortcutService"
|
||||
)
|
||||
|
||||
// These constants are the fully-qualified names of the RPCs defined in this package. They're
|
||||
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
|
||||
//
|
||||
// Note that these are different from the fully-qualified method names used by
|
||||
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
|
||||
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
||||
// period.
|
||||
const (
|
||||
// ShortcutServiceListShortcutsProcedure is the fully-qualified name of the ShortcutService's
|
||||
// ListShortcuts RPC.
|
||||
ShortcutServiceListShortcutsProcedure = "/memos.api.v1.ShortcutService/ListShortcuts"
|
||||
// ShortcutServiceGetShortcutProcedure is the fully-qualified name of the ShortcutService's
|
||||
// GetShortcut RPC.
|
||||
ShortcutServiceGetShortcutProcedure = "/memos.api.v1.ShortcutService/GetShortcut"
|
||||
// ShortcutServiceCreateShortcutProcedure is the fully-qualified name of the ShortcutService's
|
||||
// CreateShortcut RPC.
|
||||
ShortcutServiceCreateShortcutProcedure = "/memos.api.v1.ShortcutService/CreateShortcut"
|
||||
// ShortcutServiceUpdateShortcutProcedure is the fully-qualified name of the ShortcutService's
|
||||
// UpdateShortcut RPC.
|
||||
ShortcutServiceUpdateShortcutProcedure = "/memos.api.v1.ShortcutService/UpdateShortcut"
|
||||
// ShortcutServiceDeleteShortcutProcedure is the fully-qualified name of the ShortcutService's
|
||||
// DeleteShortcut RPC.
|
||||
ShortcutServiceDeleteShortcutProcedure = "/memos.api.v1.ShortcutService/DeleteShortcut"
|
||||
)
|
||||
|
||||
// ShortcutServiceClient is a client for the memos.api.v1.ShortcutService service.
|
||||
type ShortcutServiceClient interface {
|
||||
// ListShortcuts returns a list of shortcuts for a user.
|
||||
ListShortcuts(context.Context, *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error)
|
||||
// GetShortcut gets a shortcut by name.
|
||||
GetShortcut(context.Context, *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error)
|
||||
// CreateShortcut creates a new shortcut for a user.
|
||||
CreateShortcut(context.Context, *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error)
|
||||
// UpdateShortcut updates a shortcut for a user.
|
||||
UpdateShortcut(context.Context, *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error)
|
||||
// DeleteShortcut deletes a shortcut for a user.
|
||||
DeleteShortcut(context.Context, *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error)
|
||||
}
|
||||
|
||||
// NewShortcutServiceClient constructs a client for the memos.api.v1.ShortcutService service. By
|
||||
// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
|
||||
// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
|
||||
// connect.WithGRPC() or connect.WithGRPCWeb() options.
|
||||
//
|
||||
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
|
||||
// http://api.acme.com or https://acme.com/grpc).
|
||||
func NewShortcutServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ShortcutServiceClient {
|
||||
baseURL = strings.TrimRight(baseURL, "/")
|
||||
shortcutServiceMethods := v1.File_api_v1_shortcut_service_proto.Services().ByName("ShortcutService").Methods()
|
||||
return &shortcutServiceClient{
|
||||
listShortcuts: connect.NewClient[v1.ListShortcutsRequest, v1.ListShortcutsResponse](
|
||||
httpClient,
|
||||
baseURL+ShortcutServiceListShortcutsProcedure,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("ListShortcuts")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
getShortcut: connect.NewClient[v1.GetShortcutRequest, v1.Shortcut](
|
||||
httpClient,
|
||||
baseURL+ShortcutServiceGetShortcutProcedure,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("GetShortcut")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
createShortcut: connect.NewClient[v1.CreateShortcutRequest, v1.Shortcut](
|
||||
httpClient,
|
||||
baseURL+ShortcutServiceCreateShortcutProcedure,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("CreateShortcut")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
updateShortcut: connect.NewClient[v1.UpdateShortcutRequest, v1.Shortcut](
|
||||
httpClient,
|
||||
baseURL+ShortcutServiceUpdateShortcutProcedure,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("UpdateShortcut")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
deleteShortcut: connect.NewClient[v1.DeleteShortcutRequest, emptypb.Empty](
|
||||
httpClient,
|
||||
baseURL+ShortcutServiceDeleteShortcutProcedure,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("DeleteShortcut")),
|
||||
connect.WithClientOptions(opts...),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// shortcutServiceClient implements ShortcutServiceClient.
|
||||
type shortcutServiceClient struct {
|
||||
listShortcuts *connect.Client[v1.ListShortcutsRequest, v1.ListShortcutsResponse]
|
||||
getShortcut *connect.Client[v1.GetShortcutRequest, v1.Shortcut]
|
||||
createShortcut *connect.Client[v1.CreateShortcutRequest, v1.Shortcut]
|
||||
updateShortcut *connect.Client[v1.UpdateShortcutRequest, v1.Shortcut]
|
||||
deleteShortcut *connect.Client[v1.DeleteShortcutRequest, emptypb.Empty]
|
||||
}
|
||||
|
||||
// ListShortcuts calls memos.api.v1.ShortcutService.ListShortcuts.
|
||||
func (c *shortcutServiceClient) ListShortcuts(ctx context.Context, req *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error) {
|
||||
return c.listShortcuts.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// GetShortcut calls memos.api.v1.ShortcutService.GetShortcut.
|
||||
func (c *shortcutServiceClient) GetShortcut(ctx context.Context, req *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error) {
|
||||
return c.getShortcut.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// CreateShortcut calls memos.api.v1.ShortcutService.CreateShortcut.
|
||||
func (c *shortcutServiceClient) CreateShortcut(ctx context.Context, req *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error) {
|
||||
return c.createShortcut.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// UpdateShortcut calls memos.api.v1.ShortcutService.UpdateShortcut.
|
||||
func (c *shortcutServiceClient) UpdateShortcut(ctx context.Context, req *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error) {
|
||||
return c.updateShortcut.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteShortcut calls memos.api.v1.ShortcutService.DeleteShortcut.
|
||||
func (c *shortcutServiceClient) DeleteShortcut(ctx context.Context, req *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error) {
|
||||
return c.deleteShortcut.CallUnary(ctx, req)
|
||||
}
|
||||
|
||||
// ShortcutServiceHandler is an implementation of the memos.api.v1.ShortcutService service.
|
||||
type ShortcutServiceHandler interface {
|
||||
// ListShortcuts returns a list of shortcuts for a user.
|
||||
ListShortcuts(context.Context, *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error)
|
||||
// GetShortcut gets a shortcut by name.
|
||||
GetShortcut(context.Context, *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error)
|
||||
// CreateShortcut creates a new shortcut for a user.
|
||||
CreateShortcut(context.Context, *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error)
|
||||
// UpdateShortcut updates a shortcut for a user.
|
||||
UpdateShortcut(context.Context, *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error)
|
||||
// DeleteShortcut deletes a shortcut for a user.
|
||||
DeleteShortcut(context.Context, *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error)
|
||||
}
|
||||
|
||||
// NewShortcutServiceHandler builds an HTTP handler from the service implementation. It returns the
|
||||
// path on which to mount the handler and the handler itself.
|
||||
//
|
||||
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
|
||||
// and JSON codecs. They also support gzip compression.
|
||||
func NewShortcutServiceHandler(svc ShortcutServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
||||
shortcutServiceMethods := v1.File_api_v1_shortcut_service_proto.Services().ByName("ShortcutService").Methods()
|
||||
shortcutServiceListShortcutsHandler := connect.NewUnaryHandler(
|
||||
ShortcutServiceListShortcutsProcedure,
|
||||
svc.ListShortcuts,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("ListShortcuts")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
shortcutServiceGetShortcutHandler := connect.NewUnaryHandler(
|
||||
ShortcutServiceGetShortcutProcedure,
|
||||
svc.GetShortcut,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("GetShortcut")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
shortcutServiceCreateShortcutHandler := connect.NewUnaryHandler(
|
||||
ShortcutServiceCreateShortcutProcedure,
|
||||
svc.CreateShortcut,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("CreateShortcut")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
shortcutServiceUpdateShortcutHandler := connect.NewUnaryHandler(
|
||||
ShortcutServiceUpdateShortcutProcedure,
|
||||
svc.UpdateShortcut,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("UpdateShortcut")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
shortcutServiceDeleteShortcutHandler := connect.NewUnaryHandler(
|
||||
ShortcutServiceDeleteShortcutProcedure,
|
||||
svc.DeleteShortcut,
|
||||
connect.WithSchema(shortcutServiceMethods.ByName("DeleteShortcut")),
|
||||
connect.WithHandlerOptions(opts...),
|
||||
)
|
||||
return "/memos.api.v1.ShortcutService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case ShortcutServiceListShortcutsProcedure:
|
||||
shortcutServiceListShortcutsHandler.ServeHTTP(w, r)
|
||||
case ShortcutServiceGetShortcutProcedure:
|
||||
shortcutServiceGetShortcutHandler.ServeHTTP(w, r)
|
||||
case ShortcutServiceCreateShortcutProcedure:
|
||||
shortcutServiceCreateShortcutHandler.ServeHTTP(w, r)
|
||||
case ShortcutServiceUpdateShortcutProcedure:
|
||||
shortcutServiceUpdateShortcutHandler.ServeHTTP(w, r)
|
||||
case ShortcutServiceDeleteShortcutProcedure:
|
||||
shortcutServiceDeleteShortcutHandler.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// UnimplementedShortcutServiceHandler returns CodeUnimplemented from all methods.
|
||||
type UnimplementedShortcutServiceHandler struct{}
|
||||
|
||||
func (UnimplementedShortcutServiceHandler) ListShortcuts(context.Context, *connect.Request[v1.ListShortcutsRequest]) (*connect.Response[v1.ListShortcutsResponse], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.ListShortcuts is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedShortcutServiceHandler) GetShortcut(context.Context, *connect.Request[v1.GetShortcutRequest]) (*connect.Response[v1.Shortcut], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.GetShortcut is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedShortcutServiceHandler) CreateShortcut(context.Context, *connect.Request[v1.CreateShortcutRequest]) (*connect.Response[v1.Shortcut], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.CreateShortcut is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedShortcutServiceHandler) UpdateShortcut(context.Context, *connect.Request[v1.UpdateShortcutRequest]) (*connect.Response[v1.Shortcut], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.UpdateShortcut is not implemented"))
|
||||
}
|
||||
|
||||
func (UnimplementedShortcutServiceHandler) DeleteShortcut(context.Context, *connect.Request[v1.DeleteShortcutRequest]) (*connect.Response[emptypb.Empty], error) {
|
||||
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.ShortcutService.DeleteShortcut is not implemented"))
|
||||
}
|
||||
Reference in New Issue
Block a user