react-native-appwrite 0.7.2 → 0.7.4

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/README.md +1 -1
  3. package/dist/cjs/sdk.js +36 -84
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +36 -84
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/docs/examples/account/create-anonymous-session.md +1 -1
  8. package/docs/examples/account/create-email-password-session.md +1 -1
  9. package/docs/examples/account/create-email-token.md +1 -1
  10. package/docs/examples/account/create-j-w-t.md +1 -1
  11. package/docs/examples/account/create-magic-u-r-l-token.md +1 -1
  12. package/docs/examples/account/create-mfa-authenticator.md +1 -1
  13. package/docs/examples/account/create-mfa-challenge.md +1 -1
  14. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  15. package/docs/examples/account/create-o-auth2session.md +1 -1
  16. package/docs/examples/account/create-o-auth2token.md +1 -1
  17. package/docs/examples/account/create-phone-token.md +1 -1
  18. package/docs/examples/account/create-phone-verification.md +1 -1
  19. package/docs/examples/account/create-push-target.md +1 -1
  20. package/docs/examples/account/create-recovery.md +1 -1
  21. package/docs/examples/account/create-session.md +1 -1
  22. package/docs/examples/account/create-verification.md +1 -1
  23. package/docs/examples/account/create.md +1 -1
  24. package/docs/examples/account/delete-identity.md +1 -1
  25. package/docs/examples/account/delete-mfa-authenticator.md +1 -1
  26. package/docs/examples/account/delete-push-target.md +1 -1
  27. package/docs/examples/account/delete-session.md +1 -1
  28. package/docs/examples/account/delete-sessions.md +1 -1
  29. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  30. package/docs/examples/account/get-prefs.md +1 -1
  31. package/docs/examples/account/get-session.md +1 -1
  32. package/docs/examples/account/get.md +1 -1
  33. package/docs/examples/account/list-identities.md +1 -1
  34. package/docs/examples/account/list-logs.md +1 -1
  35. package/docs/examples/account/list-mfa-factors.md +1 -1
  36. package/docs/examples/account/list-sessions.md +1 -1
  37. package/docs/examples/account/update-email.md +1 -1
  38. package/docs/examples/account/update-m-f-a.md +1 -1
  39. package/docs/examples/account/update-magic-u-r-l-session.md +1 -1
  40. package/docs/examples/account/update-mfa-authenticator.md +1 -1
  41. package/docs/examples/account/update-mfa-challenge.md +1 -1
  42. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  43. package/docs/examples/account/update-name.md +1 -1
  44. package/docs/examples/account/update-password.md +1 -1
  45. package/docs/examples/account/update-phone-session.md +1 -1
  46. package/docs/examples/account/update-phone-verification.md +1 -1
  47. package/docs/examples/account/update-phone.md +1 -1
  48. package/docs/examples/account/update-prefs.md +1 -1
  49. package/docs/examples/account/update-push-target.md +1 -1
  50. package/docs/examples/account/update-recovery.md +1 -1
  51. package/docs/examples/account/update-session.md +1 -1
  52. package/docs/examples/account/update-status.md +1 -1
  53. package/docs/examples/account/update-verification.md +1 -1
  54. package/docs/examples/avatars/get-browser.md +1 -1
  55. package/docs/examples/avatars/get-credit-card.md +1 -1
  56. package/docs/examples/avatars/get-favicon.md +1 -1
  57. package/docs/examples/avatars/get-flag.md +1 -1
  58. package/docs/examples/avatars/get-image.md +1 -1
  59. package/docs/examples/avatars/get-initials.md +1 -1
  60. package/docs/examples/avatars/get-q-r.md +1 -1
  61. package/docs/examples/databases/create-document.md +1 -1
  62. package/docs/examples/databases/delete-document.md +1 -1
  63. package/docs/examples/databases/get-document.md +1 -1
  64. package/docs/examples/databases/list-documents.md +1 -1
  65. package/docs/examples/databases/update-document.md +1 -1
  66. package/docs/examples/functions/create-execution.md +1 -1
  67. package/docs/examples/functions/get-execution.md +1 -1
  68. package/docs/examples/functions/list-executions.md +1 -1
  69. package/docs/examples/graphql/mutation.md +1 -1
  70. package/docs/examples/graphql/query.md +1 -1
  71. package/docs/examples/locale/get.md +1 -1
  72. package/docs/examples/locale/list-codes.md +1 -1
  73. package/docs/examples/locale/list-continents.md +1 -1
  74. package/docs/examples/locale/list-countries-e-u.md +1 -1
  75. package/docs/examples/locale/list-countries-phones.md +1 -1
  76. package/docs/examples/locale/list-countries.md +1 -1
  77. package/docs/examples/locale/list-currencies.md +1 -1
  78. package/docs/examples/locale/list-languages.md +1 -1
  79. package/docs/examples/messaging/create-subscriber.md +1 -1
  80. package/docs/examples/messaging/delete-subscriber.md +1 -1
  81. package/docs/examples/storage/create-file.md +1 -1
  82. package/docs/examples/storage/delete-file.md +1 -1
  83. package/docs/examples/storage/get-file-download.md +1 -1
  84. package/docs/examples/storage/get-file-preview.md +1 -1
  85. package/docs/examples/storage/get-file-view.md +1 -1
  86. package/docs/examples/storage/get-file.md +1 -1
  87. package/docs/examples/storage/list-files.md +1 -1
  88. package/docs/examples/storage/update-file.md +1 -1
  89. package/docs/examples/teams/create-membership.md +1 -1
  90. package/docs/examples/teams/create.md +1 -1
  91. package/docs/examples/teams/delete-membership.md +1 -1
  92. package/docs/examples/teams/delete.md +1 -1
  93. package/docs/examples/teams/get-membership.md +1 -1
  94. package/docs/examples/teams/get-prefs.md +1 -1
  95. package/docs/examples/teams/get.md +1 -1
  96. package/docs/examples/teams/list-memberships.md +1 -1
  97. package/docs/examples/teams/list.md +1 -1
  98. package/docs/examples/teams/update-membership-status.md +1 -1
  99. package/docs/examples/teams/update-membership.md +1 -1
  100. package/docs/examples/teams/update-name.md +1 -1
  101. package/docs/examples/teams/update-prefs.md +1 -1
  102. package/package.json +3 -3
  103. package/src/client.ts +10 -3
  104. package/src/enums/o-auth-provider.ts +1 -0
  105. package/src/services/account.ts +0 -8
  106. package/src/services/databases.ts +0 -3
  107. package/src/services/functions.ts +0 -2
  108. package/src/services/locale.ts +0 -8
  109. package/src/services/storage.ts +0 -2
  110. package/src/services/teams.ts +0 -5
  111. package/types/enums/o-auth-provider.d.ts +1 -0
  112. package/types/services/databases.d.ts +0 -1
