react-native-appwrite 0.6.0 → 0.7.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.
@@ -16,8 +16,6 @@ export class Storage extends Service {
16
16
  }
17
17
 
18
18
  /**
19
- * List files
20
- *
21
19
  * Get a list of all the user files. You can use the query params to filter
22
20
  * your results.
23
21
  *
@@ -27,7 +25,7 @@ export class Storage extends Service {
27
25
  * @throws {AppwriteException}
28
26
  * @returns {Promise}
29
27
  */
30
- async listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList> {
28
+ listFiles(bucketId: string, queries?: string[], search?: string): Promise<Models.FileList> {
31
29
  if (typeof bucketId === 'undefined') {
32
30
  throw new AppwriteException('Missing required parameter: "bucketId"');
33
31
  }
@@ -44,14 +42,12 @@ export class Storage extends Service {
44
42
  }
45
43
 
46
44
  const uri = new URL(this.client.config.endpoint + apiPath);
47
- return await this.client.call('get', uri, {
45
+ return this.client.call('get', uri, {
48
46
  'content-type': 'application/json',
49
47
  }, payload);
50
48
  }
51
49
 
52
50
  /**
53
- * Create file
54
- *
55
51
  * Create a new file. Before using this route, you should create a new bucket
56
52
  * resource using either a [server
57
53
  * integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
@@ -111,7 +107,7 @@ export class Storage extends Service {
111
107
  const size = file.size;
112
108
 
113
109
  if (size <= Service.CHUNK_SIZE) {
114
- return await this.client.call('post', uri, {
110
+ return this.client.call('post', uri, {
115
111
  'content-type': 'multipart/form-data',
116
112
  }, payload);
117
113
  }
@@ -122,12 +118,10 @@ export class Storage extends Service {
122
118
 
123
119
  let offset = 0;
124
120
  let response = undefined;
125
- if(fileId != 'unique()') {
126
- try {
127
- response = await this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
128
- offset = response.chunksUploaded * Service.CHUNK_SIZE;
129
- } catch(e) {
130
- }
121
+ try {
122
+ response = await this.client.call('GET', new URL(this.client.config.endpoint + apiPath + '/' + fileId), apiHeaders);
123
+ offset = response.chunksUploaded * Service.CHUNK_SIZE;
124
+ } catch(e) {
131
125
  }
132
126
 
133
127
  let timestamp = new Date().getTime();
@@ -169,8 +163,6 @@ export class Storage extends Service {
169
163
  }
170
164
 
171
165
  /**
172
- * Get file
173
- *
174
166
  * Get a file by its unique ID. This endpoint response returns a JSON object
175
167
  * with the file metadata.
176
168
  *
@@ -179,7 +171,7 @@ export class Storage extends Service {
179
171
  * @throws {AppwriteException}
180
172
  * @returns {Promise}
181
173
  */
182
- async getFile(bucketId: string, fileId: string): Promise<Models.File> {
174
+ getFile(bucketId: string, fileId: string): Promise<Models.File> {
183
175
  if (typeof bucketId === 'undefined') {
184
176
  throw new AppwriteException('Missing required parameter: "bucketId"');
185
177
  }
@@ -192,14 +184,12 @@ export class Storage extends Service {
192
184
  const payload: Payload = {};
193
185
 
194
186
  const uri = new URL(this.client.config.endpoint + apiPath);
195
- return await this.client.call('get', uri, {
187
+ return this.client.call('get', uri, {
196
188
  'content-type': 'application/json',
197
189
  }, payload);
198
190
  }
199
191
 
200
192
  /**
201
- * Update file
202
- *
203
193
  * Update a file by its unique ID. Only users with write permissions have
204
194
  * access to update this resource.
205
195
  *
@@ -210,7 +200,7 @@ export class Storage extends Service {
210
200
  * @throws {AppwriteException}
211
201
  * @returns {Promise}
212
202
  */
213
- async updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File> {
203
+ updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File> {
214
204
  if (typeof bucketId === 'undefined') {
215
205
  throw new AppwriteException('Missing required parameter: "bucketId"');
216
206
  }
@@ -231,14 +221,12 @@ export class Storage extends Service {
231
221
  }
232
222
 
233
223
  const uri = new URL(this.client.config.endpoint + apiPath);
234
- return await this.client.call('put', uri, {
224
+ return this.client.call('put', uri, {
235
225
  'content-type': 'application/json',
236
226
  }, payload);
237
227
  }
238
228
 
239
229
  /**
240
- * Delete file
241
- *
242
230
  * Delete a file by its unique ID. Only users with write permissions have
243
231
  * access to delete this resource.
244
232
  *
@@ -247,7 +235,7 @@ export class Storage extends Service {
247
235
  * @throws {AppwriteException}
248
236
  * @returns {Promise}
249
237
  */
250
- async deleteFile(bucketId: string, fileId: string): Promise<{}> {
238
+ deleteFile(bucketId: string, fileId: string): Promise<{}> {
251
239
  if (typeof bucketId === 'undefined') {
252
240
  throw new AppwriteException('Missing required parameter: "bucketId"');
253
241
  }
@@ -260,14 +248,12 @@ export class Storage extends Service {
260
248
  const payload: Payload = {};
261
249
 
262
250
  const uri = new URL(this.client.config.endpoint + apiPath);
263
- return await this.client.call('delete', uri, {
251
+ return this.client.call('delete', uri, {
264
252
  'content-type': 'application/json',
265
253
  }, payload);
266
254
  }
267
255
 
268
256
  /**
269
- * Get file for download
270
- *
271
257
  * Get a file content by its unique ID. The endpoint response return with a
272
258
  * 'Content-Disposition: attachment' header that tells the browser to start
273
259
  * downloading the file to user downloads directory.
@@ -300,8 +286,6 @@ export class Storage extends Service {
300
286
  }
301
287
 
302
288
  /**
303
- * Get file preview
304
- *
305
289
  * Get a file preview image. Currently, this method supports preview for image
306
290
  * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
307
291
  * and spreadsheets, will return the file icon image. You can also pass query
@@ -391,8 +375,6 @@ export class Storage extends Service {
391
375
  }
392
376
 
393
377
  /**
394
- * Get file for view
395
- *
396
378
  * Get a file content by its unique ID. This endpoint is similar to the
397
379
  * download method but returns with no 'Content-Disposition: attachment'
398
380
  * header.
@@ -14,8 +14,6 @@ export class Teams extends Service {
14
14
  }
15
15
 
16
16
  /**
17
- * List teams
18
- *
19
17
  * Get a list of all the teams in which the current user is a member. You can
20
18
  * use the parameters to filter your results.
21
19
  *
@@ -24,7 +22,7 @@ export class Teams extends Service {
24
22
  * @throws {AppwriteException}
25
23
  * @returns {Promise}
26
24
  */
27
- async list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
25
+ list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
28
26
  const apiPath = '/teams';
29
27
  const payload: Payload = {};
30
28
 
@@ -37,14 +35,12 @@ export class Teams extends Service {
37
35
  }
38
36
 
39
37
  const uri = new URL(this.client.config.endpoint + apiPath);
40
- return await this.client.call('get', uri, {
38
+ return this.client.call('get', uri, {
41
39
  'content-type': 'application/json',
42
40
  }, payload);
43
41
  }
44
42
 
45
43
  /**
46
- * Create team
47
- *
48
44
  * Create a new team. The user who creates the team will automatically be
49
45
  * assigned as the owner of the team. Only the users with the owner role can
50
46
  * invite new members, add new owners and delete or update the team.
@@ -55,7 +51,7 @@ export class Teams extends Service {
55
51
  * @throws {AppwriteException}
56
52
  * @returns {Promise}
57
53
  */
58
- async create<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>> {
54
+ create<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>> {
59
55
  if (typeof teamId === 'undefined') {
60
56
  throw new AppwriteException('Missing required parameter: "teamId"');
61
57
  }
@@ -80,21 +76,19 @@ export class Teams extends Service {
80
76
  }
81
77
 
82
78
  const uri = new URL(this.client.config.endpoint + apiPath);
83
- return await this.client.call('post', uri, {
79
+ return this.client.call('post', uri, {
84
80
  'content-type': 'application/json',
85
81
  }, payload);
86
82
  }
87
83
 
88
84
  /**
89
- * Get team
90
- *
91
85
  * Get a team by its ID. All team members have read access for this resource.
92
86
  *
93
87
  * @param {string} teamId
94
88
  * @throws {AppwriteException}
95
89
  * @returns {Promise}
96
90
  */
97
- async get<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>> {
91
+ get<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>> {
98
92
  if (typeof teamId === 'undefined') {
99
93
  throw new AppwriteException('Missing required parameter: "teamId"');
100
94
  }
@@ -103,14 +97,12 @@ export class Teams extends Service {
103
97
  const payload: Payload = {};
104
98
 
105
99
  const uri = new URL(this.client.config.endpoint + apiPath);
106
- return await this.client.call('get', uri, {
100
+ return this.client.call('get', uri, {
107
101
  'content-type': 'application/json',
108
102
  }, payload);
109
103
  }
110
104
 
111
105
  /**
112
- * Update name
113
- *
114
106
  * Update the team's name by its unique ID.
115
107
  *
116
108
  * @param {string} teamId
@@ -118,7 +110,7 @@ export class Teams extends Service {
118
110
  * @throws {AppwriteException}
119
111
  * @returns {Promise}
120
112
  */
121
- async updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>> {
113
+ updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>> {
122
114
  if (typeof teamId === 'undefined') {
123
115
  throw new AppwriteException('Missing required parameter: "teamId"');
124
116
  }
@@ -135,14 +127,12 @@ export class Teams extends Service {
135
127
  }
136
128
 
137
129
  const uri = new URL(this.client.config.endpoint + apiPath);
138
- return await this.client.call('put', uri, {
130
+ return this.client.call('put', uri, {
139
131
  'content-type': 'application/json',
140
132
  }, payload);
141
133
  }
142
134
 
143
135
  /**
144
- * Delete team
145
- *
146
136
  * Delete a team using its ID. Only team members with the owner role can
147
137
  * delete the team.
148
138
  *
@@ -150,7 +140,7 @@ export class Teams extends Service {
150
140
  * @throws {AppwriteException}
151
141
  * @returns {Promise}
152
142
  */
153
- async delete(teamId: string): Promise<{}> {
143
+ delete(teamId: string): Promise<{}> {
154
144
  if (typeof teamId === 'undefined') {
155
145
  throw new AppwriteException('Missing required parameter: "teamId"');
156
146
  }
@@ -159,14 +149,12 @@ export class Teams extends Service {
159
149
  const payload: Payload = {};
160
150
 
161
151
  const uri = new URL(this.client.config.endpoint + apiPath);
162
- return await this.client.call('delete', uri, {
152
+ return this.client.call('delete', uri, {
163
153
  'content-type': 'application/json',
164
154
  }, payload);
165
155
  }
166
156
 
167
157
  /**
168
- * List team memberships
169
- *
170
158
  * Use this endpoint to list a team's members using the team's ID. All team
171
159
  * members have read access to this endpoint. Hide sensitive attributes from
172
160
  * the response by toggling membership privacy in the Console.
@@ -177,7 +165,7 @@ export class Teams extends Service {
177
165
  * @throws {AppwriteException}
178
166
  * @returns {Promise}
179
167
  */
180
- async listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> {
168
+ listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> {
181
169
  if (typeof teamId === 'undefined') {
182
170
  throw new AppwriteException('Missing required parameter: "teamId"');
183
171
  }
@@ -194,14 +182,12 @@ export class Teams extends Service {
194
182
  }
195
183
 
196
184
  const uri = new URL(this.client.config.endpoint + apiPath);
197
- return await this.client.call('get', uri, {
185
+ return this.client.call('get', uri, {
198
186
  'content-type': 'application/json',
199
187
  }, payload);
200
188
  }
201
189
 
202
190
  /**
203
- * Create team membership
204
- *
205
191
  * Invite a new member to join your team. Provide an ID for existing users, or
206
192
  * invite unregistered users using an email or phone number. If initiated from
207
193
  * a Client SDK, Appwrite will send an email or sms with a link to join the
@@ -234,7 +220,7 @@ export class Teams extends Service {
234
220
  * @throws {AppwriteException}
235
221
  * @returns {Promise}
236
222
  */
237
- async createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership> {
223
+ createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership> {
238
224
  if (typeof teamId === 'undefined') {
239
225
  throw new AppwriteException('Missing required parameter: "teamId"');
240
226
  }
@@ -271,14 +257,12 @@ export class Teams extends Service {
271
257
  }
272
258
 
273
259
  const uri = new URL(this.client.config.endpoint + apiPath);
274
- return await this.client.call('post', uri, {
260
+ return this.client.call('post', uri, {
275
261
  'content-type': 'application/json',
276
262
  }, payload);
277
263
  }
278
264
 
279
265
  /**
280
- * Get team membership
281
- *
282
266
  * Get a team member by the membership unique id. All team members have read
283
267
  * access for this resource. Hide sensitive attributes from the response by
284
268
  * toggling membership privacy in the Console.
@@ -288,7 +272,7 @@ export class Teams extends Service {
288
272
  * @throws {AppwriteException}
289
273
  * @returns {Promise}
290
274
  */
291
- async getMembership(teamId: string, membershipId: string): Promise<Models.Membership> {
275
+ getMembership(teamId: string, membershipId: string): Promise<Models.Membership> {
292
276
  if (typeof teamId === 'undefined') {
293
277
  throw new AppwriteException('Missing required parameter: "teamId"');
294
278
  }
@@ -301,14 +285,12 @@ export class Teams extends Service {
301
285
  const payload: Payload = {};
302
286
 
303
287
  const uri = new URL(this.client.config.endpoint + apiPath);
304
- return await this.client.call('get', uri, {
288
+ return this.client.call('get', uri, {
305
289
  'content-type': 'application/json',
306
290
  }, payload);
307
291
  }
308
292
 
309
293
  /**
310
- * Update membership
311
- *
312
294
  * Modify the roles of a team member. Only team members with the owner role
313
295
  * have access to this endpoint. Learn more about [roles and
314
296
  * permissions](https://appwrite.io/docs/permissions).
@@ -320,7 +302,7 @@ export class Teams extends Service {
320
302
  * @throws {AppwriteException}
321
303
  * @returns {Promise}
322
304
  */
323
- async updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership> {
305
+ updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership> {
324
306
  if (typeof teamId === 'undefined') {
325
307
  throw new AppwriteException('Missing required parameter: "teamId"');
326
308
  }
@@ -341,14 +323,12 @@ export class Teams extends Service {
341
323
  }
342
324
 
343
325
  const uri = new URL(this.client.config.endpoint + apiPath);
344
- return await this.client.call('patch', uri, {
326
+ return this.client.call('patch', uri, {
345
327
  'content-type': 'application/json',
346
328
  }, payload);
347
329
  }
348
330
 
349
331
  /**
350
- * Delete team membership
351
- *
352
332
  * This endpoint allows a user to leave a team or for a team owner to delete
353
333
  * the membership of any other team member. You can also use this endpoint to
354
334
  * delete a user membership even if it is not accepted.
@@ -358,7 +338,7 @@ export class Teams extends Service {
358
338
  * @throws {AppwriteException}
359
339
  * @returns {Promise}
360
340
  */
361
- async deleteMembership(teamId: string, membershipId: string): Promise<{}> {
341
+ deleteMembership(teamId: string, membershipId: string): Promise<{}> {
362
342
  if (typeof teamId === 'undefined') {
363
343
  throw new AppwriteException('Missing required parameter: "teamId"');
364
344
  }
@@ -371,14 +351,12 @@ export class Teams extends Service {
371
351
  const payload: Payload = {};
372
352
 
373
353
  const uri = new URL(this.client.config.endpoint + apiPath);
374
- return await this.client.call('delete', uri, {
354
+ return this.client.call('delete', uri, {
375
355
  'content-type': 'application/json',
376
356
  }, payload);
377
357
  }
378
358
 
379
359
  /**
380
- * Update team membership status
381
- *
382
360
  * Use this endpoint to allow a user to accept an invitation to join a team
383
361
  * after being redirected back to your app from the invitation email received
384
362
  * by the user.
@@ -394,7 +372,7 @@ export class Teams extends Service {
394
372
  * @throws {AppwriteException}
395
373
  * @returns {Promise}
396
374
  */
397
- async updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership> {
375
+ updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership> {
398
376
  if (typeof teamId === 'undefined') {
399
377
  throw new AppwriteException('Missing required parameter: "teamId"');
400
378
  }
@@ -423,14 +401,12 @@ export class Teams extends Service {
423
401
  }
424
402
 
425
403
  const uri = new URL(this.client.config.endpoint + apiPath);
426
- return await this.client.call('patch', uri, {
404
+ return this.client.call('patch', uri, {
427
405
  'content-type': 'application/json',
428
406
  }, payload);
429
407
  }
430
408
 
431
409
  /**
432
- * Get team preferences
433
- *
434
410
  * Get the team's shared preferences by its unique ID. If a preference doesn't
435
411
  * need to be shared by all team members, prefer storing them in [user
436
412
  * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
@@ -439,7 +415,7 @@ export class Teams extends Service {
439
415
  * @throws {AppwriteException}
440
416
  * @returns {Promise}
441
417
  */
442
- async getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences> {
418
+ getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences> {
443
419
  if (typeof teamId === 'undefined') {
444
420
  throw new AppwriteException('Missing required parameter: "teamId"');
445
421
  }
@@ -448,14 +424,12 @@ export class Teams extends Service {
448
424
  const payload: Payload = {};
449
425
 
450
426
  const uri = new URL(this.client.config.endpoint + apiPath);
451
- return await this.client.call('get', uri, {
427
+ return this.client.call('get', uri, {
452
428
  'content-type': 'application/json',
453
429
  }, payload);
454
430
  }
455
431
 
456
432
  /**
457
- * Update preferences
458
- *
459
433
  * Update the team's preferences by its unique ID. The object you pass is
460
434
  * stored as is and replaces any previous value. The maximum allowed prefs
461
435
  * size is 64kB and throws an error if exceeded.
@@ -465,7 +439,7 @@ export class Teams extends Service {
465
439
  * @throws {AppwriteException}
466
440
  * @returns {Promise}
467
441
  */
468
- async updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences> {
442
+ updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences> {
469
443
  if (typeof teamId === 'undefined') {
470
444
  throw new AppwriteException('Missing required parameter: "teamId"');
471
445
  }
@@ -482,7 +456,7 @@ export class Teams extends Service {
482
456
  }
483
457
 
484
458
  const uri = new URL(this.client.config.endpoint + apiPath);
485
- return await this.client.call('put', uri, {
459
+ return this.client.call('put', uri, {
486
460
  'content-type': 'application/json',
487
461
  }, payload);
488
462
  }
@@ -4,5 +4,6 @@ export declare enum ImageFormat {
4
4
  Gif = "gif",
5
5
  Png = "png",
6
6
  Webp = "webp",
7
+ Heic = "heic",
7
8
  Avif = "avif"
8
9
  }