@appwrite.io/console 0.3.0 → 0.4.1
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/publish.yml +2 -2
- package/README.md +3 -3
- package/dist/cjs/sdk.js +1354 -1197
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1354 -1197
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +1354 -1197
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/update.md +1 -1
- package/docs/examples/{projects/get-usage.md → health/get-queue-builds.md} +3 -3
- package/docs/examples/{account/create-with-invite-code.md → health/get-queue-databases.md} +3 -3
- package/docs/examples/health/get-queue-deletes.md +18 -0
- package/docs/examples/health/get-queue-mails.md +18 -0
- package/docs/examples/health/get-queue-messaging.md +18 -0
- package/docs/examples/health/get-queue-migrations.md +18 -0
- package/docs/examples/project/get-usage.md +1 -1
- package/docs/examples/teams/create-membership.md +1 -1
- package/package.json +3 -2
- package/src/client.ts +1 -1
- package/src/models.ts +147 -279
- package/src/query.ts +1 -1
- package/src/role.ts +72 -6
- package/src/services/account.ts +154 -204
- package/src/services/assistant.ts +3 -3
- package/src/services/avatars.ts +32 -31
- package/src/services/console.ts +4 -4
- package/src/services/databases.ts +195 -195
- package/src/services/functions.ts +117 -126
- package/src/services/graphql.ts +8 -8
- package/src/services/health.ts +219 -50
- package/src/services/locale.ts +31 -31
- package/src/services/migrations.ts +48 -48
- package/src/services/project.ts +40 -22
- package/src/services/projects.ts +143 -170
- package/src/services/proxy.ts +15 -15
- package/src/services/storage.ts +74 -84
- package/src/services/teams.ts +62 -66
- package/src/services/users.ts +132 -135
- package/src/services/vcs.ts +27 -27
- package/types/models.d.ts +147 -279
- package/types/role.d.ts +62 -0
- package/types/services/account.d.ts +61 -70
- package/types/services/avatars.d.ts +11 -10
- package/types/services/console.d.ts +1 -1
- package/types/services/databases.d.ts +51 -51
- package/types/services/functions.d.ts +32 -27
- package/types/services/graphql.d.ts +2 -2
- package/types/services/health.d.ts +85 -14
- package/types/services/locale.d.ts +7 -7
- package/types/services/project.d.ts +4 -2
- package/types/services/projects.d.ts +26 -36
- package/types/services/storage.d.ts +13 -13
- package/types/services/teams.d.ts +20 -20
- package/types/services/users.d.ts +45 -44
package/src/services/proxy.ts
CHANGED
|
@@ -22,8 +22,8 @@ export class Proxy extends Service {
|
|
|
22
22
|
* @returns {Promise}
|
|
23
23
|
*/
|
|
24
24
|
async listRules(queries?: string[], search?: string): Promise<Models.ProxyRuleList> {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const apiPath = '/proxy/rules';
|
|
26
|
+
const payload: Payload = {};
|
|
27
27
|
|
|
28
28
|
if (typeof queries !== 'undefined') {
|
|
29
29
|
payload['queries'] = queries;
|
|
@@ -33,7 +33,7 @@ export class Proxy extends Service {
|
|
|
33
33
|
payload['search'] = search;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const uri = new URL(this.client.config.endpoint +
|
|
36
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
37
37
|
return await this.client.call('get', uri, {
|
|
38
38
|
'content-type': 'application/json',
|
|
39
39
|
}, payload);
|
|
@@ -59,8 +59,8 @@ export class Proxy extends Service {
|
|
|
59
59
|
throw new AppwriteException('Missing required parameter: "resourceType"');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const apiPath = '/proxy/rules';
|
|
63
|
+
const payload: Payload = {};
|
|
64
64
|
|
|
65
65
|
if (typeof domain !== 'undefined') {
|
|
66
66
|
payload['domain'] = domain;
|
|
@@ -74,7 +74,7 @@ export class Proxy extends Service {
|
|
|
74
74
|
payload['resourceId'] = resourceId;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const uri = new URL(this.client.config.endpoint +
|
|
77
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
78
78
|
return await this.client.call('post', uri, {
|
|
79
79
|
'content-type': 'application/json',
|
|
80
80
|
}, payload);
|
|
@@ -94,10 +94,10 @@ export class Proxy extends Service {
|
|
|
94
94
|
throw new AppwriteException('Missing required parameter: "ruleId"');
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId);
|
|
98
|
+
const payload: Payload = {};
|
|
99
99
|
|
|
100
|
-
const uri = new URL(this.client.config.endpoint +
|
|
100
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
101
101
|
return await this.client.call('get', uri, {
|
|
102
102
|
'content-type': 'application/json',
|
|
103
103
|
}, payload);
|
|
@@ -117,10 +117,10 @@ export class Proxy extends Service {
|
|
|
117
117
|
throw new AppwriteException('Missing required parameter: "ruleId"');
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId);
|
|
121
|
+
const payload: Payload = {};
|
|
122
122
|
|
|
123
|
-
const uri = new URL(this.client.config.endpoint +
|
|
123
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
124
124
|
return await this.client.call('delete', uri, {
|
|
125
125
|
'content-type': 'application/json',
|
|
126
126
|
}, payload);
|
|
@@ -139,10 +139,10 @@ export class Proxy extends Service {
|
|
|
139
139
|
throw new AppwriteException('Missing required parameter: "ruleId"');
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
const apiPath = '/proxy/rules/{ruleId}/verification'.replace('{ruleId}', ruleId);
|
|
143
|
+
const payload: Payload = {};
|
|
144
144
|
|
|
145
|
-
const uri = new URL(this.client.config.endpoint +
|
|
145
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
146
146
|
return await this.client.call('patch', uri, {
|
|
147
147
|
'content-type': 'application/json',
|
|
148
148
|
}, payload);
|
package/src/services/storage.ts
CHANGED
|
@@ -22,8 +22,8 @@ export class Storage extends Service {
|
|
|
22
22
|
* @returns {Promise}
|
|
23
23
|
*/
|
|
24
24
|
async listBuckets(queries?: string[], search?: string): Promise<Models.BucketList> {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const apiPath = '/storage/buckets';
|
|
26
|
+
const payload: Payload = {};
|
|
27
27
|
|
|
28
28
|
if (typeof queries !== 'undefined') {
|
|
29
29
|
payload['queries'] = queries;
|
|
@@ -33,7 +33,7 @@ export class Storage extends Service {
|
|
|
33
33
|
payload['search'] = search;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const uri = new URL(this.client.config.endpoint +
|
|
36
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
37
37
|
return await this.client.call('get', uri, {
|
|
38
38
|
'content-type': 'application/json',
|
|
39
39
|
}, payload);
|
|
@@ -66,8 +66,8 @@ export class Storage extends Service {
|
|
|
66
66
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const apiPath = '/storage/buckets';
|
|
70
|
+
const payload: Payload = {};
|
|
71
71
|
|
|
72
72
|
if (typeof bucketId !== 'undefined') {
|
|
73
73
|
payload['bucketId'] = bucketId;
|
|
@@ -109,14 +109,14 @@ export class Storage extends Service {
|
|
|
109
109
|
payload['antivirus'] = antivirus;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const uri = new URL(this.client.config.endpoint +
|
|
112
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
113
113
|
return await this.client.call('post', uri, {
|
|
114
114
|
'content-type': 'application/json',
|
|
115
115
|
}, payload);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
|
-
* Get
|
|
119
|
+
* Get bucket
|
|
120
120
|
*
|
|
121
121
|
* Get a storage bucket by its unique ID. This endpoint response returns a
|
|
122
122
|
* JSON object with the storage bucket metadata.
|
|
@@ -130,17 +130,17 @@ export class Storage extends Service {
|
|
|
130
130
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
134
|
+
const payload: Payload = {};
|
|
135
135
|
|
|
136
|
-
const uri = new URL(this.client.config.endpoint +
|
|
136
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
137
137
|
return await this.client.call('get', uri, {
|
|
138
138
|
'content-type': 'application/json',
|
|
139
139
|
}, payload);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
* Update
|
|
143
|
+
* Update bucket
|
|
144
144
|
*
|
|
145
145
|
* Update a storage bucket by its unique ID.
|
|
146
146
|
*
|
|
@@ -166,8 +166,8 @@ export class Storage extends Service {
|
|
|
166
166
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
170
|
+
const payload: Payload = {};
|
|
171
171
|
|
|
172
172
|
if (typeof name !== 'undefined') {
|
|
173
173
|
payload['name'] = name;
|
|
@@ -205,14 +205,14 @@ export class Storage extends Service {
|
|
|
205
205
|
payload['antivirus'] = antivirus;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
const uri = new URL(this.client.config.endpoint +
|
|
208
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
209
209
|
return await this.client.call('put', uri, {
|
|
210
210
|
'content-type': 'application/json',
|
|
211
211
|
}, payload);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
|
-
* Delete
|
|
215
|
+
* Delete bucket
|
|
216
216
|
*
|
|
217
217
|
* Delete a storage bucket by its unique ID.
|
|
218
218
|
*
|
|
@@ -225,17 +225,17 @@ export class Storage extends Service {
|
|
|
225
225
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
229
|
+
const payload: Payload = {};
|
|
230
230
|
|
|
231
|
-
const uri = new URL(this.client.config.endpoint +
|
|
231
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
232
232
|
return await this.client.call('delete', uri, {
|
|
233
233
|
'content-type': 'application/json',
|
|
234
234
|
}, payload);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
|
-
* List
|
|
238
|
+
* List files
|
|
239
239
|
*
|
|
240
240
|
* Get a list of all the user files. You can use the query params to filter
|
|
241
241
|
* your results.
|
|
@@ -251,8 +251,8 @@ export class Storage extends Service {
|
|
|
251
251
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
|
|
255
|
+
const payload: Payload = {};
|
|
256
256
|
|
|
257
257
|
if (typeof queries !== 'undefined') {
|
|
258
258
|
payload['queries'] = queries;
|
|
@@ -262,19 +262,19 @@ export class Storage extends Service {
|
|
|
262
262
|
payload['search'] = search;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
const uri = new URL(this.client.config.endpoint +
|
|
265
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
266
266
|
return await this.client.call('get', uri, {
|
|
267
267
|
'content-type': 'application/json',
|
|
268
268
|
}, payload);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* Create
|
|
272
|
+
* Create file
|
|
273
273
|
*
|
|
274
274
|
* Create a new file. Before using this route, you should create a new bucket
|
|
275
275
|
* resource using either a [server
|
|
276
|
-
* integration](/docs/server/storage#storageCreateBucket)
|
|
277
|
-
* your Appwrite console.
|
|
276
|
+
* integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
|
|
277
|
+
* API or directly from your Appwrite console.
|
|
278
278
|
*
|
|
279
279
|
* Larger files should be uploaded using multiple requests with the
|
|
280
280
|
* [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
|
|
@@ -310,8 +310,8 @@ export class Storage extends Service {
|
|
|
310
310
|
throw new AppwriteException('Missing required parameter: "file"');
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
|
|
314
|
+
const payload: Payload = {};
|
|
315
315
|
|
|
316
316
|
if (typeof fileId !== 'undefined') {
|
|
317
317
|
payload['fileId'] = fileId;
|
|
@@ -325,7 +325,7 @@ export class Storage extends Service {
|
|
|
325
325
|
payload['permissions'] = permissions;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
const uri = new URL(this.client.config.endpoint +
|
|
328
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
329
329
|
|
|
330
330
|
if(!(file instanceof File)) {
|
|
331
331
|
throw new AppwriteException('Parameter "file" has to be a File.');
|
|
@@ -335,62 +335,52 @@ export class Storage extends Service {
|
|
|
335
335
|
|
|
336
336
|
if (size <= Service.CHUNK_SIZE) {
|
|
337
337
|
return await this.client.call('post', uri, {
|
|
338
|
-
|
|
339
338
|
'content-type': 'multipart/form-data',
|
|
340
339
|
}, payload);
|
|
341
340
|
}
|
|
342
|
-
let id = undefined;
|
|
343
|
-
let response = undefined;
|
|
344
341
|
|
|
345
|
-
const
|
|
342
|
+
const apiHeaders: { [header: string]: string } = {
|
|
346
343
|
'content-type': 'multipart/form-data',
|
|
347
344
|
}
|
|
348
345
|
|
|
349
|
-
let
|
|
350
|
-
|
|
346
|
+
let offset = 0;
|
|
347
|
+
let response = undefined;
|
|
351
348
|
if(fileId != 'unique()') {
|
|
352
349
|
try {
|
|
353
|
-
response = await this.client.call('GET', new URL(this.client.config.endpoint +
|
|
354
|
-
|
|
350
|
+
response = await this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
|
|
351
|
+
offset = response.chunksUploaded * Service.CHUNK_SIZE;
|
|
355
352
|
} catch(e) {
|
|
356
353
|
}
|
|
357
354
|
}
|
|
358
355
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const end = Math.min((((counter * Service.CHUNK_SIZE) + Service.CHUNK_SIZE) - 1), size);
|
|
362
|
-
|
|
363
|
-
headers['content-range'] = 'bytes ' + start + '-' + end + '/' + size
|
|
356
|
+
while (offset < size) {
|
|
357
|
+
let end = Math.min(offset + Service.CHUNK_SIZE - 1, size - 1);
|
|
364
358
|
|
|
365
|
-
|
|
366
|
-
|
|
359
|
+
apiHeaders['content-range'] = 'bytes ' + offset + '-' + end + '/' + size;
|
|
360
|
+
if (response && response.$id) {
|
|
361
|
+
apiHeaders['x-appwrite-id'] = response.$id;
|
|
367
362
|
}
|
|
368
363
|
|
|
369
|
-
const
|
|
370
|
-
payload['file'] = new File([
|
|
371
|
-
|
|
372
|
-
response = await this.client.call('post', uri, headers, payload);
|
|
373
|
-
|
|
374
|
-
if (!id) {
|
|
375
|
-
id = response['$id'];
|
|
376
|
-
}
|
|
364
|
+
const chunk = file.slice(offset, end + 1);
|
|
365
|
+
payload['file'] = new File([chunk], file.name);
|
|
366
|
+
response = await this.client.call('post', uri, apiHeaders, payload);
|
|
377
367
|
|
|
378
368
|
if (onProgress) {
|
|
379
369
|
onProgress({
|
|
380
370
|
$id: response.$id,
|
|
381
|
-
progress:
|
|
382
|
-
sizeUploaded:
|
|
371
|
+
progress: (offset / size) * 100,
|
|
372
|
+
sizeUploaded: offset,
|
|
383
373
|
chunksTotal: response.chunksTotal,
|
|
384
374
|
chunksUploaded: response.chunksUploaded
|
|
385
375
|
});
|
|
386
376
|
}
|
|
377
|
+
offset += Service.CHUNK_SIZE;
|
|
387
378
|
}
|
|
388
|
-
|
|
389
379
|
return response;
|
|
390
380
|
}
|
|
391
381
|
|
|
392
382
|
/**
|
|
393
|
-
* Get
|
|
383
|
+
* Get file
|
|
394
384
|
*
|
|
395
385
|
* Get a file by its unique ID. This endpoint response returns a JSON object
|
|
396
386
|
* with the file metadata.
|
|
@@ -409,17 +399,17 @@ export class Storage extends Service {
|
|
|
409
399
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
410
400
|
}
|
|
411
401
|
|
|
412
|
-
|
|
413
|
-
|
|
402
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
403
|
+
const payload: Payload = {};
|
|
414
404
|
|
|
415
|
-
const uri = new URL(this.client.config.endpoint +
|
|
405
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
416
406
|
return await this.client.call('get', uri, {
|
|
417
407
|
'content-type': 'application/json',
|
|
418
408
|
}, payload);
|
|
419
409
|
}
|
|
420
410
|
|
|
421
411
|
/**
|
|
422
|
-
* Update
|
|
412
|
+
* Update file
|
|
423
413
|
*
|
|
424
414
|
* Update a file by its unique ID. Only users with write permissions have
|
|
425
415
|
* access to update this resource.
|
|
@@ -440,8 +430,8 @@ export class Storage extends Service {
|
|
|
440
430
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
441
431
|
}
|
|
442
432
|
|
|
443
|
-
|
|
444
|
-
|
|
433
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
434
|
+
const payload: Payload = {};
|
|
445
435
|
|
|
446
436
|
if (typeof name !== 'undefined') {
|
|
447
437
|
payload['name'] = name;
|
|
@@ -451,7 +441,7 @@ export class Storage extends Service {
|
|
|
451
441
|
payload['permissions'] = permissions;
|
|
452
442
|
}
|
|
453
443
|
|
|
454
|
-
const uri = new URL(this.client.config.endpoint +
|
|
444
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
455
445
|
return await this.client.call('put', uri, {
|
|
456
446
|
'content-type': 'application/json',
|
|
457
447
|
}, payload);
|
|
@@ -477,17 +467,17 @@ export class Storage extends Service {
|
|
|
477
467
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
478
468
|
}
|
|
479
469
|
|
|
480
|
-
|
|
481
|
-
|
|
470
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
471
|
+
const payload: Payload = {};
|
|
482
472
|
|
|
483
|
-
const uri = new URL(this.client.config.endpoint +
|
|
473
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
484
474
|
return await this.client.call('delete', uri, {
|
|
485
475
|
'content-type': 'application/json',
|
|
486
476
|
}, payload);
|
|
487
477
|
}
|
|
488
478
|
|
|
489
479
|
/**
|
|
490
|
-
* Get
|
|
480
|
+
* Get file for download
|
|
491
481
|
*
|
|
492
482
|
* Get a file content by its unique ID. The endpoint response return with a
|
|
493
483
|
* 'Content-Disposition: attachment' header that tells the browser to start
|
|
@@ -507,10 +497,10 @@ export class Storage extends Service {
|
|
|
507
497
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
508
498
|
}
|
|
509
499
|
|
|
510
|
-
|
|
511
|
-
|
|
500
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
501
|
+
const payload: Payload = {};
|
|
512
502
|
|
|
513
|
-
const uri = new URL(this.client.config.endpoint +
|
|
503
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
514
504
|
payload['project'] = this.client.config.project;
|
|
515
505
|
|
|
516
506
|
|
|
@@ -521,7 +511,7 @@ export class Storage extends Service {
|
|
|
521
511
|
}
|
|
522
512
|
|
|
523
513
|
/**
|
|
524
|
-
* Get
|
|
514
|
+
* Get file preview
|
|
525
515
|
*
|
|
526
516
|
* Get a file preview image. Currently, this method supports preview for image
|
|
527
517
|
* files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
|
|
@@ -554,8 +544,8 @@ export class Storage extends Service {
|
|
|
554
544
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
555
545
|
}
|
|
556
546
|
|
|
557
|
-
|
|
558
|
-
|
|
547
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
548
|
+
const payload: Payload = {};
|
|
559
549
|
|
|
560
550
|
if (typeof width !== 'undefined') {
|
|
561
551
|
payload['width'] = width;
|
|
@@ -601,7 +591,7 @@ export class Storage extends Service {
|
|
|
601
591
|
payload['output'] = output;
|
|
602
592
|
}
|
|
603
593
|
|
|
604
|
-
const uri = new URL(this.client.config.endpoint +
|
|
594
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
605
595
|
payload['project'] = this.client.config.project;
|
|
606
596
|
|
|
607
597
|
|
|
@@ -612,7 +602,7 @@ export class Storage extends Service {
|
|
|
612
602
|
}
|
|
613
603
|
|
|
614
604
|
/**
|
|
615
|
-
* Get
|
|
605
|
+
* Get file for view
|
|
616
606
|
*
|
|
617
607
|
* Get a file content by its unique ID. This endpoint is similar to the
|
|
618
608
|
* download method but returns with no 'Content-Disposition: attachment'
|
|
@@ -632,10 +622,10 @@ export class Storage extends Service {
|
|
|
632
622
|
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
633
623
|
}
|
|
634
624
|
|
|
635
|
-
|
|
636
|
-
|
|
625
|
+
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
626
|
+
const payload: Payload = {};
|
|
637
627
|
|
|
638
|
-
const uri = new URL(this.client.config.endpoint +
|
|
628
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
639
629
|
payload['project'] = this.client.config.project;
|
|
640
630
|
|
|
641
631
|
|
|
@@ -654,21 +644,21 @@ export class Storage extends Service {
|
|
|
654
644
|
* @returns {Promise}
|
|
655
645
|
*/
|
|
656
646
|
async getUsage(range?: string): Promise<Models.UsageStorage> {
|
|
657
|
-
|
|
658
|
-
|
|
647
|
+
const apiPath = '/storage/usage';
|
|
648
|
+
const payload: Payload = {};
|
|
659
649
|
|
|
660
650
|
if (typeof range !== 'undefined') {
|
|
661
651
|
payload['range'] = range;
|
|
662
652
|
}
|
|
663
653
|
|
|
664
|
-
const uri = new URL(this.client.config.endpoint +
|
|
654
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
665
655
|
return await this.client.call('get', uri, {
|
|
666
656
|
'content-type': 'application/json',
|
|
667
657
|
}, payload);
|
|
668
658
|
}
|
|
669
659
|
|
|
670
660
|
/**
|
|
671
|
-
* Get usage stats for
|
|
661
|
+
* Get usage stats for storage bucket
|
|
672
662
|
*
|
|
673
663
|
*
|
|
674
664
|
* @param {string} bucketId
|
|
@@ -681,14 +671,14 @@ export class Storage extends Service {
|
|
|
681
671
|
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
682
672
|
}
|
|
683
673
|
|
|
684
|
-
|
|
685
|
-
|
|
674
|
+
const apiPath = '/storage/{bucketId}/usage'.replace('{bucketId}', bucketId);
|
|
675
|
+
const payload: Payload = {};
|
|
686
676
|
|
|
687
677
|
if (typeof range !== 'undefined') {
|
|
688
678
|
payload['range'] = range;
|
|
689
679
|
}
|
|
690
680
|
|
|
691
|
-
const uri = new URL(this.client.config.endpoint +
|
|
681
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
692
682
|
return await this.client.call('get', uri, {
|
|
693
683
|
'content-type': 'application/json',
|
|
694
684
|
}, payload);
|