package/dist/esm/sdk.js CHANGED
@@ -77,7 +77,7 @@ class Client {
77
77
  'x-sdk-name': 'React Native',
78
78
  'x-sdk-platform': 'client',
79
79
  'x-sdk-language': 'reactnative',
80
- 'x-sdk-version': '0.7.2',
80
+ 'x-sdk-version': '0.7.4',
81
81
  'X-Appwrite-Response-Format': '1.6.0',
82
82
  };
83
83
  this.realtime = {
@@ -227,8 +227,11 @@ class Client {
227
227
  * @returns {this}
228
228
  */
229
229
  setEndpoint(endpoint) {
230
+ if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
231
+ throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
232
+ }
230
233
  this.config.endpoint = endpoint;
231
- this.config.endpointRealtime = this.config.endpointRealtime || this.config.endpoint.replace('https://', 'wss://').replace('http://', 'ws://');
234
+ this.config.endpointRealtime = endpoint.replace('https://', 'wss://').replace('http://', 'ws://');
232
235
  return this;
233
236
  }
234
237
  /**
@@ -239,6 +242,9 @@ class Client {
239
242
  * @returns {this}
240
243
  */
241
244
  setEndpointRealtime(endpointRealtime) {
245
+ if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
246
+ throw new AppwriteException('Invalid realtime endpoint URL: ' + endpointRealtime);
247
+ }
242
248
  this.config.endpointRealtime = endpointRealtime;
243
249
  return this;
244
250
  }
@@ -442,9 +448,7 @@ class Account extends Service {
442
448
  const apiPath = '/account';
443
449
  const payload = {};
444
450
  const uri = new URL(this.client.config.endpoint + apiPath);
445
- return this.client.call('get', uri, {
446
- 'content-type': 'application/json',
447
- }, payload);
451
+ return this.client.call('get', uri, {}, payload);
448
452
  }
