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/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.
|
|
80
|
+
'x-sdk-version': '0.7.3',
|
|
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 =
|
|
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
|
|
@@ -2058,9 +2046,7 @@ class Databases extends Service {
|
|
|
2058
2046
|
payload['queries'] = queries;
|
|
2059
2047
|
}
|
|
2060
2048
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2061
|
-
return this.client.call('get', uri, {
|
|
2062
|
-
'content-type': 'application/json',
|
|
2063
|
-
}, payload);
|
|
2049
|
+
return this.client.call('get', uri, {}, payload);
|
|
2064
2050
|
}
|
|
2065
2051
|
/**
|
|
2066
2052
|
* Update a document by its unique ID. Using the patch method you can pass
|
|
@@ -2152,9 +2138,7 @@ class Functions extends Service {
|
|
|
2152
2138
|
payload['search'] = search;
|
|
2153
2139
|
}
|
|
2154
2140
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2155
|
-
return this.client.call('get', uri, {
|
|
2156
|
-
'content-type': 'application/json',
|
|
2157
|
-
}, payload);
|
|
2141
|
+
return this.client.call('get', uri, {}, payload);
|
|
2158
2142
|
}
|
|
2159
2143
|
/**
|
|
2160
2144
|
* Trigger a function execution. The returned object will return you the
|
|
@@ -2219,9 +2203,7 @@ class Functions extends Service {
|
|
|
2219
2203
|
const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
2220
2204
|
const payload = {};
|
|
2221
2205
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2222
|
-
return this.client.call('get', uri, {
|
|
2223
|
-
'content-type': 'application/json',
|
|
2224
|
-
}, payload);
|
|
2206
|
+
return this.client.call('get', uri, {}, payload);
|
|
2225
2207
|
}
|
|
2226
2208
|
}
|
|
2227
2209
|
|
|
@@ -2294,9 +2276,7 @@ class Locale extends Service {
|
|
|
2294
2276
|
const apiPath = '/locale';
|
|
2295
2277
|
const payload = {};
|
|
2296
2278
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2297
|
-
return this.client.call('get', uri, {
|
|
2298
|
-
'content-type': 'application/json',
|
|
2299
|
-
}, payload);
|
|
2279
|
+
return this.client.call('get', uri, {}, payload);
|
|
2300
2280
|
}
|
|
2301
2281
|
/**
|
|
2302
2282
|
* List of all locale codes in [ISO
|
|
@@ -2309,9 +2289,7 @@ class Locale extends Service {
|
|
|
2309
2289
|
const apiPath = '/locale/codes';
|
|
2310
2290
|
const payload = {};
|
|
2311
2291
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2312
|
-
return this.client.call('get', uri, {
|
|
2313
|
-
'content-type': 'application/json',
|
|
2314
|
-
}, payload);
|
|
2292
|
+
return this.client.call('get', uri, {}, payload);
|
|
2315
2293
|
}
|
|
2316
2294
|
/**
|
|
2317
2295
|
* List of all continents. You can use the locale header to get the data in a
|
|
@@ -2324,9 +2302,7 @@ class Locale extends Service {
|
|
|
2324
2302
|
const apiPath = '/locale/continents';
|
|
2325
2303
|
const payload = {};
|
|
2326
2304
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2327
|
-
return this.client.call('get', uri, {
|
|
2328
|
-
'content-type': 'application/json',
|
|
2329
|
-
}, payload);
|
|
2305
|
+
return this.client.call('get', uri, {}, payload);
|
|
2330
2306
|
}
|
|
2331
2307
|
/**
|
|
2332
2308
|
* List of all countries. You can use the locale header to get the data in a
|
|
@@ -2339,9 +2315,7 @@ class Locale extends Service {
|
|
|
2339
2315
|
const apiPath = '/locale/countries';
|
|
2340
2316
|
const payload = {};
|
|
2341
2317
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2342
|
-
return this.client.call('get', uri, {
|
|
2343
|
-
'content-type': 'application/json',
|
|
2344
|
-
}, payload);
|
|
2318
|
+
return this.client.call('get', uri, {}, payload);
|
|
2345
2319
|
}
|
|
2346
2320
|
/**
|
|
2347
2321
|
* List of all countries that are currently members of the EU. You can use the
|
|
@@ -2354,9 +2328,7 @@ class Locale extends Service {
|
|
|
2354
2328
|
const apiPath = '/locale/countries/eu';
|
|
2355
2329
|
const payload = {};
|
|
2356
2330
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2357
|
-
return this.client.call('get', uri, {
|
|
2358
|
-
'content-type': 'application/json',
|
|
2359
|
-
}, payload);
|
|
2331
|
+
return this.client.call('get', uri, {}, payload);
|
|
2360
2332
|
}
|
|
2361
2333
|
/**
|
|
2362
2334
|
* List of all countries phone codes. You can use the locale header to get the
|
|
@@ -2369,9 +2341,7 @@ class Locale extends Service {
|
|
|
2369
2341
|
const apiPath = '/locale/countries/phones';
|
|
2370
2342
|
const payload = {};
|
|
2371
2343
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2372
|
-
return this.client.call('get', uri, {
|
|
2373
|
-
'content-type': 'application/json',
|
|
2374
|
-
}, payload);
|
|
2344
|
+
return this.client.call('get', uri, {}, payload);
|
|
2375
2345
|
}
|
|
2376
2346
|
/**
|
|
2377
2347
|
* List of all currencies, including currency symbol, name, plural, and
|
|
@@ -2385,9 +2355,7 @@ class Locale extends Service {
|
|
|
2385
2355
|
const apiPath = '/locale/currencies';
|
|
2386
2356
|
const payload = {};
|
|
2387
2357
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2388
|
-
return this.client.call('get', uri, {
|
|
2389
|
-
'content-type': 'application/json',
|
|
2390
|
-
}, payload);
|
|
2358
|
+
return this.client.call('get', uri, {}, payload);
|
|
2391
2359
|
}
|
|
2392
2360
|
/**
|
|
2393
2361
|
* List of all languages classified by ISO 639-1 including 2-letter code, name
|
|
@@ -2400,9 +2368,7 @@ class Locale extends Service {
|
|
|
2400
2368
|
const apiPath = '/locale/languages';
|
|
2401
2369
|
const payload = {};
|
|
2402
2370
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2403
|
-
return this.client.call('get', uri, {
|
|
2404
|
-
'content-type': 'application/json',
|
|
2405
|
-
}, payload);
|
|
2371
|
+
return this.client.call('get', uri, {}, payload);
|
|
2406
2372
|
}
|
|
2407
2373
|
}
|
|
2408
2374
|
|
|
@@ -2493,9 +2459,7 @@ class Storage extends Service {
|
|
|
2493
2459
|
payload['search'] = search;
|
|
2494
2460
|
}
|
|
2495
2461
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2496
|
-
return this.client.call('get', uri, {
|
|
2497
|
-
'content-type': 'application/json',
|
|
2498
|
-
}, payload);
|
|
2462
|
+
return this.client.call('get', uri, {}, payload);
|
|
2499
2463
|
}
|
|
2500
2464
|
/**
|
|
2501
2465
|
* Create a new file. Before using this route, you should create a new bucket
|
|
@@ -2616,9 +2580,7 @@ class Storage extends Service {
|
|
|
2616
2580
|
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
2617
2581
|
const payload = {};
|
|
2618
2582
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2619
|
-
return this.client.call('get', uri, {
|
|
2620
|
-
'content-type': 'application/json',
|
|
2621
|
-
}, payload);
|
|
2583
|
+
return this.client.call('get', uri, {}, payload);
|
|
2622
2584
|
}
|
|
2623
2585
|
/**
|
|
2624
2586
|
* Update a file by its unique ID. Only users with write permissions have
|
|
@@ -2823,9 +2785,7 @@ class Teams extends Service {
|
|
|
2823
2785
|
payload['search'] = search;
|
|
2824
2786
|
}
|
|
2825
2787
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2826
|
-
return this.client.call('get', uri, {
|
|
2827
|
-
'content-type': 'application/json',
|
|
2828
|
-
}, payload);
|
|
2788
|
+
return this.client.call('get', uri, {}, payload);
|
|
2829
2789
|
}
|
|
2830
2790
|
/**
|
|
2831
2791
|
* Create a new team. The user who creates the team will automatically be
|
|
@@ -2875,9 +2835,7 @@ class Teams extends Service {
|
|
|
2875
2835
|
const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId);
|
|
2876
2836
|
const payload = {};
|
|
2877
2837
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2878
|
-
return this.client.call('get', uri, {
|
|
2879
|
-
'content-type': 'application/json',
|
|
2880
|
-
}, payload);
|
|
2838
|
+
return this.client.call('get', uri, {}, payload);
|
|
2881
2839
|
}
|
|
2882
2840
|
/**
|
|
2883
2841
|
* Update the team's name by its unique ID.
|
|
@@ -2947,9 +2905,7 @@ class Teams extends Service {
|
|
|
2947
2905
|
payload['search'] = search;
|
|
2948
2906
|
}
|
|
2949
2907
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2950
|
-
return this.client.call('get', uri, {
|
|
2951
|
-
'content-type': 'application/json',
|
|
2952
|
-
}, payload);
|
|
2908
|
+
return this.client.call('get', uri, {}, payload);
|
|
2953
2909
|
}
|
|
2954
2910
|
/**
|
|
2955
2911
|
* Invite a new member to join your team. Provide an ID for existing users, or
|
|
@@ -3036,9 +2992,7 @@ class Teams extends Service {
|
|
|
3036
2992
|
const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
|
|
3037
2993
|
const payload = {};
|
|
3038
2994
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3039
|
-
return this.client.call('get', uri, {
|
|
3040
|
-
'content-type': 'application/json',
|
|
3041
|
-
}, payload);
|
|
2995
|
+
return this.client.call('get', uri, {}, payload);
|
|
3042
2996
|
}
|
|
3043
2997
|
/**
|
|
3044
2998
|
* Modify the roles of a team member. Only team members with the owner role
|
|
@@ -3154,9 +3108,7 @@ class Teams extends Service {
|
|
|
3154
3108
|
const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
|
|
3155
3109
|
const payload = {};
|
|
3156
3110
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3157
|
-
return this.client.call('get', uri, {
|
|
3158
|
-
'content-type': 'application/json',
|
|
3159
|
-
}, payload);
|
|
3111
|
+
return this.client.call('get', uri, {}, payload);
|
|
3160
3112
|
}
|
|
3161
3113
|
/**
|
|
3162
3114
|
* Update the team's preferences by its unique ID. The object you pass is
|
|
@@ -3397,6 +3349,7 @@ var OAuthProvider;
|
|
|
3397
3349
|
OAuthProvider["Dropbox"] = "dropbox";
|
|
3398
3350
|
OAuthProvider["Etsy"] = "etsy";
|
|
3399
3351
|
OAuthProvider["Facebook"] = "facebook";
|
|
3352
|
+
OAuthProvider["Figma"] = "figma";
|
|
3400
3353
|
OAuthProvider["Github"] = "github";
|
|
3401
3354
|
OAuthProvider["Gitlab"] = "gitlab";
|
|
3402
3355
|
OAuthProvider["Google"] = "google";
|