react-native-appwrite 0.7.4 → 0.9.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.
@@ -10,7 +10,7 @@ const result = avatars.getBrowser(
10
10
  Browser.AvantBrowser, // code
11
11
  0, // width (optional)
12
12
  0, // height (optional)
13
- 0 // quality (optional)
13
+ -1 // quality (optional)
14
14
  );
15
15
 
16
16
  console.log(result);
@@ -10,7 +10,7 @@ const result = avatars.getCreditCard(
10
10
  CreditCard.AmericanExpress, // code
11
11
  0, // width (optional)
12
12
  0, // height (optional)
13
- 0 // quality (optional)
13
+ -1 // quality (optional)
14
14
  );
15
15
 
16
16
  console.log(result);
@@ -10,7 +10,7 @@ const result = avatars.getFlag(
10
10
  Flag.Afghanistan, // code
11
11
  0, // width (optional)
12
12
  0, // height (optional)
13
- 0 // quality (optional)
13
+ -1 // quality (optional)
14
14
  );
15
15
 
16
16
  console.log(result);
@@ -2,7 +2,9 @@ import { Client, Databases } from "react-native-appwrite";
2
2
 
3
3
  const client = new Client()
4
4
  .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
5
+ .setSession('') // The user session to authenticate with
6
+ .setKey('') //
7
+ .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
6
8
 
7
9
  const databases = new Databases(client);
8
10
 
@@ -8,8 +8,7 @@ const functions = new Functions(client);
8
8
 
9
9
  const result = await functions.listExecutions(
10
10
  '<FUNCTION_ID>', // functionId
11
- [], // queries (optional)
12
- '<SEARCH>' // search (optional)
11
+ [] // queries (optional)
13
12
  );
14
13
 
15
14
  console.log(result);
@@ -8,7 +8,8 @@ const storage = new Storage(client);
8
8
 
9
9
  const result = storage.getFileDownload(
10
10
  '<BUCKET_ID>', // bucketId
11
- '<FILE_ID>' // fileId
11
+ '<FILE_ID>', // fileId
12
+ '<TOKEN>' // token (optional)
12
13
  );
13
14
 
14
15
  console.log(result);
@@ -12,14 +12,15 @@ const result = storage.getFilePreview(
12
12
  0, // width (optional)
13
13
  0, // height (optional)
14
14
  ImageGravity.Center, // gravity (optional)
15
- 0, // quality (optional)
15
+ -1, // quality (optional)
16
16
  0, // borderWidth (optional)
17
17
  '', // borderColor (optional)
18
18
  0, // borderRadius (optional)
19
19
  0, // opacity (optional)
20
20
  -360, // rotation (optional)
21
21
  '', // background (optional)
22
- ImageFormat.Jpg // output (optional)
22
+ ImageFormat.Jpg, // output (optional)
23
+ '<TOKEN>' // token (optional)
23
24
  );
24
25
 
25
26
  console.log(result);
@@ -8,7 +8,8 @@ const storage = new Storage(client);
8
8
 
9
9
  const result = storage.getFileView(
10
10
  '<BUCKET_ID>', // bucketId
11
- '<FILE_ID>' // fileId
11
+ '<FILE_ID>', // fileId
12
+ '<TOKEN>' // token (optional)
12
13
  );
13
14
 
14
15
  console.log(result);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-native-appwrite",
3
3
  "homepage": "https://appwrite.io/support",
4
4
  "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "0.7.4",
