// SPDX-License-Identifier: MIT // Code generated by protoc-gen-connect-go. DO NOT EDIT. // // Source: ermite/git.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 ( // GitServiceName is the fully-qualified name of the GitService service. GitServiceName = "ermite.GitService" ) // 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 ( // GitServiceListRefsProcedure is the fully-qualified name of the GitService's ListRefs RPC. GitServiceListRefsProcedure = "/ermite.GitService/ListRefs" // GitServiceGetTreeProcedure is the fully-qualified name of the GitService's GetTree RPC. GitServiceGetTreeProcedure = "/ermite.GitService/GetTree" // GitServiceListPathsProcedure is the fully-qualified name of the GitService's ListPaths RPC. GitServiceListPathsProcedure = "/ermite.GitService/ListPaths" // GitServiceGetBlobProcedure is the fully-qualified name of the GitService's GetBlob RPC. GitServiceGetBlobProcedure = "/ermite.GitService/GetBlob" // GitServiceListCommitsProcedure is the fully-qualified name of the GitService's ListCommits RPC. GitServiceListCommitsProcedure = "/ermite.GitService/ListCommits" // GitServiceGetCommitProcedure is the fully-qualified name of the GitService's GetCommit RPC. GitServiceGetCommitProcedure = "/ermite.GitService/GetCommit" // GitServiceResolveRevisionProcedure is the fully-qualified name of the GitService's // ResolveRevision RPC. GitServiceResolveRevisionProcedure = "/ermite.GitService/ResolveRevision" ) // GitServiceClient is a client for the ermite.GitService service. type GitServiceClient interface { // ListRefs lists the branches, tags and HEAD of a repository. Refs are // ordered by kind (HEAD, branches, tags) then by name. ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) // GetTree lists the entries of a directory at a revision. Fails with // not_found if the path does not exist and invalid_argument if it is not a // directory. GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) // ListPaths lists the paths of every file and symbolic link of a revision, // recursively, in Git tree order (the order of `git ls-tree -r`). Directories // and submodules are not listed, nor paths GetBlob cannot address (not valid // UTF-8, or with a control character). Fails with not_found for an unknown // revision or an empty repository. Servers that have it advertise the // feature "git.list_paths" in GetVersion. ListPaths(context.Context, *connect.Request[ermite.ListPathsRequest]) (*connect.Response[ermite.ListPathsResponse], error) // GetBlob streams the content of a file at a revision, in chunks of at most // 64 KiB. The first message carries the metadata in info, then the chunks // follow; the memory used by the server does not depend on the file size. // Fails with not_found if the path does not exist and invalid_argument if it // is not a file. GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest]) (*connect.ServerStreamForClient[ermite.GetBlobResponse], error) // ListCommits lists the history reachable from a revision, newest first // (Git's default order), optionally limited to the commits that touched a // path. A page_token that points deeper than 100,000 commits into the // history is invalid_argument. ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) // GetCommit returns one commit with its statistics and its diff. GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) // ResolveRevision turns a revision into the id of the commit it designates. ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) } // NewGitServiceClient constructs a client for the ermite.GitService 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 NewGitServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GitServiceClient { baseURL = strings.TrimRight(baseURL, "/") gitServiceMethods := ermite.File_ermite_git_proto.Services().ByName("GitService").Methods() return &gitServiceClient{ listRefs: connect.NewClient[ermite.ListRefsRequest, ermite.ListRefsResponse]( httpClient, baseURL+GitServiceListRefsProcedure, connect.WithSchema(gitServiceMethods.ByName("ListRefs")), connect.WithClientOptions(opts...), ), getTree: connect.NewClient[ermite.GetTreeRequest, ermite.GetTreeResponse]( httpClient, baseURL+GitServiceGetTreeProcedure, connect.WithSchema(gitServiceMethods.ByName("GetTree")), connect.WithClientOptions(opts...), ), listPaths: connect.NewClient[ermite.ListPathsRequest, ermite.ListPathsResponse]( httpClient, baseURL+GitServiceListPathsProcedure, connect.WithSchema(gitServiceMethods.ByName("ListPaths")), connect.WithClientOptions(opts...), ), getBlob: connect.NewClient[ermite.GetBlobRequest, ermite.GetBlobResponse]( httpClient, baseURL+GitServiceGetBlobProcedure, connect.WithSchema(gitServiceMethods.ByName("GetBlob")), connect.WithClientOptions(opts...), ), listCommits: connect.NewClient[ermite.ListCommitsRequest, ermite.ListCommitsResponse]( httpClient, baseURL+GitServiceListCommitsProcedure, connect.WithSchema(gitServiceMethods.ByName("ListCommits")), connect.WithClientOptions(opts...), ), getCommit: connect.NewClient[ermite.GetCommitRequest, ermite.GetCommitResponse]( httpClient, baseURL+GitServiceGetCommitProcedure, connect.WithSchema(gitServiceMethods.ByName("GetCommit")), connect.WithClientOptions(opts...), ), resolveRevision: connect.NewClient[ermite.ResolveRevisionRequest, ermite.ResolveRevisionResponse]( httpClient, baseURL+GitServiceResolveRevisionProcedure, connect.WithSchema(gitServiceMethods.ByName("ResolveRevision")), connect.WithClientOptions(opts...), ), } } // gitServiceClient implements GitServiceClient. type gitServiceClient struct { listRefs *connect.Client[ermite.ListRefsRequest, ermite.ListRefsResponse] getTree *connect.Client[ermite.GetTreeRequest, ermite.GetTreeResponse] listPaths *connect.Client[ermite.ListPathsRequest, ermite.ListPathsResponse] getBlob *connect.Client[ermite.GetBlobRequest, ermite.GetBlobResponse] listCommits *connect.Client[ermite.ListCommitsRequest, ermite.ListCommitsResponse] getCommit *connect.Client[ermite.GetCommitRequest, ermite.GetCommitResponse] resolveRevision *connect.Client[ermite.ResolveRevisionRequest, ermite.ResolveRevisionResponse] } // ListRefs calls ermite.GitService.ListRefs. func (c *gitServiceClient) ListRefs(ctx context.Context, req *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) { return c.listRefs.CallUnary(ctx, req) } // GetTree calls ermite.GitService.GetTree. func (c *gitServiceClient) GetTree(ctx context.Context, req *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) { return c.getTree.CallUnary(ctx, req) } // ListPaths calls ermite.GitService.ListPaths. func (c *gitServiceClient) ListPaths(ctx context.Context, req *connect.Request[ermite.ListPathsRequest]) (*connect.Response[ermite.ListPathsResponse], error) { return c.listPaths.CallUnary(ctx, req) } // GetBlob calls ermite.GitService.GetBlob. func (c *gitServiceClient) GetBlob(ctx context.Context, req *connect.Request[ermite.GetBlobRequest]) (*connect.ServerStreamForClient[ermite.GetBlobResponse], error) { return c.getBlob.CallServerStream(ctx, req) } // ListCommits calls ermite.GitService.ListCommits. func (c *gitServiceClient) ListCommits(ctx context.Context, req *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) { return c.listCommits.CallUnary(ctx, req) } // GetCommit calls ermite.GitService.GetCommit. func (c *gitServiceClient) GetCommit(ctx context.Context, req *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) { return c.getCommit.CallUnary(ctx, req) } // ResolveRevision calls ermite.GitService.ResolveRevision. func (c *gitServiceClient) ResolveRevision(ctx context.Context, req *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) { return c.resolveRevision.CallUnary(ctx, req) } // GitServiceHandler is an implementation of the ermite.GitService service. type GitServiceHandler interface { // ListRefs lists the branches, tags and HEAD of a repository. Refs are // ordered by kind (HEAD, branches, tags) then by name. ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) // GetTree lists the entries of a directory at a revision. Fails with // not_found if the path does not exist and invalid_argument if it is not a // directory. GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) // ListPaths lists the paths of every file and symbolic link of a revision, // recursively, in Git tree order (the order of `git ls-tree -r`). Directories // and submodules are not listed, nor paths GetBlob cannot address (not valid // UTF-8, or with a control character). Fails with not_found for an unknown // revision or an empty repository. Servers that have it advertise the // feature "git.list_paths" in GetVersion. ListPaths(context.Context, *connect.Request[ermite.ListPathsRequest]) (*connect.Response[ermite.ListPathsResponse], error) // GetBlob streams the content of a file at a revision, in chunks of at most // 64 KiB. The first message carries the metadata in info, then the chunks // follow; the memory used by the server does not depend on the file size. // Fails with not_found if the path does not exist and invalid_argument if it // is not a file. GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest], *connect.ServerStream[ermite.GetBlobResponse]) error // ListCommits lists the history reachable from a revision, newest first // (Git's default order), optionally limited to the commits that touched a // path. A page_token that points deeper than 100,000 commits into the // history is invalid_argument. ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) // GetCommit returns one commit with its statistics and its diff. GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) // ResolveRevision turns a revision into the id of the commit it designates. ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) } // NewGitServiceHandler 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 NewGitServiceHandler(svc GitServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { gitServiceMethods := ermite.File_ermite_git_proto.Services().ByName("GitService").Methods() gitServiceListRefsHandler := connect.NewUnaryHandler( GitServiceListRefsProcedure, svc.ListRefs, connect.WithSchema(gitServiceMethods.ByName("ListRefs")), connect.WithHandlerOptions(opts...), ) gitServiceGetTreeHandler := connect.NewUnaryHandler( GitServiceGetTreeProcedure, svc.GetTree, connect.WithSchema(gitServiceMethods.ByName("GetTree")), connect.WithHandlerOptions(opts...), ) gitServiceListPathsHandler := connect.NewUnaryHandler( GitServiceListPathsProcedure, svc.ListPaths, connect.WithSchema(gitServiceMethods.ByName("ListPaths")), connect.WithHandlerOptions(opts...), ) gitServiceGetBlobHandler := connect.NewServerStreamHandler( GitServiceGetBlobProcedure, svc.GetBlob, connect.WithSchema(gitServiceMethods.ByName("GetBlob")), connect.WithHandlerOptions(opts...), ) gitServiceListCommitsHandler := connect.NewUnaryHandler( GitServiceListCommitsProcedure, svc.ListCommits, connect.WithSchema(gitServiceMethods.ByName("ListCommits")), connect.WithHandlerOptions(opts...), ) gitServiceGetCommitHandler := connect.NewUnaryHandler( GitServiceGetCommitProcedure, svc.GetCommit, connect.WithSchema(gitServiceMethods.ByName("GetCommit")), connect.WithHandlerOptions(opts...), ) gitServiceResolveRevisionHandler := connect.NewUnaryHandler( GitServiceResolveRevisionProcedure, svc.ResolveRevision, connect.WithSchema(gitServiceMethods.ByName("ResolveRevision")), connect.WithHandlerOptions(opts...), ) return "/ermite.GitService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case GitServiceListRefsProcedure: gitServiceListRefsHandler.ServeHTTP(w, r) case GitServiceGetTreeProcedure: gitServiceGetTreeHandler.ServeHTTP(w, r) case GitServiceListPathsProcedure: gitServiceListPathsHandler.ServeHTTP(w, r) case GitServiceGetBlobProcedure: gitServiceGetBlobHandler.ServeHTTP(w, r) case GitServiceListCommitsProcedure: gitServiceListCommitsHandler.ServeHTTP(w, r) case GitServiceGetCommitProcedure: gitServiceGetCommitHandler.ServeHTTP(w, r) case GitServiceResolveRevisionProcedure: gitServiceResolveRevisionHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } }) } // UnimplementedGitServiceHandler returns CodeUnimplemented from all methods. type UnimplementedGitServiceHandler struct{} func (UnimplementedGitServiceHandler) ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ListRefs is not implemented")) } func (UnimplementedGitServiceHandler) GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetTree is not implemented")) } func (UnimplementedGitServiceHandler) ListPaths(context.Context, *connect.Request[ermite.ListPathsRequest]) (*connect.Response[ermite.ListPathsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ListPaths is not implemented")) } func (UnimplementedGitServiceHandler) GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest], *connect.ServerStream[ermite.GetBlobResponse]) error { return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetBlob is not implemented")) } func (UnimplementedGitServiceHandler) ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ListCommits is not implemented")) } func (UnimplementedGitServiceHandler) GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetCommit is not implemented")) } func (UnimplementedGitServiceHandler) ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ResolveRevision is not implemented")) }