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/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/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/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.v1.UserService"
30
)
31
32
// UserServiceClient is a client for the gitpod.v1.UserService service.
33
type UserServiceClient interface {
34
// GetAuthenticatedUser allows to retrieve the current user.
35
GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error)
36
// UpdateUser updates the properties of a user.
37
UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error)
38
// SetWorkspaceAutoStartOptions updates the auto start options for the Gitpod Dashboard.
39
// +internal - only used by the Gitpod Dashboard.
40
SetWorkspaceAutoStartOptions(context.Context, *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error)
41
// DeleteUser deletes the specified user.
42
DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error)
43
// VerifyUser markes the specified user as verified.
44
// +admin – only to be used by installation admins
45
VerifyUser(context.Context, *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error)
46
// BlockUser markes the specified user as blocked.
47
// +admin – only to be used by installation admins
48
BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error)
49
// ListUsers markes the specified user as blocked.
50
// +admin – only to be used by installation admins
51
ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error)
52
// GetUser allows to retrieve the specified user.
53
// +admin – only to be used by installation admins
54
GetUser(context.Context, *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error)
55
// SetRolesOrPermissions allows to set roles or permissions for the specified user.
56
// +admin – only to be used by installation admins
57
SetRolesOrPermissions(context.Context, *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error)
58
}
59
60
// NewUserServiceClient constructs a client for the gitpod.v1.UserService service. By default, it
61
// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
62
// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
63
// connect.WithGRPCWeb() options.
64
//
65
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
66
// http://api.acme.com or https://acme.com/grpc).
67
func NewUserServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) UserServiceClient {
68
baseURL = strings.TrimRight(baseURL, "/")
69
return &userServiceClient{
70
getAuthenticatedUser: connect_go.NewClient[v1.GetAuthenticatedUserRequest, v1.GetAuthenticatedUserResponse](
71
httpClient,
72
baseURL+"/gitpod.v1.UserService/GetAuthenticatedUser",
73
opts...,
74
),
75
updateUser: connect_go.NewClient[v1.UpdateUserRequest, v1.UpdateUserResponse](
76
httpClient,
77
baseURL+"/gitpod.v1.UserService/UpdateUser",
78
opts...,
79
),
80
setWorkspaceAutoStartOptions: connect_go.NewClient[v1.SetWorkspaceAutoStartOptionsRequest, v1.SetWorkspaceAutoStartOptionsResponse](
81
httpClient,
82
baseURL+"/gitpod.v1.UserService/SetWorkspaceAutoStartOptions",
83
opts...,
84
),
85
deleteUser: connect_go.NewClient[v1.DeleteUserRequest, v1.DeleteUserResponse](
86
httpClient,
87
baseURL+"/gitpod.v1.UserService/DeleteUser",
88
opts...,
89
),
90
verifyUser: connect_go.NewClient[v1.VerifyUserRequest, v1.VerifyUserResponse](
91
httpClient,
92
baseURL+"/gitpod.v1.UserService/VerifyUser",
93
opts...,
94
),
95
blockUser: connect_go.NewClient[v1.BlockUserRequest, v1.BlockUserResponse](
96
httpClient,
97
baseURL+"/gitpod.v1.UserService/BlockUser",
98
opts...,
99
),
100
listUsers: connect_go.NewClient[v1.ListUsersRequest, v1.ListUsersResponse](
101
httpClient,
102
baseURL+"/gitpod.v1.UserService/ListUsers",
103
opts...,
104
),
105
getUser: connect_go.NewClient[v1.GetUserRequest, v1.GetUserResponse](
106
httpClient,
107
baseURL+"/gitpod.v1.UserService/GetUser",
108
opts...,
109
),
110
setRolesOrPermissions: connect_go.NewClient[v1.SetRolesOrPermissionsRequest, v1.SetRolesOrPermissionsResponse](
111
httpClient,
112
baseURL+"/gitpod.v1.UserService/SetRolesOrPermissions",
113
opts...,
114
),
115
}
116
}
117
118
// userServiceClient implements UserServiceClient.
119
type userServiceClient struct {
120
getAuthenticatedUser *connect_go.Client[v1.GetAuthenticatedUserRequest, v1.GetAuthenticatedUserResponse]
121
updateUser *connect_go.Client[v1.UpdateUserRequest, v1.UpdateUserResponse]
122
setWorkspaceAutoStartOptions *connect_go.Client[v1.SetWorkspaceAutoStartOptionsRequest, v1.SetWorkspaceAutoStartOptionsResponse]
123
deleteUser *connect_go.Client[v1.DeleteUserRequest, v1.DeleteUserResponse]
124
verifyUser *connect_go.Client[v1.VerifyUserRequest, v1.VerifyUserResponse]
125
blockUser *connect_go.Client[v1.BlockUserRequest, v1.BlockUserResponse]
126
listUsers *connect_go.Client[v1.ListUsersRequest, v1.ListUsersResponse]
127
getUser *connect_go.Client[v1.GetUserRequest, v1.GetUserResponse]
128
setRolesOrPermissions *connect_go.Client[v1.SetRolesOrPermissionsRequest, v1.SetRolesOrPermissionsResponse]
129
}
130
131
// GetAuthenticatedUser calls gitpod.v1.UserService.GetAuthenticatedUser.
132
func (c *userServiceClient) GetAuthenticatedUser(ctx context.Context, req *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error) {
133
return c.getAuthenticatedUser.CallUnary(ctx, req)
134
}
135
136
// UpdateUser calls gitpod.v1.UserService.UpdateUser.
137
func (c *userServiceClient) UpdateUser(ctx context.Context, req *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error) {
138
return c.updateUser.CallUnary(ctx, req)
139
}
140
141
// SetWorkspaceAutoStartOptions calls gitpod.v1.UserService.SetWorkspaceAutoStartOptions.
142
func (c *userServiceClient) SetWorkspaceAutoStartOptions(ctx context.Context, req *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error) {
143
return c.setWorkspaceAutoStartOptions.CallUnary(ctx, req)
144
}
145
146
// DeleteUser calls gitpod.v1.UserService.DeleteUser.
147
func (c *userServiceClient) DeleteUser(ctx context.Context, req *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) {
148
return c.deleteUser.CallUnary(ctx, req)
149
}
150
151
// VerifyUser calls gitpod.v1.UserService.VerifyUser.
152
func (c *userServiceClient) VerifyUser(ctx context.Context, req *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error) {
153
return c.verifyUser.CallUnary(ctx, req)
154
}
155
156
// BlockUser calls gitpod.v1.UserService.BlockUser.
157
func (c *userServiceClient) BlockUser(ctx context.Context, req *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error) {
158
return c.blockUser.CallUnary(ctx, req)
159
}
160
161
// ListUsers calls gitpod.v1.UserService.ListUsers.
162
func (c *userServiceClient) ListUsers(ctx context.Context, req *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error) {
163
return c.listUsers.CallUnary(ctx, req)
164
}
165
166
// GetUser calls gitpod.v1.UserService.GetUser.
167
func (c *userServiceClient) GetUser(ctx context.Context, req *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error) {
168
return c.getUser.CallUnary(ctx, req)
169
}
170
171
// SetRolesOrPermissions calls gitpod.v1.UserService.SetRolesOrPermissions.
172
func (c *userServiceClient) SetRolesOrPermissions(ctx context.Context, req *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error) {
173
return c.setRolesOrPermissions.CallUnary(ctx, req)
174
}
175
176
// UserServiceHandler is an implementation of the gitpod.v1.UserService service.
177
type UserServiceHandler interface {
178
// GetAuthenticatedUser allows to retrieve the current user.
179
GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error)
180
// UpdateUser updates the properties of a user.
181
UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error)
182
// SetWorkspaceAutoStartOptions updates the auto start options for the Gitpod Dashboard.
183
// +internal - only used by the Gitpod Dashboard.
184
SetWorkspaceAutoStartOptions(context.Context, *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error)
185
// DeleteUser deletes the specified user.
186
DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error)
187
// VerifyUser markes the specified user as verified.
188
// +admin – only to be used by installation admins
189
VerifyUser(context.Context, *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error)
190
// BlockUser markes the specified user as blocked.
191
// +admin – only to be used by installation admins
192
BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error)
193
// ListUsers markes the specified user as blocked.
194
// +admin – only to be used by installation admins
195
ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error)
196
// GetUser allows to retrieve the specified user.
197
// +admin – only to be used by installation admins
198
GetUser(context.Context, *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error)
199
// SetRolesOrPermissions allows to set roles or permissions for the specified user.
200
// +admin – only to be used by installation admins
201
SetRolesOrPermissions(context.Context, *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error)
202
}
203
204
// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path
205
// on which to mount the handler and the handler itself.
206
//
207
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
208
// and JSON codecs. They also support gzip compression.
209
func NewUserServiceHandler(svc UserServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {
210
mux := http.NewServeMux()
211
mux.Handle("/gitpod.v1.UserService/GetAuthenticatedUser", connect_go.NewUnaryHandler(
212
"/gitpod.v1.UserService/GetAuthenticatedUser",
213
svc.GetAuthenticatedUser,
214
opts...,
215
))
216
mux.Handle("/gitpod.v1.UserService/UpdateUser", connect_go.NewUnaryHandler(
217
"/gitpod.v1.UserService/UpdateUser",
218
svc.UpdateUser,
219
opts...,
220
))
221
mux.Handle("/gitpod.v1.UserService/SetWorkspaceAutoStartOptions", connect_go.NewUnaryHandler(
222
"/gitpod.v1.UserService/SetWorkspaceAutoStartOptions",
223
svc.SetWorkspaceAutoStartOptions,
224
opts...,
225
))
226
mux.Handle("/gitpod.v1.UserService/DeleteUser", connect_go.NewUnaryHandler(
227
"/gitpod.v1.UserService/DeleteUser",
228
svc.DeleteUser,
229
opts...,
230
))
231
mux.Handle("/gitpod.v1.UserService/VerifyUser", connect_go.NewUnaryHandler(
232
"/gitpod.v1.UserService/VerifyUser",
233
svc.VerifyUser,
234
opts...,
235
))
236
mux.Handle("/gitpod.v1.UserService/BlockUser", connect_go.NewUnaryHandler(
237
"/gitpod.v1.UserService/BlockUser",
238
svc.BlockUser,
239
opts...,
240
))
241
mux.Handle("/gitpod.v1.UserService/ListUsers", connect_go.NewUnaryHandler(
242
"/gitpod.v1.UserService/ListUsers",
243
svc.ListUsers,
244
opts...,
245
))
246
mux.Handle("/gitpod.v1.UserService/GetUser", connect_go.NewUnaryHandler(
247
"/gitpod.v1.UserService/GetUser",
248
svc.GetUser,
249
opts...,
250
))
251
mux.Handle("/gitpod.v1.UserService/SetRolesOrPermissions", connect_go.NewUnaryHandler(
252
"/gitpod.v1.UserService/SetRolesOrPermissions",
253
svc.SetRolesOrPermissions,
254
opts...,
255
))
256
return "/gitpod.v1.UserService/", mux
257
}
258
259
// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods.
260
type UnimplementedUserServiceHandler struct{}
261
262
func (UnimplementedUserServiceHandler) GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error) {
263
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.GetAuthenticatedUser is not implemented"))
264
}
265
266
func (UnimplementedUserServiceHandler) UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error) {
267
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.UpdateUser is not implemented"))
268
}
269
270
func (UnimplementedUserServiceHandler) SetWorkspaceAutoStartOptions(context.Context, *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error) {
271
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.SetWorkspaceAutoStartOptions is not implemented"))
272
}
273
274
func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) {
275
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.DeleteUser is not implemented"))
276
}
277
278
func (UnimplementedUserServiceHandler) VerifyUser(context.Context, *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error) {
279
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.VerifyUser is not implemented"))
280
}
281
282
func (UnimplementedUserServiceHandler) BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error) {
283
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.BlockUser is not implemented"))
284
}
285
286
func (UnimplementedUserServiceHandler) ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error) {
287
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.ListUsers is not implemented"))
288
}
289
290
func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error) {
291
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.GetUser is not implemented"))
292
}
293
294
func (UnimplementedUserServiceHandler) SetRolesOrPermissions(context.Context, *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error) {
295
return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.SetRolesOrPermissions is not implemented"))
296
}
297
298