@appwrite.io/console 1.0.1 → 1.1.0-rc.2
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/README.md +3 -3
- package/dist/cjs/sdk.js +3565 -2411
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +3564 -2412
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +3565 -2411
- package/docs/examples/{functions/list-specifications.md → account/create-payment-method.md} +3 -3
- package/docs/examples/account/delete-mfa-authenticator.md +2 -1
- 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/{functions/get-template.md → account/list-billing-addresses.md} +4 -4
- 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-copon.md +13 -0
- package/docs/examples/console/plans.md +11 -0
- package/docs/examples/console/regions.md +11 -0
- package/docs/examples/functions/create-build.md +1 -1
- package/docs/examples/functions/create-execution.md +1 -2
- package/docs/examples/functions/create.md +1 -3
- package/docs/examples/functions/{get-deployment-download.md → download-deployment.md} +1 -1
- package/docs/examples/functions/update.md +1 -3
- 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-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 +2 -2
- package/src/enums/billing-plan.ts +5 -0
- package/src/enums/email-template-type.ts +0 -2
- package/src/enums/platform-type.ts +0 -2
- package/src/enums/runtime.ts +0 -1
- package/src/index.ts +4 -1
- package/src/models.ts +956 -282
- package/src/services/account.ts +345 -2
- package/src/services/backups.ts +425 -0
- package/src/services/console.ts +120 -0
- package/src/services/functions.ts +14 -195
- package/src/services/organizations.ts +896 -0
- package/src/services/projects.ts +1 -110
- package/src/services/users.ts +0 -37
- package/src/services/vcs.ts +0 -36
- package/types/enums/billing-plan.d.ts +5 -0
- package/types/enums/email-template-type.d.ts +1 -3
- package/types/enums/platform-type.d.ts +1 -3
- package/types/enums/runtime.d.ts +1 -2
- package/types/index.d.ts +4 -1
- package/types/models.d.ts +956 -282
- package/types/services/account.d.ts +105 -1
- package/types/services/backups.d.ts +128 -0
- package/types/services/console.d.ts +38 -0
- package/types/services/functions.d.ts +8 -67
- package/types/services/organizations.d.ts +273 -0
- package/types/services/projects.d.ts +1 -32
- package/types/services/users.d.ts +0 -12
- package/types/services/vcs.d.ts +0 -11
- package/docs/examples/functions/delete-execution.md +0 -14
- package/docs/examples/functions/list-templates.md +0 -16
- package/docs/examples/functions/update-deployment-build.md +0 -14
- package/docs/examples/projects/create-j-w-t.md +0 -15
- package/docs/examples/projects/update-mock-numbers.md +0 -14
- package/docs/examples/projects/update-session-alerts.md +0 -14
- package/docs/examples/users/create-j-w-t.md +0 -15
- package/docs/examples/vcs/get-repository-contents.md +0 -15
|
@@ -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
|
+
* Create archive
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* @param {string[]} services
|
|
17
|
+
* @param {string} resourceId
|
|
18
|
+
* @throws {AppwriteException}
|
|
19
|
+
* @returns {Promise<Models.BackupArchive>}
|
|
20
|
+
*/
|
|
21
|
+
async createArchive(services: string[], resourceId?: string): Promise<Models.BackupArchive> {
|
|
22
|
+
if (typeof services === 'undefined') {
|
|
23
|
+
throw new AppwriteException('Missing required parameter: "services"');
|
|
24
|
+
}
|
|
25
|
+
const apiPath = '/backups/archive';
|
|
26
|
+
const payload: Payload = {};
|
|
27
|
+
if (typeof services !== 'undefined') {
|
|
28
|
+
payload['services'] = services;
|
|
29
|
+
}
|
|
30
|
+
if (typeof resourceId !== 'undefined') {
|
|
31
|
+
payload['resourceId'] = resourceId;
|
|
32
|
+
}
|
|
33
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
34
|
+
|
|
35
|
+
const apiHeaders: { [header: string]: string } = {
|
|
36
|
+
'content-type': 'application/json',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
return await this.client.call(
|
|
41
|
+
'post',
|
|
42
|
+
uri,
|
|
43
|
+
apiHeaders,
|
|
44
|
+
payload
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Delete archive
|
|
49
|
+
*
|
|
50
|
+
*
|
|
51
|
+
* @param {string} archiveId
|
|
52
|
+
* @throws {AppwriteException}
|
|
53
|
+
* @returns {Promise<{}>}
|
|
54
|
+
*/
|
|
55
|
+
async deleteArchive(archiveId: string): Promise<{}> {
|
|
56
|
+
if (typeof archiveId === 'undefined') {
|
|
57
|
+
throw new AppwriteException('Missing required parameter: "archiveId"');
|
|
58
|
+
}
|
|
59
|
+
const apiPath = '/backups/archive/{archiveId}'.replace('{archiveId}', archiveId);
|
|
60
|
+
const payload: Payload = {};
|
|
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
|
+
'delete',
|
|
70
|
+
uri,
|
|
71
|
+
apiHeaders,
|
|
72
|
+
payload
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* List archives
|
|
77
|
+
*
|
|
78
|
+
*
|
|
79
|
+
* @param {string[]} queries
|
|
80
|
+
* @throws {AppwriteException}
|
|
81
|
+
* @returns {Promise<Models.BackupArchiveList>}
|
|
82
|
+
*/
|
|
83
|
+
async listArchives(queries?: string[]): Promise<Models.BackupArchiveList> {
|
|
84
|
+
const apiPath = '/backups/archives';
|
|
85
|
+
const payload: Payload = {};
|
|
86
|
+
if (typeof queries !== 'undefined') {
|
|
87
|
+
payload['queries'] = queries;
|
|
88
|
+
}
|
|
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
|
+
* Get backup archive
|
|
105
|
+
*
|
|
106
|
+
*
|
|
107
|
+
* @param {string} archiveId
|
|
108
|
+
* @throws {AppwriteException}
|
|
109
|
+
* @returns {Promise<Models.BackupArchive>}
|
|
110
|
+
*/
|
|
111
|
+
async getArchive(archiveId: string): Promise<Models.BackupArchive> {
|
|
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
|
+
'get',
|
|
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,126 @@ export class Console {
|
|
|
9
9
|
this.client = client;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Get coupon details
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* @param {string} couponId
|
|
17
|
+
* @throws {AppwriteException}
|
|
18
|
+
* @returns {Promise<Models.Coupon>}
|
|
19
|
+
*/
|
|
20
|
+
async getCopon(couponId: string): Promise<Models.Coupon> {
|
|
21
|
+
if (typeof couponId === 'undefined') {
|
|
22
|
+
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
23
|
+
}
|
|
24
|
+
const apiPath = '/console/coupons/{couponId}'.replace('{couponId}', couponId);
|
|
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 plans
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* @throws {AppwriteException}
|
|
45
|
+
* @returns {Promise<Models.BillingPlanList>}
|
|
46
|
+
*/
|
|
47
|
+
async plans(): Promise<Models.BillingPlanList> {
|
|
48
|
+
const apiPath = '/console/plans';
|
|
49
|
+
const payload: Payload = {};
|
|
50
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
51
|
+
|
|
52
|
+
const apiHeaders: { [header: string]: string } = {
|
|
53
|
+
'content-type': 'application/json',
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
return await this.client.call(
|
|
58
|
+
'get',
|
|
59
|
+
uri,
|
|
60
|
+
apiHeaders,
|
|
61
|
+
payload
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get Regions
|
|
66
|
+
*
|
|
67
|
+
*
|
|
68
|
+
* @throws {AppwriteException}
|
|
69
|
+
* @returns {Promise<Models.ConsoleRegionList>}
|
|
70
|
+
*/
|
|
71
|
+
async regions(): Promise<Models.ConsoleRegionList> {
|
|
72
|
+
const apiPath = '/console/regions';
|
|
73
|
+
const payload: Payload = {};
|
|
74
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
75
|
+
|
|
76
|
+
const apiHeaders: { [header: string]: string } = {
|
|
77
|
+
'content-type': 'application/json',
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
return await this.client.call(
|
|
82
|
+
'get',
|
|
83
|
+
uri,
|
|
84
|
+
apiHeaders,
|
|
85
|
+
payload
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Create source
|
|
90
|
+
*
|
|
91
|
+
*
|
|
92
|
+
* @param {string} ref
|
|
93
|
+
* @param {string} referrer
|
|
94
|
+
* @param {string} utmSource
|
|
95
|
+
* @param {string} utmCampaign
|
|
96
|
+
* @param {string} utmMedium
|
|
97
|
+
* @throws {AppwriteException}
|
|
98
|
+
* @returns {Promise<{}>}
|
|
99
|
+
*/
|
|
100
|
+
async createSource(ref?: string, referrer?: string, utmSource?: string, utmCampaign?: string, utmMedium?: string): Promise<{}> {
|
|
101
|
+
const apiPath = '/console/sources';
|
|
102
|
+
const payload: Payload = {};
|
|
103
|
+
if (typeof ref !== 'undefined') {
|
|
104
|
+
payload['ref'] = ref;
|
|
105
|
+
}
|
|
106
|
+
if (typeof referrer !== 'undefined') {
|
|
107
|
+
payload['referrer'] = referrer;
|
|
108
|
+
}
|
|
109
|
+
if (typeof utmSource !== 'undefined') {
|
|
110
|
+
payload['utmSource'] = utmSource;
|
|
111
|
+
}
|
|
112
|
+
if (typeof utmCampaign !== 'undefined') {
|
|
113
|
+
payload['utmCampaign'] = utmCampaign;
|
|
114
|
+
}
|
|
115
|
+
if (typeof utmMedium !== 'undefined') {
|
|
116
|
+
payload['utmMedium'] = utmMedium;
|
|
117
|
+
}
|
|
118
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
119
|
+
|
|
120
|
+
const apiHeaders: { [header: string]: string } = {
|
|
121
|
+
'content-type': 'application/json',
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
return await this.client.call(
|
|
126
|
+
'post',
|
|
127
|
+
uri,
|
|
128
|
+
apiHeaders,
|
|
129
|
+
payload
|
|
130
|
+
);
|
|
131
|
+
}
|
|
12
132
|
/**
|
|
13
133
|
* Get variables
|
|
14
134
|
*
|