react-native-appwrite 0.2.1 → 0.3.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 (131) hide show
  1. package/.github/workflows/publish.yml +13 -4
  2. package/CHANGELOG.md +1 -1
  3. package/LICENSE +1 -1
  4. package/README.md +22 -9
  5. package/dist/cjs/sdk.js +1196 -273
  6. package/dist/cjs/sdk.js.map +1 -1
  7. package/dist/esm/sdk.js +1196 -273
  8. package/dist/esm/sdk.js.map +1 -1
  9. package/docs/examples/account/create-anonymous-session.md +6 -13
  10. package/docs/examples/account/create-email-password-session.md +14 -0
  11. package/docs/examples/account/create-email-token.md +15 -0
  12. package/docs/examples/account/create-j-w-t.md +6 -13
  13. package/docs/examples/account/create-magic-u-r-l-token.md +16 -0
  14. package/docs/examples/account/create-mfa-authenticator.md +13 -0
  15. package/docs/examples/account/create-mfa-challenge.md +13 -0
  16. package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
  17. package/docs/examples/account/create-o-auth2session.md +10 -9
  18. package/docs/examples/account/create-o-auth2token.md +15 -0
  19. package/docs/examples/account/create-phone-token.md +14 -0
  20. package/docs/examples/account/create-phone-verification.md +6 -13
  21. package/docs/examples/account/create-push-target.md +15 -0
  22. package/docs/examples/account/create-recovery.md +9 -13
  23. package/docs/examples/account/create-session.md +14 -0
  24. package/docs/examples/account/create-verification.md +8 -13
  25. package/docs/examples/account/create.md +11 -13
  26. package/docs/examples/account/delete-identity.md +8 -13
  27. package/docs/examples/account/delete-mfa-authenticator.md +14 -0
  28. package/docs/examples/account/delete-push-target.md +13 -0
  29. package/docs/examples/account/delete-session.md +8 -13
  30. package/docs/examples/account/delete-sessions.md +6 -13
  31. package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
  32. package/docs/examples/account/get-prefs.md +6 -13
  33. package/docs/examples/account/get-session.md +8 -13
  34. package/docs/examples/account/get.md +6 -13
  35. package/docs/examples/account/list-identities.md +8 -13
  36. package/docs/examples/account/list-logs.md +8 -13
  37. package/docs/examples/account/list-mfa-factors.md +11 -0
  38. package/docs/examples/account/list-sessions.md +6 -13
  39. package/docs/examples/account/update-email.md +9 -13
  40. package/docs/examples/account/update-m-f-a.md +13 -0
  41. package/docs/examples/account/update-magic-u-r-l-session.md +9 -13
  42. package/docs/examples/account/update-mfa-authenticator.md +14 -0
  43. package/docs/examples/account/update-mfa-challenge.md +14 -0
  44. package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
  45. package/docs/examples/account/update-name.md +8 -13
  46. package/docs/examples/account/update-password.md +9 -13
  47. package/docs/examples/account/update-phone-session.md +9 -13
  48. package/docs/examples/account/update-phone-verification.md +9 -13
  49. package/docs/examples/account/update-phone.md +9 -13
  50. package/docs/examples/account/update-prefs.md +8 -13
  51. package/docs/examples/account/update-push-target.md +14 -0
  52. package/docs/examples/account/update-recovery.md +10 -13
  53. package/docs/examples/account/update-session.md +8 -13
  54. package/docs/examples/account/update-status.md +6 -13
  55. package/docs/examples/account/update-verification.md +9 -13
  56. package/docs/examples/avatars/get-browser.md +11 -9
  57. package/docs/examples/avatars/get-credit-card.md +11 -9
  58. package/docs/examples/avatars/get-favicon.md +8 -9
  59. package/docs/examples/avatars/get-flag.md +11 -9
  60. package/docs/examples/avatars/get-image.md +10 -9
  61. package/docs/examples/avatars/get-initials.md +11 -9
  62. package/docs/examples/avatars/get-q-r.md +11 -9
  63. package/docs/examples/databases/create-document.md +12 -13
  64. package/docs/examples/databases/delete-document.md +10 -13
  65. package/docs/examples/databases/get-document.md +11 -13
  66. package/docs/examples/databases/list-documents.md +10 -13
  67. package/docs/examples/databases/update-document.md +12 -13
  68. package/docs/examples/functions/create-execution.md +13 -13
  69. package/docs/examples/functions/get-execution.md +9 -13
  70. package/docs/examples/functions/list-executions.md +10 -13
  71. package/docs/examples/graphql/mutation.md +8 -13
  72. package/docs/examples/graphql/query.md +8 -13
  73. package/docs/examples/locale/get.md +6 -13
  74. package/docs/examples/locale/list-codes.md +6 -13
  75. package/docs/examples/locale/list-continents.md +6 -13
  76. package/docs/examples/locale/list-countries-e-u.md +6 -13
  77. package/docs/examples/locale/list-countries-phones.md +6 -13
  78. package/docs/examples/locale/list-countries.md +6 -13
  79. package/docs/examples/locale/list-currencies.md +6 -13
  80. package/docs/examples/locale/list-languages.md +6 -13
  81. package/docs/examples/messaging/create-subscriber.md +15 -0
  82. package/docs/examples/messaging/delete-subscriber.md +14 -0
  83. package/docs/examples/storage/create-file.md +11 -13
  84. package/docs/examples/storage/delete-file.md +9 -13
  85. package/docs/examples/storage/get-file-download.md +9 -9
  86. package/docs/examples/storage/get-file-preview.md +20 -9
  87. package/docs/examples/storage/get-file-view.md +9 -9
  88. package/docs/examples/storage/get-file.md +9 -13
  89. package/docs/examples/storage/list-files.md +10 -13
  90. package/docs/examples/storage/update-file.md +11 -13
  91. package/docs/examples/teams/create-membership.md +14 -13
  92. package/docs/examples/teams/create.md +10 -13
  93. package/docs/examples/teams/delete-membership.md +9 -13
  94. package/docs/examples/teams/delete.md +8 -13
  95. package/docs/examples/teams/get-membership.md +9 -13
  96. package/docs/examples/teams/get-prefs.md +8 -13
  97. package/docs/examples/teams/get.md +8 -13
  98. package/docs/examples/teams/list-memberships.md +10 -13
  99. package/docs/examples/teams/list.md +9 -13
  100. package/docs/examples/teams/update-membership-status.md +11 -13
  101. package/docs/examples/teams/update-membership.md +10 -13
  102. package/docs/examples/teams/update-name.md +9 -13
  103. package/docs/examples/teams/update-prefs.md +9 -13
  104. package/package.json +4 -3
  105. package/src/client.ts +39 -13
  106. package/src/enums/authentication-factor.ts +6 -0
  107. package/src/enums/authenticator-type.ts +3 -0
  108. package/src/enums/browser.ts +16 -0
  109. package/src/enums/credit-card.ts +18 -0
  110. package/src/enums/execution-method.ts +8 -0
  111. package/src/enums/flag.ts +197 -0
  112. package/src/enums/image-format.ts +7 -0
  113. package/src/enums/image-gravity.ts +11 -0
  114. package/src/enums/o-auth-provider.ts +41 -0
  115. package/src/id.ts +23 -4
  116. package/src/index.ts +13 -2
  117. package/src/models.ts +174 -0
  118. package/src/query.ts +61 -34
  119. package/src/service.ts +4 -7
  120. package/src/services/account.ts +643 -119
  121. package/src/services/avatars.ts +12 -6
  122. package/src/services/databases.ts +7 -4
  123. package/src/services/functions.ts +6 -2
  124. package/src/services/graphql.ts +3 -0
  125. package/src/services/locale.ts +3 -0
  126. package/src/services/messaging.ts +84 -0
  127. package/src/services/storage.ts +13 -7
  128. package/src/services/teams.ts +3 -0
  129. package/docs/examples/account/create-email-session.md +0 -18
  130. package/docs/examples/account/create-magic-u-r-l-session.md +0 -18
  131. package/docs/examples/account/create-phone-session.md +0 -18
