// Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: api/v1/attachment_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 ( // AttachmentServiceName is the fully-qualified name of the AttachmentService service. AttachmentServiceName = "memos.api.v1.AttachmentService" ) // 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 ( // AttachmentServiceCreateAttachmentProcedure is the fully-qualified name of the AttachmentService's // CreateAttachment RPC. AttachmentServiceCreateAttachmentProcedure = "/memos.api.v1.AttachmentService/CreateAttachment" // AttachmentServiceListAttachmentsProcedure is the fully-qualified name of the AttachmentService's // ListAttachments RPC. AttachmentServiceListAttachmentsProcedure = "/memos.api.v1.AttachmentService/ListAttachments" // AttachmentServiceGetAttachmentProcedure is the fully-qualified name of the AttachmentService's // GetAttachment RPC. AttachmentServiceGetAttachmentProcedure = "/memos.api.v1.AttachmentService/GetAttachment" // AttachmentServiceUpdateAttachmentProcedure is the fully-qualified name of the AttachmentService's // UpdateAttachment RPC. AttachmentServiceUpdateAttachmentProcedure = "/memos.api.v1.AttachmentService/UpdateAttachment" // AttachmentServiceDeleteAttachmentProcedure is the fully-qualified name of the AttachmentService's // DeleteAttachment RPC. AttachmentServiceDeleteAttachmentProcedure = "/memos.api.v1.AttachmentService/DeleteAttachment" ) // AttachmentServiceClient is a client for the memos.api.v1.AttachmentService service. type AttachmentServiceClient interface { // CreateAttachment creates a new attachment. CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) // ListAttachments lists all attachments. ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) // GetAttachment returns a attachment by name. GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) // UpdateAttachment updates a attachment. UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) // DeleteAttachment deletes a attachment by name. DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) } // NewAttachmentServiceClient constructs a client for the memos.api.v1.AttachmentService 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 NewAttachmentServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AttachmentServiceClient { baseURL = strings.TrimRight(baseURL, "/") attachmentServiceMethods := v1.File_api_v1_attachment_service_proto.Services().ByName("AttachmentService").Methods() return &attachmentServiceClient{ createAttachment: connect.NewClient[v1.CreateAttachmentRequest, v1.Attachment]( httpClient, baseURL+AttachmentServiceCreateAttachmentProcedure, connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), connect.WithClientOptions(opts...), ), listAttachments: connect.NewClient[v1.ListAttachmentsRequest, v1.ListAttachmentsResponse]( httpClient, baseURL+AttachmentServiceListAttachmentsProcedure, connect.WithSchema(attachmentServiceMethods.ByName("ListAttachments")), connect.WithClientOptions(opts...), ), getAttachment: connect.NewClient[v1.GetAttachmentRequest, v1.Attachment]( httpClient, baseURL+AttachmentServiceGetAttachmentProcedure, connect.WithSchema(attachmentServiceMethods.ByName("GetAttachment")), connect.WithClientOptions(opts...), ), updateAttachment: connect.NewClient[v1.UpdateAttachmentRequest, v1.Attachment]( httpClient, baseURL+AttachmentServiceUpdateAttachmentProcedure, connect.WithSchema(attachmentServiceMethods.ByName("UpdateAttachment")), connect.WithClientOptions(opts...), ), deleteAttachment: connect.NewClient[v1.DeleteAttachmentRequest, emptypb.Empty]( httpClient, baseURL+AttachmentServiceDeleteAttachmentProcedure, connect.WithSchema(attachmentServiceMethods.ByName("DeleteAttachment")), connect.WithClientOptions(opts...), ), } } // attachmentServiceClient implements AttachmentServiceClient. type attachmentServiceClient struct { createAttachment *connect.Client[v1.CreateAttachmentRequest, v1.Attachment] listAttachments *connect.Client[v1.ListAttachmentsRequest, v1.ListAttachmentsResponse] getAttachment *connect.Client[v1.GetAttachmentRequest, v1.Attachment] updateAttachment *connect.Client[v1.UpdateAttachmentRequest, v1.Attachment] deleteAttachment *connect.Client[v1.DeleteAttachmentRequest, emptypb.Empty] } // CreateAttachment calls memos.api.v1.AttachmentService.CreateAttachment. func (c *attachmentServiceClient) CreateAttachment(ctx context.Context, req *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { return c.createAttachment.CallUnary(ctx, req) } // ListAttachments calls memos.api.v1.AttachmentService.ListAttachments. func (c *attachmentServiceClient) ListAttachments(ctx context.Context, req *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) { return c.listAttachments.CallUnary(ctx, req) } // GetAttachment calls memos.api.v1.AttachmentService.GetAttachment. func (c *attachmentServiceClient) GetAttachment(ctx context.Context, req *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) { return c.getAttachment.CallUnary(ctx, req) } // UpdateAttachment calls memos.api.v1.AttachmentService.UpdateAttachment. func (c *attachmentServiceClient) UpdateAttachment(ctx context.Context, req *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { return c.updateAttachment.CallUnary(ctx, req) } // DeleteAttachment calls memos.api.v1.AttachmentService.DeleteAttachment. func (c *attachmentServiceClient) DeleteAttachment(ctx context.Context, req *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { return c.deleteAttachment.CallUnary(ctx, req) } // AttachmentServiceHandler is an implementation of the memos.api.v1.AttachmentService service. type AttachmentServiceHandler interface { // CreateAttachment creates a new attachment. CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) // ListAttachments lists all attachments. ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) // GetAttachment returns a attachment by name. GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) // UpdateAttachment updates a attachment. UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) // DeleteAttachment deletes a attachment by name. DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) } // NewAttachmentServiceHandler 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 NewAttachmentServiceHandler(svc AttachmentServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { attachmentServiceMethods := v1.File_api_v1_attachment_service_proto.Services().ByName("AttachmentService").Methods() attachmentServiceCreateAttachmentHandler := connect.NewUnaryHandler( AttachmentServiceCreateAttachmentProcedure, svc.CreateAttachment, connect.WithSchema(attachmentServiceMethods.ByName("CreateAttachment")), connect.WithHandlerOptions(opts...), ) attachmentServiceListAttachmentsHandler := connect.NewUnaryHandler( AttachmentServiceListAttachmentsProcedure, svc.ListAttachments, connect.WithSchema(attachmentServiceMethods.ByName("ListAttachments")), connect.WithHandlerOptions(opts...), ) attachmentServiceGetAttachmentHandler := connect.NewUnaryHandler( AttachmentServiceGetAttachmentProcedure, svc.GetAttachment, connect.WithSchema(attachmentServiceMethods.ByName("GetAttachment")), connect.WithHandlerOptions(opts...), ) attachmentServiceUpdateAttachmentHandler := connect.NewUnaryHandler( AttachmentServiceUpdateAttachmentProcedure, svc.UpdateAttachment, connect.WithSchema(attachmentServiceMethods.ByName("UpdateAttachment")), connect.WithHandlerOptions(opts...), ) attachmentServiceDeleteAttachmentHandler := connect.NewUnaryHandler( AttachmentServiceDeleteAttachmentProcedure, svc.DeleteAttachment, connect.WithSchema(attachmentServiceMethods.ByName("DeleteAttachment")), connect.WithHandlerOptions(opts...), ) return "/memos.api.v1.AttachmentService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case AttachmentServiceCreateAttachmentProcedure: attachmentServiceCreateAttachmentHandler.ServeHTTP(w, r) case AttachmentServiceListAttachmentsProcedure: attachmentServiceListAttachmentsHandler.ServeHTTP(w, r) case AttachmentServiceGetAttachmentProcedure: attachmentServiceGetAttachmentHandler.ServeHTTP(w, r) case AttachmentServiceUpdateAttachmentProcedure: attachmentServiceUpdateAttachmentHandler.ServeHTTP(w, r) case AttachmentServiceDeleteAttachmentProcedure: attachmentServiceDeleteAttachmentHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedAttachmentServiceHandler returns CodeUnimplemented from all methods. type UnimplementedAttachmentServiceHandler struct{} func (UnimplementedAttachmentServiceHandler) CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.CreateAttachment is not implemented")) } func (UnimplementedAttachmentServiceHandler) ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.ListAttachments is not implemented")) } func (UnimplementedAttachmentServiceHandler) GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.GetAttachment is not implemented")) } func (UnimplementedAttachmentServiceHandler) UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.UpdateAttachment is not implemented")) } func (UnimplementedAttachmentServiceHandler) DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.v1.AttachmentService.DeleteAttachment is not implemented")) }