react-native-appwrite 0.19.0 → 0.20.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 (158) hide show
  1. package/.github/workflows/publish.yml +9 -8
  2. package/CHANGELOG.md +6 -0
  3. package/LICENSE +1 -1
  4. package/README.md +2 -2
  5. package/dist/cjs/sdk.js +223 -44
  6. package/dist/cjs/sdk.js.map +1 -1
  7. package/dist/esm/sdk.js +219 -45
  8. package/dist/esm/sdk.js.map +1 -1
  9. package/docs/examples/account/create-anonymous-session.md +2 -0
  10. package/docs/examples/account/create-email-password-session.md +2 -0
  11. package/docs/examples/account/create-email-token.md +2 -0
  12. package/docs/examples/account/create-email-verification.md +2 -0
  13. package/docs/examples/account/create-jwt.md +5 -1
  14. package/docs/examples/account/create-magic-url-token.md +2 -0
  15. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  16. package/docs/examples/account/create-mfa-challenge.md +2 -0
  17. package/docs/examples/account/create-mfa-recovery-codes.md +2 -0
  18. package/docs/examples/account/create-o-auth-2-session.md +2 -0
  19. package/docs/examples/account/create-o-auth-2-token.md +2 -0
  20. package/docs/examples/account/create-phone-token.md +2 -0
  21. package/docs/examples/account/create-phone-verification.md +2 -0
  22. package/docs/examples/account/create-push-target.md +2 -0
  23. package/docs/examples/account/create-recovery.md +2 -0
  24. package/docs/examples/account/create-session.md +2 -0
  25. package/docs/examples/account/create-verification.md +2 -0
  26. package/docs/examples/account/create.md +2 -0
  27. package/docs/examples/account/delete-identity.md +2 -0
  28. package/docs/examples/account/delete-mfa-authenticator.md +2 -0
  29. package/docs/examples/account/delete-push-target.md +2 -0
  30. package/docs/examples/account/delete-session.md +2 -0
  31. package/docs/examples/account/delete-sessions.md +2 -0
  32. package/docs/examples/account/get-mfa-recovery-codes.md +2 -0
  33. package/docs/examples/account/get-prefs.md +2 -0
  34. package/docs/examples/account/get-session.md +2 -0
  35. package/docs/examples/account/get.md +2 -0
  36. package/docs/examples/account/list-identities.md +2 -0
  37. package/docs/examples/account/list-logs.md +2 -0
  38. package/docs/examples/account/list-mfa-factors.md +2 -0
  39. package/docs/examples/account/list-sessions.md +2 -0
  40. package/docs/examples/account/update-email-verification.md +2 -0
  41. package/docs/examples/account/update-email.md +2 -0
  42. package/docs/examples/account/update-magic-url-session.md +2 -0
  43. package/docs/examples/account/update-mfa-authenticator.md +2 -0
  44. package/docs/examples/account/update-mfa-challenge.md +2 -0
  45. package/docs/examples/account/update-mfa-recovery-codes.md +2 -0
  46. package/docs/examples/account/update-mfa.md +2 -0
  47. package/docs/examples/account/update-name.md +2 -0
  48. package/docs/examples/account/update-password.md +2 -0
  49. package/docs/examples/account/update-phone-session.md +2 -0
  50. package/docs/examples/account/update-phone-verification.md +2 -0
  51. package/docs/examples/account/update-phone.md +2 -0
  52. package/docs/examples/account/update-prefs.md +2 -0
  53. package/docs/examples/account/update-push-target.md +2 -0
  54. package/docs/examples/account/update-recovery.md +2 -0
  55. package/docs/examples/account/update-session.md +2 -0
  56. package/docs/examples/account/update-status.md +2 -0
  57. package/docs/examples/account/update-verification.md +2 -0
  58. package/docs/examples/avatars/get-browser.md +2 -0
  59. package/docs/examples/avatars/get-credit-card.md +2 -0
  60. package/docs/examples/avatars/get-favicon.md +2 -0
  61. package/docs/examples/avatars/get-flag.md +2 -0
  62. package/docs/examples/avatars/get-image.md +2 -0
  63. package/docs/examples/avatars/get-initials.md +2 -0
  64. package/docs/examples/avatars/get-qr.md +2 -0
  65. package/docs/examples/avatars/get-screenshot.md +7 -5
  66. package/docs/examples/databases/create-document.md +2 -0
  67. package/docs/examples/databases/create-operations.md +2 -0
  68. package/docs/examples/databases/create-transaction.md +2 -0
  69. package/docs/examples/databases/decrement-document-attribute.md +2 -0
  70. package/docs/examples/databases/delete-document.md +2 -0
  71. package/docs/examples/databases/delete-transaction.md +2 -0
  72. package/docs/examples/databases/get-document.md +2 -0
  73. package/docs/examples/databases/get-transaction.md +2 -0
  74. package/docs/examples/databases/increment-document-attribute.md +2 -0
  75. package/docs/examples/databases/list-documents.md +2 -0
  76. package/docs/examples/databases/list-transactions.md +2 -0
  77. package/docs/examples/databases/update-document.md +9 -1
  78. package/docs/examples/databases/update-transaction.md +2 -0
  79. package/docs/examples/databases/upsert-document.md +9 -1
  80. package/docs/examples/functions/create-execution.md +2 -0
  81. package/docs/examples/functions/get-execution.md +2 -0
  82. package/docs/examples/functions/list-executions.md +2 -0
  83. package/docs/examples/graphql/mutation.md +2 -0
  84. package/docs/examples/graphql/query.md +2 -0
  85. package/docs/examples/locale/get.md +2 -0
  86. package/docs/examples/locale/list-codes.md +2 -0
  87. package/docs/examples/locale/list-continents.md +2 -0
  88. package/docs/examples/locale/list-countries-eu.md +2 -0
  89. package/docs/examples/locale/list-countries-phones.md +2 -0
  90. package/docs/examples/locale/list-countries.md +2 -0
  91. package/docs/examples/locale/list-currencies.md +2 -0
  92. package/docs/examples/locale/list-languages.md +2 -0
  93. package/docs/examples/messaging/create-subscriber.md +2 -0
  94. package/docs/examples/messaging/delete-subscriber.md +2 -0
  95. package/docs/examples/storage/create-file.md +2 -0
  96. package/docs/examples/storage/delete-file.md +2 -0
  97. package/docs/examples/storage/get-file-download.md +2 -0
  98. package/docs/examples/storage/get-file-preview.md +2 -0
  99. package/docs/examples/storage/get-file-view.md +2 -0
  100. package/docs/examples/storage/get-file.md +2 -0
  101. package/docs/examples/storage/list-files.md +2 -0
  102. package/docs/examples/storage/update-file.md +2 -0
  103. package/docs/examples/tablesdb/create-operations.md +2 -0
  104. package/docs/examples/tablesdb/create-row.md +2 -0
  105. package/docs/examples/tablesdb/create-transaction.md +2 -0
  106. package/docs/examples/tablesdb/decrement-row-column.md +2 -0
  107. package/docs/examples/tablesdb/delete-row.md +2 -0
  108. package/docs/examples/tablesdb/delete-transaction.md +2 -0
  109. package/docs/examples/tablesdb/get-row.md +2 -0
  110. package/docs/examples/tablesdb/get-transaction.md +2 -0
  111. package/docs/examples/tablesdb/increment-row-column.md +2 -0
  112. package/docs/examples/tablesdb/list-rows.md +2 -0
  113. package/docs/examples/tablesdb/list-transactions.md +2 -0
  114. package/docs/examples/tablesdb/update-row.md +9 -1
  115. package/docs/examples/tablesdb/update-transaction.md +2 -0
  116. package/docs/examples/tablesdb/upsert-row.md +9 -1
  117. package/docs/examples/teams/create-membership.md +4 -2
  118. package/docs/examples/teams/create.md +2 -0
  119. package/docs/examples/teams/delete-membership.md +2 -0
  120. package/docs/examples/teams/delete.md +2 -0
  121. package/docs/examples/teams/get-membership.md +2 -0
  122. package/docs/examples/teams/get-prefs.md +2 -0
  123. package/docs/examples/teams/get.md +2 -0
  124. package/docs/examples/teams/list-memberships.md +2 -0
  125. package/docs/examples/teams/list.md +2 -0
  126. package/docs/examples/teams/update-membership-status.md +2 -0
  127. package/docs/examples/teams/update-membership.md +4 -2
  128. package/docs/examples/teams/update-name.md +2 -0
  129. package/docs/examples/teams/update-prefs.md +2 -0
  130. package/package.json +6 -3
  131. package/rollup.config.js +3 -1
  132. package/src/channel.ts +134 -0
  133. package/src/client.ts +41 -6
  134. package/src/enums/browser-permission.ts +22 -0
  135. package/src/enums/o-auth-provider.ts +0 -1
  136. package/src/enums/roles.ts +5 -0
  137. package/src/index.ts +4 -2
  138. package/src/models.ts +8 -0
  139. package/src/query.ts +54 -9
  140. package/src/services/account.ts +30 -1
  141. package/src/services/avatars.ts +17 -16
  142. package/src/services/databases.ts +5 -9
  143. package/src/services/storage.ts +8 -8
  144. package/src/services/teams.ts +19 -18
  145. package/types/channel.d.ts +71 -0
  146. package/types/enums/browser-permission.d.ts +22 -0
  147. package/types/enums/o-auth-provider.d.ts +1 -2
  148. package/types/enums/roles.d.ts +5 -0
  149. package/types/index.d.ts +4 -2
  150. package/types/models.d.ts +8 -0
  151. package/types/query.d.ts +36 -6
  152. package/types/services/account.d.ts +13 -1
  153. package/types/services/avatars.d.ts +12 -11
  154. package/types/services/databases.d.ts +2 -2
  155. package/types/services/storage.d.ts +8 -8
  156. package/types/services/teams.d.ts +9 -8
  157. package/src/enums/output.ts +0 -9
  158. package/types/enums/output.d.ts +0 -9
