@pelican.ts/sdk 0.4.13 → 0.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/dist/api/index.d.mts +1 -1
  3. package/dist/api/index.d.ts +1 -1
  4. package/dist/api/index.js +1 -1
  5. package/dist/api/index.mjs +1 -1
  6. package/dist/index.d.mts +139 -139
  7. package/dist/index.d.ts +139 -139
  8. package/dist/index.js +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/types.d.ts +258 -258
  11. package/package.json +1 -1
  12. package/.husky/pre-commit +0 -2
  13. package/scripts/create-types.ts +0 -24
  14. package/src/api/application/client.ts +0 -70
  15. package/src/api/application/database_hosts.ts +0 -65
  16. package/src/api/application/eggs.ts +0 -43
  17. package/src/api/application/mounts.ts +0 -109
  18. package/src/api/application/nodes.ts +0 -126
  19. package/src/api/application/nodes_allocations.ts +0 -47
  20. package/src/api/application/roles.ts +0 -39
  21. package/src/api/application/servers.ts +0 -145
  22. package/src/api/application/servers_databases.ts +0 -53
  23. package/src/api/application/types/container.ts +0 -9
  24. package/src/api/application/types/database_host.ts +0 -11
  25. package/src/api/application/types/egg.ts +0 -65
  26. package/src/api/application/types/index.ts +0 -10
  27. package/src/api/application/types/location.ts +0 -7
  28. package/src/api/application/types/mount.ts +0 -12
  29. package/src/api/application/types/node.ts +0 -58
  30. package/src/api/application/types/role.ts +0 -6
  31. package/src/api/application/types/server.ts +0 -24
  32. package/src/api/application/types/server_allocation.ts +0 -20
  33. package/src/api/application/types/user.ts +0 -34
  34. package/src/api/application/users.ts +0 -146
  35. package/src/api/base/request.ts +0 -44
  36. package/src/api/base/types.ts +0 -40
  37. package/src/api/client/account.ts +0 -77
  38. package/src/api/client/client.ts +0 -56
  39. package/src/api/client/server.ts +0 -74
  40. package/src/api/client/server_activity.ts +0 -25
  41. package/src/api/client/server_allocations.ts +0 -50
  42. package/src/api/client/server_backups.ts +0 -82
  43. package/src/api/client/server_databases.ts +0 -51
  44. package/src/api/client/server_files.ts +0 -145
  45. package/src/api/client/server_schedules.ts +0 -130
  46. package/src/api/client/server_settings.ts +0 -36
  47. package/src/api/client/server_startup.ts +0 -41
  48. package/src/api/client/server_users.ts +0 -55
  49. package/src/api/client/server_websocket.ts +0 -570
  50. package/src/api/client/types/index.ts +0 -5
  51. package/src/api/client/types/server.ts +0 -72
  52. package/src/api/client/types/server_allocation.ts +0 -10
  53. package/src/api/client/types/server_subuser.ts +0 -55
  54. package/src/api/client/types/user.ts +0 -31
  55. package/src/api/client/types/websocket.ts +0 -138
  56. package/src/api/common/types/egg.ts +0 -9
  57. package/src/api/common/types/enums.ts +0 -21
  58. package/src/api/common/types/index.ts +0 -9
  59. package/src/api/common/types/server_backup.ts +0 -13
  60. package/src/api/common/types/server_database.ts +0 -13
  61. package/src/api/common/types/server_files.ts +0 -11
  62. package/src/api/common/types/server_limits.ts +0 -18
  63. package/src/api/common/types/server_power.ts +0 -1
  64. package/src/api/common/types/server_schedule.ts +0 -37
  65. package/src/api/common/types/server_startup.ts +0 -11
  66. package/src/api/index.ts +0 -17
  67. package/src/humane/Account.ts +0 -60
  68. package/src/humane/Client.ts +0 -44
  69. package/src/humane/Server.ts +0 -206
  70. package/src/humane/ServerAllocation.ts +0 -41
  71. package/src/humane/ServerBackup.ts +0 -44
  72. package/src/humane/ServerDatabase.ts +0 -37
  73. package/src/humane/ServerFile.ts +0 -91
  74. package/src/humane/ServerSchedule.ts +0 -160
  75. package/src/humane/ServerUser.ts +0 -44
  76. package/src/index.ts +0 -21
  77. package/src/types.ts +0 -3
  78. package/src/utils/sized.ts +0 -13
  79. package/src/utils/transform.ts +0 -21
  80. package/src/utils/types.ts +0 -10