449
453
  /**
450
454
  * Use this endpoint to allow a new user to register a new account in your
@@ -540,9 +544,7 @@ class Account extends Service {
540
544
  payload['queries'] = queries;
541
545
  }
542
546
  const uri = new URL(this.client.config.endpoint + apiPath);
543
- return this.client.call('get', uri, {
544
- 'content-type': 'application/json',
545
- }, payload);
547
+ return this.client.call('get', uri, {}, payload);
546
548
  }
547
549
  /**
548
550
  * Delete an identity by its unique ID.
@@ -595,9 +597,7 @@ class Account extends Service {
595
597
  payload['queries'] = queries;
596
598
  }
597
599
  const uri = new URL(this.client.config.endpoint + apiPath);
598
- return this.client.call('get', uri, {
599
- 'content-type': 'application/json',
600
- }, payload);
600
+ return this.client.call('get', uri, {}, payload);
601
601
  }
602
602
  /**
603
603
  * Enable or disable MFA on an account.
@@ -751,9 +751,7 @@ class Account extends Service {
751
751
  const apiPath = '/account/mfa/factors';
752
752
  const payload = {};
753
753
  const uri = new URL(this.client.config.endpoint + apiPath);
754
- return this.client.call('get', uri, {
755
- 'content-type': 'application/json',
756
- }, payload);
754
+ return this.client.call('get', uri, {}, payload);
757
755
  }
758
756
  /**
759
757
  * Get recovery codes that can be used as backup for MFA flow. Before getting
@@ -768,9 +766,7 @@ class Account extends Service {
768
766
  const apiPath = '/account/mfa/recovery-codes';
769
767
  const payload = {};
770
768
  const uri = new URL(this.client.config.endpoint + apiPath);
771
- return this.client.call('get', uri, {
772
- 'content-type': 'application/json',
773
- }, payload);
769
+ return this.client.call('get', uri, {}, payload);
774
770
  }
775
771
  /**
776
772
  * Generate recovery codes as backup for MFA flow. It's recommended to
@@ -897,9 +893,7 @@ class Account extends Service {
897
893
  const apiPath = '/account/prefs';
898
894
  const payload = {};
899
895
  const uri = new URL(this.client.config.endpoint + apiPath);
900
- return this.client.call('get', uri, {
901
- 'content-type': 'application/json',
902
- }, payload);
896
+ return this.client.call('get', uri, {}, payload);
903
897
  }
904
898
  /**
905
899
  * Update currently logged in user account preferences. The object you pass is
@@ -1014,9 +1008,7 @@ class Account extends Service {
1014
1008
  const apiPath = '/account/sessions';
1015
1009
  const payload = {};
1016
1010
  const uri = new URL(this.client.config.endpoint + apiPath);
1017
- return this.client.call('get', uri, {
1018
- 'content-type': 'application/json',
1019
- }, payload);
1011
+ return this.client.call('get', uri, {}, payload);
1020
1012
  }
1021
1013
  /**
1022
1014
  * Delete all sessions from the user account and remove any sessions cookies
@@ -1238,9 +1230,7 @@ class Account extends Service {
1238
1230
  const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1239
1231
  const payload = {};
1240
1232
  const uri = new URL(this.client.config.endpoint + apiPath);
1241
- return this.client.call('get', uri, {
1242
- 'content-type': 'application/json',
1243
- }, payload);
1233
+ return this.client.call('get', uri, {}, payload);
1244
1234
  }
1245
1235
  /**
1246
1236
  * Use this endpoint to extend a session's length. Extending a session is
@@ -1983,9 +1973,7 @@ class Databases extends Service {
1983
1973
  payload['queries'] = queries;
1984
1974
  }
1985
1975
  const uri = new URL(this.client.config.endpoint + apiPath);
1986
- return this.client.call('get', uri, {
1987
- 'content-type': 'application/json',
1988
- }, payload);
1976
+ return this.client.call('get', uri, {}, payload);
1989
1977
  }
1990
1978
  /**
1991
1979
  * Create a new Document. Before using this route, you should create a new
@@ -1993,7 +1981,6 @@ class Databases extends Service {
1993
1981
  * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
1994
1982
  * API or directly from your database console.
1995
1983
  *
1996
- *
1997
1984
  * @param {string} databaseId
1998
1985
  * @param {string} collectionId
1999
1986
  * @param {string} documentId
@@ -2058,9 +2045,7 @@ class Databases extends Service {
2058
2045
  payload['queries'] = queries;
2059
2046
  }
2060
2047
  const uri = new URL(this.client.config.endpoint + apiPath);
2061
- return this.client.call('get', uri, {
2062
- 'content-type': 'application/json',
2063
- }, payload);
2048
+ return this.client.call('get', uri, {}, payload);
2064
2049
  }
2065
2050
  /**
2066
2051
  * Update a document by its unique ID. Using the patch method you can pass
@@ -2152,9 +2137,7 @@ class Functions extends Service {
2152
2137
  payload['search'] = search;
2153
2138
  }
2154
2139
  const uri = new URL(this.client.config.endpoint + apiPath);
2155
- return this.client.call('get', uri, {
2156
- 'content-type': 'application/json',
2157
- }, payload);
2140
+ return this.client.call('get', uri, {}, payload);
2158
2141
  }
2159
2142
  /**
2160
2143
  * Trigger a function execution. The returned object will return you the
@@ -2219,9 +2202,7 @@ class Functions extends Service {
2219
2202
  const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
2220
2203
  const payload = {};
2221
2204
  const uri = new URL(this.client.config.endpoint + apiPath);
2222
- return this.client.call('get', uri, {
2223
- 'content-type': 'application/json',
2224
- }, payload);
2205
+ return this.client.call('get', uri, {}, payload);
2225
2206
  }
2226
2207
  }
2227
2208
 
@@ -2294,9 +2275,7 @@ class Locale extends Service {
2294
2275
  const apiPath = '/locale';
2295
2276
  const payload = {};
2296
2277
  const uri = new URL(this.client.config.endpoint + apiPath);
2297
- return this.client.call('get', uri, {
2298
- 'content-type': 'application/json',
2299
- }, payload);
2278
+ return this.client.call('get', uri, {}, payload);
2300
2279
  }
2301
2280
  /**
2302
2281
  * List of all locale codes in [ISO
@@ -2309,9 +2288,7 @@ class Locale extends Service {
2309
2288
  const apiPath = '/locale/codes';
2310
2289
  const payload = {};
2311
2290
  const uri = new URL(this.client.config.endpoint + apiPath);
2312
- return this.client.call('get', uri, {
2313
- 'content-type': 'application/json',
2314
- }, payload);
2291
+ return this.client.call('get', uri, {}, payload);
2315
2292
  }
2316
2293
  /**
2317
2294
  * List of all continents. You can use the locale header to get the data in a
@@ -2324,9 +2301,7 @@ class Locale extends Service {
2324
2301
  const apiPath = '/locale/continents';
2325
2302
  const payload = {};
2326
2303
  const uri = new URL(this.client.config.endpoint + apiPath);
2327
- return this.client.call('get', uri, {
2328
- 'content-type': 'application/json',
2329
- }, payload);
2304
+ return this.client.call('get', uri, {}, payload);
2330
2305
  }
2331
2306
  /**
2332
2307
  * List of all countries. You can use the locale header to get the data in a
@@ -2339,9 +2314,7 @@ class Locale extends Service {
2339
2314
  const apiPath = '/locale/countries';
2340
2315
  const payload = {};
2341
2316
  const uri = new URL(this.client.config.endpoint + apiPath);
2342
- return this.client.call('get', uri, {
2343
- 'content-type': 'application/json',
2344
- }, payload);
2317
+ return this.client.call('get', uri, {}, payload);
2345
2318
  }
2346
2319
  /**
2347
2320
  * List of all countries that are currently members of the EU. You can use the
@@ -2354,9 +2327,7 @@ class Locale extends Service {
2354
2327
  const apiPath = '/locale/countries/eu';
2355
2328
  const payload = {};
2356
2329
  const uri = new URL(this.client.config.endpoint + apiPath);
2357
- return this.client.call('get', uri, {
2358
- 'content-type': 'application/json',
2359
- }, payload);
2330
+ return this.client.call('get', uri, {}, payload);
2360
2331
  }
2361
2332
  /**
2362
2333
  * List of all countries phone codes. You can use the locale header to get the
@@ -2369,9 +2340,7 @@ class Locale extends Service {
2369
2340
  const apiPath = '/locale/countries/phones';
2370
2341
  const payload = {};
2371
2342
  const uri = new URL(this.client.config.endpoint + apiPath);
2372
- return this.client.call('get', uri, {
2373
- 'content-type': 'application/json',
2374
- }, payload);
2343
+ return this.client.call('get', uri, {}, payload);
2375
2344
  }
2376
2345
  /**
2377
2346
  * List of all currencies, including currency symbol, name, plural, and
@@ -2385,9 +2354,7 @@ class Locale extends Service {
2385
2354
  const apiPath = '/locale/currencies';
2386
2355
  const payload = {};
2387
2356
  const uri = new URL(this.client.config.endpoint + apiPath);
2388
- return this.client.call('get', uri, {
2389
- 'content-type': 'application/json',
2390
- }, payload);
2357
+ return this.client.call('get', uri, {}, payload);
2391
2358
  }
2392
2359
  /**
2393
2360
  * List of all languages classified by ISO 639-1 including 2-letter code, name
@@ -2400,9 +2367,7 @@ class Locale extends Service {
2400
2367
  const apiPath = '/locale/languages';
2401
2368
  const payload = {};
2402
2369
  const uri = new URL(this.client.config.endpoint + apiPath);
2403
- return this.client.call('get', uri, {
2404
- 'content-type': 'application/json',
2405
- }, payload);
2370
+ return this.client.call('get', uri, {}, payload);
2406
2371
  }
2407
2372
  }
2408
2373
 
@@ -2493,9 +2458,7 @@ class Storage extends Service {
2493
2458
  payload['search'] = search;
2494
2459
  }
2495
2460
  const uri = new URL(this.client.config.endpoint + apiPath);
2496
- return this.client.call('get', uri, {
2497
- 'content-type': 'application/json',
2498
- }, payload);
2461
+ return this.client.call('get', uri, {}, payload);
2499
2462
  }
2500
2463
  /**
2501
2464
  * Create a new file. Before using this route, you should create a new bucket
@@ -2616,9 +2579,7 @@ class Storage extends Service {
2616
2579
  const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
2617
2580
  const payload = {};
2618
2581
  const uri = new URL(this.client.config.endpoint + apiPath);
2619
- return this.client.call('get', uri, {
2620
- 'content-type': 'application/json',
2621
- }, payload);
2582
+ return this.client.call('get', uri, {}, payload);
2622
2583
  }
2623
2584
  /**
2624
2585
  * Update a file by its unique ID. Only users with write permissions have
@@ -2823,9 +2784,7 @@ class Teams extends Service {
2823
2784
  payload['search'] = search;
2824
2785
  }
2825
2786
  const uri = new URL(this.client.config.endpoint + apiPath);
2826
- return this.client.call('get', uri, {
2827
- 'content-type': 'application/json',
2828
- }, payload);
2787
+ return this.client.call('get', uri, {}, payload);
2829
2788
  }
2830
2789
  /**
2831
2790
  * Create a new team. The user who creates the team will automatically be
@@ -2875,9 +2834,7 @@ class Teams extends Service {
2875
2834
  const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
2876
2835
  const payload = {};
2877
2836
  const uri = new URL(this.client.config.endpoint + apiPath);
2878
- return this.client.call('get', uri, {
2879
- 'content-type': 'application/json',
2880
- }, payload);
2837
+ return this.client.call('get', uri, {}, payload);
2881
2838
  }
2882
2839
  /**
2883
2840
  * Update the team's name by its unique ID.
@@ -2947,9 +2904,7 @@ class Teams extends Service {
2947
2904
  payload['search'] = search;
2948
2905
  }
2949
2906
  const uri = new URL(this.client.config.endpoint + apiPath);
2950
- return this.client.call('get', uri, {
2951
- 'content-type': 'application/json',
2952
- }, payload);
2907
+ return this.client.call('get', uri, {}, payload);
2953
2908
  }
2954
2909
  /**
2955
2910
  * Invite a new member to join your team. Provide an ID for existing users, or
@@ -3036,9 +2991,7 @@ class Teams extends Service {
3036
2991
  const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
3037
2992
  const payload = {};
3038
2993
  const uri = new URL(this.client.config.endpoint + apiPath);
3039
- return this.client.call('get', uri, {
3040
- 'content-type': 'application/json',
3041
- }, payload);
2994
+ return this.client.call('get', uri, {}, payload);
3042
2995
  }
3043
2996
  /**
3044
2997
  * Modify the roles of a team member. Only team members with the owner role
@@ -3154,9 +3107,7 @@ class Teams extends Service {
3154
3107
  const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
3155
3108
  const payload = {};
3156
3109
  const uri = new URL(this.client.config.endpoint + apiPath);
3157
- return this.client.call('get', uri, {
3158
- 'content-type': 'application/json',
3159
- }, payload);
3110
+ return this.client.call('get', uri, {}, payload);
3160
3111
  }
3161
3112
  /**
3162
3113
  * Update the team's preferences by its unique ID. The object you pass is
@@ -3397,6 +3348,7 @@ var OAuthProvider;
3397
3348
  OAuthProvider["Dropbox"] = "dropbox";
3398
3349
  OAuthProvider["Etsy"] = "etsy";
3399
3350
  OAuthProvider["Facebook"] = "facebook";
3351
+ OAuthProvider["Figma"] = "figma";
3400
3352
  OAuthProvider["Github"] = "github";
3401
3353
  OAuthProvider["Gitlab"] = "gitlab";
3402
3354
  OAuthProvider["Google"] = "google";