Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/public-api/go/experimental/v1/v1connect/user.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/experimental/v1/user.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/experimental/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
// UserServiceName is the fully-qualified name of the UserService service.
29
UserServiceName = "gitpod.experimental.v1.UserService"
30
)
31
32
// UserServiceClient is a client for the gitpod.experimental.v1.UserService service.
33
type UserServiceClient interface {
34
// GetAuthenticatedUser gets the user info.
35
GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error)
36
// ListSSHKeys lists the public SSH keys.
37
ListSSHKeys(context.Context, *connect_go.Request[v1.ListSSHKeysRequest]) (*connect_go.Response[v1.ListSSHKeysResponse], error)
38
// CreateSSHKey adds a public SSH key.
39
CreateSSHKey(context.Context, *connect_go.Request[v1.CreateSSHKeyRequest]) (*connect_go.Response[v1.CreateSSHKeyResponse], error)
40
// GetSSHKey retrieves an ssh key by ID.
41
GetSSHKey(context.Context, *connect_go.Request[v1.GetSSHKeyRequest]) (*connect_go.Response[v1.GetSSHKeyResponse], error)
42
// DeleteSSHKey removes a public SSH key.
43
DeleteSSHKey(context.Context, *connect_go.Request[v1.DeleteSSHKeyRequest]) (*connect_go.Response[v1.DeleteSSHKeyResponse], error)
44
GetGitToken(context.Context, *connect_go.Request[v1.GetGitTokenRequest]) (*connect_go.Response[v1.GetGitTokenResponse], error)
45
BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error)
46
}
47
48
// NewUserServiceClient constructs a client for the gitpod.experimental.v1.UserService service. By
49
// default, it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses,
50
// and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the
51
// connect.WithGRPC() or 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 NewUserServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) UserServiceClient {
56
baseURL = strings.TrimRight(baseURL, "/")
57
return &userServiceClient{
58
getAuthenticatedUser: connect_go.NewClient[v1.GetAuthenticatedUserRequest, v1.GetAuthenticatedUserResponse](
59
httpClient,
60
baseURL+"/gitpod.experimental.v1.UserService/GetAuthenticatedUser",
61
opts...,
62
),
63
listSSHKeys: connect_go.NewClient[v1.ListSSHKeysRequest, v1.ListSSHKeysResponse](
64
httpClient,
65
baseURL+"/gitpod.experimental.v1.UserService/ListSSHKeys",
66
opts...,
67
),
68
createSSHKey: connect_go.NewClient[v1.CreateSSHKeyRequest, v1.CreateSSHKeyResponse](
69
httpClient,
70
baseURL+"/gitpod.experimental.v1.UserService/CreateSSHKey",
71
opts...,
72
),
73
getSSHKey: connect_go.NewClient[v1.GetSSHKeyRequest, v1.GetSSHKeyResponse](
74
httpClient,
75
baseURL+"/gitpod.experimental.v1.UserService/GetSSHKey",
76
opts...,
77
),
78
deleteSSHKey: connect_go.NewClient[v1.DeleteSSHKeyRequest, v1.DeleteSSHKeyResponse](
79
httpClient,
80
baseURL+"/gitpod.experimental.v1.UserService/DeleteSSHKey",
81
opts...,
82
),
83
getGitToken: connect_go.NewClient[v1.GetGitTokenRequest, v1.GetGitTokenResponse](
84
httpClient,
85
baseURL+"/gitpod.experimental.v1.UserService/GetGitToken",
86
opts...,
87
),
88
blockUser: connect_go.NewClient[v1.BlockUserRequest, v1.BlockUserResponse](
89
httpClient,
90
baseURL+"/gitpod.experimental.v1.UserService/BlockUser",
91
opts...,
92
),
93
}
94
}
95
96
// userServiceClient implements UserServiceClient.
97
type userServiceClient struct {
98
getAuthenticatedUser *connect_go.Client[v1.GetAuthenticatedUserRequest, v1.GetAuthenticatedUserResponse]
99
listSSHKeys *connect_go.Client[v1.ListSSHKeysRequest, v1.ListSSHKeysResponse]
100
createSSHKey *connect_go.Client[v1.CreateSSHKeyRequest, v1.CreateSSHKeyResponse]
101
getSSHKey *connect_go.Client[v1.GetSSHKeyRequest, v1.GetSSHKeyResponse]
102
deleteSSHKey *connect_go.Client[v1.DeleteSSHKeyRequest, v1.DeleteSSHKeyResponse]
103
getGitToken *connect_go.Client[v1.GetGitTokenRequest, v1.GetGitTokenResponse]
104
blockUser *connect_go.Client[v1.BlockUserRequest, v1.BlockUserResponse]
105
}
106
107
// GetAuthenticatedUser calls gitpod.experimental.v1.UserService.GetAuthenticatedUser.
108
func (c *userServiceClient) GetAuthenticatedUser(ctx context.Context, req *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error) {
109
return c.getAuthenticatedUser.CallUnary(ctx, req)
110
}
111
112
// ListSSHKeys calls gitpod.experimental.v1.UserService.ListSSHKeys.
113
func (c *userServiceClient) ListSSHKeys(ctx context.Context, req *connect_go.Request[v1.ListSSHKeysRequest]) (*connect_go.Response[v1.ListSSHKeysResponse], error) {
114
return c.listSSHKeys.CallUnary(ctx, req)
115
}
116
117
// CreateSSHKey calls gitpod.experimental.v1.UserService.CreateSSHKey.
118
func (c *userServiceClient) CreateSSHKey(ctx context.Context, req *connect_go.Request[v1.CreateSSHKeyRequest]) (*connect_go.Response[v1.CreateSSHKeyResponse], error) {
119
return c.createSSHKey.CallUnary(ctx, req)
120
}
121
122
// GetSSHKey calls gitpod.experimental.v1.UserService.GetSSHKey.
123
func (c *userServiceClient) GetSSHKey(ctx context.Context, req *connect_go.Request[v1.GetSSHKeyRequest]) (*connect_go.Response[v1.GetSSHKeyResponse], error) {
124
return c.getSSHKey.CallUnary(ctx, req)
125
}
126
127
// DeleteSSHKey calls gitpod.experimental.v1.UserService.DeleteSSHKey.
128
func (c *userServiceClient) DeleteSSHKey(ctx context.Context, req *connect_go.Request[v1.DeleteSSHKeyRequest]) (*connect_go.Response[v1.DeleteSSHKeyResponse], error) {
129
return c.deleteSSHKey.CallUnary(ctx, req)
130
}
131
132
// GetGitToken calls gitpod.experimental.v1.UserService.GetGitToken.
133
func (c *userServiceClient) GetGitToken(ctx context.Context, req *connect_go.Request[v1.GetGitTokenRequest]) (*connect_go.Response[v1.GetGitTokenResponse], error) {
134
return c.getGitToken.CallUnary(ctx, req)
135
}
136
137
// BlockUser calls gitpod.experimental.v1.UserService.BlockUser.
138
func (c *userServiceClient) BlockUser(ctx context.Context, req *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error) {
139
return c.blockUser.CallUnary(ctx, req)
140
}
141
142
// UserServiceHandler is an implementation of the gitpod.experimental.v1.UserService service.
143
type UserServiceHandler interface {
144
// GetAuthenticatedUser gets the user info.
145
GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error)
146
// ListSSHKeys lists the public SSH keys.
147
ListSSHKeys(context.Context, *connect_go.Request[v1.ListSSHKeysRequest]) (*connect_go.Response[v1.ListSSHKeysResponse], error)
148
// CreateSSHKey adds a public SSH key.
149
CreateSSHKey(context.Context, *connect_go.Request[v1.CreateSSHKeyRequest]) (*connect_go.Response[v1.CreateSSHKeyResponse], error)
150
// GetSSHKey retrieves an ssh key by ID.
151
GetSSHKey(context.Context, *connect_go.Request[v1.GetSSHKeyRequest]) (*connect_go.Response[v1.GetSSHKeyResponse], error)
152
// DeleteSSHKey removes a public SSH key.
153
DeleteSSHKey(context.Context, *connect_go.Request[v1.DeleteSSHKeyRequest]) (*connect_go.Response[v1.DeleteSSHKeyResponse], error)
154
GetGitToken(context.Context, *connect_go.Request[v1.GetGitTokenRequest]) (*connect_go.Response[v1.GetGitTokenResponse], error)
155
BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error)
156
}
157
158
// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path
159
// on which to mount the handler and the handler itself.
160
//
161
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
162
// and JSON codecs. They also support gzip compression.
163
func NewUserServiceHandler(svc UserServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
164
mux := http.NewServeMux()
165
mux.Handle("/gitpod.experimental.v1.UserService/GetAuthenticatedUser", connect_go.NewUnaryHandler(
166
"/gitpod.experimental.v1.UserService/GetAuthenticatedUser",
167
svc.GetAuthenticatedUser,
168
opts...,
169
))
170
mux.Handle("/gitpod.experimental.v1.UserService/ListSSHKeys", connect_go.NewUnaryHandler(
171
"/gitpod.experimental.v1.UserService/ListSSHKeys",
172
svc.ListSSHKeys,
173
opts...,
174
))
175
mux.Handle("/gitpod.experimental.v1.UserService/CreateSSHKey", connect_go.NewUnaryHandler(
176
"/gitpod.experimental.v1.UserService/CreateSSHKey",
177
svc.CreateSSHKey,
178
opts...,
179
))
180
mux.Handle("/gitpod.experimental.v1.UserService/GetSSHKey", connect_go.NewUnaryHandler(
181
"/gitpod.experimental.v1.UserService/GetSSHKey",
182
svc.GetSSHKey,
183
opts...,
184
))
185
mux.Handle("/gitpod.experimental.v1.UserService/DeleteSSHKey", connect_go.NewUnaryHandler(
186
"/gitpod.experimental.v1.UserService/DeleteSSHKey",
187
svc.DeleteSSHKey,
188
opts...,
189
))
190
mux.Handle("/gitpod.experimental.v1.UserService/GetGitToken", connect_go.NewUnaryHandler(
191
"/gitpod.experimental.v1.UserService/GetGitToken",
192
svc.GetGitToken,
193
opts...,
194
))
195
mux.Handle("/gitpod.experimental.v1.UserService/BlockUser", connect_go.NewUnaryHandler(
196
"/gitpod.experimental.v1.UserService/BlockUser",
197
svc.BlockUser,
198
opts...,
199
))
200
return "/gitpod.experimental.v1.UserService/", mux
201
}
202
203
// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods.
204
type UnimplementedUserServiceHandler struct{}
205
206
func (UnimplementedUserServiceHandler) GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error) {
207
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.UserService.GetAuthenticatedUser is not implemented"))
208
}
209
210
func (UnimplementedUserServiceHandler) ListSSHKeys(context.Context, *connect_go.Request[v1.ListSSHKeysRequest]) (*connect_go.Response[v1.ListSSHKeysResponse], error) {
211
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.UserService.ListSSHKeys is not implemented"))
212
}
213
214
func (UnimplementedUserServiceHandler) CreateSSHKey(context.Context, *connect_go.Request[v1.CreateSSHKeyRequest]) (*connect_go.Response[v1.CreateSSHKeyResponse], error) {
215
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.UserService.CreateSSHKey is not implemented"))
216
}
217
218
func (UnimplementedUserServiceHandler) GetSSHKey(context.Context, *connect_go.Request[v1.GetSSHKeyRequest]) (*connect_go.Response[v1.GetSSHKeyResponse], error) {
219
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.UserService.GetSSHKey is not implemented"))
220
}
221
222
func (UnimplementedUserServiceHandler) DeleteSSHKey(context.Context, *connect_go.Request[v1.DeleteSSHKeyRequest]) (*connect_go.Response[v1.DeleteSSHKeyResponse], error) {
223
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.UserService.DeleteSSHKey is not implemented"))
224
}
225
226
func (UnimplementedUserServiceHandler) GetGitToken(context.Context, *connect_go.Request[v1.GetGitTokenRequest]) (*connect_go.Response[v1.GetGitTokenResponse], error) {
227
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.UserService.GetGitToken is not implemented"))
228
}
229
230
func (UnimplementedUserServiceHandler) BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error) {
231
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.experimental.v1.UserService.BlockUser is not implemented"))
232
}
233
234