19684: Catch object values in primitive parameters and external values in files/direc...
[arvados.git] / src / services / user-service / user-service.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { AxiosInstance } from "axios";
6 import { CommonResourceService } from "services/common-service/common-resource-service";
7 import { UserResource } from "models/user";
8 import { ApiActions } from "services/api/api-actions";
9 import { ListResults } from "services/common-service/common-service";
10
11 export class UserService extends CommonResourceService<UserResource> {
12     constructor(serverApi: AxiosInstance, actions: ApiActions, readOnlyFields: string[] = []) {
13         super(serverApi, "users", actions, readOnlyFields.concat([
14             'fullName',
15             'isInvited',
16             'writableBy',
17         ]));
18     }
19
20     activate(uuid: string) {
21         return CommonResourceService.defaultResponse<UserResource>(
22             this.serverApi
23                 .post(this.resourceType + `/${uuid}/activate`),
24             this.actions
25         );
26     }
27
28     setup(uuid: string) {
29         return CommonResourceService.defaultResponse<ListResults<any>>(
30             this.serverApi
31                 .post(this.resourceType + `/setup`, {}, { params: { uuid } }),
32             this.actions
33         );
34     }
35
36     unsetup(uuid: string) {
37         return CommonResourceService.defaultResponse<UserResource>(
38             this.serverApi
39                 .post(this.resourceType + `/${uuid}/unsetup`),
40             this.actions
41         );
42     }
43 }