@@ -1,25 +0,0 @@
1
- import {AxiosInstance} from "axios"
2
- import {ServerActivityLog} from "@/api/client/types/server"
3
- import {GenericListResponse, GenericResponse} from "@/api/base/types"
4
-
5
- export class ServerActivity {
6
- private readonly r: AxiosInstance
7
- private readonly id: string
8
-
9
- constructor(r: AxiosInstance, id: string) {
10
- this.r = r
11
- this.id = id
12
- }
13
-
14
- list = async (
15
- page: number = 1,
16
- per_page: number = 25
17
- ): Promise<ServerActivityLog[]> => {
18
- const {data} = await this.r.get<
19
- GenericListResponse<
20
- GenericResponse<ServerActivityLog, "activity_log">
21
- >
22
- >(`/server/${this.id}/activity`, {params: {page, per_page}})
23
- return data.data.map(log => log.attributes)
24
- }
25
- }
@@ -1,50 +0,0 @@
1
- import {AxiosInstance} from "axios"
2
- import {GenericListResponse, GenericResponse} from "@/api/base/types"
3
- import {ServerAllocation} from "@/api/client/types/server_allocation"
4
-
5
- export class ServerAllocations {
6
- private readonly r: AxiosInstance
7
- private readonly id: string
8
-
9
- constructor(requester: AxiosInstance, id: string) {
10
- this.r = requester
11
- this.id = id
12
- }
13
-
14
- list = async (): Promise<ServerAllocation[]> => {
15
- const {data} = await this.r.get<
16
- GenericListResponse<GenericResponse<ServerAllocation, "allocation">>
17
- >(`/servers/${this.id}/network/allocations`)
18
- return data.data.map(r => r.attributes)
19
- }
20
-
21
- autoAssign = async (): Promise<ServerAllocation> => {
22
- const {data} = await this.r.post<
23
- GenericResponse<ServerAllocation, "allocation">
24
- >(`/servers/${this.id}/network/allocations`)
25
- return data.attributes
26
- }
27
-
28
- setNotes = async (
29
- alloc_id: number,
30
- notes: string
31
- ): Promise<ServerAllocation> => {
32
- const {data} = await this.r.post<
33
- GenericResponse<ServerAllocation, "allocation">
34
- >(`/servers/${this.id}/network/allocations/${alloc_id}`, {notes})
35
- return data.attributes
36
- }
37
-
38
- setPrimary = async (alloc_id: number): Promise<ServerAllocation> => {
39
- const {data} = await this.r.post<
40
- GenericResponse<ServerAllocation, "allocation">
41
- >(`/servers/${this.id}/network/allocations/${alloc_id}/primary`)
42
- return data.attributes
43
- }
44
-
45
- unassign = async (alloc_id: number): Promise<void> => {
46
- await this.r.delete(
47
- `/servers/${this.id}/network/allocations/${alloc_id}`
48
- )
49
- }
50
- }
@@ -1,82 +0,0 @@
1
- import axios, {AxiosInstance} from "axios"
2
- import {ServerBackup} from "@/api/common/types/server_backup"
3
- import z, {string} from "zod"
4
- import {GenericListResponse, GenericResponse} from "@/api/base/types"
5
-
6
- export class ServerBackups {
7
- private readonly r: AxiosInstance
8
- private readonly id: string
9
-
10
- constructor(requester: AxiosInstance, id: string) {
11
- this.r = requester
12
- this.id = id
13
- }
14
-
15
- list = async (page: number = 1): Promise<ServerBackup[]> => {
16
- z.number().positive().parse(page)
17
- const {data} = await this.r.get<
18
- GenericListResponse<GenericResponse<ServerBackup, "backup">>
19
- >(`/servers/${this.id}/backups`, {params: {page}})
20
-
21
- return data.data.map(d => d.attributes)
22
- }
23
-
24
- create = async (args: {
25
- name?: string
26
- is_locked: boolean
27
- ignored_files: string[]
28
- }): Promise<ServerBackup> => {
29
- args.name = z.string().max(255).optional().parse(args.name)
30
- const {data} = await this.r.post<
31
- GenericResponse<ServerBackup, "backup">
32
- >(`/servers/${this.id}/backups`, {
33
- name: args.name,
34
- is_locked: args.is_locked,
35
- ignored_files: args.ignored_files.join("\n")
36
- })
37
- return data.attributes
38
- }
39
-
40
- info = async (backup_uuid: string): Promise<ServerBackup> => {
41
- const {data} = await this.r.get<
42
- GenericResponse<ServerBackup, "backup">
43
- >(`/servers/${this.id}/backups/${backup_uuid}`)
44
- return data.attributes
45
- }
46
-
47
- downloadGetUrl = async (backup_uuid: string): Promise<string> => {
48
- const {data} = await this.r.get<
49
- GenericResponse<{url: string}, "signed_url">
50
- >(`/servers/${this.id}/backups/${backup_uuid}/download`)
51
- return data.attributes.url
52
- }
53
-
54
- download = async (backup_uuid: string): Promise<ArrayBuffer> => {
55
- const url = await this.downloadGetUrl(backup_uuid)
56
- const {data} = await axios.get<ArrayBuffer>(url, {
57
- responseType: "arraybuffer"
58
- })
59
- return data
60
- }
61
-
62
- delete = async (backup_uuid: string): Promise<void> => {
63
- await this.r.delete(`/servers/${this.id}/backups/${backup_uuid}`)
64
- }
65
-
66
- rename = async (backup_uuid: string, name: string): Promise<void> => {
67
- await this.r.put(`/servers/${this.id}/backups/${backup_uuid}/rename`, {
68
- name
69
- })
70
- }
71
-
72
- toggleLock = async (backup_uuid: string): Promise<void> => {
73
- await this.r.post(`/servers/${this.id}/backups/${backup_uuid}/lock`)
74
- }
75
-
76
- restore = async (backup_uuid: string, truncate: boolean): Promise<void> => {
77
- await this.r.post(
78
- `/servers/${this.id}/backups/${backup_uuid}/restore`,
79
- {truncate}
80
- )
81
- }
82
- }
@@ -1,51 +0,0 @@
1
- import {AxiosInstance} from "axios"
2
- import z from "zod"
3
- import {GenericListResponse, GenericResponse} from "@/api/base/types"
4
- import {ServerDatabase} from "@/api/common/types/server_database"
5
- // TODO: Check for validity
6
-
7
- export class ServerDatabases {
8
- private readonly r: AxiosInstance
9
- private readonly id: string
10
-
11
- constructor(requester: AxiosInstance, id: string) {
12
- this.r = requester
13
- this.id = id
14
- }
15
-
16
- list = async (
17
- include?: "password"[],
18
- page: number = 1
19
- ): Promise<ServerDatabase[]> => {
20
- z.number().positive().parse(page)
21
- const {data} = await this.r.get<
22
- GenericListResponse<
23
- GenericResponse<ServerDatabase, "server_database">
24
- >
25
- >(`/servers/${this.id}/databases`, {
26
- params: {include: include?.join(","), page}
27
- })
28
- return data.data.map(d => d.attributes)
29
- }
30
-
31
- create = async (
32
- database: string,
33
- remote: string
34
- ): Promise<ServerDatabase> => {
35
- const {data} = await this.r.post<
36
- GenericResponse<ServerDatabase, "server_database">
37
- >(`/servers/${this.id}/databases`, {database, remote})
38
- return data.attributes
39
- }
40
-
41
- rotatePassword = async (database_id: string): Promise<ServerDatabase> => {
42
- const {data} = await this.r.post<
43
- GenericResponse<ServerDatabase, "server_database">
44
- >(`/servers/${this.id}/databases/${database_id}/rotate-password`)
45
- return data.attributes
46
- }
47
-
48
- delete = async (database_id: string): Promise<void> => {
49
- await this.r.delete(`/servers/${this.id}/databases/${database_id}`)
50
- }
51
- }
@@ -1,145 +0,0 @@
1
- import axios, {AxiosInstance} from "axios"
2
- import {string} from "zod"
3
- import {FileObject} from "@/api/common/types/server_files"
4
- import {GenericListResponse, GenericResponse} from "@/api/base/types"
5
-
6
- export class ServerFiles {
7
- private readonly r: AxiosInstance
8
- private readonly id: string
9
-
10
- constructor(requester: AxiosInstance, id: string) {
11
- this.r = requester
12
- this.id = id
13
- }
14
-
15
- list = async (path?: string): Promise<FileObject[]> => {
16
- const {data} = await this.r.get<
17
- GenericListResponse<GenericResponse<FileObject, "file_object">>
18
- >(`/servers/${this.id}/files/list`, {params: {directory: path}})
19
- return data.data.map(r => r.attributes)
20
- }
21
-
22
- /**
23
- * Return the contents of a file. To read binary file (non-editable) use {@link download} instead
24
- */
25
- contents = async (path: string): Promise<string> => {
26
- const {data} = await this.r.get<string>(
27
- `/servers/${this.id}/files/contents`,
28
- {params: {file: path}}
29
- )
30
- return data
31
- }
32
-
33
- downloadGetUrl = async (path: string): Promise<string> => {
34
- const {data} = await this.r.get<
35
- GenericResponse<{url: string}, "signed_url">
36
- >(`/servers/${this.id}/files/download`, {params: {file: path}})
37
- return data.attributes.url
38
- }
39
-
40
- download = async (path: string): Promise<ArrayBuffer> => {
41
- const url = await this.downloadGetUrl(path)
42
- const {data} = await axios.get<ArrayBuffer>(url, {
43
- responseType: "arraybuffer"
44
- })
45
- return data
46
- }
47
-
48
- rename = async (
49
- root: string = "/",
50
- files: {from: string; to: string}[]
51
- ): Promise<void> => {
52
- await this.r.put(`/servers/${this.id}/files/rename`, {root, files})
53
- }
54
-
55
- copy = async (location: string): Promise<void> => {
56
- await this.r.post(`/servers/${this.id}/files/copy`, {location})
57
- }
58
-
59
- write = async (path: string, content: string): Promise<void> => {
60
- await this.r.post(`/servers/${this.id}/files/write`, content, {
61
- params: {file: path}
62
- })
63
- }
64
-
65
- compress = async (
66
- root: string = "/",
67
- files: string[],
68
- archive_name?: string,
69
- extension?:
70
- | "zip"
71
- | "tgz"
72
- | "tar.gz"
73
- | "txz"
74
- | "tar.xz"
75
- | "tbz2"
76
- | "tar.bz2"
77
- ): Promise<FileObject> => {
78
- const {data} = await this.r.post<
79
- GenericResponse<FileObject, "file_object">
80
- >(`/servers/${this.id}/files/compress`, {
81
- root,
82
- files,
83
- archive_name,
84
- extension
85
- })
86
- return data.attributes
87
- }
88
-
89
- decompress = async (root: string = "/", file: string): Promise<void> => {
90
- await this.r.post(`/servers/${this.id}/files/decompress`, {root, file})
91
- }
92
-
93
- delete = async (root: string = "/", files: string[]): Promise<void> => {
94
- await this.r.post(`/servers/${this.id}/files/delete`, {root, files})
95
- }
96
-
97
- createFolder = async (root: string = "/", name: string): Promise<void> => {
98
- await this.r.post(`/servers/${this.id}/files/create-folder`, {
99
- root,
100
- name
101
- })
102
- }
103
-
104
- chmod = async (
105
- root: string = "/",
106
- files: Array<{file: string; mode: number}>
107
- ): Promise<void> => {
108
- await this.r.post(`/servers/${this.id}/files/chmod`, {root, files})
109
- }
110
-
111
- pullFromRemote = async (
112
- url: string,
113
- directory?: string,
114
- filename?: string, // Unused
115
- use_header: boolean = false, // Unused
116
- foreground: boolean = false // Unused
117
- ): Promise<void> => {
118
- await this.r.post(`/servers/${this.id}/files/pull`, {
119
- url,
120
- directory,
121
- filename,
122
- use_header,
123
- foreground
124
- })
125
- }
126
-
127
- uploadGetUrl = async (): Promise<string> => {
128
- const {data} = await this.r.get<
129
- GenericResponse<{url: string}, "signed_url">
130
- >(`/servers/${this.id}/files/upload`)
131
- return data.attributes.url
132
- }
133
-
134
- upload = async (file: File, root: string = "/"): Promise<void> => {
135
- const url = await this.uploadGetUrl()
136
- await axios.post(
137
- url,
138
- {files: file},
139
- {
140
- headers: {"Content-Type": "multipart/form-data"},
141
- params: {directory: root}
142
- }
143
- )
144
- }
145
- }
@@ -1,130 +0,0 @@
1
- import {AxiosInstance} from "axios"
2
- import {Schedule, ScheduleTask} from "@/api/common/types/server_schedule"
3
- import {GenericListResponse, GenericResponse} from "@/api/base/types"
4
- import {PartialBy} from "@/utils/types"
5
-
6
- export class ServerSchedules {
7
- private readonly r: AxiosInstance
8
- private readonly id: string
9
-
10
- constructor(requester: AxiosInstance, id: string) {
11
- this.r = requester
12
- this.id = id
13
- }
14
-
15
- list = async (): Promise<Schedule[]> => {
16
- const {data} = await this.r.get<
17
- GenericListResponse<GenericResponse<Schedule, "server_schedule">>
18
- >(`/servers/${this.id}/schedules`)
19
- return data.data.map(d => d.attributes)
20
- }
21
-
22
- create = async (params: ScheduleCreateParams): Promise<Schedule> => {
23
- const {data} = await this.r.post<
24
- GenericResponse<Schedule, "server_schedule">
25
- >(`/servers/${this.id}/schedules`, params)
26
- return data.attributes
27
- }
28
-
29
- control = (sched_id: number) =>
30
- new ScheduleControl(this.r, this.id, sched_id)
31
- }
32
-
33
- type ScheduleCreateParams = {
34
- name: string
35
- is_active?: boolean
36
- only_when_online?: boolean
37
- minute: string
38
- hour: string
39
- day_of_week: string
40
- month: string
41
- day_of_month: string
42
- }
43
-
44
- class ScheduleControl {
45
- private r: AxiosInstance
46
- private readonly id: string
47
- private readonly sched_id: number
48
-
49
- constructor(requester: AxiosInstance, id: string, sched_id: number) {
50
- this.r = requester
51
- this.id = id
52
- this.sched_id = sched_id
53
- }
54
-
55
- info = async (): Promise<Schedule> => {
56
- const {data} = await this.r.get<
57
- GenericResponse<Schedule, "server_schedule">
58
- >(`/servers/${this.id}/schedules/${this.sched_id}`)
59
- return data.attributes
60
- }
61
-
62
- update = async (params: ScheduleCreateParams): Promise<Schedule> => {
63
- const {data} = await this.r.post<
64
- GenericResponse<Schedule, "server_schedule">
65
- >(`/servers/${this.id}/schedules/${this.sched_id}`, params)
66
- return data.attributes
67
- }
68
-
69
- delete = async (): Promise<void> => {
70
- await this.r.delete(`/servers/${this.id}/schedules/${this.sched_id}`)
71
- }
72
-
73
- execute = async (): Promise<void> => {
74
- await this.r.post(
75
- `/servers/${this.id}/schedules/${this.sched_id}/execute`
76
- )
77
- }
78
-
79
- tasks = {
80
- create: async (
81
- opts: PartialBy<
82
- Pick<
83
- ScheduleTask,
84
- | "action"
85
- | "payload"
86
- | "time_offset"
87
- | "sequence_id"
88
- | "continue_on_failure"
89
- >,
90
- "payload" | "sequence_id" | "continue_on_failure"
91
- >
92
- ): Promise<ScheduleTask> => {
93
- const {data} = await this.r.post<
94
- GenericResponse<ScheduleTask, "server_schedule_task">
95
- >(`/servers/${this.id}/schedules/${this.sched_id}/tasks`, opts)
96
- return data.attributes
97
- },
98
-
99
- update: async <
100
- T extends "command" | "power" | "backup" | "delete_files"
101
- >(
102
- task_id: number,
103
- opts: PartialBy<
104
- Pick<
105
- ScheduleTask,
106
- | "action"
107
- | "payload"
108
- | "time_offset"
109
- | "sequence_id"
110
- | "continue_on_failure"
111
- >,
112
- "payload" | "sequence_id" | "continue_on_failure"
113
- >
114
- ): Promise<ScheduleTask> => {
115
- const {data} = await this.r.post<
116
- GenericResponse<ScheduleTask, "server_schedule_task">
117
- >(
118
- `/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`,
119
- opts
120
- )
121
- return data.attributes
122
- },
123
-
124
- delete: async (task_id: number): Promise<void> => {
125
- await this.r.delete(
126
- `/servers/${this.id}/schedules/${this.sched_id}/tasks/${task_id}`
127
- )
128
- }
129
- }
130
- }
@@ -1,36 +0,0 @@
1
- import {AxiosInstance} from "axios"
2
- import z from "zod"
3
- import {Nullable} from "@/utils/types"
4
-
5
- export class ServerSettings {
6
- private readonly r: AxiosInstance
7
- private readonly id: string
8
-
9
- constructor(requester: AxiosInstance, id: string) {
10
- this.r = requester
11
- this.id = id
12
- }
13
-
14
- rename = async (name: string): Promise<void> => {
15
- name = z.string().max(255).parse(name)
16
- await this.r.post(`/servers/${this.id}/settings/rename`, {name})
17
- }
18
-
19
- updateDescription = async (
20
- description: Nullable<string>
21
- ): Promise<void> => {
22
- await this.r.post(`/servers/${this.id}/settings/description`, {
23
- description
24
- })
25
- }
26
-
27
- reinstall = async (): Promise<void> => {
28
- await this.r.post(`/servers/${this.id}/settings/reinstall`)
29
- }
30
-
31
- changeDockerImage = async (image: string): Promise<void> => {
32
- await this.r.put(`/servers/${this.id}/settings/docker-image`, {
33
- docker_image: image
34
- })
35
- }
36
- }
@@ -1,41 +0,0 @@
1
- import {AxiosInstance} from "axios"
2
- import {
3
- CustomListResponse,
4
- GenericListResponse,
5
- GenericResponse
6
- } from "@/api/base/types"
7
- import {StartupMeta, StartupParams} from "@/api/common/types/server_startup"
8
-
9
- export class ServerStartup {
10
- private readonly r: AxiosInstance
11
- private readonly id: string
12
-
13
- constructor(requester: AxiosInstance, id: string) {
14
- this.r = requester
15
- this.id = id
16
- }
17
-
18
- list = async (): Promise<
19
- CustomListResponse<StartupParams, StartupMeta>
20
- > => {
21
- const {data} = await this.r.get<
22
- CustomListResponse<
23
- GenericResponse<StartupParams, "egg_variable">,
24
- StartupMeta
25
- >
26
- >(`/servers/${this.id}/startup`)
27
-
28
- return {
29
- object: "list",
30
- meta: data.meta,
31
- data: data.data.map(d => d.attributes)
32
- }
33
- }
34
-
35
- set = async (key: string, value: string): Promise<StartupParams> => {
36
- const {data} = await this.r.put<
37
- GenericResponse<StartupParams, "egg_variable">
38
- >(`/servers/${this.id}/startup/variable`, {key, value})
39
- return data.attributes
40
- }
41
- }
@@ -1,55 +0,0 @@
1
- import {AxiosInstance} from "axios"
2
- import {GenericListResponse, GenericResponse} from "@/api/base/types"
3
- import {
4
- ServerSubuser,
5
- SubuserPermission
6
- } from "@/api/client/types/server_subuser"
7
-
8
- export class ServerUsers {
9
- private readonly r: AxiosInstance
10
- private readonly id: string
11
-
12
- constructor(requester: AxiosInstance, id: string) {
13
- this.r = requester
14
- this.id = id
15
- }
16
-
17
- list = async (): Promise<ServerSubuser[]> => {
18
- const {data} = await this.r.get<
19
- GenericListResponse<GenericResponse<ServerSubuser, "user">>
20
- >(`/servers/${this.id}/users`)
21
- return data.data.map(d => d.attributes)
22
- }
23
-
24
- create = async (
25
- email: string,
26
- permissions: SubuserPermission[] | string[]
27
- ): Promise<ServerSubuser> => {
28
- const {data} = await this.r.post<
29
- GenericResponse<ServerSubuser, "user">
30
- >(`/servers/${this.id}/users`, {email, permissions})
31
- return data.attributes
32
- }
33
-
34
- info = async (user_uuid: string): Promise<ServerSubuser> => {
35
- const {data} = await this.r.get<GenericResponse<ServerSubuser, "user">>(
36
- `/servers/${this.id}/users/${user_uuid}`
37
- )
38
- return data.attributes
39
- }
40
-
41
- update = async (
42
- user_uuid: string,
43
- permissions: SubuserPermission[] | string[]
44
- ): Promise<ServerSubuser> => {
45
- const {data} = await this.r.put<GenericResponse<ServerSubuser, "user">>(
46
- `/servers/${this.id}/users/${user_uuid}`,
47
- {permissions}
48
- )
49
- return data.attributes
50
- }
51
-
52
- delete = async (user_uuid: string): Promise<void> => {
53
- await this.r.delete(`/servers/${this.id}/users/${user_uuid}`)
54
- }
55
- }