Path: blob/main/components/public-api/go/v1/v1connect/user.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/user.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// UserServiceName is the fully-qualified name of the UserService service.28UserServiceName = "gitpod.v1.UserService"29)3031// UserServiceClient is a client for the gitpod.v1.UserService service.32type UserServiceClient interface {33// GetAuthenticatedUser allows to retrieve the current user.34GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error)35// UpdateUser updates the properties of a user.36UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error)37// SetWorkspaceAutoStartOptions updates the auto start options for the Gitpod Dashboard.38// +internal - only used by the Gitpod Dashboard.39SetWorkspaceAutoStartOptions(context.Context, *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error)40// DeleteUser deletes the specified user.41DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error)42// VerifyUser markes the specified user as verified.43// +admin – only to be used by installation admins44VerifyUser(context.Context, *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error)45// BlockUser markes the specified user as blocked.46// +admin – only to be used by installation admins47BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error)48// ListUsers markes the specified user as blocked.49// +admin – only to be used by installation admins50ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error)51// GetUser allows to retrieve the specified user.52// +admin – only to be used by installation admins53GetUser(context.Context, *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error)54// SetRolesOrPermissions allows to set roles or permissions for the specified user.55// +admin – only to be used by installation admins56SetRolesOrPermissions(context.Context, *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error)57}5859// NewUserServiceClient constructs a client for the gitpod.v1.UserService service. By default, it60// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends61// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or62// connect.WithGRPCWeb() options.63//64// The URL supplied here should be the base URL for the Connect or gRPC server (for example,65// http://api.acme.com or https://acme.com/grpc).66func NewUserServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) UserServiceClient {67baseURL = strings.TrimRight(baseURL, "/")68return &userServiceClient{69getAuthenticatedUser: connect_go.NewClient[v1.GetAuthenticatedUserRequest, v1.GetAuthenticatedUserResponse](70httpClient,71baseURL+"/gitpod.v1.UserService/GetAuthenticatedUser",72opts...,73),74updateUser: connect_go.NewClient[v1.UpdateUserRequest, v1.UpdateUserResponse](75httpClient,76baseURL+"/gitpod.v1.UserService/UpdateUser",77opts...,78),79setWorkspaceAutoStartOptions: connect_go.NewClient[v1.SetWorkspaceAutoStartOptionsRequest, v1.SetWorkspaceAutoStartOptionsResponse](80httpClient,81baseURL+"/gitpod.v1.UserService/SetWorkspaceAutoStartOptions",82opts...,83),84deleteUser: connect_go.NewClient[v1.DeleteUserRequest, v1.DeleteUserResponse](85httpClient,86baseURL+"/gitpod.v1.UserService/DeleteUser",87opts...,88),89verifyUser: connect_go.NewClient[v1.VerifyUserRequest, v1.VerifyUserResponse](90httpClient,91baseURL+"/gitpod.v1.UserService/VerifyUser",92opts...,93),94blockUser: connect_go.NewClient[v1.BlockUserRequest, v1.BlockUserResponse](95httpClient,96baseURL+"/gitpod.v1.UserService/BlockUser",97opts...,98),99listUsers: connect_go.NewClient[v1.ListUsersRequest, v1.ListUsersResponse](100httpClient,101baseURL+"/gitpod.v1.UserService/ListUsers",102opts...,103),104getUser: connect_go.NewClient[v1.GetUserRequest, v1.GetUserResponse](105httpClient,106baseURL+"/gitpod.v1.UserService/GetUser",107opts...,108),109setRolesOrPermissions: connect_go.NewClient[v1.SetRolesOrPermissionsRequest, v1.SetRolesOrPermissionsResponse](110httpClient,111baseURL+"/gitpod.v1.UserService/SetRolesOrPermissions",112opts...,113),114}115}116117// userServiceClient implements UserServiceClient.118type userServiceClient struct {119getAuthenticatedUser *connect_go.Client[v1.GetAuthenticatedUserRequest, v1.GetAuthenticatedUserResponse]120updateUser *connect_go.Client[v1.UpdateUserRequest, v1.UpdateUserResponse]121setWorkspaceAutoStartOptions *connect_go.Client[v1.SetWorkspaceAutoStartOptionsRequest, v1.SetWorkspaceAutoStartOptionsResponse]122deleteUser *connect_go.Client[v1.DeleteUserRequest, v1.DeleteUserResponse]123verifyUser *connect_go.Client[v1.VerifyUserRequest, v1.VerifyUserResponse]124blockUser *connect_go.Client[v1.BlockUserRequest, v1.BlockUserResponse]125listUsers *connect_go.Client[v1.ListUsersRequest, v1.ListUsersResponse]126getUser *connect_go.Client[v1.GetUserRequest, v1.GetUserResponse]127setRolesOrPermissions *connect_go.Client[v1.SetRolesOrPermissionsRequest, v1.SetRolesOrPermissionsResponse]128}129130// GetAuthenticatedUser calls gitpod.v1.UserService.GetAuthenticatedUser.131func (c *userServiceClient) GetAuthenticatedUser(ctx context.Context, req *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error) {132return c.getAuthenticatedUser.CallUnary(ctx, req)133}134135// UpdateUser calls gitpod.v1.UserService.UpdateUser.136func (c *userServiceClient) UpdateUser(ctx context.Context, req *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error) {137return c.updateUser.CallUnary(ctx, req)138}139140// SetWorkspaceAutoStartOptions calls gitpod.v1.UserService.SetWorkspaceAutoStartOptions.141func (c *userServiceClient) SetWorkspaceAutoStartOptions(ctx context.Context, req *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error) {142return c.setWorkspaceAutoStartOptions.CallUnary(ctx, req)143}144145// DeleteUser calls gitpod.v1.UserService.DeleteUser.146func (c *userServiceClient) DeleteUser(ctx context.Context, req *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) {147return c.deleteUser.CallUnary(ctx, req)148}149150// VerifyUser calls gitpod.v1.UserService.VerifyUser.151func (c *userServiceClient) VerifyUser(ctx context.Context, req *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error) {152return c.verifyUser.CallUnary(ctx, req)153}154155// BlockUser calls gitpod.v1.UserService.BlockUser.156func (c *userServiceClient) BlockUser(ctx context.Context, req *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error) {157return c.blockUser.CallUnary(ctx, req)158}159160// ListUsers calls gitpod.v1.UserService.ListUsers.161func (c *userServiceClient) ListUsers(ctx context.Context, req *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error) {162return c.listUsers.CallUnary(ctx, req)163}164165// GetUser calls gitpod.v1.UserService.GetUser.166func (c *userServiceClient) GetUser(ctx context.Context, req *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error) {167return c.getUser.CallUnary(ctx, req)168}169170// SetRolesOrPermissions calls gitpod.v1.UserService.SetRolesOrPermissions.171func (c *userServiceClient) SetRolesOrPermissions(ctx context.Context, req *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error) {172return c.setRolesOrPermissions.CallUnary(ctx, req)173}174175// UserServiceHandler is an implementation of the gitpod.v1.UserService service.176type UserServiceHandler interface {177// GetAuthenticatedUser allows to retrieve the current user.178GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error)179// UpdateUser updates the properties of a user.180UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error)181// SetWorkspaceAutoStartOptions updates the auto start options for the Gitpod Dashboard.182// +internal - only used by the Gitpod Dashboard.183SetWorkspaceAutoStartOptions(context.Context, *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error)184// DeleteUser deletes the specified user.185DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error)186// VerifyUser markes the specified user as verified.187// +admin – only to be used by installation admins188VerifyUser(context.Context, *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error)189// BlockUser markes the specified user as blocked.190// +admin – only to be used by installation admins191BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error)192// ListUsers markes the specified user as blocked.193// +admin – only to be used by installation admins194ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error)195// GetUser allows to retrieve the specified user.196// +admin – only to be used by installation admins197GetUser(context.Context, *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error)198// SetRolesOrPermissions allows to set roles or permissions for the specified user.199// +admin – only to be used by installation admins200SetRolesOrPermissions(context.Context, *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error)201}202203// NewUserServiceHandler builds an HTTP handler from the service implementation. It returns the path204// on which to mount the handler and the handler itself.205//206// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf207// and JSON codecs. They also support gzip compression.208func NewUserServiceHandler(svc UserServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) {209mux := http.NewServeMux()210mux.Handle("/gitpod.v1.UserService/GetAuthenticatedUser", connect_go.NewUnaryHandler(211"/gitpod.v1.UserService/GetAuthenticatedUser",212svc.GetAuthenticatedUser,213opts...,214))215mux.Handle("/gitpod.v1.UserService/UpdateUser", connect_go.NewUnaryHandler(216"/gitpod.v1.UserService/UpdateUser",217svc.UpdateUser,218opts...,219))220mux.Handle("/gitpod.v1.UserService/SetWorkspaceAutoStartOptions", connect_go.NewUnaryHandler(221"/gitpod.v1.UserService/SetWorkspaceAutoStartOptions",222svc.SetWorkspaceAutoStartOptions,223opts...,224))225mux.Handle("/gitpod.v1.UserService/DeleteUser", connect_go.NewUnaryHandler(226"/gitpod.v1.UserService/DeleteUser",227svc.DeleteUser,228opts...,229))230mux.Handle("/gitpod.v1.UserService/VerifyUser", connect_go.NewUnaryHandler(231"/gitpod.v1.UserService/VerifyUser",232svc.VerifyUser,233opts...,234))235mux.Handle("/gitpod.v1.UserService/BlockUser", connect_go.NewUnaryHandler(236"/gitpod.v1.UserService/BlockUser",237svc.BlockUser,238opts...,239))240mux.Handle("/gitpod.v1.UserService/ListUsers", connect_go.NewUnaryHandler(241"/gitpod.v1.UserService/ListUsers",242svc.ListUsers,243opts...,244))245mux.Handle("/gitpod.v1.UserService/GetUser", connect_go.NewUnaryHandler(246"/gitpod.v1.UserService/GetUser",247svc.GetUser,248opts...,249))250mux.Handle("/gitpod.v1.UserService/SetRolesOrPermissions", connect_go.NewUnaryHandler(251"/gitpod.v1.UserService/SetRolesOrPermissions",252svc.SetRolesOrPermissions,253opts...,254))255return "/gitpod.v1.UserService/", mux256}257258// UnimplementedUserServiceHandler returns CodeUnimplemented from all methods.259type UnimplementedUserServiceHandler struct{}260261func (UnimplementedUserServiceHandler) GetAuthenticatedUser(context.Context, *connect_go.Request[v1.GetAuthenticatedUserRequest]) (*connect_go.Response[v1.GetAuthenticatedUserResponse], error) {262return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.GetAuthenticatedUser is not implemented"))263}264265func (UnimplementedUserServiceHandler) UpdateUser(context.Context, *connect_go.Request[v1.UpdateUserRequest]) (*connect_go.Response[v1.UpdateUserResponse], error) {266return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.UpdateUser is not implemented"))267}268269func (UnimplementedUserServiceHandler) SetWorkspaceAutoStartOptions(context.Context, *connect_go.Request[v1.SetWorkspaceAutoStartOptionsRequest]) (*connect_go.Response[v1.SetWorkspaceAutoStartOptionsResponse], error) {270return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.SetWorkspaceAutoStartOptions is not implemented"))271}272273func (UnimplementedUserServiceHandler) DeleteUser(context.Context, *connect_go.Request[v1.DeleteUserRequest]) (*connect_go.Response[v1.DeleteUserResponse], error) {274return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.DeleteUser is not implemented"))275}276277func (UnimplementedUserServiceHandler) VerifyUser(context.Context, *connect_go.Request[v1.VerifyUserRequest]) (*connect_go.Response[v1.VerifyUserResponse], error) {278return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.VerifyUser is not implemented"))279}280281func (UnimplementedUserServiceHandler) BlockUser(context.Context, *connect_go.Request[v1.BlockUserRequest]) (*connect_go.Response[v1.BlockUserResponse], error) {282return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.BlockUser is not implemented"))283}284285func (UnimplementedUserServiceHandler) ListUsers(context.Context, *connect_go.Request[v1.ListUsersRequest]) (*connect_go.Response[v1.ListUsersResponse], error) {286return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.ListUsers is not implemented"))287}288289func (UnimplementedUserServiceHandler) GetUser(context.Context, *connect_go.Request[v1.GetUserRequest]) (*connect_go.Response[v1.GetUserResponse], error) {290return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.GetUser is not implemented"))291}292293func (UnimplementedUserServiceHandler) SetRolesOrPermissions(context.Context, *connect_go.Request[v1.SetRolesOrPermissionsRequest]) (*connect_go.Response[v1.SetRolesOrPermissionsResponse], error) {294return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("gitpod.v1.UserService.SetRolesOrPermissions is not implemented"))295}296297298