5
+ "version": "0.9.0",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/cjs/sdk.js",
8
8
  "exports": {
package/src/client.ts CHANGED
@@ -114,8 +114,8 @@ class Client {
114
114
  'x-sdk-name': 'React Native',
115
115
  'x-sdk-platform': 'client',
116
116
  'x-sdk-language': 'reactnative',
117
- 'x-sdk-version': '0.7.4',
118
- 'X-Appwrite-Response-Format': '1.6.0',
117
+ 'x-sdk-version': '0.9.0',
118
+ 'X-Appwrite-Response-Format': '1.7.0',
119
119
  };
120
120
 
121
121
  /**
@@ -1,7 +1,6 @@
1
1
  export enum ImageFormat {
2
2
  Jpg = 'jpg',
3
3
  Jpeg = 'jpeg',
4
- Gif = 'gif',
5
4
  Png = 'png',
6
5
  Webp = 'webp',
7
6
  Heic = 'heic',
package/src/models.ts CHANGED
@@ -940,7 +940,7 @@ export namespace Models {
940
940
  */
941
941
  errors: string;
942
942
  /**
943
- * Function execution duration in seconds.
943
+ * Resource(function/site) execution duration in seconds.
944
944
  */
945
945
  duration: number;
946
946
  /**
@@ -20,11 +20,10 @@ export class Functions extends Service {
20
20
  *
21
21
  * @param {string} functionId
22
22
  * @param {string[]} queries
23
- * @param {string} search
24
23
  * @throws {AppwriteException}
25
24
  * @returns {Promise}
26
25
  */
27
- listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList> {
26
+ listExecutions(functionId: string, queries?: string[]): Promise<Models.ExecutionList> {
28
27
  if (typeof functionId === 'undefined') {
29
28
  throw new AppwriteException('Missing required parameter: "functionId"');
30
29
  }
@@ -36,10 +35,6 @@ export class Functions extends Service {
36
35
  payload['queries'] = queries;
37
36
  }
38
37
 
39
- if (typeof search !== 'undefined') {
40
- payload['search'] = search;
41
- }
42
-
43
38
  const uri = new URL(this.client.config.endpoint + apiPath);
44
39
  return this.client.call('get', uri, {
45
40
  }, payload);
@@ -258,10 +258,11 @@ export class Storage extends Service {
258
258
  *
259
259
  * @param {string} bucketId
260
260
  * @param {string} fileId
261
+ * @param {string} token
261
262
  * @throws {AppwriteException}
262
263
  * @returns {URL}
263
264
  */
264
- getFileDownload(bucketId: string, fileId: string): URL {
265
+ getFileDownload(bucketId: string, fileId: string, token?: string): URL {
265
266
  if (typeof bucketId === 'undefined') {
266
267
  throw new AppwriteException('Missing required parameter: "bucketId"');
267
268
  }
@@ -273,6 +274,10 @@ export class Storage extends Service {
273
274
  const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
274
275
  const payload: Payload = {};
275
276
 
277
+ if (typeof token !== 'undefined') {
278
+ payload['token'] = token;
279
+ }
280
+
276
281
  const uri = new URL(this.client.config.endpoint + apiPath);
277
282
  payload['project'] = this.client.config.project;
278
283
 
@@ -303,10 +308,11 @@ export class Storage extends Service {
303
308
  * @param {number} rotation
304
309
  * @param {string} background
305
310
  * @param {ImageFormat} output
311
+ * @param {string} token
306
312
  * @throws {AppwriteException}
307
313
  * @returns {URL}
308
314
  */
309
- getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): URL {
315
+ getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): URL {
310
316
  if (typeof bucketId === 'undefined') {
311
317
  throw new AppwriteException('Missing required parameter: "bucketId"');
312
318
  }
@@ -362,6 +368,10 @@ export class Storage extends Service {
362
368
  payload['output'] = output;
363
369
  }
364
370
 
371
+ if (typeof token !== 'undefined') {
372
+ payload['token'] = token;
373
+ }
374
+
365
375
  const uri = new URL(this.client.config.endpoint + apiPath);
366
376
  payload['project'] = this.client.config.project;
367
377
 
@@ -379,10 +389,11 @@ export class Storage extends Service {
379
389
  *
380
390
  * @param {string} bucketId
381
391
  * @param {string} fileId
392
+ * @param {string} token
382
393
  * @throws {AppwriteException}
383
394
  * @returns {URL}
384
395
  */
385
- getFileView(bucketId: string, fileId: string): URL {
396
+ getFileView(bucketId: string, fileId: string, token?: string): URL {
386
397
  if (typeof bucketId === 'undefined') {
387
398
  throw new AppwriteException('Missing required parameter: "bucketId"');
388
399
  }
@@ -394,6 +405,10 @@ export class Storage extends Service {
394
405
  const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
395
406
  const payload: Payload = {};
396
407
 
408
+ if (typeof token !== 'undefined') {
409
+ payload['token'] = token;
410
+ }
411
+
397
412
  const uri = new URL(this.client.config.endpoint + apiPath);
398
413
  payload['project'] = this.client.config.project;
399
414
 
@@ -1,7 +1,6 @@
1
1
  export declare enum ImageFormat {
2
2
  Jpg = "jpg",
3
3
  Jpeg = "jpeg",
4
- Gif = "gif",
5
4
  Png = "png",
6
5
  Webp = "webp",
7
6
  Heic = "heic",
package/types/models.d.ts CHANGED
@@ -940,7 +940,7 @@ export declare namespace Models {
940
940
  */
941
941
  errors: string;
942
942
  /**
943
- * Function execution duration in seconds.
943
+ * Resource(function/site) execution duration in seconds.
944
944
  */
945
945
  duration: number;
946
946
  /**
@@ -10,11 +10,10 @@ export declare class Functions extends Service {
10
10
  *
11
11
  * @param {string} functionId
12
12
  * @param {string[]} queries
13
- * @param {string} search
14
13
  * @throws {AppwriteException}
15
14
  * @returns {Promise}
16
15
  */
17
- listExecutions(functionId: string, queries?: string[], search?: string): Promise<Models.ExecutionList>;
16
+ listExecutions(functionId: string, queries?: string[]): Promise<Models.ExecutionList>;
18
17
  /**
19
18
  * Trigger a function execution. The returned object will return you the
20
19
  * current execution status. You can ping the `Get Execution` endpoint to get
@@ -89,10 +89,11 @@ export declare class Storage extends Service {
89
89
  *
90
90
  * @param {string} bucketId
91
91
  * @param {string} fileId
92
+ * @param {string} token
92
93
  * @throws {AppwriteException}
93
94
  * @returns {URL}
94
95
  */
95
- getFileDownload(bucketId: string, fileId: string): URL;
96
+ getFileDownload(bucketId: string, fileId: string, token?: string): URL;
96
97
  /**
97
98
  * Get a file preview image. Currently, this method supports preview for image
98
99
  * files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
@@ -113,10 +114,11 @@ export declare class Storage extends Service {
113
114
  * @param {number} rotation
114
115
  * @param {string} background
115
116
  * @param {ImageFormat} output
117
+ * @param {string} token
116
118
  * @throws {AppwriteException}
117
119
  * @returns {URL}
118
120
  */
119
- getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat): URL;
121
+ getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): URL;
120
122
  /**
121
123
  * Get a file content by its unique ID. This endpoint is similar to the
122
124
  * download method but returns with no 'Content-Disposition: attachment'
@@ -124,8 +126,9 @@ export declare class Storage extends Service {
124
126
  *
125
127
  * @param {string} bucketId
126
128
  * @param {string} fileId
129
+ * @param {string} token
127
130
  * @throws {AppwriteException}
128
131
  * @returns {URL}
129
132
  */
130
- getFileView(bucketId: string, fileId: string): URL;
133
+ getFileView(bucketId: string, fileId: string, token?: string): URL;
131
134
  }