Path: blob/main/components/public-api/go/v1/v1connect/scm.connect.go
2501 views
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34// Code generated by protoc-gen-connect-go. DO NOT EDIT.5//6// Source: gitpod/v1/scm.proto78package v1connect910import (11context "context"12errors "errors"13connect_go "github.com/bufbuild/connect-go"14v1 "github.com/gitpod-io/gitpod/components/public-api/go/v1"15http "net/http"16strings "strings"17)1819// This is a compile-time assertion to ensure that this generated file and the connect package are20// compatible. If you get a compiler error that this constant is not defined, this code was21// generated with a version of connect newer than the one compiled into your binary. You can fix the22// problem by either regenerating this code with an older version of connect or updating the connect23// version compiled into your binary.24const _ = connect_go.IsAtLeastVersion0_1_02526const (27// SCMServiceName is the fully-qualified name of the SCMService service.28SCMServiceName = "gitpod.v1.SCMService"29)3031// SCMServiceClient is a client for the gitpod.v1.SCMService service.32type SCMServiceClient interface {33// SearchSCMTokens allows clients to retrieve SCM tokens based on the34// specified host.35SearchSCMTokens(context.Context, *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error)36// GuessTokenScopes allows clients to retrieve scopes their SCM token would37// require for the specified git command.38GuessTokenScopes(context.Context, *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error)39// SearchRepositories allows clients to search for suggested repositories of40// SCM providers they are connected with.41SearchRepositories(context.Context, *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error)42// ListSuggestedRepositories allows clients to list suggested repositories43// based on recent workspaces and accessible repo configurations.44ListSuggestedRepositories(context.Context, *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error)45}4647// NewSCMServiceClient constructs a client for the gitpod.v1.SCMService service. By default, it uses48// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends49// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or50// connect.WithGRPCWeb() options.51//52// The URL supplied here should be the base URL for the Connect or gRPC server (for example,53// http://api.acme.com or https://acme.com/grpc).54func NewSCMServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SCMServiceClient {55baseURL = strings.TrimRight(baseURL, "/")56return &sCMServiceClient{57searchSCMTokens: connect_go.NewClient[v1.SearchSCMTokensRequest, v1.SearchSCMTokensResponse](58httpClient,59baseURL+"/gitpod.v1.SCMService/SearchSCMTokens",60opts...,61),62guessTokenScopes: connect_go.NewClient[v1.GuessTokenScopesRequest, v1.GuessTokenScopesResponse](63httpClient,64baseURL+"/gitpod.v1.SCMService/GuessTokenScopes",65opts...,66),67searchRepositories: connect_go.NewClient[v1.SearchRepositoriesRequest, v1.SearchRepositoriesResponse](68httpClient,69baseURL+"/gitpod.v1.SCMService/SearchRepositories",70opts...,71),72listSuggestedRepositories: connect_go.NewClient[v1.ListSuggestedRepositoriesRequest, v1.ListSuggestedRepositoriesResponse](73httpClient,74baseURL+"/gitpod.v1.SCMService/ListSuggestedRepositories",75opts...,76),77}78}7980// sCMServiceClient implements SCMServiceClient.81type sCMServiceClient struct {82searchSCMTokens *connect_go.Client[v1.SearchSCMTokensRequest, v1.SearchSCMTokensResponse]83guessTokenScopes *connect_go.Client[v1.GuessTokenScopesRequest, v1.GuessTokenScopesResponse]84searchRepositories *connect_go.Client[v1.SearchRepositoriesRequest, v1.SearchRepositoriesResponse]85listSuggestedRepositories *connect_go.Client[v1.ListSuggestedRepositoriesRequest, v1.ListSuggestedRepositoriesResponse]86}8788// SearchSCMTokens calls gitpod.v1.SCMService.SearchSCMTokens.89func (c *sCMServiceClient) SearchSCMTokens(ctx context.Context, req *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error) {90return c.searchSCMTokens.CallUnary(ctx, req)91}9293// GuessTokenScopes calls gitpod.v1.SCMService.GuessTokenScopes.94func (c *sCMServiceClient) GuessTokenScopes(ctx context.Context, req *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error) {95return c.guessTokenScopes.CallUnary(ctx, req)96}9798// SearchRepositories calls gitpod.v1.SCMService.SearchRepositories.99func (c *sCMServiceClient) SearchRepositories(ctx context.Context, req *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error) {100return c.searchRepositories.CallUnary(ctx, req)101}102103// ListSuggestedRepositories calls gitpod.v1.SCMService.ListSuggestedRepositories.104func (c *sCMServiceClient) ListSuggestedRepositories(ctx context.Context, req *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error) {105return c.listSuggestedRepositories.CallUnary(ctx, req)106}107108// SCMServiceHandler is an implementation of the gitpod.v1.SCMService service.109type SCMServiceHandler interface {110// SearchSCMTokens allows clients to retrieve SCM tokens based on the111// specified host.112SearchSCMTokens(context.Context, *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error)113// GuessTokenScopes allows clients to retrieve scopes their SCM token would114// require for the specified git command.115GuessTokenScopes(context.Context, *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error)116// SearchRepositories allows clients to search for suggested repositories of117// SCM providers they are connected with.118SearchRepositories(context.Context, *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error)119// ListSuggestedRepositories allows clients to list suggested repositories120// based on recent workspaces and accessible repo configurations.121ListSuggestedRepositories(context.Context, *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error)122}123124// NewSCMServiceHandler builds an HTTP handler from the service implementation. It returns the path125// on which to mount the handler and the handler itself.126//127// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf128// and JSON codecs. They also support gzip compression.129func NewSCMServiceHandler(svc SCMServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {130mux := http.NewServeMux()131mux.Handle("/gitpod.v1.SCMService/SearchSCMTokens", connect_go.NewUnaryHandler(132"/gitpod.v1.SCMService/SearchSCMTokens",133svc.SearchSCMTokens,134opts...,135))136mux.Handle("/gitpod.v1.SCMService/GuessTokenScopes", connect_go.NewUnaryHandler(137"/gitpod.v1.SCMService/GuessTokenScopes",138svc.GuessTokenScopes,139opts...,140))141mux.Handle("/gitpod.v1.SCMService/SearchRepositories", connect_go.NewUnaryHandler(142"/gitpod.v1.SCMService/SearchRepositories",143svc.SearchRepositories,144opts...,145))146mux.Handle("/gitpod.v1.SCMService/ListSuggestedRepositories", connect_go.NewUnaryHandler(147"/gitpod.v1.SCMService/ListSuggestedRepositories",148svc.ListSuggestedRepositories,149opts...,150))151return "/gitpod.v1.SCMService/", mux152}153154// UnimplementedSCMServiceHandler returns CodeUnimplemented from all methods.155type UnimplementedSCMServiceHandler struct{}156157func (UnimplementedSCMServiceHandler) SearchSCMTokens(context.Context, *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error) {158return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.SearchSCMTokens is not implemented"))159}160161func (UnimplementedSCMServiceHandler) GuessTokenScopes(context.Context, *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error) {162return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.GuessTokenScopes is not implemented"))163}164165func (UnimplementedSCMServiceHandler) SearchRepositories(context.Context, *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error) {166return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.SearchRepositories is not implemented"))167}168169func (UnimplementedSCMServiceHandler) ListSuggestedRepositories(context.Context, *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error) {170return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.ListSuggestedRepositories is not implemented"))171}172173174