@@ -1,18 +1,15 @@
1
- import { Client, Databases } from "appwrite";
1
+ import { Client, Databases } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const databases = new Databases(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = databases.deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
9
+ const result = await databases.deleteDocument(
10
+ '<DATABASE_ID>', // databaseId
11
+ '<COLLECTION_ID>', // collectionId
12
+ '<DOCUMENT_ID>' // documentId
13
+ );
13
14
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
15
+ console.log(response);
@@ -1,18 +1,16 @@
1
- import { Client, Databases } from "appwrite";
1
+ import { Client, Databases } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const databases = new Databases(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = databases.getDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
9
+ const result = await databases.getDocument(
10
+ '<DATABASE_ID>', // databaseId
11
+ '<COLLECTION_ID>', // collectionId
12
+ '<DOCUMENT_ID>', // documentId
13
+ [] // queries (optional)
14
+ );
13
15
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
16
+ console.log(response);
@@ -1,18 +1,15 @@
1
- import { Client, Databases } from "appwrite";
1
+ import { Client, Databases } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const databases = new Databases(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = databases.listDocuments('[DATABASE_ID]', '[COLLECTION_ID]');
9
+ const result = await databases.listDocuments(
10
+ '<DATABASE_ID>', // databaseId
11
+ '<COLLECTION_ID>', // collectionId
12
+ [] // queries (optional)
13
+ );
13
14
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
15
+ console.log(response);
@@ -1,18 +1,17 @@
1
- import { Client, Databases } from "appwrite";
1
+ import { Client, Databases } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const databases = new Databases(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = databases.updateDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
9
+ const result = await databases.updateDocument(
10
+ '<DATABASE_ID>', // databaseId
11
+ '<COLLECTION_ID>', // collectionId
12
+ '<DOCUMENT_ID>', // documentId
13
+ {}, // data (optional)
14
+ ["read("any")"] // permissions (optional)
15
+ );
13
16
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
17
+ console.log(response);
@@ -1,18 +1,18 @@
1
- import { Client, Functions } from "appwrite";
1
+ import { Client, Functions, ExecutionMethod } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const functions = new Functions(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = functions.createExecution('[FUNCTION_ID]');
9
+ const result = await functions.createExecution(
10
+ '<FUNCTION_ID>', // functionId
11
+ '<BODY>', // body (optional)
12
+ false, // async (optional)
13
+ '<PATH>', // path (optional)
14
+ ExecutionMethod.GET, // method (optional)
15
+ {} // headers (optional)
16
+ );
13
17
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
18
+ console.log(response);
@@ -1,18 +1,14 @@
1
- import { Client, Functions } from "appwrite";
1
+ import { Client, Functions } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const functions = new Functions(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]');
9
+ const result = await functions.getExecution(
10
+ '<FUNCTION_ID>', // functionId
11
+ '<EXECUTION_ID>' // executionId
12
+ );
13
13
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
14
+ console.log(response);
@@ -1,18 +1,15 @@
1
- import { Client, Functions } from "appwrite";
1
+ import { Client, Functions } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const functions = new Functions(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = functions.listExecutions('[FUNCTION_ID]');
9
+ const result = await functions.listExecutions(
10
+ '<FUNCTION_ID>', // functionId
11
+ [], // queries (optional)
12
+ '<SEARCH>' // search (optional)
13
+ );
13
14
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
15
+ console.log(response);
@@ -1,18 +1,13 @@
1
- import { Client, Graphql } from "appwrite";
1
+ import { Client, Graphql } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const graphql = new Graphql(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = graphql.mutation({});
9
+ const result = await graphql.mutation(
10
+ {} // query
11
+ );
13
12
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
13
+ console.log(response);
@@ -1,18 +1,13 @@
1
- import { Client, Graphql } from "appwrite";
1
+ import { Client, Graphql } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const graphql = new Graphql(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = graphql.query({});
9
+ const result = await graphql.query(
10
+ {} // query
11
+ );
13
12
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
13
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.get();
9
+ const result = await locale.get();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.listCodes();
9
+ const result = await locale.listCodes();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.listContinents();
9
+ const result = await locale.listContinents();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.listCountriesEU();
9
+ const result = await locale.listCountriesEU();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.listCountriesPhones();
9
+ const result = await locale.listCountriesPhones();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.listCountries();
9
+ const result = await locale.listCountries();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.listCurrencies();
9
+ const result = await locale.listCurrencies();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -1,18 +1,11 @@
1
- import { Client, Locale } from "appwrite";
1
+ import { Client, Locale } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const locale = new Locale(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = locale.listLanguages();
9
+ const result = await locale.listLanguages();
13
10
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
11
+ console.log(response);
@@ -0,0 +1,15 @@
1
+ import { Client, Messaging } from "react-native-appwrite";
2
+
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
6
+
7
+ const messaging = new Messaging(client);
8
+
9
+ const result = await messaging.createSubscriber(
10
+ '<TOPIC_ID>', // topicId
11
+ '<SUBSCRIBER_ID>', // subscriberId
12
+ '<TARGET_ID>' // targetId
13
+ );
14
+
15
+ console.log(response);
@@ -0,0 +1,14 @@
1
+ import { Client, Messaging } from "react-native-appwrite";
2
+
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
6
+
7
+ const messaging = new Messaging(client);
8
+
9
+ const result = await messaging.deleteSubscriber(
10
+ '<TOPIC_ID>', // topicId
11
+ '<SUBSCRIBER_ID>' // subscriberId
12
+ );
13
+
14
+ console.log(response);
@@ -1,18 +1,16 @@
1
- import { Client, Storage } from "appwrite";
1
+ import { Client, Storage } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const storage = new Storage(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', document.getElementById('uploader').files[0]);
9
+ const result = await storage.createFile(
10
+ '<BUCKET_ID>', // bucketId
11
+ '<FILE_ID>', // fileId
12
+ await pickSingle(), // file
13
+ ["read("any")"] // permissions (optional)
14
+ );
13
15
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
16
+ console.log(response);
@@ -1,18 +1,14 @@
1
- import { Client, Storage } from "appwrite";
1
+ import { Client, Storage } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const storage = new Storage(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const promise = storage.deleteFile('[BUCKET_ID]', '[FILE_ID]');
9
+ const result = await storage.deleteFile(
10
+ '<BUCKET_ID>', // bucketId
11
+ '<FILE_ID>' // fileId
12
+ );
13
13
 
14
- promise.then(function (response) {
15
- console.log(response); // Success
16
- }, function (error) {
17
- console.log(error); // Failure
18
- });
14
+ console.log(response);
@@ -1,14 +1,14 @@
1
- import { Client, Storage } from "appwrite";
1
+ import { Client, Storage } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const storage = new Storage(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const result = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]');
9
+ const result = storage.getFileDownload(
10
+ '<BUCKET_ID>', // bucketId
11
+ '<FILE_ID>' // fileId
12
+ );
13
13
 
14
- console.log(result); // Resource URL
14
+ console.log(result);
@@ -1,14 +1,25 @@
1
- import { Client, Storage } from "appwrite";
1
+ import { Client, Storage, ImageGravity, ImageFormat } from "react-native-appwrite";
2
2
 
3
- const client = new Client();
3
+ const client = new Client()
4
+ .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
+ .setProject('5df5acd0d48c2'); // Your project ID
4
6
 
5
7
  const storage = new Storage(client);
6
8
 
7
- client
8
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9
- .setProject('5df5acd0d48c2') // Your project ID
10
- ;
11
-
12
- const result = storage.getFilePreview('[BUCKET_ID]', '[FILE_ID]');
9
+ const result = storage.getFilePreview(
10
+ '<BUCKET_ID>', // bucketId
11
+ '<FILE_ID>', // fileId
12
+ 0, // width (optional)
13
+ 0, // height (optional)
14
+ ImageGravity.Center, // gravity (optional)
15
+ 0, // quality (optional)
16
+ 0, // borderWidth (optional)
17
+ '', // borderColor (optional)
18
+ 0, // borderRadius (optional)
19
+ 0, // opacity (optional)
20
+ -360, // rotation (optional)
21
+ '', // background (optional)
22
+ ImageFormat.Jpg // output (optional)
23
+ );
13
24
 
14
- console.log(result); // Resource URL
25
+ console.log(result);