// SPDX-License-Identifier: MIT // Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: ermite/merge_request.proto package ermiteconnect import ( ermite "bnema.dev/ermite-api/gen/ermite" connect "connectrpc.com/connect" context "context" errors "errors" 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 ( // MergeRequestServiceName is the fully-qualified name of the MergeRequestService service. MergeRequestServiceName = "ermite.MergeRequestService" ) // 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 ( // MergeRequestServiceCreateMergeRequestProcedure is the fully-qualified name of the // MergeRequestService's CreateMergeRequest RPC. MergeRequestServiceCreateMergeRequestProcedure = "/ermite.MergeRequestService/CreateMergeRequest" // MergeRequestServiceListMergeRequestsProcedure is the fully-qualified name of the // MergeRequestService's ListMergeRequests RPC. MergeRequestServiceListMergeRequestsProcedure = "/ermite.MergeRequestService/ListMergeRequests" // MergeRequestServiceGetMergeRequestProcedure is the fully-qualified name of the // MergeRequestService's GetMergeRequest RPC. MergeRequestServiceGetMergeRequestProcedure = "/ermite.MergeRequestService/GetMergeRequest" // MergeRequestServiceAddCommentProcedure is the fully-qualified name of the MergeRequestService's // AddComment RPC. MergeRequestServiceAddCommentProcedure = "/ermite.MergeRequestService/AddComment" // MergeRequestServiceResolveCommentProcedure is the fully-qualified name of the // MergeRequestService's ResolveComment RPC. MergeRequestServiceResolveCommentProcedure = "/ermite.MergeRequestService/ResolveComment" // MergeRequestServiceCloseMergeRequestProcedure is the fully-qualified name of the // MergeRequestService's CloseMergeRequest RPC. MergeRequestServiceCloseMergeRequestProcedure = "/ermite.MergeRequestService/CloseMergeRequest" // MergeRequestServiceMergeMergeRequestProcedure is the fully-qualified name of the // MergeRequestService's MergeMergeRequest RPC. MergeRequestServiceMergeMergeRequestProcedure = "/ermite.MergeRequestService/MergeMergeRequest" // MergeRequestServiceMarkReadProcedure is the fully-qualified name of the MergeRequestService's // MarkRead RPC. MergeRequestServiceMarkReadProcedure = "/ermite.MergeRequestService/MarkRead" ) // MergeRequestServiceClient is a client for the ermite.MergeRequestService service. type MergeRequestServiceClient interface { // CreateMergeRequest opens a merge request. Needs the mr:write scope. Fails // with invalid_argument if a text rule is broken, if a branch does not exist // or if source and target are the same branch, and with already_exists if an // open merge request already has the same source and target. CreateMergeRequest(context.Context, *connect.Request[ermite.CreateMergeRequestRequest]) (*connect.Response[ermite.CreateMergeRequestResponse], error) // ListMergeRequests lists the merge requests of a repository, highest // number (newest) first, optionally restricted to one state. The listed // merge requests carry no diff or comments; head_id is set. Fails with // not_found if the repository does not exist or is not readable. ListMergeRequests(context.Context, *connect.Request[ermite.ListMergeRequestsRequest]) (*connect.Response[ermite.ListMergeRequestsResponse], error) // GetMergeRequest returns one merge request with its commits, its diff and // its comments. The diff compares the target with the head (what the merge // would bring: "target...head"), or, with since_last_read, the head the // caller last marked read with the current head. Fails with not_found if // the repository or the number is unknown. GetMergeRequest(context.Context, *connect.Request[ermite.GetMergeRequestRequest]) (*connect.Response[ermite.GetMergeRequestResponse], error) // AddComment adds a general comment or a comment on a line of the diff. // Needs the mr:write scope. Fails with invalid_argument if the text breaks // a rule or if path, line and side do not designate a line of the current // diff of the merge request, and with failed_precondition if the merge // request is not open. AddComment(context.Context, *connect.Request[ermite.AddCommentRequest]) (*connect.Response[ermite.AddCommentResponse], error) // ResolveComment marks a comment resolved or unresolved. Needs the mr:write // scope. Fails with not_found if the comment is unknown and with // failed_precondition if the merge request is not open. Setting the state // the comment already has succeeds and changes nothing. ResolveComment(context.Context, *connect.Request[ermite.ResolveCommentRequest]) (*connect.Response[ermite.ResolveCommentResponse], error) // CloseMergeRequest closes an open merge request without merging it. Needs // the mr:write scope. Fails with failed_precondition if the merge request // is not open. A closed merge request cannot be reopened: open a new one. CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. // The caller passes the head it reviewed: the server merges only if the // source branch still points to it, so a push between review and merge is // never merged unseen. Fails with invalid_argument if head_id is empty or // not a commit id, and with failed_precondition if the merge request is not // open, if the source branch no longer points to head_id ("branch moved, // read again"), if the target is not an ancestor of the head (rebase and // push again), if the mode is not allowed by RepoSettings, or if a check // fails and RepoSettings.failing_checks_block is set. Merges of one // repository run one at a time. Repeating a call that succeeded fails with // failed_precondition (not open). On success the server publishes // MergeRequestMerged then Pushed for the target branch. MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) // MarkRead records the head the caller has reviewed, for the since_last_read // option of GetMergeRequest. There is one read position per merge request, // the reviewer's. Needs the mr:write scope. Marking a commit that does not // exist in the repository is invalid_argument. MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) } // NewMergeRequestServiceClient constructs a client for the ermite.MergeRequestService 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 NewMergeRequestServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) MergeRequestServiceClient { baseURL = strings.TrimRight(baseURL, "/") mergeRequestServiceMethods := ermite.File_ermite_merge_request_proto.Services().ByName("MergeRequestService").Methods() return &mergeRequestServiceClient{ createMergeRequest: connect.NewClient[ermite.CreateMergeRequestRequest, ermite.CreateMergeRequestResponse]( httpClient, baseURL+MergeRequestServiceCreateMergeRequestProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("CreateMergeRequest")), connect.WithClientOptions(opts...), ), listMergeRequests: connect.NewClient[ermite.ListMergeRequestsRequest, ermite.ListMergeRequestsResponse]( httpClient, baseURL+MergeRequestServiceListMergeRequestsProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("ListMergeRequests")), connect.WithClientOptions(opts...), ), getMergeRequest: connect.NewClient[ermite.GetMergeRequestRequest, ermite.GetMergeRequestResponse]( httpClient, baseURL+MergeRequestServiceGetMergeRequestProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("GetMergeRequest")), connect.WithClientOptions(opts...), ), addComment: connect.NewClient[ermite.AddCommentRequest, ermite.AddCommentResponse]( httpClient, baseURL+MergeRequestServiceAddCommentProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("AddComment")), connect.WithClientOptions(opts...), ), resolveComment: connect.NewClient[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse]( httpClient, baseURL+MergeRequestServiceResolveCommentProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("ResolveComment")), connect.WithClientOptions(opts...), ), closeMergeRequest: connect.NewClient[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse]( httpClient, baseURL+MergeRequestServiceCloseMergeRequestProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), connect.WithClientOptions(opts...), ), mergeMergeRequest: connect.NewClient[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse]( httpClient, baseURL+MergeRequestServiceMergeMergeRequestProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), connect.WithClientOptions(opts...), ), markRead: connect.NewClient[ermite.MarkReadRequest, ermite.MarkReadResponse]( httpClient, baseURL+MergeRequestServiceMarkReadProcedure, connect.WithSchema(mergeRequestServiceMethods.ByName("MarkRead")), connect.WithClientOptions(opts...), ), } } // mergeRequestServiceClient implements MergeRequestServiceClient. type mergeRequestServiceClient struct { createMergeRequest *connect.Client[ermite.CreateMergeRequestRequest, ermite.CreateMergeRequestResponse] listMergeRequests *connect.Client[ermite.ListMergeRequestsRequest, ermite.ListMergeRequestsResponse] getMergeRequest *connect.Client[ermite.GetMergeRequestRequest, ermite.GetMergeRequestResponse] addComment *connect.Client[ermite.AddCommentRequest, ermite.AddCommentResponse] resolveComment *connect.Client[ermite.ResolveCommentRequest, ermite.ResolveCommentResponse] closeMergeRequest *connect.Client[ermite.CloseMergeRequestRequest, ermite.CloseMergeRequestResponse] mergeMergeRequest *connect.Client[ermite.MergeMergeRequestRequest, ermite.MergeMergeRequestResponse] markRead *connect.Client[ermite.MarkReadRequest, ermite.MarkReadResponse] } // CreateMergeRequest calls ermite.MergeRequestService.CreateMergeRequest. func (c *mergeRequestServiceClient) CreateMergeRequest(ctx context.Context, req *connect.Request[ermite.CreateMergeRequestRequest]) (*connect.Response[ermite.CreateMergeRequestResponse], error) { return c.createMergeRequest.CallUnary(ctx, req) } // ListMergeRequests calls ermite.MergeRequestService.ListMergeRequests. func (c *mergeRequestServiceClient) ListMergeRequests(ctx context.Context, req *connect.Request[ermite.ListMergeRequestsRequest]) (*connect.Response[ermite.ListMergeRequestsResponse], error) { return c.listMergeRequests.CallUnary(ctx, req) } // GetMergeRequest calls ermite.MergeRequestService.GetMergeRequest. func (c *mergeRequestServiceClient) GetMergeRequest(ctx context.Context, req *connect.Request[ermite.GetMergeRequestRequest]) (*connect.Response[ermite.GetMergeRequestResponse], error) { return c.getMergeRequest.CallUnary(ctx, req) } // AddComment calls ermite.MergeRequestService.AddComment. func (c *mergeRequestServiceClient) AddComment(ctx context.Context, req *connect.Request[ermite.AddCommentRequest]) (*connect.Response[ermite.AddCommentResponse], error) { return c.addComment.CallUnary(ctx, req) } // ResolveComment calls ermite.MergeRequestService.ResolveComment. func (c *mergeRequestServiceClient) ResolveComment(ctx context.Context, req *connect.Request[ermite.ResolveCommentRequest]) (*connect.Response[ermite.ResolveCommentResponse], error) { return c.resolveComment.CallUnary(ctx, req) } // CloseMergeRequest calls ermite.MergeRequestService.CloseMergeRequest. func (c *mergeRequestServiceClient) CloseMergeRequest(ctx context.Context, req *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) { return c.closeMergeRequest.CallUnary(ctx, req) } // MergeMergeRequest calls ermite.MergeRequestService.MergeMergeRequest. func (c *mergeRequestServiceClient) MergeMergeRequest(ctx context.Context, req *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { return c.mergeMergeRequest.CallUnary(ctx, req) } // MarkRead calls ermite.MergeRequestService.MarkRead. func (c *mergeRequestServiceClient) MarkRead(ctx context.Context, req *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { return c.markRead.CallUnary(ctx, req) } // MergeRequestServiceHandler is an implementation of the ermite.MergeRequestService service. type MergeRequestServiceHandler interface { // CreateMergeRequest opens a merge request. Needs the mr:write scope. Fails // with invalid_argument if a text rule is broken, if a branch does not exist // or if source and target are the same branch, and with already_exists if an // open merge request already has the same source and target. CreateMergeRequest(context.Context, *connect.Request[ermite.CreateMergeRequestRequest]) (*connect.Response[ermite.CreateMergeRequestResponse], error) // ListMergeRequests lists the merge requests of a repository, highest // number (newest) first, optionally restricted to one state. The listed // merge requests carry no diff or comments; head_id is set. Fails with // not_found if the repository does not exist or is not readable. ListMergeRequests(context.Context, *connect.Request[ermite.ListMergeRequestsRequest]) (*connect.Response[ermite.ListMergeRequestsResponse], error) // GetMergeRequest returns one merge request with its commits, its diff and // its comments. The diff compares the target with the head (what the merge // would bring: "target...head"), or, with since_last_read, the head the // caller last marked read with the current head. Fails with not_found if // the repository or the number is unknown. GetMergeRequest(context.Context, *connect.Request[ermite.GetMergeRequestRequest]) (*connect.Response[ermite.GetMergeRequestResponse], error) // AddComment adds a general comment or a comment on a line of the diff. // Needs the mr:write scope. Fails with invalid_argument if the text breaks // a rule or if path, line and side do not designate a line of the current // diff of the merge request, and with failed_precondition if the merge // request is not open. AddComment(context.Context, *connect.Request[ermite.AddCommentRequest]) (*connect.Response[ermite.AddCommentResponse], error) // ResolveComment marks a comment resolved or unresolved. Needs the mr:write // scope. Fails with not_found if the comment is unknown and with // failed_precondition if the merge request is not open. Setting the state // the comment already has succeeds and changes nothing. ResolveComment(context.Context, *connect.Request[ermite.ResolveCommentRequest]) (*connect.Response[ermite.ResolveCommentResponse], error) // CloseMergeRequest closes an open merge request without merging it. Needs // the mr:write scope. Fails with failed_precondition if the merge request // is not open. A closed merge request cannot be reopened: open a new one. CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) // MergeMergeRequest merges an open merge request. Needs the mr:merge scope. // The caller passes the head it reviewed: the server merges only if the // source branch still points to it, so a push between review and merge is // never merged unseen. Fails with invalid_argument if head_id is empty or // not a commit id, and with failed_precondition if the merge request is not // open, if the source branch no longer points to head_id ("branch moved, // read again"), if the target is not an ancestor of the head (rebase and // push again), if the mode is not allowed by RepoSettings, or if a check // fails and RepoSettings.failing_checks_block is set. Merges of one // repository run one at a time. Repeating a call that succeeded fails with // failed_precondition (not open). On success the server publishes // MergeRequestMerged then Pushed for the target branch. MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) // MarkRead records the head the caller has reviewed, for the since_last_read // option of GetMergeRequest. There is one read position per merge request, // the reviewer's. Needs the mr:write scope. Marking a commit that does not // exist in the repository is invalid_argument. MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) } // NewMergeRequestServiceHandler 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 NewMergeRequestServiceHandler(svc MergeRequestServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { mergeRequestServiceMethods := ermite.File_ermite_merge_request_proto.Services().ByName("MergeRequestService").Methods() mergeRequestServiceCreateMergeRequestHandler := connect.NewUnaryHandler( MergeRequestServiceCreateMergeRequestProcedure, svc.CreateMergeRequest, connect.WithSchema(mergeRequestServiceMethods.ByName("CreateMergeRequest")), connect.WithHandlerOptions(opts...), ) mergeRequestServiceListMergeRequestsHandler := connect.NewUnaryHandler( MergeRequestServiceListMergeRequestsProcedure, svc.ListMergeRequests, connect.WithSchema(mergeRequestServiceMethods.ByName("ListMergeRequests")), connect.WithHandlerOptions(opts...), ) mergeRequestServiceGetMergeRequestHandler := connect.NewUnaryHandler( MergeRequestServiceGetMergeRequestProcedure, svc.GetMergeRequest, connect.WithSchema(mergeRequestServiceMethods.ByName("GetMergeRequest")), connect.WithHandlerOptions(opts...), ) mergeRequestServiceAddCommentHandler := connect.NewUnaryHandler( MergeRequestServiceAddCommentProcedure, svc.AddComment, connect.WithSchema(mergeRequestServiceMethods.ByName("AddComment")), connect.WithHandlerOptions(opts...), ) mergeRequestServiceResolveCommentHandler := connect.NewUnaryHandler( MergeRequestServiceResolveCommentProcedure, svc.ResolveComment, connect.WithSchema(mergeRequestServiceMethods.ByName("ResolveComment")), connect.WithHandlerOptions(opts...), ) mergeRequestServiceCloseMergeRequestHandler := connect.NewUnaryHandler( MergeRequestServiceCloseMergeRequestProcedure, svc.CloseMergeRequest, connect.WithSchema(mergeRequestServiceMethods.ByName("CloseMergeRequest")), connect.WithHandlerOptions(opts...), ) mergeRequestServiceMergeMergeRequestHandler := connect.NewUnaryHandler( MergeRequestServiceMergeMergeRequestProcedure, svc.MergeMergeRequest, connect.WithSchema(mergeRequestServiceMethods.ByName("MergeMergeRequest")), connect.WithHandlerOptions(opts...), ) mergeRequestServiceMarkReadHandler := connect.NewUnaryHandler( MergeRequestServiceMarkReadProcedure, svc.MarkRead, connect.WithSchema(mergeRequestServiceMethods.ByName("MarkRead")), connect.WithHandlerOptions(opts...), ) return "/ermite.MergeRequestService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case MergeRequestServiceCreateMergeRequestProcedure: mergeRequestServiceCreateMergeRequestHandler.ServeHTTP(w, r) case MergeRequestServiceListMergeRequestsProcedure: mergeRequestServiceListMergeRequestsHandler.ServeHTTP(w, r) case MergeRequestServiceGetMergeRequestProcedure: mergeRequestServiceGetMergeRequestHandler.ServeHTTP(w, r) case MergeRequestServiceAddCommentProcedure: mergeRequestServiceAddCommentHandler.ServeHTTP(w, r) case MergeRequestServiceResolveCommentProcedure: mergeRequestServiceResolveCommentHandler.ServeHTTP(w, r) case MergeRequestServiceCloseMergeRequestProcedure: mergeRequestServiceCloseMergeRequestHandler.ServeHTTP(w, r) case MergeRequestServiceMergeMergeRequestProcedure: mergeRequestServiceMergeMergeRequestHandler.ServeHTTP(w, r) case MergeRequestServiceMarkReadProcedure: mergeRequestServiceMarkReadHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedMergeRequestServiceHandler returns CodeUnimplemented from all methods. type UnimplementedMergeRequestServiceHandler struct{} func (UnimplementedMergeRequestServiceHandler) CreateMergeRequest(context.Context, *connect.Request[ermite.CreateMergeRequestRequest]) (*connect.Response[ermite.CreateMergeRequestResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CreateMergeRequest is not implemented")) } func (UnimplementedMergeRequestServiceHandler) ListMergeRequests(context.Context, *connect.Request[ermite.ListMergeRequestsRequest]) (*connect.Response[ermite.ListMergeRequestsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.ListMergeRequests is not implemented")) } func (UnimplementedMergeRequestServiceHandler) GetMergeRequest(context.Context, *connect.Request[ermite.GetMergeRequestRequest]) (*connect.Response[ermite.GetMergeRequestResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.GetMergeRequest is not implemented")) } func (UnimplementedMergeRequestServiceHandler) AddComment(context.Context, *connect.Request[ermite.AddCommentRequest]) (*connect.Response[ermite.AddCommentResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.AddComment is not implemented")) } func (UnimplementedMergeRequestServiceHandler) ResolveComment(context.Context, *connect.Request[ermite.ResolveCommentRequest]) (*connect.Response[ermite.ResolveCommentResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.ResolveComment is not implemented")) } func (UnimplementedMergeRequestServiceHandler) CloseMergeRequest(context.Context, *connect.Request[ermite.CloseMergeRequestRequest]) (*connect.Response[ermite.CloseMergeRequestResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.CloseMergeRequest is not implemented")) } func (UnimplementedMergeRequestServiceHandler) MergeMergeRequest(context.Context, *connect.Request[ermite.MergeMergeRequestRequest]) (*connect.Response[ermite.MergeMergeRequestResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MergeMergeRequest is not implemented")) } func (UnimplementedMergeRequestServiceHandler) MarkRead(context.Context, *connect.Request[ermite.MarkReadRequest]) (*connect.Response[ermite.MarkReadResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.MergeRequestService.MarkRead is not implemented")) }