react-native-appwrite 0.7.2 → 0.7.3
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 +1 -1
- package/dist/cjs/sdk.js +36 -83
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +36 -83
- package/dist/esm/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +10 -3
- package/src/enums/o-auth-provider.ts +1 -0
- package/src/services/account.ts +0 -8
- package/src/services/databases.ts +0 -2
- package/src/services/functions.ts +0 -2
- package/src/services/locale.ts +0 -8
- package/src/services/storage.ts +0 -2
- package/src/services/teams.ts +0 -5
- package/types/enums/o-auth-provider.d.ts +1 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Appwrite React Native SDK
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|
[](https://travis-ci.com/appwrite/sdk-generator)
|
|
6
6
|
[](https://twitter.com/appwrite)
|
|
7
7
|
[](https://appwrite.io/discord)
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -99,7 +99,7 @@ class Client {
|
|
|
99
99
|
'x-sdk-name': 'React Native',
|
|
100
100
|
'x-sdk-platform': 'client',
|
|
101
101
|
'x-sdk-language': 'reactnative',
|
|
102
|
-
'x-sdk-version': '0.7.
|
|
102
|
+
'x-sdk-version': '0.7.3',
|
|
103
103
|
'X-Appwrite-Response-Format': '1.6.0',
|
|
104
104
|
};
|
|
105
105
|
this.realtime = {
|
|
@@ -249,8 +249,11 @@ class Client {
|
|
|
249
249
|
* @returns {this}
|
|
250
250
|
*/
|
|
251
251
|
setEndpoint(endpoint) {
|
|
252
|
+
if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
|
|
253
|
+
throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
|
|
254
|
+
}
|
|
252
255
|
this.config.endpoint = endpoint;
|
|
253
|
-
this.config.endpointRealtime =
|
|
256
|
+
this.config.endpointRealtime = endpoint.replace('https://', 'wss://').replace('http://', 'ws://');
|
|
254
257
|
return this;
|
|
255
258
|
}
|
|
256
259
|
/**
|
|
@@ -261,6 +264,9 @@ class Client {
|
|
|
261
264
|
* @returns {this}
|
|
262
265
|
*/
|
|
263
266
|
setEndpointRealtime(endpointRealtime) {
|
|
267
|
+
if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
|
|
268
|
+
throw new AppwriteException('Invalid realtime endpoint URL: ' + endpointRealtime);
|
|
269
|
+
}
|
|
264
270
|
this.config.endpointRealtime = endpointRealtime;
|
|
265
271
|
return this;
|
|
266
272
|
}
|
|
@@ -464,9 +470,7 @@ class Account extends Service {
|
|
|
464
470
|
const apiPath = '/account';
|
|
465
471
|
const payload = {};
|
|
466
472
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
467
|
-
return this.client.call('get', uri, {
|
|
468
|
-
'content-type': 'application/json',
|
|
469
|
-
}, payload);
|
|
473
|
+
return this.client.call('get', uri, {}, payload);
|
|
470
474
|
}
|
|
471
475
|
/**
|
|
472
476
|
* Use this endpoint to allow a new user to register a new account in your
|
|
@@ -562,9 +566,7 @@ class Account extends Service {
|
|
|
562
566
|
payload['queries'] = queries;
|
|
563
567
|
}
|
|
564
568
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
565
|
-
return this.client.call('get', uri, {
|
|
566
|
-
'content-type': 'application/json',
|
|
567
|
-
}, payload);
|
|
569
|
+
return this.client.call('get', uri, {}, payload);
|
|
568
570
|
}
|
|
569
571
|
/**
|
|
570
572
|
* Delete an identity by its unique ID.
|
|
@@ -617,9 +619,7 @@ class Account extends Service {
|
|
|
617
619
|
payload['queries'] = queries;
|
|
618
620
|
}
|
|
619
621
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
620
|
-
return this.client.call('get', uri, {
|
|
621
|
-
'content-type': 'application/json',
|
|
622
|
-
}, payload);
|
|
622
|
+
return this.client.call('get', uri, {}, payload);
|
|
623
623
|
}
|
|
624
624
|
/**
|
|
625
625
|
* Enable or disable MFA on an account.
|
|
@@ -773,9 +773,7 @@ class Account extends Service {
|
|
|
773
773
|
const apiPath = '/account/mfa/factors';
|
|
774
774
|
const payload = {};
|
|
775
775
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
776
|
-
return this.client.call('get', uri, {
|
|
777
|
-
'content-type': 'application/json',
|
|
778
|
-
}, payload);
|
|
776
|
+
return this.client.call('get', uri, {}, payload);
|
|
779
777
|
}
|
|
780
778
|
/**
|
|
781
779
|
* Get recovery codes that can be used as backup for MFA flow. Before getting
|
|
@@ -790,9 +788,7 @@ class Account extends Service {
|
|
|
790
788
|
const apiPath = '/account/mfa/recovery-codes';
|
|
791
789
|
const payload = {};
|
|
792
790
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
793
|
-
return this.client.call('get', uri, {
|
|
794
|
-
'content-type': 'application/json',
|
|
795
|
-
}, payload);
|
|
791
|
+
return this.client.call('get', uri, {}, payload);
|
|
796
792
|
}
|
|
797
793
|
/**
|
|
798
794
|
* Generate recovery codes as backup for MFA flow. It's recommended to
|
|
@@ -919,9 +915,7 @@ class Account extends Service {
|
|
|
919
915
|
const apiPath = '/account/prefs';
|
|
920
916
|
const payload = {};
|
|
921
917
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
922
|
-
return this.client.call('get', uri, {
|
|
923
|
-
'content-type': 'application/json',
|
|
924
|
-
}, payload);
|
|
918
|
+
return this.client.call('get', uri, {}, payload);
|
|
925
919
|
}
|
|
926
920
|
/**
|
|
927
921
|
* Update currently logged in user account preferences. The object you pass is
|
|
@@ -1036,9 +1030,7 @@ class Account extends Service {
|
|
|
1036
1030
|
const apiPath = '/account/sessions';
|
|
1037
1031
|
const payload = {};
|
|
1038
1032
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1039
|
-
return this.client.call('get', uri, {
|
|
1040
|
-
'content-type': 'application/json',
|
|
1041
|
-
}, payload);
|
|
1033
|
+
return this.client.call('get', uri, {}, payload);
|
|
1042
1034
|
}
|
|
1043
1035
|
/**
|
|
1044
1036
|
* Delete all sessions from the user account and remove any sessions cookies
|
|
@@ -1260,9 +1252,7 @@ class Account extends Service {
|
|
|
1260
1252
|
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1261
1253
|
const payload = {};
|
|
1262
1254
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1263
|
-
return this.client.call('get', uri, {
|
|
1264
|
-
'content-type': 'application/json',
|
|
1265
|
-
}, payload);
|
|
1255
|
+
return this.client.call('get', uri, {}, payload);
|
|
1266
1256
|
}
|
|
1267
1257
|
/**
|
|
1268
1258
|
* Use this endpoint to extend a session's length. Extending a session is
|
|
@@ -2005,9 +1995,7 @@ class Databases extends Service {
|
|
|
2005
1995
|
payload['queries'] = queries;
|
|
2006
1996
|
}
|
|
2007
1997
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2008
|
-
return this.client.call('get', uri, {
|
|
2009
|
-
'content-type': 'application/json',
|
|
2010
|
-
}, payload);
|
|
1998
|
+
return this.client.call('get', uri, {}, payload);
|
|
2011
1999
|
}
|
|
2012
2000
|
/**
|
|
2013
2001
|
* Create a new Document. Before using this route, you should create a new
|
|
@@ -2080,9 +2068,7 @@ class Databases extends Service {
|
|
|
2080
2068
|
payload['queries'] = queries;
|
|
2081
2069
|
}
|
|
2082
2070
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2083
|
-
return this.client.call('get', uri, {
|
|
2084
|
-
'content-type': 'application/json',
|
|
2085
|
-
}, payload);
|
|
2071
|
+
return this.client.call('get', uri, {}, payload);
|
|
2086
2072
|
}
|
|
2087
2073
|
/**
|
|
2088
2074
|
* Update a document by its unique ID. Using the patch method you can pass
|
|
@@ -2174,9 +2160,7 @@ class Functions extends Service {
|
|
|
2174
2160
|
payload['search'] = search;
|
|
2175
2161
|
}
|
|
2176
2162
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2177
|
-
return this.client.call('get', uri, {
|
|
2178
|
-
'content-type': 'application/json',
|
|
2179
|
-
}, payload);
|
|
2163
|
+
return this.client.call('get', uri, {}, payload);
|
|
2180
2164
|
}
|
|
2181
2165
|
/**
|
|
2182
2166
|
* Trigger a function execution. The returned object will return you the
|
|
@@ -2241,9 +2225,7 @@ class Functions extends Service {
|
|
|
2241
2225
|
const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
2242
2226
|
const payload = {};
|
|
2243
2227
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2244
|
-
return this.client.call('get', uri, {
|
|
2245
|
-
'content-type': 'application/json',
|
|
2246
|
-
}, payload);
|
|
2228
|
+
return this.client.call('get', uri, {}, payload);
|
|
2247
2229
|
}
|
|
2248
2230
|
}
|
|
2249
2231
|
|
|
@@ -2316,9 +2298,7 @@ class Locale extends Service {
|
|
|
2316
2298
|
const apiPath = '/locale';
|
|
2317
2299
|
const payload = {};
|
|
2318
2300
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2319
|
-
return this.client.call('get', uri, {
|
|
2320
|
-
'content-type': 'application/json',
|
|
2321
|
-
}, payload);
|
|
2301
|
+
return this.client.call('get', uri, {}, payload);
|
|
2322
2302
|
}
|
|
2323
2303
|
/**
|
|
2324
2304
|
* List of all locale codes in [ISO
|
|
@@ -2331,9 +2311,7 @@ class Locale extends Service {
|
|
|
2331
2311
|
const apiPath = '/locale/codes';
|
|
2332
2312
|
const payload = {};
|
|
2333
2313
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2334
|
-
return this.client.call('get', uri, {
|
|
2335
|
-
'content-type': 'application/json',
|
|
2336
|
-
}, payload);
|
|
2314
|
+
return this.client.call('get', uri, {}, payload);
|
|
2337
2315
|
}
|
|
2338
2316
|
/**
|
|
2339
2317
|
* List of all continents. You can use the locale header to get the data in a
|
|
@@ -2346,9 +2324,7 @@ class Locale extends Service {
|
|
|
2346
2324
|
const apiPath = '/locale/continents';
|
|
2347
2325
|
const payload = {};
|
|
2348
2326
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2349
|
-
return this.client.call('get', uri, {
|
|
2350
|
-
'content-type': 'application/json',
|
|
2351
|
-
}, payload);
|
|
2327
|
+
return this.client.call('get', uri, {}, payload);
|
|
2352
2328
|
}
|
|
2353
2329
|
/**
|
|
2354
2330
|
* List of all countries. You can use the locale header to get the data in a
|
|
@@ -2361,9 +2337,7 @@ class Locale extends Service {
|
|
|
2361
2337
|
const apiPath = '/locale/countries';
|
|
2362
2338
|
const payload = {};
|
|
2363
2339
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2364
|
-
return this.client.call('get', uri, {
|
|
2365
|
-
'content-type': 'application/json',
|
|
2366
|
-
}, payload);
|
|
2340
|
+
return this.client.call('get', uri, {}, payload);
|
|
2367
2341
|
}
|
|
2368
2342
|
/**
|
|
2369
2343
|
* List of all countries that are currently members of the EU. You can use the
|
|
@@ -2376,9 +2350,7 @@ class Locale extends Service {
|
|
|
2376
2350
|
const apiPath = '/locale/countries/eu';
|
|
2377
2351
|
const payload = {};
|
|
2378
2352
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2379
|
-
return this.client.call('get', uri, {
|
|
2380
|
-
'content-type': 'application/json',
|
|
2381
|
-
}, payload);
|
|
2353
|
+
return this.client.call('get', uri, {}, payload);
|
|
2382
2354
|
}
|
|
2383
2355
|
/**
|
|
2384
2356
|
* List of all countries phone codes. You can use the locale header to get the
|
|
@@ -2391,9 +2363,7 @@ class Locale extends Service {
|
|
|
2391
2363
|
const apiPath = '/locale/countries/phones';
|
|
2392
2364
|
const payload = {};
|
|
2393
2365
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2394
|
-
return this.client.call('get', uri, {
|
|
2395
|
-
'content-type': 'application/json',
|
|
2396
|
-
}, payload);
|
|
2366
|
+
return this.client.call('get', uri, {}, payload);
|
|
2397
2367
|
}
|
|
2398
2368
|
/**
|
|
2399
2369
|
* List of all currencies, including currency symbol, name, plural, and
|
|
@@ -2407,9 +2377,7 @@ class Locale extends Service {
|
|
|
2407
2377
|
const apiPath = '/locale/currencies';
|
|
2408
2378
|
const payload = {};
|
|
2409
2379
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2410
|
-
return this.client.call('get', uri, {
|
|
2411
|
-
'content-type': 'application/json',
|
|
2412
|
-
}, payload);
|
|
2380
|
+
return this.client.call('get', uri, {}, payload);
|
|
2413
2381
|
}
|
|
2414
2382
|
/**
|
|
2415
2383
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
@@ -2422,9 +2390,7 @@ class Locale extends Service {
|
|
|
2422
2390
|
const apiPath = '/locale/languages';
|
|
2423
2391
|
const payload = {};
|
|
2424
2392
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2425
|
-
return this.client.call('get', uri, {
|
|
2426
|
-
'content-type': 'application/json',
|
|
2427
|
-
}, payload);
|
|
2393
|
+
return this.client.call('get', uri, {}, payload);
|
|
2428
2394
|
}
|
|
2429
2395
|
}
|
|
2430
2396
|
|
|
@@ -2515,9 +2481,7 @@ class Storage extends Service {
|
|
|
2515
2481
|
payload['search'] = search;
|
|
2516
2482
|
}
|
|
2517
2483
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2518
|
-
return this.client.call('get', uri, {
|
|
2519
|
-
'content-type': 'application/json',
|
|
2520
|
-
}, payload);
|
|
2484
|
+
return this.client.call('get', uri, {}, payload);
|
|
2521
2485
|
}
|
|
2522
2486
|
/**
|
|
2523
2487
|
* Create a new file. Before using this route, you should create a new bucket
|
|
@@ -2638,9 +2602,7 @@ class Storage extends Service {
|
|
|
2638
2602
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
2639
2603
|
const payload = {};
|
|
2640
2604
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2641
|
-
return this.client.call('get', uri, {
|
|
2642
|
-
'content-type': 'application/json',
|
|
2643
|
-
}, payload);
|
|
2605
|
+
return this.client.call('get', uri, {}, payload);
|
|
2644
2606
|
}
|
|
2645
2607
|
/**
|
|
2646
2608
|
* Update a file by its unique ID. Only users with write permissions have
|
|
@@ -2845,9 +2807,7 @@ class Teams extends Service {
|
|
|
2845
2807
|
payload['search'] = search;
|
|
2846
2808
|
}
|
|
2847
2809
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2848
|
-
return this.client.call('get', uri, {
|
|
2849
|
-
'content-type': 'application/json',
|
|
2850
|
-
}, payload);
|
|
2810
|
+
return this.client.call('get', uri, {}, payload);
|
|
2851
2811
|
}
|
|
2852
2812
|
/**
|
|
2853
2813
|
* Create a new team. The user who creates the team will automatically be
|
|
@@ -2897,9 +2857,7 @@ class Teams extends Service {
|
|
|
2897
2857
|
const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
2898
2858
|
const payload = {};
|
|
2899
2859
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2900
|
-
return this.client.call('get', uri, {
|
|
2901
|
-
'content-type': 'application/json',
|
|
2902
|
-
}, payload);
|
|
2860
|
+
return this.client.call('get', uri, {}, payload);
|
|
2903
2861
|
}
|
|
2904
2862
|
/**
|
|
2905
2863
|
* Update the team's name by its unique ID.
|
|
@@ -2969,9 +2927,7 @@ class Teams extends Service {
|
|
|
2969
2927
|
payload['search'] = search;
|
|
2970
2928
|
}
|
|
2971
2929
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2972
|
-
return this.client.call('get', uri, {
|
|
2973
|
-
'content-type': 'application/json',
|
|
2974
|
-
}, payload);
|
|
2930
|
+
return this.client.call('get', uri, {}, payload);
|
|
2975
2931
|
}
|
|
2976
2932
|
/**
|
|
2977
2933
|
* Invite a new member to join your team. Provide an ID for existing users, or
|
|
@@ -3058,9 +3014,7 @@ class Teams extends Service {
|
|
|
3058
3014
|
const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
3059
3015
|
const payload = {};
|
|
3060
3016
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3061
|
-
return this.client.call('get', uri, {
|
|
3062
|
-
'content-type': 'application/json',
|
|
3063
|
-
}, payload);
|
|
3017
|
+
return this.client.call('get', uri, {}, payload);
|
|
3064
3018
|
}
|
|
3065
3019
|
/**
|
|
3066
3020
|
* Modify the roles of a team member. Only team members with the owner role
|
|
@@ -3176,9 +3130,7 @@ class Teams extends Service {
|
|
|
3176
3130
|
const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
|
|
3177
3131
|
const payload = {};
|
|
3178
3132
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3179
|
-
return this.client.call('get', uri, {
|
|
3180
|
-
'content-type': 'application/json',
|
|
3181
|
-
}, payload);
|
|
3133
|
+
return this.client.call('get', uri, {}, payload);
|
|
3182
3134
|
}
|
|
3183
3135
|
/**
|
|
3184
3136
|
* Update the team's preferences by its unique ID. The object you pass is
|
|
@@ -3419,6 +3371,7 @@ exports.OAuthProvider = void 0;
|
|
|
3419
3371
|
OAuthProvider["Dropbox"] = "dropbox";
|
|
3420
3372
|
OAuthProvider["Etsy"] = "etsy";
|
|
3421
3373
|
OAuthProvider["Facebook"] = "facebook";
|
|
3374
|
+
OAuthProvider["Figma"] = "figma";
|
|
3422
3375
|
OAuthProvider["Github"] = "github";
|
|
3423
3376
|
OAuthProvider["Gitlab"] = "gitlab";
|
|
3424
3377
|
OAuthProvider["Google"] = "google";
|