976 lines
50 KiB
Go
976 lines
50 KiB
Go
// Connect (crpc) contract for the gitrpc JSON-RPC server.
|
|
//
|
|
// This is a faithful translation of the hand-written JSON-RPC method set in
|
|
// handlers.go (registerRepoMethods + registerWriteMethods) plus the gitcmd
|
|
// result types those handlers return verbatim. Every rpc below maps 1:1 to a
|
|
// "repo.<name>" JSON-RPC method (noted in each comment); every message field
|
|
// keeps the snake_case name of the corresponding Go struct json tag so the
|
|
// wire shape matches what gitrpc serializes today.
|
|
//
|
|
// The server is path-driven and stateless: every method takes the repository
|
|
// NAME (owner/name.git) in `repo`; the server resolves it to an on-disk path
|
|
// and has already authorized the call before the handler runs. Auth/ACL and
|
|
// name->path resolution live in the caller (simpleconsole), not here.
|
|
//
|
|
// Generate Go + TS with protoc-gen-es (TS) / protoc-gen-go + protoc-gen-connect-go:
|
|
// protoc -I . --go_out=. --go_opt=paths=source_relative \
|
|
// --connect_go_out=. --connect_go_opt=paths=source_relative \
|
|
// --es_out=./gen --es_opt=target=ts \
|
|
// --plugin=protoc-gen-es=./node_modules/.bin/protoc-gen-es \
|
|
// gitrpc.proto
|
|
|
|
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
|
|
//
|
|
// Source: gitrpc/gitrpc.proto
|
|
|
|
package v1connect
|
|
|
|
import (
|
|
connect "connectrpc.com/connect"
|
|
context "context"
|
|
errors "errors"
|
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
|
http "net/http"
|
|
v1 "simplegit/gitrpc/v1"
|
|
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 = "simplegit.v1.GitService"
|
|
// ManageServiceName is the fully-qualified name of the ManageService service.
|
|
ManageServiceName = "simplegit.v1.ManageService"
|
|
)
|
|
|
|
// 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 (
|
|
// GitServiceListBranchesProcedure is the fully-qualified name of the GitService's ListBranches RPC.
|
|
GitServiceListBranchesProcedure = "/simplegit.v1.GitService/ListBranches"
|
|
// GitServiceListTagsProcedure is the fully-qualified name of the GitService's ListTags RPC.
|
|
GitServiceListTagsProcedure = "/simplegit.v1.GitService/ListTags"
|
|
// GitServiceListCommitsProcedure is the fully-qualified name of the GitService's ListCommits RPC.
|
|
GitServiceListCommitsProcedure = "/simplegit.v1.GitService/ListCommits"
|
|
// GitServiceListCommitsByPathProcedure is the fully-qualified name of the GitService's
|
|
// ListCommitsByPath RPC.
|
|
GitServiceListCommitsByPathProcedure = "/simplegit.v1.GitService/ListCommitsByPath"
|
|
// GitServiceGetCommitProcedure is the fully-qualified name of the GitService's GetCommit RPC.
|
|
GitServiceGetCommitProcedure = "/simplegit.v1.GitService/GetCommit"
|
|
// GitServiceGetCommitDiffProcedure is the fully-qualified name of the GitService's GetCommitDiff
|
|
// RPC.
|
|
GitServiceGetCommitDiffProcedure = "/simplegit.v1.GitService/GetCommitDiff"
|
|
// GitServiceGetTreeProcedure is the fully-qualified name of the GitService's GetTree RPC.
|
|
GitServiceGetTreeProcedure = "/simplegit.v1.GitService/GetTree"
|
|
// GitServiceGetBlobProcedure is the fully-qualified name of the GitService's GetBlob RPC.
|
|
GitServiceGetBlobProcedure = "/simplegit.v1.GitService/GetBlob"
|
|
// GitServiceCompareProcedure is the fully-qualified name of the GitService's Compare RPC.
|
|
GitServiceCompareProcedure = "/simplegit.v1.GitService/Compare"
|
|
// GitServiceBlameProcedure is the fully-qualified name of the GitService's Blame RPC.
|
|
GitServiceBlameProcedure = "/simplegit.v1.GitService/Blame"
|
|
// GitServiceGetContributorsProcedure is the fully-qualified name of the GitService's
|
|
// GetContributors RPC.
|
|
GitServiceGetContributorsProcedure = "/simplegit.v1.GitService/GetContributors"
|
|
// GitServiceGetStatsProcedure is the fully-qualified name of the GitService's GetStats RPC.
|
|
GitServiceGetStatsProcedure = "/simplegit.v1.GitService/GetStats"
|
|
// GitServiceCountObjectsProcedure is the fully-qualified name of the GitService's CountObjects RPC.
|
|
GitServiceCountObjectsProcedure = "/simplegit.v1.GitService/CountObjects"
|
|
// GitServiceCreateFileProcedure is the fully-qualified name of the GitService's CreateFile RPC.
|
|
GitServiceCreateFileProcedure = "/simplegit.v1.GitService/CreateFile"
|
|
// GitServiceDeleteFileProcedure is the fully-qualified name of the GitService's DeleteFile RPC.
|
|
GitServiceDeleteFileProcedure = "/simplegit.v1.GitService/DeleteFile"
|
|
// GitServiceMergeProcedure is the fully-qualified name of the GitService's Merge RPC.
|
|
GitServiceMergeProcedure = "/simplegit.v1.GitService/Merge"
|
|
// ManageServiceCreateRepoProcedure is the fully-qualified name of the ManageService's CreateRepo
|
|
// RPC.
|
|
ManageServiceCreateRepoProcedure = "/simplegit.v1.ManageService/CreateRepo"
|
|
// ManageServiceExistRepoProcedure is the fully-qualified name of the ManageService's ExistRepo RPC.
|
|
ManageServiceExistRepoProcedure = "/simplegit.v1.ManageService/ExistRepo"
|
|
// ManageServiceDeleteRepoProcedure is the fully-qualified name of the ManageService's DeleteRepo
|
|
// RPC.
|
|
ManageServiceDeleteRepoProcedure = "/simplegit.v1.ManageService/DeleteRepo"
|
|
// ManageServiceMoveRepoProcedure is the fully-qualified name of the ManageService's MoveRepo RPC.
|
|
ManageServiceMoveRepoProcedure = "/simplegit.v1.ManageService/MoveRepo"
|
|
// ManageServiceMoveNSProcedure is the fully-qualified name of the ManageService's MoveNS RPC.
|
|
ManageServiceMoveNSProcedure = "/simplegit.v1.ManageService/MoveNS"
|
|
// ManageServiceACLUpsertSSHKeyOnNSProcedure is the fully-qualified name of the ManageService's
|
|
// ACLUpsertSSHKeyOnNS RPC.
|
|
ManageServiceACLUpsertSSHKeyOnNSProcedure = "/simplegit.v1.ManageService/ACLUpsertSSHKeyOnNS"
|
|
// ManageServiceACLUpsertPATOnNSProcedure is the fully-qualified name of the ManageService's
|
|
// ACLUpsertPATOnNS RPC.
|
|
ManageServiceACLUpsertPATOnNSProcedure = "/simplegit.v1.ManageService/ACLUpsertPATOnNS"
|
|
// ManageServiceACLUpsertSSHKeyOnRepoProcedure is the fully-qualified name of the ManageService's
|
|
// ACLUpsertSSHKeyOnRepo RPC.
|
|
ManageServiceACLUpsertSSHKeyOnRepoProcedure = "/simplegit.v1.ManageService/ACLUpsertSSHKeyOnRepo"
|
|
// ManageServiceACLUpsertPATOnRepoProcedure is the fully-qualified name of the ManageService's
|
|
// ACLUpsertPATOnRepo RPC.
|
|
ManageServiceACLUpsertPATOnRepoProcedure = "/simplegit.v1.ManageService/ACLUpsertPATOnRepo"
|
|
// ManageServiceACLDeleteProcedure is the fully-qualified name of the ManageService's ACLDelete RPC.
|
|
ManageServiceACLDeleteProcedure = "/simplegit.v1.ManageService/ACLDelete"
|
|
// ManageServiceStatusProcedure is the fully-qualified name of the ManageService's Status RPC.
|
|
ManageServiceStatusProcedure = "/simplegit.v1.ManageService/Status"
|
|
)
|
|
|
|
// GitServiceClient is a client for the simplegit.v1.GitService service.
|
|
type GitServiceClient interface {
|
|
// repo.listBranches
|
|
ListBranches(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListBranchesResponse], error)
|
|
// repo.listTags
|
|
ListTags(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListTagsResponse], error)
|
|
// repo.listCommits
|
|
ListCommits(context.Context, *connect.Request[v1.ListCommitsRequest]) (*connect.Response[v1.ListCommitsResponse], error)
|
|
// repo.listCommitsByPath
|
|
ListCommitsByPath(context.Context, *connect.Request[v1.ListCommitsByPathRequest]) (*connect.Response[v1.ListCommitsResponse], error)
|
|
// repo.getCommit
|
|
GetCommit(context.Context, *connect.Request[v1.GetCommitRequest]) (*connect.Response[v1.CommitDetail], error)
|
|
// repo.getCommitDiff
|
|
GetCommitDiff(context.Context, *connect.Request[v1.GetCommitDiffRequest]) (*connect.Response[v1.DiffResult], error)
|
|
// repo.getTree
|
|
GetTree(context.Context, *connect.Request[v1.GetTreeRequest]) (*connect.Response[v1.Tree], error)
|
|
// repo.getBlob
|
|
GetBlob(context.Context, *connect.Request[v1.GetBlobRequest]) (*connect.Response[v1.Blob], error)
|
|
// repo.compare
|
|
Compare(context.Context, *connect.Request[v1.CompareRequest]) (*connect.Response[v1.CompareResult], error)
|
|
// repo.blame
|
|
Blame(context.Context, *connect.Request[v1.BlameRequest]) (*connect.Response[v1.BlameResult], error)
|
|
// repo.getContributors
|
|
GetContributors(context.Context, *connect.Request[v1.GetContributorsRequest]) (*connect.Response[v1.GetContributorsResponse], error)
|
|
// repo.getStats
|
|
GetStats(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.RepoStats], error)
|
|
// repo.countObjects
|
|
CountObjects(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.CountObjectsResult], error)
|
|
// repo.createFile
|
|
CreateFile(context.Context, *connect.Request[v1.CreateFileRequest]) (*connect.Response[v1.FileCommitResult], error)
|
|
// repo.deleteFile
|
|
DeleteFile(context.Context, *connect.Request[v1.DeleteFileRequest]) (*connect.Response[v1.FileCommitResult], error)
|
|
// repo.merge
|
|
Merge(context.Context, *connect.Request[v1.MergeRequest]) (*connect.Response[v1.MergeResult], error)
|
|
}
|
|
|
|
// NewGitServiceClient constructs a client for the simplegit.v1.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 := v1.File_gitrpc_gitrpc_proto.Services().ByName("GitService").Methods()
|
|
return &gitServiceClient{
|
|
listBranches: connect.NewClient[v1.RepoRequest, v1.ListBranchesResponse](
|
|
httpClient,
|
|
baseURL+GitServiceListBranchesProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListBranches")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
listTags: connect.NewClient[v1.RepoRequest, v1.ListTagsResponse](
|
|
httpClient,
|
|
baseURL+GitServiceListTagsProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListTags")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
listCommits: connect.NewClient[v1.ListCommitsRequest, v1.ListCommitsResponse](
|
|
httpClient,
|
|
baseURL+GitServiceListCommitsProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListCommits")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
listCommitsByPath: connect.NewClient[v1.ListCommitsByPathRequest, v1.ListCommitsResponse](
|
|
httpClient,
|
|
baseURL+GitServiceListCommitsByPathProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListCommitsByPath")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getCommit: connect.NewClient[v1.GetCommitRequest, v1.CommitDetail](
|
|
httpClient,
|
|
baseURL+GitServiceGetCommitProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetCommit")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getCommitDiff: connect.NewClient[v1.GetCommitDiffRequest, v1.DiffResult](
|
|
httpClient,
|
|
baseURL+GitServiceGetCommitDiffProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetCommitDiff")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getTree: connect.NewClient[v1.GetTreeRequest, v1.Tree](
|
|
httpClient,
|
|
baseURL+GitServiceGetTreeProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetTree")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getBlob: connect.NewClient[v1.GetBlobRequest, v1.Blob](
|
|
httpClient,
|
|
baseURL+GitServiceGetBlobProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetBlob")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
compare: connect.NewClient[v1.CompareRequest, v1.CompareResult](
|
|
httpClient,
|
|
baseURL+GitServiceCompareProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("Compare")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
blame: connect.NewClient[v1.BlameRequest, v1.BlameResult](
|
|
httpClient,
|
|
baseURL+GitServiceBlameProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("Blame")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getContributors: connect.NewClient[v1.GetContributorsRequest, v1.GetContributorsResponse](
|
|
httpClient,
|
|
baseURL+GitServiceGetContributorsProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetContributors")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
getStats: connect.NewClient[v1.RepoRequest, v1.RepoStats](
|
|
httpClient,
|
|
baseURL+GitServiceGetStatsProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetStats")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
countObjects: connect.NewClient[v1.RepoRequest, v1.CountObjectsResult](
|
|
httpClient,
|
|
baseURL+GitServiceCountObjectsProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("CountObjects")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
createFile: connect.NewClient[v1.CreateFileRequest, v1.FileCommitResult](
|
|
httpClient,
|
|
baseURL+GitServiceCreateFileProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("CreateFile")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
deleteFile: connect.NewClient[v1.DeleteFileRequest, v1.FileCommitResult](
|
|
httpClient,
|
|
baseURL+GitServiceDeleteFileProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("DeleteFile")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
merge: connect.NewClient[v1.MergeRequest, v1.MergeResult](
|
|
httpClient,
|
|
baseURL+GitServiceMergeProcedure,
|
|
connect.WithSchema(gitServiceMethods.ByName("Merge")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
}
|
|
}
|
|
|
|
// gitServiceClient implements GitServiceClient.
|
|
type gitServiceClient struct {
|
|
listBranches *connect.Client[v1.RepoRequest, v1.ListBranchesResponse]
|
|
listTags *connect.Client[v1.RepoRequest, v1.ListTagsResponse]
|
|
listCommits *connect.Client[v1.ListCommitsRequest, v1.ListCommitsResponse]
|
|
listCommitsByPath *connect.Client[v1.ListCommitsByPathRequest, v1.ListCommitsResponse]
|
|
getCommit *connect.Client[v1.GetCommitRequest, v1.CommitDetail]
|
|
getCommitDiff *connect.Client[v1.GetCommitDiffRequest, v1.DiffResult]
|
|
getTree *connect.Client[v1.GetTreeRequest, v1.Tree]
|
|
getBlob *connect.Client[v1.GetBlobRequest, v1.Blob]
|
|
compare *connect.Client[v1.CompareRequest, v1.CompareResult]
|
|
blame *connect.Client[v1.BlameRequest, v1.BlameResult]
|
|
getContributors *connect.Client[v1.GetContributorsRequest, v1.GetContributorsResponse]
|
|
getStats *connect.Client[v1.RepoRequest, v1.RepoStats]
|
|
countObjects *connect.Client[v1.RepoRequest, v1.CountObjectsResult]
|
|
createFile *connect.Client[v1.CreateFileRequest, v1.FileCommitResult]
|
|
deleteFile *connect.Client[v1.DeleteFileRequest, v1.FileCommitResult]
|
|
merge *connect.Client[v1.MergeRequest, v1.MergeResult]
|
|
}
|
|
|
|
// ListBranches calls simplegit.v1.GitService.ListBranches.
|
|
func (c *gitServiceClient) ListBranches(ctx context.Context, req *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListBranchesResponse], error) {
|
|
return c.listBranches.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ListTags calls simplegit.v1.GitService.ListTags.
|
|
func (c *gitServiceClient) ListTags(ctx context.Context, req *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListTagsResponse], error) {
|
|
return c.listTags.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ListCommits calls simplegit.v1.GitService.ListCommits.
|
|
func (c *gitServiceClient) ListCommits(ctx context.Context, req *connect.Request[v1.ListCommitsRequest]) (*connect.Response[v1.ListCommitsResponse], error) {
|
|
return c.listCommits.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ListCommitsByPath calls simplegit.v1.GitService.ListCommitsByPath.
|
|
func (c *gitServiceClient) ListCommitsByPath(ctx context.Context, req *connect.Request[v1.ListCommitsByPathRequest]) (*connect.Response[v1.ListCommitsResponse], error) {
|
|
return c.listCommitsByPath.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetCommit calls simplegit.v1.GitService.GetCommit.
|
|
func (c *gitServiceClient) GetCommit(ctx context.Context, req *connect.Request[v1.GetCommitRequest]) (*connect.Response[v1.CommitDetail], error) {
|
|
return c.getCommit.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetCommitDiff calls simplegit.v1.GitService.GetCommitDiff.
|
|
func (c *gitServiceClient) GetCommitDiff(ctx context.Context, req *connect.Request[v1.GetCommitDiffRequest]) (*connect.Response[v1.DiffResult], error) {
|
|
return c.getCommitDiff.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetTree calls simplegit.v1.GitService.GetTree.
|
|
func (c *gitServiceClient) GetTree(ctx context.Context, req *connect.Request[v1.GetTreeRequest]) (*connect.Response[v1.Tree], error) {
|
|
return c.getTree.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetBlob calls simplegit.v1.GitService.GetBlob.
|
|
func (c *gitServiceClient) GetBlob(ctx context.Context, req *connect.Request[v1.GetBlobRequest]) (*connect.Response[v1.Blob], error) {
|
|
return c.getBlob.CallUnary(ctx, req)
|
|
}
|
|
|
|
// Compare calls simplegit.v1.GitService.Compare.
|
|
func (c *gitServiceClient) Compare(ctx context.Context, req *connect.Request[v1.CompareRequest]) (*connect.Response[v1.CompareResult], error) {
|
|
return c.compare.CallUnary(ctx, req)
|
|
}
|
|
|
|
// Blame calls simplegit.v1.GitService.Blame.
|
|
func (c *gitServiceClient) Blame(ctx context.Context, req *connect.Request[v1.BlameRequest]) (*connect.Response[v1.BlameResult], error) {
|
|
return c.blame.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetContributors calls simplegit.v1.GitService.GetContributors.
|
|
func (c *gitServiceClient) GetContributors(ctx context.Context, req *connect.Request[v1.GetContributorsRequest]) (*connect.Response[v1.GetContributorsResponse], error) {
|
|
return c.getContributors.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GetStats calls simplegit.v1.GitService.GetStats.
|
|
func (c *gitServiceClient) GetStats(ctx context.Context, req *connect.Request[v1.RepoRequest]) (*connect.Response[v1.RepoStats], error) {
|
|
return c.getStats.CallUnary(ctx, req)
|
|
}
|
|
|
|
// CountObjects calls simplegit.v1.GitService.CountObjects.
|
|
func (c *gitServiceClient) CountObjects(ctx context.Context, req *connect.Request[v1.RepoRequest]) (*connect.Response[v1.CountObjectsResult], error) {
|
|
return c.countObjects.CallUnary(ctx, req)
|
|
}
|
|
|
|
// CreateFile calls simplegit.v1.GitService.CreateFile.
|
|
func (c *gitServiceClient) CreateFile(ctx context.Context, req *connect.Request[v1.CreateFileRequest]) (*connect.Response[v1.FileCommitResult], error) {
|
|
return c.createFile.CallUnary(ctx, req)
|
|
}
|
|
|
|
// DeleteFile calls simplegit.v1.GitService.DeleteFile.
|
|
func (c *gitServiceClient) DeleteFile(ctx context.Context, req *connect.Request[v1.DeleteFileRequest]) (*connect.Response[v1.FileCommitResult], error) {
|
|
return c.deleteFile.CallUnary(ctx, req)
|
|
}
|
|
|
|
// Merge calls simplegit.v1.GitService.Merge.
|
|
func (c *gitServiceClient) Merge(ctx context.Context, req *connect.Request[v1.MergeRequest]) (*connect.Response[v1.MergeResult], error) {
|
|
return c.merge.CallUnary(ctx, req)
|
|
}
|
|
|
|
// GitServiceHandler is an implementation of the simplegit.v1.GitService service.
|
|
type GitServiceHandler interface {
|
|
// repo.listBranches
|
|
ListBranches(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListBranchesResponse], error)
|
|
// repo.listTags
|
|
ListTags(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListTagsResponse], error)
|
|
// repo.listCommits
|
|
ListCommits(context.Context, *connect.Request[v1.ListCommitsRequest]) (*connect.Response[v1.ListCommitsResponse], error)
|
|
// repo.listCommitsByPath
|
|
ListCommitsByPath(context.Context, *connect.Request[v1.ListCommitsByPathRequest]) (*connect.Response[v1.ListCommitsResponse], error)
|
|
// repo.getCommit
|
|
GetCommit(context.Context, *connect.Request[v1.GetCommitRequest]) (*connect.Response[v1.CommitDetail], error)
|
|
// repo.getCommitDiff
|
|
GetCommitDiff(context.Context, *connect.Request[v1.GetCommitDiffRequest]) (*connect.Response[v1.DiffResult], error)
|
|
// repo.getTree
|
|
GetTree(context.Context, *connect.Request[v1.GetTreeRequest]) (*connect.Response[v1.Tree], error)
|
|
// repo.getBlob
|
|
GetBlob(context.Context, *connect.Request[v1.GetBlobRequest]) (*connect.Response[v1.Blob], error)
|
|
// repo.compare
|
|
Compare(context.Context, *connect.Request[v1.CompareRequest]) (*connect.Response[v1.CompareResult], error)
|
|
// repo.blame
|
|
Blame(context.Context, *connect.Request[v1.BlameRequest]) (*connect.Response[v1.BlameResult], error)
|
|
// repo.getContributors
|
|
GetContributors(context.Context, *connect.Request[v1.GetContributorsRequest]) (*connect.Response[v1.GetContributorsResponse], error)
|
|
// repo.getStats
|
|
GetStats(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.RepoStats], error)
|
|
// repo.countObjects
|
|
CountObjects(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.CountObjectsResult], error)
|
|
// repo.createFile
|
|
CreateFile(context.Context, *connect.Request[v1.CreateFileRequest]) (*connect.Response[v1.FileCommitResult], error)
|
|
// repo.deleteFile
|
|
DeleteFile(context.Context, *connect.Request[v1.DeleteFileRequest]) (*connect.Response[v1.FileCommitResult], error)
|
|
// repo.merge
|
|
Merge(context.Context, *connect.Request[v1.MergeRequest]) (*connect.Response[v1.MergeResult], 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 := v1.File_gitrpc_gitrpc_proto.Services().ByName("GitService").Methods()
|
|
gitServiceListBranchesHandler := connect.NewUnaryHandler(
|
|
GitServiceListBranchesProcedure,
|
|
svc.ListBranches,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListBranches")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceListTagsHandler := connect.NewUnaryHandler(
|
|
GitServiceListTagsProcedure,
|
|
svc.ListTags,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListTags")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceListCommitsHandler := connect.NewUnaryHandler(
|
|
GitServiceListCommitsProcedure,
|
|
svc.ListCommits,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListCommits")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceListCommitsByPathHandler := connect.NewUnaryHandler(
|
|
GitServiceListCommitsByPathProcedure,
|
|
svc.ListCommitsByPath,
|
|
connect.WithSchema(gitServiceMethods.ByName("ListCommitsByPath")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceGetCommitHandler := connect.NewUnaryHandler(
|
|
GitServiceGetCommitProcedure,
|
|
svc.GetCommit,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetCommit")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceGetCommitDiffHandler := connect.NewUnaryHandler(
|
|
GitServiceGetCommitDiffProcedure,
|
|
svc.GetCommitDiff,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetCommitDiff")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceGetTreeHandler := connect.NewUnaryHandler(
|
|
GitServiceGetTreeProcedure,
|
|
svc.GetTree,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetTree")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceGetBlobHandler := connect.NewUnaryHandler(
|
|
GitServiceGetBlobProcedure,
|
|
svc.GetBlob,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetBlob")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceCompareHandler := connect.NewUnaryHandler(
|
|
GitServiceCompareProcedure,
|
|
svc.Compare,
|
|
connect.WithSchema(gitServiceMethods.ByName("Compare")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceBlameHandler := connect.NewUnaryHandler(
|
|
GitServiceBlameProcedure,
|
|
svc.Blame,
|
|
connect.WithSchema(gitServiceMethods.ByName("Blame")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceGetContributorsHandler := connect.NewUnaryHandler(
|
|
GitServiceGetContributorsProcedure,
|
|
svc.GetContributors,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetContributors")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceGetStatsHandler := connect.NewUnaryHandler(
|
|
GitServiceGetStatsProcedure,
|
|
svc.GetStats,
|
|
connect.WithSchema(gitServiceMethods.ByName("GetStats")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceCountObjectsHandler := connect.NewUnaryHandler(
|
|
GitServiceCountObjectsProcedure,
|
|
svc.CountObjects,
|
|
connect.WithSchema(gitServiceMethods.ByName("CountObjects")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceCreateFileHandler := connect.NewUnaryHandler(
|
|
GitServiceCreateFileProcedure,
|
|
svc.CreateFile,
|
|
connect.WithSchema(gitServiceMethods.ByName("CreateFile")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceDeleteFileHandler := connect.NewUnaryHandler(
|
|
GitServiceDeleteFileProcedure,
|
|
svc.DeleteFile,
|
|
connect.WithSchema(gitServiceMethods.ByName("DeleteFile")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
gitServiceMergeHandler := connect.NewUnaryHandler(
|
|
GitServiceMergeProcedure,
|
|
svc.Merge,
|
|
connect.WithSchema(gitServiceMethods.ByName("Merge")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
return "/simplegit.v1.GitService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case GitServiceListBranchesProcedure:
|
|
gitServiceListBranchesHandler.ServeHTTP(w, r)
|
|
case GitServiceListTagsProcedure:
|
|
gitServiceListTagsHandler.ServeHTTP(w, r)
|
|
case GitServiceListCommitsProcedure:
|
|
gitServiceListCommitsHandler.ServeHTTP(w, r)
|
|
case GitServiceListCommitsByPathProcedure:
|
|
gitServiceListCommitsByPathHandler.ServeHTTP(w, r)
|
|
case GitServiceGetCommitProcedure:
|
|
gitServiceGetCommitHandler.ServeHTTP(w, r)
|
|
case GitServiceGetCommitDiffProcedure:
|
|
gitServiceGetCommitDiffHandler.ServeHTTP(w, r)
|
|
case GitServiceGetTreeProcedure:
|
|
gitServiceGetTreeHandler.ServeHTTP(w, r)
|
|
case GitServiceGetBlobProcedure:
|
|
gitServiceGetBlobHandler.ServeHTTP(w, r)
|
|
case GitServiceCompareProcedure:
|
|
gitServiceCompareHandler.ServeHTTP(w, r)
|
|
case GitServiceBlameProcedure:
|
|
gitServiceBlameHandler.ServeHTTP(w, r)
|
|
case GitServiceGetContributorsProcedure:
|
|
gitServiceGetContributorsHandler.ServeHTTP(w, r)
|
|
case GitServiceGetStatsProcedure:
|
|
gitServiceGetStatsHandler.ServeHTTP(w, r)
|
|
case GitServiceCountObjectsProcedure:
|
|
gitServiceCountObjectsHandler.ServeHTTP(w, r)
|
|
case GitServiceCreateFileProcedure:
|
|
gitServiceCreateFileHandler.ServeHTTP(w, r)
|
|
case GitServiceDeleteFileProcedure:
|
|
gitServiceDeleteFileHandler.ServeHTTP(w, r)
|
|
case GitServiceMergeProcedure:
|
|
gitServiceMergeHandler.ServeHTTP(w, r)
|
|
default:
|
|
http.NotFound(w, r)
|
|
}
|
|
})
|
|
}
|
|
|
|
// UnimplementedGitServiceHandler returns CodeUnimplemented from all methods.
|
|
type UnimplementedGitServiceHandler struct{}
|
|
|
|
func (UnimplementedGitServiceHandler) ListBranches(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListBranchesResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.ListBranches is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) ListTags(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.ListTagsResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.ListTags is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) ListCommits(context.Context, *connect.Request[v1.ListCommitsRequest]) (*connect.Response[v1.ListCommitsResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.ListCommits is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) ListCommitsByPath(context.Context, *connect.Request[v1.ListCommitsByPathRequest]) (*connect.Response[v1.ListCommitsResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.ListCommitsByPath is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) GetCommit(context.Context, *connect.Request[v1.GetCommitRequest]) (*connect.Response[v1.CommitDetail], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.GetCommit is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) GetCommitDiff(context.Context, *connect.Request[v1.GetCommitDiffRequest]) (*connect.Response[v1.DiffResult], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.GetCommitDiff is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) GetTree(context.Context, *connect.Request[v1.GetTreeRequest]) (*connect.Response[v1.Tree], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.GetTree is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) GetBlob(context.Context, *connect.Request[v1.GetBlobRequest]) (*connect.Response[v1.Blob], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.GetBlob is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) Compare(context.Context, *connect.Request[v1.CompareRequest]) (*connect.Response[v1.CompareResult], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.Compare is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) Blame(context.Context, *connect.Request[v1.BlameRequest]) (*connect.Response[v1.BlameResult], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.Blame is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) GetContributors(context.Context, *connect.Request[v1.GetContributorsRequest]) (*connect.Response[v1.GetContributorsResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.GetContributors is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) GetStats(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.RepoStats], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.GetStats is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) CountObjects(context.Context, *connect.Request[v1.RepoRequest]) (*connect.Response[v1.CountObjectsResult], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.CountObjects is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) CreateFile(context.Context, *connect.Request[v1.CreateFileRequest]) (*connect.Response[v1.FileCommitResult], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.CreateFile is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) DeleteFile(context.Context, *connect.Request[v1.DeleteFileRequest]) (*connect.Response[v1.FileCommitResult], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.DeleteFile is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedGitServiceHandler) Merge(context.Context, *connect.Request[v1.MergeRequest]) (*connect.Response[v1.MergeResult], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.GitService.Merge is not implemented"))
|
|
}
|
|
|
|
// ManageServiceClient is a client for the simplegit.v1.ManageService service.
|
|
type ManageServiceClient interface {
|
|
// Create a repo (git init --bare). Reuses the namespace's NamespaceID if it
|
|
// exists, else mints a new one.
|
|
CreateRepo(context.Context, *connect.Request[v1.CreateRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// OK if the repo is registered; NotFound otherwise.
|
|
ExistRepo(context.Context, *connect.Request[v1.ExistRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Remove a repo (DB row + repo-targeted ACL grants + on-disk dir).
|
|
DeleteRepo(context.Context, *connect.Request[v1.DeleteRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Move/rename a repo (transfer and/or rename).
|
|
MoveRepo(context.Context, *connect.Request[v1.MoveRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Rename a namespace (all its repos); NamespaceID is stable.
|
|
MoveNS(context.Context, *connect.Request[v1.MoveNSRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Grant an SSH key perm on a namespace; registers the key if new. Returns the ACL id.
|
|
ACLUpsertSSHKeyOnNS(context.Context, *connect.Request[v1.ACLUpsertSSHKeyOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Grant a PAT perm on a namespace; creates the PAT if new. Returns the ACL id.
|
|
ACLUpsertPATOnNS(context.Context, *connect.Request[v1.ACLUpsertPATOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Grant an SSH key perm on a repo; registers the key if new. Returns the ACL id.
|
|
ACLUpsertSSHKeyOnRepo(context.Context, *connect.Request[v1.ACLUpsertSSHKeyOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Grant a PAT perm on a repo; creates the PAT if new. Returns the ACL id.
|
|
ACLUpsertPATOnRepo(context.Context, *connect.Request[v1.ACLUpsertPATOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Remove a single ACL grant by id.
|
|
ACLDelete(context.Context, *connect.Request[v1.ACLDeleteRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Daemon status + config: startup params, listen locations, start time /
|
|
// uptime, and the state DB URI (gitctl uses db_uri to connect directly for
|
|
// inspection reads -- there is no list RPC on this service). Diagnostics only;
|
|
// does not touch the DB.
|
|
Status(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[v1.StatusResponse], error)
|
|
}
|
|
|
|
// NewManageServiceClient constructs a client for the simplegit.v1.ManageService 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 NewManageServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ManageServiceClient {
|
|
baseURL = strings.TrimRight(baseURL, "/")
|
|
manageServiceMethods := v1.File_gitrpc_gitrpc_proto.Services().ByName("ManageService").Methods()
|
|
return &manageServiceClient{
|
|
createRepo: connect.NewClient[v1.CreateRepoRequest, emptypb.Empty](
|
|
httpClient,
|
|
baseURL+ManageServiceCreateRepoProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("CreateRepo")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
existRepo: connect.NewClient[v1.ExistRepoRequest, emptypb.Empty](
|
|
httpClient,
|
|
baseURL+ManageServiceExistRepoProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("ExistRepo")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
deleteRepo: connect.NewClient[v1.DeleteRepoRequest, emptypb.Empty](
|
|
httpClient,
|
|
baseURL+ManageServiceDeleteRepoProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("DeleteRepo")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
moveRepo: connect.NewClient[v1.MoveRepoRequest, emptypb.Empty](
|
|
httpClient,
|
|
baseURL+ManageServiceMoveRepoProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("MoveRepo")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
moveNS: connect.NewClient[v1.MoveNSRequest, emptypb.Empty](
|
|
httpClient,
|
|
baseURL+ManageServiceMoveNSProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("MoveNS")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
aCLUpsertSSHKeyOnNS: connect.NewClient[v1.ACLUpsertSSHKeyOnNSRequest, v1.ACLIDResponse](
|
|
httpClient,
|
|
baseURL+ManageServiceACLUpsertSSHKeyOnNSProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertSSHKeyOnNS")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
aCLUpsertPATOnNS: connect.NewClient[v1.ACLUpsertPATOnNSRequest, v1.ACLIDResponse](
|
|
httpClient,
|
|
baseURL+ManageServiceACLUpsertPATOnNSProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertPATOnNS")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
aCLUpsertSSHKeyOnRepo: connect.NewClient[v1.ACLUpsertSSHKeyOnRepoRequest, v1.ACLIDResponse](
|
|
httpClient,
|
|
baseURL+ManageServiceACLUpsertSSHKeyOnRepoProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertSSHKeyOnRepo")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
aCLUpsertPATOnRepo: connect.NewClient[v1.ACLUpsertPATOnRepoRequest, v1.ACLIDResponse](
|
|
httpClient,
|
|
baseURL+ManageServiceACLUpsertPATOnRepoProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertPATOnRepo")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
aCLDelete: connect.NewClient[v1.ACLDeleteRequest, emptypb.Empty](
|
|
httpClient,
|
|
baseURL+ManageServiceACLDeleteProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLDelete")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
status: connect.NewClient[emptypb.Empty, v1.StatusResponse](
|
|
httpClient,
|
|
baseURL+ManageServiceStatusProcedure,
|
|
connect.WithSchema(manageServiceMethods.ByName("Status")),
|
|
connect.WithClientOptions(opts...),
|
|
),
|
|
}
|
|
}
|
|
|
|
// manageServiceClient implements ManageServiceClient.
|
|
type manageServiceClient struct {
|
|
createRepo *connect.Client[v1.CreateRepoRequest, emptypb.Empty]
|
|
existRepo *connect.Client[v1.ExistRepoRequest, emptypb.Empty]
|
|
deleteRepo *connect.Client[v1.DeleteRepoRequest, emptypb.Empty]
|
|
moveRepo *connect.Client[v1.MoveRepoRequest, emptypb.Empty]
|
|
moveNS *connect.Client[v1.MoveNSRequest, emptypb.Empty]
|
|
aCLUpsertSSHKeyOnNS *connect.Client[v1.ACLUpsertSSHKeyOnNSRequest, v1.ACLIDResponse]
|
|
aCLUpsertPATOnNS *connect.Client[v1.ACLUpsertPATOnNSRequest, v1.ACLIDResponse]
|
|
aCLUpsertSSHKeyOnRepo *connect.Client[v1.ACLUpsertSSHKeyOnRepoRequest, v1.ACLIDResponse]
|
|
aCLUpsertPATOnRepo *connect.Client[v1.ACLUpsertPATOnRepoRequest, v1.ACLIDResponse]
|
|
aCLDelete *connect.Client[v1.ACLDeleteRequest, emptypb.Empty]
|
|
status *connect.Client[emptypb.Empty, v1.StatusResponse]
|
|
}
|
|
|
|
// CreateRepo calls simplegit.v1.ManageService.CreateRepo.
|
|
func (c *manageServiceClient) CreateRepo(ctx context.Context, req *connect.Request[v1.CreateRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return c.createRepo.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ExistRepo calls simplegit.v1.ManageService.ExistRepo.
|
|
func (c *manageServiceClient) ExistRepo(ctx context.Context, req *connect.Request[v1.ExistRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return c.existRepo.CallUnary(ctx, req)
|
|
}
|
|
|
|
// DeleteRepo calls simplegit.v1.ManageService.DeleteRepo.
|
|
func (c *manageServiceClient) DeleteRepo(ctx context.Context, req *connect.Request[v1.DeleteRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return c.deleteRepo.CallUnary(ctx, req)
|
|
}
|
|
|
|
// MoveRepo calls simplegit.v1.ManageService.MoveRepo.
|
|
func (c *manageServiceClient) MoveRepo(ctx context.Context, req *connect.Request[v1.MoveRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return c.moveRepo.CallUnary(ctx, req)
|
|
}
|
|
|
|
// MoveNS calls simplegit.v1.ManageService.MoveNS.
|
|
func (c *manageServiceClient) MoveNS(ctx context.Context, req *connect.Request[v1.MoveNSRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return c.moveNS.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ACLUpsertSSHKeyOnNS calls simplegit.v1.ManageService.ACLUpsertSSHKeyOnNS.
|
|
func (c *manageServiceClient) ACLUpsertSSHKeyOnNS(ctx context.Context, req *connect.Request[v1.ACLUpsertSSHKeyOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return c.aCLUpsertSSHKeyOnNS.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ACLUpsertPATOnNS calls simplegit.v1.ManageService.ACLUpsertPATOnNS.
|
|
func (c *manageServiceClient) ACLUpsertPATOnNS(ctx context.Context, req *connect.Request[v1.ACLUpsertPATOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return c.aCLUpsertPATOnNS.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ACLUpsertSSHKeyOnRepo calls simplegit.v1.ManageService.ACLUpsertSSHKeyOnRepo.
|
|
func (c *manageServiceClient) ACLUpsertSSHKeyOnRepo(ctx context.Context, req *connect.Request[v1.ACLUpsertSSHKeyOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return c.aCLUpsertSSHKeyOnRepo.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ACLUpsertPATOnRepo calls simplegit.v1.ManageService.ACLUpsertPATOnRepo.
|
|
func (c *manageServiceClient) ACLUpsertPATOnRepo(ctx context.Context, req *connect.Request[v1.ACLUpsertPATOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return c.aCLUpsertPATOnRepo.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ACLDelete calls simplegit.v1.ManageService.ACLDelete.
|
|
func (c *manageServiceClient) ACLDelete(ctx context.Context, req *connect.Request[v1.ACLDeleteRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return c.aCLDelete.CallUnary(ctx, req)
|
|
}
|
|
|
|
// Status calls simplegit.v1.ManageService.Status.
|
|
func (c *manageServiceClient) Status(ctx context.Context, req *connect.Request[emptypb.Empty]) (*connect.Response[v1.StatusResponse], error) {
|
|
return c.status.CallUnary(ctx, req)
|
|
}
|
|
|
|
// ManageServiceHandler is an implementation of the simplegit.v1.ManageService service.
|
|
type ManageServiceHandler interface {
|
|
// Create a repo (git init --bare). Reuses the namespace's NamespaceID if it
|
|
// exists, else mints a new one.
|
|
CreateRepo(context.Context, *connect.Request[v1.CreateRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// OK if the repo is registered; NotFound otherwise.
|
|
ExistRepo(context.Context, *connect.Request[v1.ExistRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Remove a repo (DB row + repo-targeted ACL grants + on-disk dir).
|
|
DeleteRepo(context.Context, *connect.Request[v1.DeleteRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Move/rename a repo (transfer and/or rename).
|
|
MoveRepo(context.Context, *connect.Request[v1.MoveRepoRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Rename a namespace (all its repos); NamespaceID is stable.
|
|
MoveNS(context.Context, *connect.Request[v1.MoveNSRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Grant an SSH key perm on a namespace; registers the key if new. Returns the ACL id.
|
|
ACLUpsertSSHKeyOnNS(context.Context, *connect.Request[v1.ACLUpsertSSHKeyOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Grant a PAT perm on a namespace; creates the PAT if new. Returns the ACL id.
|
|
ACLUpsertPATOnNS(context.Context, *connect.Request[v1.ACLUpsertPATOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Grant an SSH key perm on a repo; registers the key if new. Returns the ACL id.
|
|
ACLUpsertSSHKeyOnRepo(context.Context, *connect.Request[v1.ACLUpsertSSHKeyOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Grant a PAT perm on a repo; creates the PAT if new. Returns the ACL id.
|
|
ACLUpsertPATOnRepo(context.Context, *connect.Request[v1.ACLUpsertPATOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error)
|
|
// Remove a single ACL grant by id.
|
|
ACLDelete(context.Context, *connect.Request[v1.ACLDeleteRequest]) (*connect.Response[emptypb.Empty], error)
|
|
// Daemon status + config: startup params, listen locations, start time /
|
|
// uptime, and the state DB URI (gitctl uses db_uri to connect directly for
|
|
// inspection reads -- there is no list RPC on this service). Diagnostics only;
|
|
// does not touch the DB.
|
|
Status(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[v1.StatusResponse], error)
|
|
}
|
|
|
|
// NewManageServiceHandler 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 NewManageServiceHandler(svc ManageServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
|
|
manageServiceMethods := v1.File_gitrpc_gitrpc_proto.Services().ByName("ManageService").Methods()
|
|
manageServiceCreateRepoHandler := connect.NewUnaryHandler(
|
|
ManageServiceCreateRepoProcedure,
|
|
svc.CreateRepo,
|
|
connect.WithSchema(manageServiceMethods.ByName("CreateRepo")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceExistRepoHandler := connect.NewUnaryHandler(
|
|
ManageServiceExistRepoProcedure,
|
|
svc.ExistRepo,
|
|
connect.WithSchema(manageServiceMethods.ByName("ExistRepo")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceDeleteRepoHandler := connect.NewUnaryHandler(
|
|
ManageServiceDeleteRepoProcedure,
|
|
svc.DeleteRepo,
|
|
connect.WithSchema(manageServiceMethods.ByName("DeleteRepo")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceMoveRepoHandler := connect.NewUnaryHandler(
|
|
ManageServiceMoveRepoProcedure,
|
|
svc.MoveRepo,
|
|
connect.WithSchema(manageServiceMethods.ByName("MoveRepo")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceMoveNSHandler := connect.NewUnaryHandler(
|
|
ManageServiceMoveNSProcedure,
|
|
svc.MoveNS,
|
|
connect.WithSchema(manageServiceMethods.ByName("MoveNS")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceACLUpsertSSHKeyOnNSHandler := connect.NewUnaryHandler(
|
|
ManageServiceACLUpsertSSHKeyOnNSProcedure,
|
|
svc.ACLUpsertSSHKeyOnNS,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertSSHKeyOnNS")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceACLUpsertPATOnNSHandler := connect.NewUnaryHandler(
|
|
ManageServiceACLUpsertPATOnNSProcedure,
|
|
svc.ACLUpsertPATOnNS,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertPATOnNS")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceACLUpsertSSHKeyOnRepoHandler := connect.NewUnaryHandler(
|
|
ManageServiceACLUpsertSSHKeyOnRepoProcedure,
|
|
svc.ACLUpsertSSHKeyOnRepo,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertSSHKeyOnRepo")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceACLUpsertPATOnRepoHandler := connect.NewUnaryHandler(
|
|
ManageServiceACLUpsertPATOnRepoProcedure,
|
|
svc.ACLUpsertPATOnRepo,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLUpsertPATOnRepo")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceACLDeleteHandler := connect.NewUnaryHandler(
|
|
ManageServiceACLDeleteProcedure,
|
|
svc.ACLDelete,
|
|
connect.WithSchema(manageServiceMethods.ByName("ACLDelete")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
manageServiceStatusHandler := connect.NewUnaryHandler(
|
|
ManageServiceStatusProcedure,
|
|
svc.Status,
|
|
connect.WithSchema(manageServiceMethods.ByName("Status")),
|
|
connect.WithHandlerOptions(opts...),
|
|
)
|
|
return "/simplegit.v1.ManageService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case ManageServiceCreateRepoProcedure:
|
|
manageServiceCreateRepoHandler.ServeHTTP(w, r)
|
|
case ManageServiceExistRepoProcedure:
|
|
manageServiceExistRepoHandler.ServeHTTP(w, r)
|
|
case ManageServiceDeleteRepoProcedure:
|
|
manageServiceDeleteRepoHandler.ServeHTTP(w, r)
|
|
case ManageServiceMoveRepoProcedure:
|
|
manageServiceMoveRepoHandler.ServeHTTP(w, r)
|
|
case ManageServiceMoveNSProcedure:
|
|
manageServiceMoveNSHandler.ServeHTTP(w, r)
|
|
case ManageServiceACLUpsertSSHKeyOnNSProcedure:
|
|
manageServiceACLUpsertSSHKeyOnNSHandler.ServeHTTP(w, r)
|
|
case ManageServiceACLUpsertPATOnNSProcedure:
|
|
manageServiceACLUpsertPATOnNSHandler.ServeHTTP(w, r)
|
|
case ManageServiceACLUpsertSSHKeyOnRepoProcedure:
|
|
manageServiceACLUpsertSSHKeyOnRepoHandler.ServeHTTP(w, r)
|
|
case ManageServiceACLUpsertPATOnRepoProcedure:
|
|
manageServiceACLUpsertPATOnRepoHandler.ServeHTTP(w, r)
|
|
case ManageServiceACLDeleteProcedure:
|
|
manageServiceACLDeleteHandler.ServeHTTP(w, r)
|
|
case ManageServiceStatusProcedure:
|
|
manageServiceStatusHandler.ServeHTTP(w, r)
|
|
default:
|
|
http.NotFound(w, r)
|
|
}
|
|
})
|
|
}
|
|
|
|
// UnimplementedManageServiceHandler returns CodeUnimplemented from all methods.
|
|
type UnimplementedManageServiceHandler struct{}
|
|
|
|
func (UnimplementedManageServiceHandler) CreateRepo(context.Context, *connect.Request[v1.CreateRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.CreateRepo is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) ExistRepo(context.Context, *connect.Request[v1.ExistRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.ExistRepo is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) DeleteRepo(context.Context, *connect.Request[v1.DeleteRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.DeleteRepo is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) MoveRepo(context.Context, *connect.Request[v1.MoveRepoRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.MoveRepo is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) MoveNS(context.Context, *connect.Request[v1.MoveNSRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.MoveNS is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) ACLUpsertSSHKeyOnNS(context.Context, *connect.Request[v1.ACLUpsertSSHKeyOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.ACLUpsertSSHKeyOnNS is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) ACLUpsertPATOnNS(context.Context, *connect.Request[v1.ACLUpsertPATOnNSRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.ACLUpsertPATOnNS is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) ACLUpsertSSHKeyOnRepo(context.Context, *connect.Request[v1.ACLUpsertSSHKeyOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.ACLUpsertSSHKeyOnRepo is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) ACLUpsertPATOnRepo(context.Context, *connect.Request[v1.ACLUpsertPATOnRepoRequest]) (*connect.Response[v1.ACLIDResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.ACLUpsertPATOnRepo is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) ACLDelete(context.Context, *connect.Request[v1.ACLDeleteRequest]) (*connect.Response[emptypb.Empty], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.ACLDelete is not implemented"))
|
|
}
|
|
|
|
func (UnimplementedManageServiceHandler) Status(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[v1.StatusResponse], error) {
|
|
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("simplegit.v1.ManageService.Status is not implemented"))
|
|
}
|