react-native-appwrite 0.4.0 → 0.5.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.
- package/.github/workflows/autoclose.yml +11 -0
- package/README.md +2 -2
- package/dist/cjs/sdk.js +19 -16
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +19 -16
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-anonymous-session.md +2 -2
- package/docs/examples/account/create-email-password-session.md +2 -2
- package/docs/examples/account/create-email-token.md +2 -2
- package/docs/examples/account/create-j-w-t.md +2 -2
- package/docs/examples/account/create-magic-u-r-l-token.md +2 -2
- package/docs/examples/account/create-mfa-authenticator.md +2 -2
- package/docs/examples/account/create-mfa-challenge.md +2 -2
- package/docs/examples/account/create-mfa-recovery-codes.md +2 -2
- package/docs/examples/account/create-o-auth2session.md +1 -1
- package/docs/examples/account/create-o-auth2token.md +1 -1
- package/docs/examples/account/create-phone-token.md +2 -2
- package/docs/examples/account/create-phone-verification.md +2 -2
- package/docs/examples/account/create-push-target.md +2 -2
- package/docs/examples/account/create-recovery.md +2 -2
- package/docs/examples/account/create-session.md +2 -2
- package/docs/examples/account/create-verification.md +2 -2
- package/docs/examples/account/create.md +2 -2
- package/docs/examples/account/delete-identity.md +2 -2
- package/docs/examples/account/delete-mfa-authenticator.md +3 -4
- package/docs/examples/account/delete-push-target.md +2 -2
- package/docs/examples/account/delete-session.md +2 -2
- package/docs/examples/account/delete-sessions.md +2 -2
- package/docs/examples/account/get-mfa-recovery-codes.md +2 -2
- package/docs/examples/account/get-prefs.md +2 -2
- package/docs/examples/account/get-session.md +2 -2
- package/docs/examples/account/get.md +2 -2
- package/docs/examples/account/list-identities.md +2 -2
- package/docs/examples/account/list-logs.md +2 -2
- package/docs/examples/account/list-mfa-factors.md +2 -2
- package/docs/examples/account/list-sessions.md +2 -2
- package/docs/examples/account/update-email.md +2 -2
- package/docs/examples/account/update-m-f-a.md +2 -2
- package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
- package/docs/examples/account/update-mfa-authenticator.md +2 -2
- package/docs/examples/account/update-mfa-challenge.md +2 -2
- package/docs/examples/account/update-mfa-recovery-codes.md +2 -2
- package/docs/examples/account/update-name.md +2 -2
- package/docs/examples/account/update-password.md +2 -2
- package/docs/examples/account/update-phone-session.md +2 -2
- package/docs/examples/account/update-phone-verification.md +2 -2
- package/docs/examples/account/update-phone.md +2 -2
- package/docs/examples/account/update-prefs.md +2 -2
- package/docs/examples/account/update-push-target.md +2 -2
- package/docs/examples/account/update-recovery.md +2 -2
- package/docs/examples/account/update-session.md +2 -2
- package/docs/examples/account/update-status.md +2 -2
- package/docs/examples/account/update-verification.md +2 -2
- package/docs/examples/avatars/get-browser.md +1 -1
- package/docs/examples/avatars/get-credit-card.md +1 -1
- package/docs/examples/avatars/get-favicon.md +1 -1
- package/docs/examples/avatars/get-flag.md +1 -1
- package/docs/examples/avatars/get-image.md +1 -1
- package/docs/examples/avatars/get-initials.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/databases/create-document.md +2 -2
- package/docs/examples/databases/delete-document.md +2 -2
- package/docs/examples/databases/get-document.md +2 -2
- package/docs/examples/databases/list-documents.md +2 -2
- package/docs/examples/databases/update-document.md +2 -2
- package/docs/examples/functions/create-execution.md +4 -3
- package/docs/examples/functions/get-execution.md +2 -2
- package/docs/examples/functions/list-executions.md +2 -2
- package/docs/examples/graphql/mutation.md +2 -2
- package/docs/examples/graphql/query.md +2 -2
- package/docs/examples/locale/get.md +2 -2
- package/docs/examples/locale/list-codes.md +2 -2
- package/docs/examples/locale/list-continents.md +2 -2
- package/docs/examples/locale/list-countries-e-u.md +2 -2
- package/docs/examples/locale/list-countries-phones.md +2 -2
- package/docs/examples/locale/list-countries.md +2 -2
- package/docs/examples/locale/list-currencies.md +2 -2
- package/docs/examples/locale/list-languages.md +2 -2
- package/docs/examples/messaging/create-subscriber.md +2 -2
- package/docs/examples/messaging/delete-subscriber.md +2 -2
- package/docs/examples/storage/create-file.md +2 -2
- package/docs/examples/storage/delete-file.md +2 -2
- package/docs/examples/storage/get-file-download.md +1 -1
- package/docs/examples/storage/get-file-preview.md +1 -1
- package/docs/examples/storage/get-file-view.md +1 -1
- package/docs/examples/storage/get-file.md +2 -2
- package/docs/examples/storage/list-files.md +2 -2
- package/docs/examples/storage/update-file.md +2 -2
- package/docs/examples/teams/create-membership.md +2 -2
- package/docs/examples/teams/create.md +2 -2
- package/docs/examples/teams/delete-membership.md +2 -2
- package/docs/examples/teams/delete.md +2 -2
- package/docs/examples/teams/get-membership.md +2 -2
- package/docs/examples/teams/get-prefs.md +2 -2
- package/docs/examples/teams/get.md +2 -2
- package/docs/examples/teams/list-memberships.md +2 -2
- package/docs/examples/teams/list.md +2 -2
- package/docs/examples/teams/update-membership-status.md +2 -2
- package/docs/examples/teams/update-membership.md +2 -2
- package/docs/examples/teams/update-name.md +2 -2
- package/docs/examples/teams/update-prefs.md +2 -2
- package/package.json +1 -1
- package/src/client.ts +7 -2
- package/src/models.ts +4 -0
- package/src/services/account.ts +6 -15
- package/src/services/avatars.ts +2 -0
- package/src/services/functions.ts +6 -1
- package/types/models.d.ts +4 -0
- package/types/services/account.d.ts +5 -6
- package/types/services/avatars.d.ts +2 -0
- package/types/services/functions.d.ts +2 -1
package/dist/esm/sdk.js
CHANGED
|
@@ -77,8 +77,8 @@ 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.
|
|
81
|
-
'X-Appwrite-Response-Format': '1.
|
|
80
|
+
'x-sdk-version': '0.5.0',
|
|
81
|
+
'X-Appwrite-Response-Format': '1.6.0',
|
|
82
82
|
};
|
|
83
83
|
this.realtime = {
|
|
84
84
|
socket: undefined,
|
|
@@ -374,6 +374,10 @@ class Client {
|
|
|
374
374
|
try {
|
|
375
375
|
let data = null;
|
|
376
376
|
const response = yield fetch(url.toString(), options);
|
|
377
|
+
const warnings = response.headers.get('x-appwrite-warning');
|
|
378
|
+
if (warnings) {
|
|
379
|
+
warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
|
|
380
|
+
}
|
|
377
381
|
if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
|
|
378
382
|
data = yield response.json();
|
|
379
383
|
}
|
|
@@ -570,7 +574,7 @@ class Account extends Service {
|
|
|
570
574
|
*/
|
|
571
575
|
createJWT() {
|
|
572
576
|
return __awaiter(this, void 0, void 0, function* () {
|
|
573
|
-
const apiPath = '/account/
|
|
577
|
+
const apiPath = '/account/jwts';
|
|
574
578
|
const payload = {};
|
|
575
579
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
576
580
|
return yield this.client.call('post', uri, {
|
|
@@ -627,7 +631,7 @@ class Account extends Service {
|
|
|
627
631
|
});
|
|
628
632
|
}
|
|
629
633
|
/**
|
|
630
|
-
*
|
|
634
|
+
* Create Authenticator
|
|
631
635
|
*
|
|
632
636
|
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
633
637
|
* authenticator using the [verify
|
|
@@ -656,7 +660,7 @@ class Account extends Service {
|
|
|
656
660
|
*
|
|
657
661
|
* Verify an authenticator app after adding it using the [add
|
|
658
662
|
* authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
|
|
659
|
-
* method.
|
|
663
|
+
* method.
|
|
660
664
|
*
|
|
661
665
|
* @param {AuthenticatorType} type
|
|
662
666
|
* @param {string} otp
|
|
@@ -688,23 +692,16 @@ class Account extends Service {
|
|
|
688
692
|
* Delete an authenticator for a user by ID.
|
|
689
693
|
*
|
|
690
694
|
* @param {AuthenticatorType} type
|
|
691
|
-
* @param {string} otp
|
|
692
695
|
* @throws {AppwriteException}
|
|
693
696
|
* @returns {Promise}
|
|
694
697
|
*/
|
|
695
|
-
deleteMfaAuthenticator(type
|
|
698
|
+
deleteMfaAuthenticator(type) {
|
|
696
699
|
return __awaiter(this, void 0, void 0, function* () {
|
|
697
700
|
if (typeof type === 'undefined') {
|
|
698
701
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
699
702
|
}
|
|
700
|
-
if (typeof otp === 'undefined') {
|
|
701
|
-
throw new AppwriteException('Missing required parameter: "otp"');
|
|
702
|
-
}
|
|
703
703
|
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
704
704
|
const payload = {};
|
|
705
|
-
if (typeof otp !== 'undefined') {
|
|
706
|
-
payload['otp'] = otp;
|
|
707
|
-
}
|
|
708
705
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
709
706
|
return yield this.client.call('delete', uri, {
|
|
710
707
|
'content-type': 'application/json',
|
|
@@ -712,7 +709,7 @@ class Account extends Service {
|
|
|
712
709
|
});
|
|
713
710
|
}
|
|
714
711
|
/**
|
|
715
|
-
* Create
|
|
712
|
+
* Create MFA Challenge
|
|
716
713
|
*
|
|
717
714
|
* Begin the process of MFA verification after sign-in. Finish the flow with
|
|
718
715
|
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
|
|
@@ -1795,7 +1792,7 @@ class Account extends Service {
|
|
|
1795
1792
|
});
|
|
1796
1793
|
}
|
|
1797
1794
|
/**
|
|
1798
|
-
*
|
|
1795
|
+
* Update phone verification (confirmation)
|
|
1799
1796
|
*
|
|
1800
1797
|
* Use this endpoint to complete the user phone verification process. Use the
|
|
1801
1798
|
* **userId** and **secret** that were sent to your user's phone number to
|
|
@@ -1926,6 +1923,7 @@ class Avatars extends Service {
|
|
|
1926
1923
|
* Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
|
|
1927
1924
|
* website URL.
|
|
1928
1925
|
*
|
|
1926
|
+
* This endpoint does not follow HTTP redirects.
|
|
1929
1927
|
*
|
|
1930
1928
|
* @param {string} url
|
|
1931
1929
|
* @throws {AppwriteException}
|
|
@@ -2003,6 +2001,7 @@ class Avatars extends Service {
|
|
|
2003
2001
|
* image at source quality. If dimensions are not specified, the default size
|
|
2004
2002
|
* of image returned is 400x400px.
|
|
2005
2003
|
*
|
|
2004
|
+
* This endpoint does not follow HTTP redirects.
|
|
2006
2005
|
*
|
|
2007
2006
|
* @param {string} url
|
|
2008
2007
|
* @param {number} width
|
|
@@ -2359,10 +2358,11 @@ class Functions extends Service {
|
|
|
2359
2358
|
* @param {string} xpath
|
|
2360
2359
|
* @param {ExecutionMethod} method
|
|
2361
2360
|
* @param {object} headers
|
|
2361
|
+
* @param {string} scheduledAt
|
|
2362
2362
|
* @throws {AppwriteException}
|
|
2363
2363
|
* @returns {Promise}
|
|
2364
2364
|
*/
|
|
2365
|
-
createExecution(functionId, body, async, xpath, method, headers) {
|
|
2365
|
+
createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
|
|
2366
2366
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2367
2367
|
if (typeof functionId === 'undefined') {
|
|
2368
2368
|
throw new AppwriteException('Missing required parameter: "functionId"');
|
|
@@ -2384,6 +2384,9 @@ class Functions extends Service {
|
|
|
2384
2384
|
if (typeof headers !== 'undefined') {
|
|
2385
2385
|
payload['headers'] = headers;
|
|
2386
2386
|
}
|
|
2387
|
+
if (typeof scheduledAt !== 'undefined') {
|
|
2388
|
+
payload['scheduledAt'] = scheduledAt;
|
|
2389
|
+
}
|
|
2387
2390
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2388
2391
|
return yield this.client.call('post', uri, {
|
|
2389
2392
|
'content-type': 'application/json',
|