@appwrite.io/console 1.2.2 → 1.3.0
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.
- package/.github/workflows/autoclose.yml +1 -1
- package/README.md +1 -1
- package/dist/cjs/sdk.js +4875 -3335
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +4874 -3336
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +4875 -3335
- package/docs/examples/account/create-payment-method.md +11 -0
- package/docs/examples/account/delete-payment-method.md +13 -0
- package/docs/examples/account/get-billing-address.md +13 -0
- package/docs/examples/account/get-payment-method.md +13 -0
- package/docs/examples/account/list-billing-addresses.md +13 -0
- package/docs/examples/account/list-credits.md +14 -0
- package/docs/examples/account/list-invoices.md +13 -0
- package/docs/examples/account/list-payment-methods.md +13 -0
- package/docs/examples/account/update-payment-method-mandate-options.md +13 -0
- package/docs/examples/account/update-payment-method-provider.md +15 -0
- package/docs/examples/account/update-payment-method.md +15 -0
- package/docs/examples/backups/create-archive.md +14 -0
- package/docs/examples/backups/create-policy.md +19 -0
- package/docs/examples/backups/create-restoration.md +16 -0
- package/docs/examples/backups/delete-archive.md +13 -0
- package/docs/examples/backups/delete-policy.md +13 -0
- package/docs/examples/backups/get-archive.md +13 -0
- package/docs/examples/backups/get-policy.md +13 -0
- package/docs/examples/backups/get-restoration.md +13 -0
- package/docs/examples/backups/list-archives.md +13 -0
- package/docs/examples/backups/list-policies.md +13 -0
- package/docs/examples/backups/list-restorations.md +13 -0
- package/docs/examples/backups/update-policy.md +17 -0
- package/docs/examples/console/create-source.md +17 -0
- package/docs/examples/console/get-campaign.md +13 -0
- package/docs/examples/console/get-copon.md +13 -0
- package/docs/examples/console/plans.md +11 -0
- package/docs/examples/console/regions.md +11 -0
- package/docs/examples/health/get-queue-billing-aggregation.md +13 -0
- package/docs/examples/health/get-queue-priority-builds.md +13 -0
- package/docs/examples/organizations/add-credit.md +14 -0
- package/docs/examples/organizations/create-invoice-payment.md +15 -0
- package/docs/examples/organizations/create.md +17 -0
- package/docs/examples/organizations/delete-backup-payment-method.md +13 -0
- package/docs/examples/organizations/delete-billing-address.md +13 -0
- package/docs/examples/organizations/delete-default-payment-method.md +13 -0
- package/docs/examples/organizations/delete.md +13 -0
- package/docs/examples/organizations/get-aggregation.md +14 -0
- package/docs/examples/organizations/get-billing-address.md +14 -0
- package/docs/examples/organizations/get-credit.md +14 -0
- package/docs/examples/organizations/get-invoice-download.md +14 -0
- package/docs/examples/organizations/get-invoice-view.md +14 -0
- package/docs/examples/organizations/get-invoice.md +14 -0
- package/docs/examples/organizations/get-payment-method.md +14 -0
- package/docs/examples/organizations/get-plan.md +13 -0
- package/docs/examples/organizations/get-scopes.md +13 -0
- package/docs/examples/organizations/get-usage.md +15 -0
- package/docs/examples/organizations/list-aggregations.md +14 -0
- package/docs/examples/organizations/list-invoices.md +14 -0
- package/docs/examples/organizations/list.md +14 -0
- package/docs/examples/organizations/set-backup-payment-method.md +14 -0
- package/docs/examples/organizations/set-billing-address.md +14 -0
- package/docs/examples/organizations/set-billing-email.md +14 -0
- package/docs/examples/organizations/set-billing-tax-id.md +14 -0
- package/docs/examples/organizations/set-default-payment-method.md +14 -0
- package/docs/examples/organizations/update-budget.md +15 -0
- package/docs/examples/organizations/update-plan.md +16 -0
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/billing-plan.ts +5 -0
- package/src/enums/runtime.ts +0 -3
- package/src/index.ts +3 -0
- package/src/models.ts +1112 -1
- package/src/services/account.ts +336 -0
- package/src/services/backups.ts +425 -0
- package/src/services/console.ts +148 -0
- package/src/services/health.ts +56 -0
- package/src/services/organizations.ts +924 -0
- package/types/enums/billing-plan.d.ts +5 -0
- package/types/enums/runtime.d.ts +0 -3
- package/types/index.d.ts +3 -0
- package/types/models.d.ts +1112 -1
- package/types/services/account.d.ts +103 -0
- package/types/services/backups.d.ts +128 -0
- package/types/services/console.d.ts +47 -0
- package/types/services/health.d.ts +18 -0
- package/types/services/organizations.d.ts +282 -0
- package/.travis.yml +0 -32
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { Service } from '../service';
|
|
2
|
+
import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
|
|
3
|
+
import type { Models } from '../models';
|
|
4
|
+
|
|
5
|
+
export class Backups {
|
|
6
|
+
client: Client;
|
|
7
|
+
|
|
8
|
+
constructor(client: Client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* List archives
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* @param {string[]} queries
|
|
17
|
+
* @throws {AppwriteException}
|
|
18
|
+
* @returns {Promise<Models.BackupArchiveList>}
|
|
19
|
+
*/
|
|
20
|
+
async listArchives(queries?: string[]): Promise<Models.BackupArchiveList> {
|
|
21
|
+
const apiPath = '/backups/archives';
|
|
22
|
+
const payload: Payload = {};
|
|
23
|
+
if (typeof queries !== 'undefined') {
|
|
24
|
+
payload['queries'] = queries;
|
|
25
|
+
}
|
|
26
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
27
|
+
|
|
28
|
+
const apiHeaders: { [header: string]: string } = {
|
|
29
|
+
'content-type': 'application/json',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return await this.client.call(
|
|
34
|
+
'get',
|
|
35
|
+
uri,
|
|
36
|
+
apiHeaders,
|
|
37
|
+
payload
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create archive
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* @param {string[]} services
|
|
45
|
+
* @param {string} resourceId
|
|
46
|
+
* @throws {AppwriteException}
|
|
47
|
+
* @returns {Promise<Models.BackupArchive>}
|
|
48
|
+
*/
|
|
49
|
+
async createArchive(services: string[], resourceId?: string): Promise<Models.BackupArchive> {
|
|
50
|
+
if (typeof services === 'undefined') {
|
|
51
|
+
throw new AppwriteException('Missing required parameter: "services"');
|
|
52
|
+
}
|
|
53
|
+
const apiPath = '/backups/archives';
|
|
54
|
+
const payload: Payload = {};
|
|
55
|
+
if (typeof services !== 'undefined') {
|
|
56
|
+
payload['services'] = services;
|
|
57
|
+
}
|
|
58
|
+
if (typeof resourceId !== 'undefined') {
|
|
59
|
+
payload['resourceId'] = resourceId;
|
|
60
|
+
}
|
|
61
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
62
|
+
|
|
63
|
+
const apiHeaders: { [header: string]: string } = {
|
|
64
|
+
'content-type': 'application/json',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
return await this.client.call(
|
|
69
|
+
'post',
|
|
70
|
+
uri,
|
|
71
|
+
apiHeaders,
|
|
72
|
+
payload
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get backup archive
|
|
77
|
+
*
|
|
78
|
+
*
|
|
79
|
+
* @param {string} archiveId
|
|
80
|
+
* @throws {AppwriteException}
|
|
81
|
+
* @returns {Promise<Models.BackupArchive>}
|
|
82
|
+
*/
|
|
83
|
+
async getArchive(archiveId: string): Promise<Models.BackupArchive> {
|
|
84
|
+
if (typeof archiveId === 'undefined') {
|
|
85
|
+
throw new AppwriteException('Missing required parameter: "archiveId"');
|
|
86
|
+
}
|
|
87
|
+
const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId);
|
|
88
|
+
const payload: Payload = {};
|
|
89
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
90
|
+
|
|
91
|
+
const apiHeaders: { [header: string]: string } = {
|
|
92
|
+
'content-type': 'application/json',
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
return await this.client.call(
|
|
97
|
+
'get',
|
|
98
|
+
uri,
|
|
99
|
+
apiHeaders,
|
|
100
|
+
payload
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Delete archive
|
|
105
|
+
*
|
|
106
|
+
*
|
|
107
|
+
* @param {string} archiveId
|
|
108
|
+
* @throws {AppwriteException}
|
|
109
|
+
* @returns {Promise<{}>}
|
|
110
|
+
*/
|
|
111
|
+
async deleteArchive(archiveId: string): Promise<{}> {
|
|
112
|
+
if (typeof archiveId === 'undefined') {
|
|
113
|
+
throw new AppwriteException('Missing required parameter: "archiveId"');
|
|
114
|
+
}
|
|
115
|
+
const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId);
|
|
116
|
+
const payload: Payload = {};
|
|
117
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
118
|
+
|
|
119
|
+
const apiHeaders: { [header: string]: string } = {
|
|
120
|
+
'content-type': 'application/json',
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
return await this.client.call(
|
|
125
|
+
'delete',
|
|
126
|
+
uri,
|
|
127
|
+
apiHeaders,
|
|
128
|
+
payload
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* List backup policies
|
|
133
|
+
*
|
|
134
|
+
*
|
|
135
|
+
* @param {string[]} queries
|
|
136
|
+
* @throws {AppwriteException}
|
|
137
|
+
* @returns {Promise<Models.BackupPolicyList>}
|
|
138
|
+
*/
|
|
139
|
+
async listPolicies(queries?: string[]): Promise<Models.BackupPolicyList> {
|
|
140
|
+
const apiPath = '/backups/policies';
|
|
141
|
+
const payload: Payload = {};
|
|
142
|
+
if (typeof queries !== 'undefined') {
|
|
143
|
+
payload['queries'] = queries;
|
|
144
|
+
}
|
|
145
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
146
|
+
|
|
147
|
+
const apiHeaders: { [header: string]: string } = {
|
|
148
|
+
'content-type': 'application/json',
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
return await this.client.call(
|
|
153
|
+
'get',
|
|
154
|
+
uri,
|
|
155
|
+
apiHeaders,
|
|
156
|
+
payload
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Create backup policy
|
|
161
|
+
*
|
|
162
|
+
*
|
|
163
|
+
* @param {string} policyId
|
|
164
|
+
* @param {string[]} services
|
|
165
|
+
* @param {number} retention
|
|
166
|
+
* @param {string} schedule
|
|
167
|
+
* @param {string} name
|
|
168
|
+
* @param {string} resourceId
|
|
169
|
+
* @param {boolean} enabled
|
|
170
|
+
* @throws {AppwriteException}
|
|
171
|
+
* @returns {Promise<Models.BackupPolicy>}
|
|
172
|
+
*/
|
|
173
|
+
async createPolicy(policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy> {
|
|
174
|
+
if (typeof policyId === 'undefined') {
|
|
175
|
+
throw new AppwriteException('Missing required parameter: "policyId"');
|
|
176
|
+
}
|
|
177
|
+
if (typeof services === 'undefined') {
|
|
178
|
+
throw new AppwriteException('Missing required parameter: "services"');
|
|
179
|
+
}
|
|
180
|
+
if (typeof retention === 'undefined') {
|
|
181
|
+
throw new AppwriteException('Missing required parameter: "retention"');
|
|
182
|
+
}
|
|
183
|
+
if (typeof schedule === 'undefined') {
|
|
184
|
+
throw new AppwriteException('Missing required parameter: "schedule"');
|
|
185
|
+
}
|
|
186
|
+
const apiPath = '/backups/policies';
|
|
187
|
+
const payload: Payload = {};
|
|
188
|
+
if (typeof policyId !== 'undefined') {
|
|
189
|
+
payload['policyId'] = policyId;
|
|
190
|
+
}
|
|
191
|
+
if (typeof name !== 'undefined') {
|
|
192
|
+
payload['name'] = name;
|
|
193
|
+
}
|
|
194
|
+
if (typeof services !== 'undefined') {
|
|
195
|
+
payload['services'] = services;
|
|
196
|
+
}
|
|
197
|
+
if (typeof resourceId !== 'undefined') {
|
|
198
|
+
payload['resourceId'] = resourceId;
|
|
199
|
+
}
|
|
200
|
+
if (typeof enabled !== 'undefined') {
|
|
201
|
+
payload['enabled'] = enabled;
|
|
202
|
+
}
|
|
203
|
+
if (typeof retention !== 'undefined') {
|
|
204
|
+
payload['retention'] = retention;
|
|
205
|
+
}
|
|
206
|
+
if (typeof schedule !== 'undefined') {
|
|
207
|
+
payload['schedule'] = schedule;
|
|
208
|
+
}
|
|
209
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
210
|
+
|
|
211
|
+
const apiHeaders: { [header: string]: string } = {
|
|
212
|
+
'content-type': 'application/json',
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
return await this.client.call(
|
|
217
|
+
'post',
|
|
218
|
+
uri,
|
|
219
|
+
apiHeaders,
|
|
220
|
+
payload
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get backup policy
|
|
225
|
+
*
|
|
226
|
+
*
|
|
227
|
+
* @param {string} policyId
|
|
228
|
+
* @throws {AppwriteException}
|
|
229
|
+
* @returns {Promise<Models.BackupPolicy>}
|
|
230
|
+
*/
|
|
231
|
+
async getPolicy(policyId: string): Promise<Models.BackupPolicy> {
|
|
232
|
+
if (typeof policyId === 'undefined') {
|
|
233
|
+
throw new AppwriteException('Missing required parameter: "policyId"');
|
|
234
|
+
}
|
|
235
|
+
const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId);
|
|
236
|
+
const payload: Payload = {};
|
|
237
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
238
|
+
|
|
239
|
+
const apiHeaders: { [header: string]: string } = {
|
|
240
|
+
'content-type': 'application/json',
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
return await this.client.call(
|
|
245
|
+
'get',
|
|
246
|
+
uri,
|
|
247
|
+
apiHeaders,
|
|
248
|
+
payload
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Update backup policy
|
|
253
|
+
*
|
|
254
|
+
*
|
|
255
|
+
* @param {string} policyId
|
|
256
|
+
* @param {string} name
|
|
257
|
+
* @param {number} retention
|
|
258
|
+
* @param {string} schedule
|
|
259
|
+
* @param {boolean} enabled
|
|
260
|
+
* @throws {AppwriteException}
|
|
261
|
+
* @returns {Promise<Models.BackupPolicy>}
|
|
262
|
+
*/
|
|
263
|
+
async updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise<Models.BackupPolicy> {
|
|
264
|
+
if (typeof policyId === 'undefined') {
|
|
265
|
+
throw new AppwriteException('Missing required parameter: "policyId"');
|
|
266
|
+
}
|
|
267
|
+
const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId);
|
|
268
|
+
const payload: Payload = {};
|
|
269
|
+
if (typeof name !== 'undefined') {
|
|
270
|
+
payload['name'] = name;
|
|
271
|
+
}
|
|
272
|
+
if (typeof retention !== 'undefined') {
|
|
273
|
+
payload['retention'] = retention;
|
|
274
|
+
}
|
|
275
|
+
if (typeof schedule !== 'undefined') {
|
|
276
|
+
payload['schedule'] = schedule;
|
|
277
|
+
}
|
|
278
|
+
if (typeof enabled !== 'undefined') {
|
|
279
|
+
payload['enabled'] = enabled;
|
|
280
|
+
}
|
|
281
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
282
|
+
|
|
283
|
+
const apiHeaders: { [header: string]: string } = {
|
|
284
|
+
'content-type': 'application/json',
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
return await this.client.call(
|
|
289
|
+
'patch',
|
|
290
|
+
uri,
|
|
291
|
+
apiHeaders,
|
|
292
|
+
payload
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Delete backup policy
|
|
297
|
+
*
|
|
298
|
+
*
|
|
299
|
+
* @param {string} policyId
|
|
300
|
+
* @throws {AppwriteException}
|
|
301
|
+
* @returns {Promise<{}>}
|
|
302
|
+
*/
|
|
303
|
+
async deletePolicy(policyId: string): Promise<{}> {
|
|
304
|
+
if (typeof policyId === 'undefined') {
|
|
305
|
+
throw new AppwriteException('Missing required parameter: "policyId"');
|
|
306
|
+
}
|
|
307
|
+
const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId);
|
|
308
|
+
const payload: Payload = {};
|
|
309
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
310
|
+
|
|
311
|
+
const apiHeaders: { [header: string]: string } = {
|
|
312
|
+
'content-type': 'application/json',
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
return await this.client.call(
|
|
317
|
+
'delete',
|
|
318
|
+
uri,
|
|
319
|
+
apiHeaders,
|
|
320
|
+
payload
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Create restoration
|
|
325
|
+
*
|
|
326
|
+
*
|
|
327
|
+
* @param {string} archiveId
|
|
328
|
+
* @param {string[]} services
|
|
329
|
+
* @param {string} newResourceId
|
|
330
|
+
* @param {string} newResourceName
|
|
331
|
+
* @throws {AppwriteException}
|
|
332
|
+
* @returns {Promise<Models.BackupRestoration>}
|
|
333
|
+
*/
|
|
334
|
+
async createRestoration(archiveId: string, services: string[], newResourceId?: string, newResourceName?: string): Promise<Models.BackupRestoration> {
|
|
335
|
+
if (typeof archiveId === 'undefined') {
|
|
336
|
+
throw new AppwriteException('Missing required parameter: "archiveId"');
|
|
337
|
+
}
|
|
338
|
+
if (typeof services === 'undefined') {
|
|
339
|
+
throw new AppwriteException('Missing required parameter: "services"');
|
|
340
|
+
}
|
|
341
|
+
const apiPath = '/backups/restoration';
|
|
342
|
+
const payload: Payload = {};
|
|
343
|
+
if (typeof archiveId !== 'undefined') {
|
|
344
|
+
payload['archiveId'] = archiveId;
|
|
345
|
+
}
|
|
346
|
+
if (typeof services !== 'undefined') {
|
|
347
|
+
payload['services'] = services;
|
|
348
|
+
}
|
|
349
|
+
if (typeof newResourceId !== 'undefined') {
|
|
350
|
+
payload['newResourceId'] = newResourceId;
|
|
351
|
+
}
|
|
352
|
+
if (typeof newResourceName !== 'undefined') {
|
|
353
|
+
payload['newResourceName'] = newResourceName;
|
|
354
|
+
}
|
|
355
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
356
|
+
|
|
357
|
+
const apiHeaders: { [header: string]: string } = {
|
|
358
|
+
'content-type': 'application/json',
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
return await this.client.call(
|
|
363
|
+
'post',
|
|
364
|
+
uri,
|
|
365
|
+
apiHeaders,
|
|
366
|
+
payload
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* List restorations
|
|
371
|
+
*
|
|
372
|
+
*
|
|
373
|
+
* @param {string[]} queries
|
|
374
|
+
* @throws {AppwriteException}
|
|
375
|
+
* @returns {Promise<Models.BackupRestorationList>}
|
|
376
|
+
*/
|
|
377
|
+
async listRestorations(queries?: string[]): Promise<Models.BackupRestorationList> {
|
|
378
|
+
const apiPath = '/backups/restorations';
|
|
379
|
+
const payload: Payload = {};
|
|
380
|
+
if (typeof queries !== 'undefined') {
|
|
381
|
+
payload['queries'] = queries;
|
|
382
|
+
}
|
|
383
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
384
|
+
|
|
385
|
+
const apiHeaders: { [header: string]: string } = {
|
|
386
|
+
'content-type': 'application/json',
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
return await this.client.call(
|
|
391
|
+
'get',
|
|
392
|
+
uri,
|
|
393
|
+
apiHeaders,
|
|
394
|
+
payload
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Get backup restoration
|
|
399
|
+
*
|
|
400
|
+
*
|
|
401
|
+
* @param {string} restorationId
|
|
402
|
+
* @throws {AppwriteException}
|
|
403
|
+
* @returns {Promise<Models.BackupArchive>}
|
|
404
|
+
*/
|
|
405
|
+
async getRestoration(restorationId: string): Promise<Models.BackupArchive> {
|
|
406
|
+
if (typeof restorationId === 'undefined') {
|
|
407
|
+
throw new AppwriteException('Missing required parameter: "restorationId"');
|
|
408
|
+
}
|
|
409
|
+
const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId);
|
|
410
|
+
const payload: Payload = {};
|
|
411
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
412
|
+
|
|
413
|
+
const apiHeaders: { [header: string]: string } = {
|
|
414
|
+
'content-type': 'application/json',
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
return await this.client.call(
|
|
419
|
+
'get',
|
|
420
|
+
uri,
|
|
421
|
+
apiHeaders,
|
|
422
|
+
payload
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
}
|
package/src/services/console.ts
CHANGED
|
@@ -9,6 +9,154 @@ export class Console {
|
|
|
9
9
|
this.client = client;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Get campaign details
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* @param {string} campaignId
|
|
17
|
+
* @throws {AppwriteException}
|
|
18
|
+
* @returns {Promise<Models.Campaign>}
|
|
19
|
+
*/
|
|
20
|
+
async getCampaign(campaignId: string): Promise<Models.Campaign> {
|
|
21
|
+
if (typeof campaignId === 'undefined') {
|
|
22
|
+
throw new AppwriteException('Missing required parameter: "campaignId"');
|
|
23
|
+
}
|
|
24
|
+
const apiPath = '/console/campaigns/{campaignId}'.replace('{campaignId}', campaignId);
|
|
25
|
+
const payload: Payload = {};
|
|
26
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
27
|
+
|
|
28
|
+
const apiHeaders: { [header: string]: string } = {
|
|
29
|
+
'content-type': 'application/json',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return await this.client.call(
|
|
34
|
+
'get',
|
|
35
|
+
uri,
|
|
36
|
+
apiHeaders,
|
|
37
|
+
payload
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get coupon details
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* @param {string} couponId
|
|
45
|
+
* @throws {AppwriteException}
|
|
46
|
+
* @returns {Promise<Models.Coupon>}
|
|
47
|
+
*/
|
|
48
|
+
async getCopon(couponId: string): Promise<Models.Coupon> {
|
|
49
|
+
if (typeof couponId === 'undefined') {
|
|
50
|
+
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
51
|
+
}
|
|
52
|
+
const apiPath = '/console/coupons/{couponId}'.replace('{couponId}', couponId);
|
|
53
|
+
const payload: Payload = {};
|
|
54
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
55
|
+
|
|
56
|
+
const apiHeaders: { [header: string]: string } = {
|
|
57
|
+
'content-type': 'application/json',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
return await this.client.call(
|
|
62
|
+
'get',
|
|
63
|
+
uri,
|
|
64
|
+
apiHeaders,
|
|
65
|
+
payload
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get plans
|
|
70
|
+
*
|
|
71
|
+
*
|
|
72
|
+
* @throws {AppwriteException}
|
|
73
|
+
* @returns {Promise<Models.BillingPlanList>}
|
|
74
|
+
*/
|
|
75
|
+
async plans(): Promise<Models.BillingPlanList> {
|
|
76
|
+
const apiPath = '/console/plans';
|
|
77
|
+
const payload: Payload = {};
|
|
78
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
79
|
+
|
|
80
|
+
const apiHeaders: { [header: string]: string } = {
|
|
81
|
+
'content-type': 'application/json',
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
return await this.client.call(
|
|
86
|
+
'get',
|
|
87
|
+
uri,
|
|
88
|
+
apiHeaders,
|
|
89
|
+
payload
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get Regions
|
|
94
|
+
*
|
|
95
|
+
*
|
|
96
|
+
* @throws {AppwriteException}
|
|
97
|
+
* @returns {Promise<Models.ConsoleRegionList>}
|
|
98
|
+
*/
|
|
99
|
+
async regions(): Promise<Models.ConsoleRegionList> {
|
|
100
|
+
const apiPath = '/console/regions';
|
|
101
|
+
const payload: Payload = {};
|
|
102
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
103
|
+
|
|
104
|
+
const apiHeaders: { [header: string]: string } = {
|
|
105
|
+
'content-type': 'application/json',
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
return await this.client.call(
|
|
110
|
+
'get',
|
|
111
|
+
uri,
|
|
112
|
+
apiHeaders,
|
|
113
|
+
payload
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Create source
|
|
118
|
+
*
|
|
119
|
+
*
|
|
120
|
+
* @param {string} ref
|
|
121
|
+
* @param {string} referrer
|
|
122
|
+
* @param {string} utmSource
|
|
123
|
+
* @param {string} utmCampaign
|
|
124
|
+
* @param {string} utmMedium
|
|
125
|
+
* @throws {AppwriteException}
|
|
126
|
+
* @returns {Promise<{}>}
|
|
127
|
+
*/
|
|
128
|
+
async createSource(ref?: string, referrer?: string, utmSource?: string, utmCampaign?: string, utmMedium?: string): Promise<{}> {
|
|
129
|
+
const apiPath = '/console/sources';
|
|
130
|
+
const payload: Payload = {};
|
|
131
|
+
if (typeof ref !== 'undefined') {
|
|
132
|
+
payload['ref'] = ref;
|
|
133
|
+
}
|
|
134
|
+
if (typeof referrer !== 'undefined') {
|
|
135
|
+
payload['referrer'] = referrer;
|
|
136
|
+
}
|
|
137
|
+
if (typeof utmSource !== 'undefined') {
|
|
138
|
+
payload['utmSource'] = utmSource;
|
|
139
|
+
}
|
|
140
|
+
if (typeof utmCampaign !== 'undefined') {
|
|
141
|
+
payload['utmCampaign'] = utmCampaign;
|
|
142
|
+
}
|
|
143
|
+
if (typeof utmMedium !== 'undefined') {
|
|
144
|
+
payload['utmMedium'] = utmMedium;
|
|
145
|
+
}
|
|
146
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
147
|
+
|
|
148
|
+
const apiHeaders: { [header: string]: string } = {
|
|
149
|
+
'content-type': 'application/json',
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
return await this.client.call(
|
|
154
|
+
'post',
|
|
155
|
+
uri,
|
|
156
|
+
apiHeaders,
|
|
157
|
+
payload
|
|
158
|
+
);
|
|
159
|
+
}
|
|
12
160
|
/**
|
|
13
161
|
* Get variables
|
|
14
162
|
*
|
package/src/services/health.ts
CHANGED
|
@@ -182,6 +182,34 @@ export class Health {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
|
|
185
|
+
return await this.client.call(
|
|
186
|
+
'get',
|
|
187
|
+
uri,
|
|
188
|
+
apiHeaders,
|
|
189
|
+
payload
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get billing aggregation queue
|
|
194
|
+
*
|
|
195
|
+
*
|
|
196
|
+
* @param {number} threshold
|
|
197
|
+
* @throws {AppwriteException}
|
|
198
|
+
* @returns {Promise<Models.HealthQueue>}
|
|
199
|
+
*/
|
|
200
|
+
async getQueueBillingAggregation(threshold?: number): Promise<Models.HealthQueue> {
|
|
201
|
+
const apiPath = '/health/queue/billing-aggregation';
|
|
202
|
+
const payload: Payload = {};
|
|
203
|
+
if (typeof threshold !== 'undefined') {
|
|
204
|
+
payload['threshold'] = threshold;
|
|
205
|
+
}
|
|
206
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
207
|
+
|
|
208
|
+
const apiHeaders: { [header: string]: string } = {
|
|
209
|
+
'content-type': 'application/json',
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
185
213
|
return await this.client.call(
|
|
186
214
|
'get',
|
|
187
215
|
uri,
|
|
@@ -211,6 +239,34 @@ export class Health {
|
|
|
211
239
|
}
|
|
212
240
|
|
|
213
241
|
|
|
242
|
+
return await this.client.call(
|
|
243
|
+
'get',
|
|
244
|
+
uri,
|
|
245
|
+
apiHeaders,
|
|
246
|
+
payload
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Get billing aggregation queue
|
|
251
|
+
*
|
|
252
|
+
*
|
|
253
|
+
* @param {number} threshold
|
|
254
|
+
* @throws {AppwriteException}
|
|
255
|
+
* @returns {Promise<Models.HealthQueue>}
|
|
256
|
+
*/
|
|
257
|
+
async getQueuePriorityBuilds(threshold?: number): Promise<Models.HealthQueue> {
|
|
258
|
+
const apiPath = '/health/queue/builds-priority';
|
|
259
|
+
const payload: Payload = {};
|
|
260
|
+
if (typeof threshold !== 'undefined') {
|
|
261
|
+
payload['threshold'] = threshold;
|
|
262
|
+
}
|
|
263
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
264
|
+
|
|
265
|
+
const apiHeaders: { [header: string]: string } = {
|
|
266
|
+
'content-type': 'application/json',
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
214
270
|
return await this.client.call(
|
|
215
271
|
'get',
|
|
216
272
|
uri,
|