@@ -242,7 +242,7 @@ export declare class Databases extends Service {
242
242
  databaseId: string;
243
243
  collectionId: string;
244
244
  documentId: string;
245
- data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>;
245
+ data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>;
246
246
  permissions?: string[];
247
247
  transactionId?: string;
248
248
  }): Promise<Document>;
@@ -259,7 +259,7 @@ export declare class Databases extends Service {
259
259
  * @returns {Promise<Document>}
260
260
  * @deprecated Use the object parameter style method for a better developer experience.
261
261
  */
262
- upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
262
+ upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
263
263
  /**
264
264
  * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
265
265
  *
@@ -112,10 +112,10 @@ export declare class Storage extends Service {
112
112
  /**
113
113
  * Update a file by its unique ID. Only users with write permissions have access to update this resource.
114
114
  *
115
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
116
- * @param {string} params.fileId - File unique ID.
117
- * @param {string} params.name - Name of the file
118
- * @param {string[]} params.permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
115
+ * @param {string} params.bucketId - Bucket unique ID.
116
+ * @param {string} params.fileId - File ID.
117
+ * @param {string} params.name - File name.
118
+ * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
119
119
  * @throws {AppwriteException}
120
120
  * @returns {Promise}
121
121
  */
@@ -128,10 +128,10 @@ export declare class Storage extends Service {
128
128
  /**
129
129
  * Update a file by its unique ID. Only users with write permissions have access to update this resource.
130
130
  *
131
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
132
- * @param {string} fileId - File unique ID.
133
- * @param {string} name - Name of the file
134
- * @param {string[]} permissions - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
131
+ * @param {string} bucketId - Bucket unique ID.
132
+ * @param {string} fileId - File ID.
133
+ * @param {string} name - File name.
134
+ * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
135
135
  * @throws {AppwriteException}
136
136
  * @returns {Promise<Models.File>}
137
137
  * @deprecated Use the object parameter style method for a better developer experience.
@@ -1,6 +1,7 @@
1
1
  import { Service } from '../service';
2
2
  import { Client } from '../client';
3
3
  import type { Models } from '../models';
4
+ import { Roles } from '../enums/roles';
4
5
  export declare class Teams extends Service {
5
6
  constructor(client: Client);
6
7
  /**
@@ -152,7 +153,7 @@ export declare class Teams extends Service {
152
153
  *
153
154
  *
154
155
  * @param {string} params.teamId - Team ID.
155
- * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
156
+ * @param {Roles[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
156
157
  * @param {string} params.email - Email of the new team member.
157
158
  * @param {string} params.userId - ID of the user to be added to a team.
158
159
  * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
@@ -163,7 +164,7 @@ export declare class Teams extends Service {
163
164
  */
164
165
  createMembership(params: {
165
166
  teamId: string;
166
- roles: string[];
167
+ roles: Roles[];
167
168
  email?: string;
168
169
  userId?: string;
169
170
  phone?: string;
@@ -181,7 +182,7 @@ export declare class Teams extends Service {
181
182
  *
182
183
  *
183
184
  * @param {string} teamId - Team ID.
184
- * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
185
+ * @param {Roles[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
185
186
  * @param {string} email - Email of the new team member.
186
187
  * @param {string} userId - ID of the user to be added to a team.
187
188
  * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
@@ -191,7 +192,7 @@ export declare class Teams extends Service {
191
192
  * @returns {Promise<Models.Membership>}
192
193
  * @deprecated Use the object parameter style method for a better developer experience.
193
194
  */
194
- createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>;
195
+ createMembership(teamId: string, roles: Roles[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>;
195
196
  /**
196
197
  * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console.
197
198
  *
@@ -220,14 +221,14 @@ export declare class Teams extends Service {
220
221
  *
221
222
  * @param {string} params.teamId - Team ID.
222
223
  * @param {string} params.membershipId - Membership ID.
223
- * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
224
+ * @param {Roles[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
224
225
  * @throws {AppwriteException}
225
226
  * @returns {Promise}
226
227
  */
227
228
  updateMembership(params: {
228
229
  teamId: string;
229
230
  membershipId: string;
230
- roles: string[];
231
+ roles: Roles[];
231
232
  }): Promise<Models.Membership>;
232
233
  /**
233
234
  * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions).
@@ -235,12 +236,12 @@ export declare class Teams extends Service {
235
236
  *
236
237
  * @param {string} teamId - Team ID.
237
238
  * @param {string} membershipId - Membership ID.
238
- * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
239
+ * @param {Roles[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long.
239
240
  * @throws {AppwriteException}
240
241
  * @returns {Promise<Models.Membership>}
241
242
  * @deprecated Use the object parameter style method for a better developer experience.
242
243
  */
243
- updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>;
244
+ updateMembership(teamId: string, membershipId: string, roles: Roles[]): Promise<Models.Membership>;
244
245
  /**
245
246
  * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted.
246
247
  *
@@ -1,9 +0,0 @@
1
- export enum Output {
2
- Jpg = 'jpg',
3
- Jpeg = 'jpeg',
4
- Png = 'png',
5
- Webp = 'webp',
6
- Heic = 'heic',
7
- Avif = 'avif',
8
- Gif = 'gif',
9
- }
@@ -1,9 +0,0 @@
1
- export declare enum Output {
2
- Jpg = "jpg",
3
- Jpeg = "jpeg",
4
- Png = "png",
5
- Webp = "webp",
6
- Heic = "heic",
7
- Avif = "avif",
8
- Gif = "gif"
9
- }