react-native-appwrite 0.3.1 → 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.
Files changed (115) hide show
  1. package/.github/workflows/autoclose.yml +11 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/package.json +3 -0
  4. package/dist/cjs/sdk.js +20 -17
  5. package/dist/cjs/sdk.js.map +1 -1
  6. package/dist/esm/package.json +3 -0
  7. package/dist/esm/sdk.js +20 -17
  8. package/dist/esm/sdk.js.map +1 -1
  9. package/docs/examples/account/create-anonymous-session.md +2 -2
  10. package/docs/examples/account/create-email-password-session.md +2 -2
  11. package/docs/examples/account/create-email-token.md +2 -2
  12. package/docs/examples/account/create-j-w-t.md +2 -2
  13. package/docs/examples/account/create-magic-u-r-l-token.md +2 -2
  14. package/docs/examples/account/create-mfa-authenticator.md +2 -2
  15. package/docs/examples/account/create-mfa-challenge.md +2 -2
  16. package/docs/examples/account/create-mfa-recovery-codes.md +2 -2
  17. package/docs/examples/account/create-o-auth2session.md +1 -1
  18. package/docs/examples/account/create-o-auth2token.md +1 -1
  19. package/docs/examples/account/create-phone-token.md +2 -2
  20. package/docs/examples/account/create-phone-verification.md +2 -2
  21. package/docs/examples/account/create-push-target.md +2 -2
  22. package/docs/examples/account/create-recovery.md +2 -2
  23. package/docs/examples/account/create-session.md +2 -2
  24. package/docs/examples/account/create-verification.md +2 -2
  25. package/docs/examples/account/create.md +2 -2
  26. package/docs/examples/account/delete-identity.md +2 -2
  27. package/docs/examples/account/delete-mfa-authenticator.md +3 -4
  28. package/docs/examples/account/delete-push-target.md +2 -2
  29. package/docs/examples/account/delete-session.md +2 -2
  30. package/docs/examples/account/delete-sessions.md +2 -2
  31. package/docs/examples/account/get-mfa-recovery-codes.md +2 -2
  32. package/docs/examples/account/get-prefs.md +2 -2
  33. package/docs/examples/account/get-session.md +2 -2
  34. package/docs/examples/account/get.md +2 -2
  35. package/docs/examples/account/list-identities.md +2 -2
  36. package/docs/examples/account/list-logs.md +2 -2
  37. package/docs/examples/account/list-mfa-factors.md +2 -2
  38. package/docs/examples/account/list-sessions.md +2 -2
  39. package/docs/examples/account/update-email.md +2 -2
  40. package/docs/examples/account/update-m-f-a.md +2 -2
  41. package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
  42. package/docs/examples/account/update-mfa-authenticator.md +2 -2
  43. package/docs/examples/account/update-mfa-challenge.md +2 -2
  44. package/docs/examples/account/update-mfa-recovery-codes.md +2 -2
  45. package/docs/examples/account/update-name.md +2 -2
  46. package/docs/examples/account/update-password.md +2 -2
  47. package/docs/examples/account/update-phone-session.md +2 -2
  48. package/docs/examples/account/update-phone-verification.md +2 -2
  49. package/docs/examples/account/update-phone.md +2 -2
  50. package/docs/examples/account/update-prefs.md +2 -2
  51. package/docs/examples/account/update-push-target.md +2 -2
  52. package/docs/examples/account/update-recovery.md +2 -2
  53. package/docs/examples/account/update-session.md +2 -2
  54. package/docs/examples/account/update-status.md +2 -2
  55. package/docs/examples/account/update-verification.md +2 -2
  56. package/docs/examples/avatars/get-browser.md +1 -1
  57. package/docs/examples/avatars/get-credit-card.md +1 -1
  58. package/docs/examples/avatars/get-favicon.md +1 -1
  59. package/docs/examples/avatars/get-flag.md +1 -1
  60. package/docs/examples/avatars/get-image.md +1 -1
  61. package/docs/examples/avatars/get-initials.md +1 -1
  62. package/docs/examples/avatars/get-q-r.md +1 -1
  63. package/docs/examples/databases/create-document.md +2 -2
  64. package/docs/examples/databases/delete-document.md +2 -2
  65. package/docs/examples/databases/get-document.md +2 -2
  66. package/docs/examples/databases/list-documents.md +2 -2
  67. package/docs/examples/databases/update-document.md +2 -2
  68. package/docs/examples/functions/create-execution.md +4 -3
  69. package/docs/examples/functions/get-execution.md +2 -2
  70. package/docs/examples/functions/list-executions.md +2 -2
  71. package/docs/examples/graphql/mutation.md +2 -2
  72. package/docs/examples/graphql/query.md +2 -2
  73. package/docs/examples/locale/get.md +2 -2
  74. package/docs/examples/locale/list-codes.md +2 -2
  75. package/docs/examples/locale/list-continents.md +2 -2
  76. package/docs/examples/locale/list-countries-e-u.md +2 -2
  77. package/docs/examples/locale/list-countries-phones.md +2 -2
  78. package/docs/examples/locale/list-countries.md +2 -2
  79. package/docs/examples/locale/list-currencies.md +2 -2
  80. package/docs/examples/locale/list-languages.md +2 -2
  81. package/docs/examples/messaging/create-subscriber.md +2 -2
  82. package/docs/examples/messaging/delete-subscriber.md +2 -2
  83. package/docs/examples/storage/create-file.md +2 -2
  84. package/docs/examples/storage/delete-file.md +2 -2
  85. package/docs/examples/storage/get-file-download.md +1 -1
  86. package/docs/examples/storage/get-file-preview.md +1 -1
  87. package/docs/examples/storage/get-file-view.md +1 -1
  88. package/docs/examples/storage/get-file.md +2 -2
  89. package/docs/examples/storage/list-files.md +2 -2
  90. package/docs/examples/storage/update-file.md +2 -2
  91. package/docs/examples/teams/create-membership.md +2 -2
  92. package/docs/examples/teams/create.md +2 -2
  93. package/docs/examples/teams/delete-membership.md +2 -2
  94. package/docs/examples/teams/delete.md +2 -2
  95. package/docs/examples/teams/get-membership.md +2 -2
  96. package/docs/examples/teams/get-prefs.md +2 -2
  97. package/docs/examples/teams/get.md +2 -2
  98. package/docs/examples/teams/list-memberships.md +2 -2
  99. package/docs/examples/teams/list.md +2 -2
  100. package/docs/examples/teams/update-membership-status.md +2 -2
  101. package/docs/examples/teams/update-membership.md +2 -2
  102. package/docs/examples/teams/update-name.md +2 -2
  103. package/docs/examples/teams/update-prefs.md +2 -2
  104. package/package.json +1 -1
  105. package/src/client.ts +7 -2
  106. package/src/enums/credit-card.ts +1 -1
  107. package/src/models.ts +4 -0
  108. package/src/services/account.ts +6 -15
  109. package/src/services/avatars.ts +2 -0
  110. package/src/services/functions.ts +6 -1
  111. package/types/enums/credit-card.d.ts +1 -1
  112. package/types/models.d.ts +4 -0
  113. package/types/services/account.d.ts +5 -6
  114. package/types/services/avatars.d.ts +2 -0
  115. package/types/services/functions.d.ts +2 -1
