Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/public-api/go/v1/v1connect/scm.connect.go
2501 views
1
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
6
//
7
// Source: gitpod/v1/scm.proto
8
9
package v1connect
10
11
import (
12
context "context"
13
errors "errors"
14
connect_go "github.com/bufbuild/connect-go"
15
v1 "github.com/gitpod-io/gitpod/components/public-api/go/v1"
16
http "net/http"
17
strings "strings"
18
)
19
20
// This is a compile-time assertion to ensure that this generated file and the connect package are
21
// compatible. If you get a compiler error that this constant is not defined, this code was
22
// generated with a version of connect newer than the one compiled into your binary. You can fix the
23
// problem by either regenerating this code with an older version of connect or updating the connect
24
// version compiled into your binary.
25
const _ = connect_go.IsAtLeastVersion0_1_0
26
27
const (
28
// SCMServiceName is the fully-qualified name of the SCMService service.
29
SCMServiceName = "gitpod.v1.SCMService"
30
)
31
32
// SCMServiceClient is a client for the gitpod.v1.SCMService service.
33
type SCMServiceClient interface {
34
// SearchSCMTokens allows clients to retrieve SCM tokens based on the
35
// specified host.
36
SearchSCMTokens(context.Context, *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error)
37
// GuessTokenScopes allows clients to retrieve scopes their SCM token would
38
// require for the specified git command.
39
GuessTokenScopes(context.Context, *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error)
40
// SearchRepositories allows clients to search for suggested repositories of
41
// SCM providers they are connected with.
42
SearchRepositories(context.Context, *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error)
43
// ListSuggestedRepositories allows clients to list suggested repositories
44
// based on recent workspaces and accessible repo configurations.
45
ListSuggestedRepositories(context.Context, *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error)
46
}
47
48
// NewSCMServiceClient constructs a client for the gitpod.v1.SCMService service. By default, it uses
49
// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
50
// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
51
// connect.WithGRPCWeb() options.
52
//
53
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
54
// http://api.acme.com or https://acme.com/grpc).
55
func NewSCMServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) SCMServiceClient {
56
baseURL = strings.TrimRight(baseURL, "/")
57
return &sCMServiceClient{
58
searchSCMTokens: connect_go.NewClient[v1.SearchSCMTokensRequest, v1.SearchSCMTokensResponse](
59
httpClient,
60
baseURL+"/gitpod.v1.SCMService/SearchSCMTokens",
61
opts...,
62
),
63
guessTokenScopes: connect_go.NewClient[v1.GuessTokenScopesRequest, v1.GuessTokenScopesResponse](
64
httpClient,
65
baseURL+"/gitpod.v1.SCMService/GuessTokenScopes",
66
opts...,
67
),
68
searchRepositories: connect_go.NewClient[v1.SearchRepositoriesRequest, v1.SearchRepositoriesResponse](
69
httpClient,
70
baseURL+"/gitpod.v1.SCMService/SearchRepositories",
71
opts...,
72
),
73
listSuggestedRepositories: connect_go.NewClient[v1.ListSuggestedRepositoriesRequest, v1.ListSuggestedRepositoriesResponse](
74
httpClient,
75
baseURL+"/gitpod.v1.SCMService/ListSuggestedRepositories",
76
opts...,
77
),
78
}
79
}
80
81
// sCMServiceClient implements SCMServiceClient.
82
type sCMServiceClient struct {
83
searchSCMTokens *connect_go.Client[v1.SearchSCMTokensRequest, v1.SearchSCMTokensResponse]
84
guessTokenScopes *connect_go.Client[v1.GuessTokenScopesRequest, v1.GuessTokenScopesResponse]
85
searchRepositories *connect_go.Client[v1.SearchRepositoriesRequest, v1.SearchRepositoriesResponse]
86
listSuggestedRepositories *connect_go.Client[v1.ListSuggestedRepositoriesRequest, v1.ListSuggestedRepositoriesResponse]
87
}
88
89
// SearchSCMTokens calls gitpod.v1.SCMService.SearchSCMTokens.
90
func (c *sCMServiceClient) SearchSCMTokens(ctx context.Context, req *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error) {
91
return c.searchSCMTokens.CallUnary(ctx, req)
92
}
93
94
// GuessTokenScopes calls gitpod.v1.SCMService.GuessTokenScopes.
95
func (c *sCMServiceClient) GuessTokenScopes(ctx context.Context, req *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error) {
96
return c.guessTokenScopes.CallUnary(ctx, req)
97
}
98
99
// SearchRepositories calls gitpod.v1.SCMService.SearchRepositories.
100
func (c *sCMServiceClient) SearchRepositories(ctx context.Context, req *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error) {
101
return c.searchRepositories.CallUnary(ctx, req)
102
}
103
104
// ListSuggestedRepositories calls gitpod.v1.SCMService.ListSuggestedRepositories.
105
func (c *sCMServiceClient) ListSuggestedRepositories(ctx context.Context, req *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error) {
106
return c.listSuggestedRepositories.CallUnary(ctx, req)
107
}
108
109
// SCMServiceHandler is an implementation of the gitpod.v1.SCMService service.
110
type SCMServiceHandler interface {
111
// SearchSCMTokens allows clients to retrieve SCM tokens based on the
112
// specified host.
113
SearchSCMTokens(context.Context, *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error)
114
// GuessTokenScopes allows clients to retrieve scopes their SCM token would
115
// require for the specified git command.
116
GuessTokenScopes(context.Context, *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error)
117
// SearchRepositories allows clients to search for suggested repositories of
118
// SCM providers they are connected with.
119
SearchRepositories(context.Context, *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error)
120
// ListSuggestedRepositories allows clients to list suggested repositories
121
// based on recent workspaces and accessible repo configurations.
122
ListSuggestedRepositories(context.Context, *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error)
123
}
124
125
// NewSCMServiceHandler builds an HTTP handler from the service implementation. It returns the path
126
// on which to mount the handler and the handler itself.
127
//
128
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
129
// and JSON codecs. They also support gzip compression.
130
func NewSCMServiceHandler(svc SCMServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
131
mux := http.NewServeMux()
132
mux.Handle("/gitpod.v1.SCMService/SearchSCMTokens", connect_go.NewUnaryHandler(
133
"/gitpod.v1.SCMService/SearchSCMTokens",
134
svc.SearchSCMTokens,
135
opts...,
136
))
137
mux.Handle("/gitpod.v1.SCMService/GuessTokenScopes", connect_go.NewUnaryHandler(
138
"/gitpod.v1.SCMService/GuessTokenScopes",
139
svc.GuessTokenScopes,
140
opts...,
141
))
142
mux.Handle("/gitpod.v1.SCMService/SearchRepositories", connect_go.NewUnaryHandler(
143
"/gitpod.v1.SCMService/SearchRepositories",
144
svc.SearchRepositories,
145
opts...,
146
))
147
mux.Handle("/gitpod.v1.SCMService/ListSuggestedRepositories", connect_go.NewUnaryHandler(
148
"/gitpod.v1.SCMService/ListSuggestedRepositories",
149
svc.ListSuggestedRepositories,
150
opts...,
151
))
152
return "/gitpod.v1.SCMService/", mux
153
}
154
155
// UnimplementedSCMServiceHandler returns CodeUnimplemented from all methods.
156
type UnimplementedSCMServiceHandler struct{}
157
158
func (UnimplementedSCMServiceHandler) SearchSCMTokens(context.Context, *connect_go.Request[v1.SearchSCMTokensRequest]) (*connect_go.Response[v1.SearchSCMTokensResponse], error) {
159
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.SearchSCMTokens is not implemented"))
160
}
161
162
func (UnimplementedSCMServiceHandler) GuessTokenScopes(context.Context, *connect_go.Request[v1.GuessTokenScopesRequest]) (*connect_go.Response[v1.GuessTokenScopesResponse], error) {
163
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.GuessTokenScopes is not implemented"))
164
}
165
166
func (UnimplementedSCMServiceHandler) SearchRepositories(context.Context, *connect_go.Request[v1.SearchRepositoriesRequest]) (*connect_go.Response[v1.SearchRepositoriesResponse], error) {
167
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.SearchRepositories is not implemented"))
168
}
169
170
func (UnimplementedSCMServiceHandler) ListSuggestedRepositories(context.Context, *connect_go.Request[v1.ListSuggestedRepositoriesRequest]) (*connect_go.Response[v1.ListSuggestedRepositoriesResponse], error) {
171
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.SCMService.ListSuggestedRepositories is not implemented"))
172
}
173
174