Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/service/json-rpc-user-client.ts
2500 views
1
/**
2
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { UserService } from "@gitpod/public-api/lib/gitpod/v1/user_connect";
8
9
import { PromiseClient } from "@connectrpc/connect";
10
import { PartialMessage } from "@bufbuild/protobuf";
11
import {
12
BlockUserRequest,
13
BlockUserResponse,
14
DeleteUserRequest,
15
DeleteUserResponse,
16
GetAuthenticatedUserRequest,
17
GetAuthenticatedUserResponse,
18
GetUserRequest,
19
GetUserResponse,
20
ListUsersRequest,
21
ListUsersResponse,
22
SetRolesOrPermissionsRequest,
23
SetRolesOrPermissionsResponse,
24
SetWorkspaceAutoStartOptionsRequest,
25
SetWorkspaceAutoStartOptionsResponse,
26
UpdateUserRequest,
27
UpdateUserResponse,
28
VerifyUserRequest,
29
VerifyUserResponse,
30
} from "@gitpod/public-api/lib/gitpod/v1/user_pb";
31
import { getGitpodService } from "./service";
32
import { converter } from "./public-api";
33
import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
34
35
export class JsonRpcUserClient implements PromiseClient<typeof UserService> {
36
async getAuthenticatedUser(
37
request: PartialMessage<GetAuthenticatedUserRequest>,
38
): Promise<GetAuthenticatedUserResponse> {
39
const user = await getGitpodService().server.getLoggedInUser();
40
return new GetAuthenticatedUserResponse({
41
user: converter.toUser(user),
42
});
43
}
44
45
async updateUser(request: PartialMessage<UpdateUserRequest>): Promise<UpdateUserResponse> {
46
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
47
}
48
49
async setWorkspaceAutoStartOptions(
50
request: PartialMessage<SetWorkspaceAutoStartOptionsRequest>,
51
): Promise<SetWorkspaceAutoStartOptionsResponse> {
52
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
53
}
54
55
async deleteUser(request: PartialMessage<DeleteUserRequest>): Promise<DeleteUserResponse> {
56
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
57
}
58
59
async verifyUser(request: PartialMessage<VerifyUserRequest>): Promise<VerifyUserResponse> {
60
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
61
}
62
63
async blockUser(request: PartialMessage<BlockUserRequest>): Promise<BlockUserResponse> {
64
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
65
}
66
67
async listUsers(request: PartialMessage<ListUsersRequest>): Promise<ListUsersResponse> {
68
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
69
}
70
71
async getUser(request: PartialMessage<GetUserRequest>): Promise<GetUserResponse> {
72
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
73
}
74
75
async setRolesOrPermissions(
76
request: PartialMessage<SetRolesOrPermissionsRequest>,
77
): Promise<SetRolesOrPermissionsResponse> {
78
throw new ApplicationError(ErrorCodes.UNIMPLEMENTED, "not implemented");
79
}
80
}
81
82