@@ -0,0 +1,11 @@
1
+ name: Auto-close External Pull Requests
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, reopened]
6
+
7
+ jobs:
8
+ auto_close:
9
+ uses: appwrite/.github/.github/workflows/autoclose.yml@main
10
+ secrets:
11
+ GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Appwrite React Native SDK
2
2
 
3
3
  ![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square)
4
- ![Version](https://img.shields.io/badge/api%20version-1.5.4-blue.svg?style=flat-square)
4
+ ![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
5
5
  [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
6
6
  [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
7
7
  [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
8
8
 
9
- **This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).**
9
+ **This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-react-native/releases).**
10
10
 
11
11
  Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the React Native SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
12
12
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
package/dist/cjs/sdk.js CHANGED
@@ -99,8 +99,8 @@ 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.3.0',
103
- 'X-Appwrite-Response-Format': '1.5.0',
102
+ 'x-sdk-version': '0.5.0',
103
+ 'X-Appwrite-Response-Format': '1.6.0',
104
104
  };
105
105
  this.realtime = {
106
106
  socket: undefined,
@@ -396,6 +396,10 @@ class Client {
396
396
  try {
397
397
  let data = null;
398
398
  const response = yield fetch(url.toString(), options);
399
+ const warnings = response.headers.get('x-appwrite-warning');
400
+ if (warnings) {
401
+ warnings.split(';').forEach((warning) => console.warn('Warning: ' + warning));
402
+ }
399
403
  if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
400
404
  data = yield response.json();
401
405
  }
@@ -592,7 +596,7 @@ class Account extends Service {
592
596
  */
593
597
  createJWT() {
594
598
  return __awaiter(this, void 0, void 0, function* () {
595
- const apiPath = '/account/jwt';
599
+ const apiPath = '/account/jwts';
596
600
  const payload = {};
597
601
  const uri = new URL(this.client.config.endpoint + apiPath);
598
602
  return yield this.client.call('post', uri, {
@@ -649,7 +653,7 @@ class Account extends Service {
649
653
  });
650
654
  }
651
655
  /**
652
- * Add Authenticator
656
+ * Create Authenticator
653
657
  *
654
658
  * Add an authenticator app to be used as an MFA factor. Verify the
655
659
  * authenticator using the [verify
@@ -678,7 +682,7 @@ class Account extends Service {
678
682
  *
679
683
  * Verify an authenticator app after adding it using the [add
680
684
  * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
681
- * method. add
685
+ * method.
682
686
  *
683
687
  * @param {AuthenticatorType} type
684
688
  * @param {string} otp
@@ -710,23 +714,16 @@ class Account extends Service {
710
714
  * Delete an authenticator for a user by ID.
711
715
  *
712
716
  * @param {AuthenticatorType} type
713
- * @param {string} otp
714
717
  * @throws {AppwriteException}
715
718
  * @returns {Promise}
716
719
  */
717
- deleteMfaAuthenticator(type, otp) {
720
+ deleteMfaAuthenticator(type) {
718
721
  return __awaiter(this, void 0, void 0, function* () {
719
722
  if (typeof type === 'undefined') {
720
723
  throw new AppwriteException('Missing required parameter: "type"');
721
724
  }
722
- if (typeof otp === 'undefined') {
723
- throw new AppwriteException('Missing required parameter: "otp"');
724
- }
725
725
  const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
726
726
  const payload = {};
727
- if (typeof otp !== 'undefined') {
728
- payload['otp'] = otp;
729
- }
730
727
  const uri = new URL(this.client.config.endpoint + apiPath);
731
728
  return yield this.client.call('delete', uri, {
732
729
  'content-type': 'application/json',
@@ -734,7 +731,7 @@ class Account extends Service {
734
731
  });
735
732
  }
736
733
  /**
737
- * Create 2FA Challenge
734
+ * Create MFA Challenge
738
735
  *
739
736
  * Begin the process of MFA verification after sign-in. Finish the flow with
740
737
  * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
@@ -1817,7 +1814,7 @@ class Account extends Service {
1817
1814
  });
1818
1815
  }
1819
1816
  /**
1820
- * Create phone verification (confirmation)
1817
+ * Update phone verification (confirmation)
1821
1818
  *
1822
1819
  * Use this endpoint to complete the user phone verification process. Use the
1823
1820
  * **userId** and **secret** that were sent to your user's phone number to
@@ -1948,6 +1945,7 @@ class Avatars extends Service {
1948
1945
  * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
1949
1946
  * website URL.
1950
1947
  *
1948
+ * This endpoint does not follow HTTP redirects.
1951
1949
  *
1952
1950
  * @param {string} url
1953
1951
  * @throws {AppwriteException}
@@ -2025,6 +2023,7 @@ class Avatars extends Service {
2025
2023
  * image at source quality. If dimensions are not specified, the default size
2026
2024
  * of image returned is 400x400px.
2027
2025
  *
2026
+ * This endpoint does not follow HTTP redirects.
2028
2027
  *
2029
2028
  * @param {string} url
2030
2029
  * @param {number} width
@@ -2381,10 +2380,11 @@ class Functions extends Service {
2381
2380
  * @param {string} xpath
2382
2381
  * @param {ExecutionMethod} method
2383
2382
  * @param {object} headers
2383
+ * @param {string} scheduledAt
2384
2384
  * @throws {AppwriteException}
2385
2385
  * @returns {Promise}
2386
2386
  */
2387
- createExecution(functionId, body, async, xpath, method, headers) {
2387
+ createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
2388
2388
  return __awaiter(this, void 0, void 0, function* () {
2389
2389
  if (typeof functionId === 'undefined') {
2390
2390
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -2406,6 +2406,9 @@ class Functions extends Service {
2406
2406
  if (typeof headers !== 'undefined') {
2407
2407
  payload['headers'] = headers;
2408
2408
  }
2409
+ if (typeof scheduledAt !== 'undefined') {
2410
+ payload['scheduledAt'] = scheduledAt;
2411
+ }
2409
2412
  const uri = new URL(this.client.config.endpoint + apiPath);
2410
2413
  return yield this.client.call('post', uri, {
2411
2414
  'content-type': 'application/json',
@@ -3786,7 +3789,7 @@ exports.CreditCard = void 0;
3786
3789
  CreditCard["AmericanExpress"] = "amex";
3787
3790
  CreditCard["Argencard"] = "argencard";
3788
3791
  CreditCard["Cabal"] = "cabal";
3789
- CreditCard["Consosud"] = "censosud";
3792
+ CreditCard["Cencosud"] = "cencosud";
3790
3793
  CreditCard["DinersClub"] = "diners";
3791
3794
  CreditCard["Discover"] = "discover";
3792
3795
  CreditCard["Elo"] = "elo";