react-native-appwrite 0.11.0 → 0.13.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 (129) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1854 -1121
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1854 -1122
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-password-session.md +4 -4
  7. package/docs/examples/account/create-email-token.md +5 -5
  8. package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
  9. package/docs/examples/account/create-mfa-authenticator.md +3 -3
  10. package/docs/examples/account/create-mfa-challenge.md +3 -3
  11. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  12. package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
  13. package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
  14. package/docs/examples/account/create-phone-token.md +4 -4
  15. package/docs/examples/account/create-push-target.md +5 -5
  16. package/docs/examples/account/create-recovery.md +4 -4
  17. package/docs/examples/account/create-session.md +4 -4
  18. package/docs/examples/account/create-verification.md +3 -3
  19. package/docs/examples/account/create.md +6 -6
  20. package/docs/examples/account/delete-identity.md +3 -3
  21. package/docs/examples/account/delete-mfa-authenticator.md +3 -3
  22. package/docs/examples/account/delete-push-target.md +3 -3
  23. package/docs/examples/account/delete-session.md +3 -3
  24. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  25. package/docs/examples/account/get-session.md +3 -3
  26. package/docs/examples/account/list-identities.md +3 -3
  27. package/docs/examples/account/list-logs.md +3 -3
  28. package/docs/examples/account/list-mfa-factors.md +1 -1
  29. package/docs/examples/account/update-email.md +4 -4
  30. package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
  31. package/docs/examples/account/update-mfa-authenticator.md +4 -4
  32. package/docs/examples/account/update-mfa-challenge.md +4 -4
  33. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  34. package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
  35. package/docs/examples/account/update-name.md +3 -3
  36. package/docs/examples/account/update-password.md +4 -4
  37. package/docs/examples/account/update-phone-session.md +4 -4
  38. package/docs/examples/account/update-phone-verification.md +4 -4
  39. package/docs/examples/account/update-phone.md +4 -4
  40. package/docs/examples/account/update-prefs.md +7 -3
  41. package/docs/examples/account/update-push-target.md +4 -4
  42. package/docs/examples/account/update-recovery.md +5 -5
  43. package/docs/examples/account/update-session.md +3 -3
  44. package/docs/examples/account/update-verification.md +4 -4
  45. package/docs/examples/avatars/get-browser.md +6 -6
  46. package/docs/examples/avatars/get-credit-card.md +6 -6
  47. package/docs/examples/avatars/get-favicon.md +3 -3
  48. package/docs/examples/avatars/get-flag.md +6 -6
  49. package/docs/examples/avatars/get-image.md +5 -5
  50. package/docs/examples/avatars/get-initials.md +6 -6
  51. package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
  52. package/docs/examples/databases/create-document.md +13 -7
  53. package/docs/examples/databases/decrement-document-attribute.md +8 -8
  54. package/docs/examples/databases/delete-document.md +5 -5
  55. package/docs/examples/databases/get-document.md +6 -6
  56. package/docs/examples/databases/increment-document-attribute.md +8 -8
  57. package/docs/examples/databases/list-documents.md +5 -5
  58. package/docs/examples/databases/update-document.md +7 -7
  59. package/docs/examples/databases/upsert-document.md +7 -7
  60. package/docs/examples/functions/create-execution.md +9 -9
  61. package/docs/examples/functions/get-execution.md +4 -4
  62. package/docs/examples/functions/list-executions.md +4 -4
  63. package/docs/examples/graphql/mutation.md +3 -3
  64. package/docs/examples/graphql/query.md +3 -3
  65. package/docs/examples/messaging/create-subscriber.md +5 -5
  66. package/docs/examples/messaging/delete-subscriber.md +4 -4
  67. package/docs/examples/storage/create-file.md +6 -6
  68. package/docs/examples/storage/delete-file.md +4 -4
  69. package/docs/examples/storage/get-file-download.md +5 -5
  70. package/docs/examples/storage/get-file-preview.md +16 -16
  71. package/docs/examples/storage/get-file-view.md +5 -5
  72. package/docs/examples/storage/get-file.md +4 -4
  73. package/docs/examples/storage/list-files.md +5 -5
  74. package/docs/examples/storage/update-file.md +6 -6
  75. package/docs/examples/tablesdb/create-row.md +23 -0
  76. package/docs/examples/tablesdb/decrement-row-column.md +18 -0
  77. package/docs/examples/tablesdb/delete-row.md +15 -0
  78. package/docs/examples/tablesdb/get-row.md +16 -0
  79. package/docs/examples/tablesdb/increment-row-column.md +18 -0
  80. package/docs/examples/tablesdb/list-rows.md +15 -0
  81. package/docs/examples/tablesdb/update-row.md +17 -0
  82. package/docs/examples/tablesdb/upsert-row.md +17 -0
  83. package/docs/examples/teams/create-membership.md +9 -9
  84. package/docs/examples/teams/create.md +5 -5
  85. package/docs/examples/teams/delete-membership.md +4 -4
  86. package/docs/examples/teams/delete.md +3 -3
  87. package/docs/examples/teams/get-membership.md +4 -4
  88. package/docs/examples/teams/get-prefs.md +3 -3
  89. package/docs/examples/teams/get.md +3 -3
  90. package/docs/examples/teams/list-memberships.md +5 -5
  91. package/docs/examples/teams/list.md +4 -4
  92. package/docs/examples/teams/update-membership-status.md +6 -6
  93. package/docs/examples/teams/update-membership.md +5 -5
  94. package/docs/examples/teams/update-name.md +4 -4
  95. package/docs/examples/teams/update-prefs.md +4 -4
  96. package/package.json +1 -1
  97. package/src/client.ts +2 -2
  98. package/src/enums/credit-card.ts +1 -1
  99. package/src/enums/execution-method.ts +1 -0
  100. package/src/index.ts +1 -0
  101. package/src/models.ts +72 -27
  102. package/src/query.ts +247 -4
  103. package/src/services/account.ts +1469 -315
  104. package/src/services/avatars.ts +289 -80
  105. package/src/services/databases.ts +345 -63
  106. package/src/services/functions.ts +115 -20
  107. package/src/services/graphql.ts +52 -4
  108. package/src/services/locale.ts +8 -19
  109. package/src/services/messaging.ts +66 -7
  110. package/src/services/storage.ts +345 -76
  111. package/src/services/tables-db.ts +621 -0
  112. package/src/services/teams.ts +454 -93
  113. package/types/enums/credit-card.d.ts +1 -1
  114. package/types/enums/execution-method.d.ts +2 -1
  115. package/types/index.d.ts +1 -0
  116. package/types/models.d.ts +69 -25
  117. package/types/query.d.ts +201 -4
  118. package/types/services/account.d.ts +734 -280
  119. package/types/services/avatars.d.ts +168 -73
  120. package/types/services/databases.d.ts +199 -58
  121. package/types/services/functions.d.ts +62 -17
  122. package/types/services/graphql.d.ts +24 -2
  123. package/types/services/locale.d.ts +8 -19
  124. package/types/services/messaging.d.ts +33 -5
  125. package/types/services/storage.d.ts +201 -68
  126. package/types/services/tables-db.d.ts +245 -0
  127. package/types/services/teams.d.ts +242 -80
  128. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  129. /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
@@ -14,15 +14,42 @@ export class Teams extends Service {
14
14
  }
15
15
 
16
16
  /**
17
- * Get a list of all the teams in which the current user is a member. You can
18
- * use the parameters to filter your results.
17
+ * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
19
18
  *
20
- * @param {string[]} queries
21
- * @param {string} search
19
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
20
+ * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
22
21
  * @throws {AppwriteException}
23
22
  * @returns {Promise}
24
23
  */
25
- list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
24
+ list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: { queries?: string[], search?: string }): Promise<Models.TeamList<Preferences>>;
25
+ /**
26
+ * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
27
+ *
28
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan
29
+ * @param {string} search - Search term to filter your list results. Max length: 256 chars.
30
+ * @throws {AppwriteException}
31
+ * @returns {Promise<Models.TeamList<Preferences>>}
32
+ * @deprecated Use the object parameter style method for a better developer experience.
33
+ */
34
+ list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>>;
35
+ list<Preferences extends Models.Preferences = Models.DefaultPreferences>(
36
+ paramsOrFirst?: { queries?: string[], search?: string } | string[],
37
+ ...rest: [(string)?]
38
+ ): Promise<Models.TeamList<Preferences>> {
39
+ let params: { queries?: string[], search?: string };
40
+
41
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
42
+ params = (paramsOrFirst || {}) as { queries?: string[], search?: string };
43
+ } else {
44
+ params = {
45
+ queries: paramsOrFirst as string[],
46
+ search: rest[0] as string
47
+ };
48
+ }
49
+
50
+ const queries = params.queries;
51
+ const search = params.search;
52
+
26
53
  const apiPath = '/teams';
27
54
  const payload: Payload = {};
28
55
 
@@ -40,17 +67,46 @@ export class Teams extends Service {
40
67
  }
41
68
 
42
69
  /**
43
- * Create a new team. The user who creates the team will automatically be
44
- * assigned as the owner of the team. Only the users with the owner role can
45
- * invite new members, add new owners and delete or update the team.
70
+ * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
46
71
  *
47
- * @param {string} teamId
48
- * @param {string} name
49
- * @param {string[]} roles
72
+ * @param {string} params.teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
73
+ * @param {string} params.name - Team name. Max length: 128 chars.
74
+ * @param {string[]} params.roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. 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.
50
75
  * @throws {AppwriteException}
51
76
  * @returns {Promise}
52
77
  */
53
- create<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>> {
78
+ create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, name: string, roles?: string[] }): Promise<Models.Team<Preferences>>;
79
+ /**
80
+ * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
81
+ *
82
+ * @param {string} teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
83
+ * @param {string} name - Team name. Max length: 128 chars.
84
+ * @param {string[]} roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. 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.
85
+ * @throws {AppwriteException}
86
+ * @returns {Promise<Models.Team<Preferences>>}
87
+ * @deprecated Use the object parameter style method for a better developer experience.
88
+ */
89
+ create<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>;
90
+ create<Preferences extends Models.Preferences = Models.DefaultPreferences>(
91
+ paramsOrFirst: { teamId: string, name: string, roles?: string[] } | string,
92
+ ...rest: [(string)?, (string[])?]
93
+ ): Promise<Models.Team<Preferences>> {
94
+ let params: { teamId: string, name: string, roles?: string[] };
95
+
96
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
97
+ params = (paramsOrFirst || {}) as { teamId: string, name: string, roles?: string[] };
98
+ } else {
99
+ params = {
100
+ teamId: paramsOrFirst as string,
101
+ name: rest[0] as string,
102
+ roles: rest[1] as string[]
103
+ };
104
+ }
105
+
106
+ const teamId = params.teamId;
107
+ const name = params.name;
108
+ const roles = params.roles;
109
+
54
110
  if (typeof teamId === 'undefined') {
55
111
  throw new AppwriteException('Missing required parameter: "teamId"');
56
112
  }
@@ -83,11 +139,35 @@ export class Teams extends Service {
83
139
  /**
84
140
  * Get a team by its ID. All team members have read access for this resource.
85
141
  *
86
- * @param {string} teamId
142
+ * @param {string} params.teamId - Team ID.
87
143
  * @throws {AppwriteException}
88
144
  * @returns {Promise}
89
145
  */
90
- get<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Models.Team<Preferences>> {
146
+ get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string }): Promise<Models.Team<Preferences>>;
147
+ /**
148
+ * Get a team by its ID. All team members have read access for this resource.
149
+ *
150
+ * @param {string} teamId - Team ID.
151
+ * @throws {AppwriteException}
152
+ * @returns {Promise<Models.Team<Preferences>>}
153
+ * @deprecated Use the object parameter style method for a better developer experience.
154
+ */
155
+ get<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Models.Team<Preferences>>;
156
+ get<Preferences extends Models.Preferences = Models.DefaultPreferences>(
157
+ paramsOrFirst: { teamId: string } | string
158
+ ): Promise<Models.Team<Preferences>> {
159
+ let params: { teamId: string };
160
+
161
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
162
+ params = (paramsOrFirst || {}) as { teamId: string };
163
+ } else {
164
+ params = {
165
+ teamId: paramsOrFirst as string
166
+ };
167
+ }
168
+
169
+ const teamId = params.teamId;
170
+
91
171
  if (typeof teamId === 'undefined') {
92
172
  throw new AppwriteException('Missing required parameter: "teamId"');
93
173
  }
@@ -103,12 +183,40 @@ export class Teams extends Service {
103
183
  /**
104
184
  * Update the team's name by its unique ID.
105
185
  *
106
- * @param {string} teamId
107
- * @param {string} name
186
+ * @param {string} params.teamId - Team ID.
187
+ * @param {string} params.name - New team name. Max length: 128 chars.
108
188
  * @throws {AppwriteException}
109
189
  * @returns {Promise}
110
190
  */
111
- updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string): Promise<Models.Team<Preferences>> {
191
+ updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, name: string }): Promise<Models.Team<Preferences>>;
192
+ /**
193
+ * Update the team's name by its unique ID.
194
+ *
195
+ * @param {string} teamId - Team ID.
196
+ * @param {string} name - New team name. Max length: 128 chars.
197
+ * @throws {AppwriteException}
198
+ * @returns {Promise<Models.Team<Preferences>>}
199
+ * @deprecated Use the object parameter style method for a better developer experience.
200
+ */
201
+ updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>;
202
+ updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(
203
+ paramsOrFirst: { teamId: string, name: string } | string,
204
+ ...rest: [(string)?]
205
+ ): Promise<Models.Team<Preferences>> {
206
+ let params: { teamId: string, name: string };
207
+
208
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
209
+ params = (paramsOrFirst || {}) as { teamId: string, name: string };
210
+ } else {
211
+ params = {
212
+ teamId: paramsOrFirst as string,
213
+ name: rest[0] as string
214
+ };
215
+ }
216
+
217
+ const teamId = params.teamId;
218
+ const name = params.name;
219
+
112
220
  if (typeof teamId === 'undefined') {
113
221
  throw new AppwriteException('Missing required parameter: "teamId"');
114
222
  }
@@ -131,14 +239,37 @@ export class Teams extends Service {
131
239
  }
132
240
 
133
241
  /**
134
- * Delete a team using its ID. Only team members with the owner role can
135
- * delete the team.
242
+ * Delete a team using its ID. Only team members with the owner role can delete the team.
136
243
  *
137
- * @param {string} teamId
244
+ * @param {string} params.teamId - Team ID.
138
245
  * @throws {AppwriteException}
139
246
  * @returns {Promise}
140
247
  */
141
- delete(teamId: string): Promise<{}> {
248
+ delete(params: { teamId: string }): Promise<{}>;
249
+ /**
250
+ * Delete a team using its ID. Only team members with the owner role can delete the team.
251
+ *
252
+ * @param {string} teamId - Team ID.
253
+ * @throws {AppwriteException}
254
+ * @returns {Promise<{}>}
255
+ * @deprecated Use the object parameter style method for a better developer experience.
256
+ */
257
+ delete(teamId: string): Promise<{}>;
258
+ delete(
259
+ paramsOrFirst: { teamId: string } | string
260
+ ): Promise<{}> {
261
+ let params: { teamId: string };
262
+
263
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
264
+ params = (paramsOrFirst || {}) as { teamId: string };
265
+ } else {
266
+ params = {
267
+ teamId: paramsOrFirst as string
268
+ };
269
+ }
270
+
271
+ const teamId = params.teamId;
272
+
142
273
  if (typeof teamId === 'undefined') {
143
274
  throw new AppwriteException('Missing required parameter: "teamId"');
144
275
  }
@@ -153,17 +284,46 @@ export class Teams extends Service {
153
284
  }
154
285
 
155
286
  /**
156
- * Use this endpoint to list a team's members using the team's ID. All team
157
- * members have read access to this endpoint. Hide sensitive attributes from
158
- * the response by toggling membership privacy in the Console.
287
+ * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
159
288
  *
160
- * @param {string} teamId
161
- * @param {string[]} queries
162
- * @param {string} search
289
+ * @param {string} params.teamId - Team ID.
290
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
291
+ * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
163
292
  * @throws {AppwriteException}
164
293
  * @returns {Promise}
165
294
  */
166
- listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> {
295
+ listMemberships(params: { teamId: string, queries?: string[], search?: string }): Promise<Models.MembershipList>;
296
+ /**
297
+ * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console.
298
+ *
299
+ * @param {string} teamId - Team ID.
300
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles
301
+ * @param {string} search - Search term to filter your list results. Max length: 256 chars.
302
+ * @throws {AppwriteException}
303
+ * @returns {Promise<Models.MembershipList>}
304
+ * @deprecated Use the object parameter style method for a better developer experience.
305
+ */
306
+ listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList>;
307
+ listMemberships(
308
+ paramsOrFirst: { teamId: string, queries?: string[], search?: string } | string,
309
+ ...rest: [(string[])?, (string)?]
310
+ ): Promise<Models.MembershipList> {
311
+ let params: { teamId: string, queries?: string[], search?: string };
312
+
313
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
314
+ params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], search?: string };
315
+ } else {
316
+ params = {
317
+ teamId: paramsOrFirst as string,
318
+ queries: rest[0] as string[],
319
+ search: rest[1] as string
320
+ };
321
+ }
322
+
323
+ const teamId = params.teamId;
324
+ const queries = params.queries;
325
+ const search = params.search;
326
+
167
327
  if (typeof teamId === 'undefined') {
168
328
  throw new AppwriteException('Missing required parameter: "teamId"');
169
329
  }
@@ -185,39 +345,76 @@ export class Teams extends Service {
185
345
  }
186
346
 
187
347
  /**
188
- * Invite a new member to join your team. Provide an ID for existing users, or
189
- * invite unregistered users using an email or phone number. If initiated from
190
- * a Client SDK, Appwrite will send an email or sms with a link to join the
191
- * team to the invited user, and an account will be created for them if one
192
- * doesn't exist. If initiated from a Server SDK, the new member will be added
193
- * automatically to the team.
348
+ * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
194
349
  *
195
- * You only need to provide one of a user ID, email, or phone number. Appwrite
196
- * will prioritize accepting the user ID > email > phone number if you provide
197
- * more than one of these parameters.
350
+ * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.
198
351
  *
199
- * Use the `url` parameter to redirect the user from the invitation email to
200
- * your app. After the user is redirected, use the [Update Team Membership
201
- * Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus)
202
- * endpoint to allow the user to accept the invitation to the team.
352
+ * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
203
353
  *
204
- * Please note that to avoid a [Redirect
205
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
206
- * Appwrite will accept the only redirect URLs under the domains you have
207
- * added as a platform on the Appwrite Console.
354
+ * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
208
355
  *
209
356
  *
210
- * @param {string} teamId
211
- * @param {string[]} roles
212
- * @param {string} email
213
- * @param {string} userId
214
- * @param {string} phone
215
- * @param {string} url
216
- * @param {string} name
357
+ * @param {string} params.teamId - Team ID.
358
+ * @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.
359
+ * @param {string} params.email - Email of the new team member.
360
+ * @param {string} params.userId - ID of the user to be added to a team.
361
+ * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
362
+ * @param {string} params.url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
363
+ * @param {string} params.name - Name of the new team member. Max length: 128 chars.
217
364
  * @throws {AppwriteException}
218
365
  * @returns {Promise}
219
366
  */
220
- createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership> {
367
+ createMembership(params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise<Models.Membership>;
368
+ /**
369
+ * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
370
+ *
371
+ * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.
372
+ *
373
+ * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team.
374
+ *
375
+ * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
376
+ *
377
+ *
378
+ * @param {string} teamId - Team ID.
379
+ * @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.
380
+ * @param {string} email - Email of the new team member.
381
+ * @param {string} userId - ID of the user to be added to a team.
382
+ * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
383
+ * @param {string} url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
384
+ * @param {string} name - Name of the new team member. Max length: 128 chars.
385
+ * @throws {AppwriteException}
386
+ * @returns {Promise<Models.Membership>}
387
+ * @deprecated Use the object parameter style method for a better developer experience.
388
+ */
389
+ createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>;
390
+ createMembership(
391
+ paramsOrFirst: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string,
392
+ ...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (string)?]
393
+ ): Promise<Models.Membership> {
394
+ let params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string };
395
+
396
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
397
+ params = (paramsOrFirst || {}) as { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string };
398
+ } else {
399
+ params = {
400
+ teamId: paramsOrFirst as string,
401
+ roles: rest[0] as string[],
402
+ email: rest[1] as string,
403
+ userId: rest[2] as string,
404
+ phone: rest[3] as string,
405
+ url: rest[4] as string,
406
+ name: rest[5] as string
407
+ };
408
+ }
409
+
410
+ const teamId = params.teamId;
411
+ const roles = params.roles;
412
+ const email = params.email;
413
+ const userId = params.userId;
414
+ const phone = params.phone;
415
+ const url = params.url;
416
+ const name = params.name;
417
+
221
418
  if (typeof teamId === 'undefined') {
222
419
  throw new AppwriteException('Missing required parameter: "teamId"');
223
420
  }
@@ -260,16 +457,42 @@ export class Teams extends Service {
260
457
  }
261
458
 
262
459
  /**
263
- * Get a team member by the membership unique id. All team members have read
264
- * access for this resource. Hide sensitive attributes from the response by
265
- * toggling membership privacy in the Console.
460
+ * 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.
266
461
  *
267
- * @param {string} teamId
268
- * @param {string} membershipId
462
+ * @param {string} params.teamId - Team ID.
463
+ * @param {string} params.membershipId - Membership ID.
269
464
  * @throws {AppwriteException}
270
465
  * @returns {Promise}
271
466
  */
272
- getMembership(teamId: string, membershipId: string): Promise<Models.Membership> {
467
+ getMembership(params: { teamId: string, membershipId: string }): Promise<Models.Membership>;
468
+ /**
469
+ * 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.
470
+ *
471
+ * @param {string} teamId - Team ID.
472
+ * @param {string} membershipId - Membership ID.
473
+ * @throws {AppwriteException}
474
+ * @returns {Promise<Models.Membership>}
475
+ * @deprecated Use the object parameter style method for a better developer experience.
476
+ */
477
+ getMembership(teamId: string, membershipId: string): Promise<Models.Membership>;
478
+ getMembership(
479
+ paramsOrFirst: { teamId: string, membershipId: string } | string,
480
+ ...rest: [(string)?]
481
+ ): Promise<Models.Membership> {
482
+ let params: { teamId: string, membershipId: string };
483
+
484
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
485
+ params = (paramsOrFirst || {}) as { teamId: string, membershipId: string };
486
+ } else {
487
+ params = {
488
+ teamId: paramsOrFirst as string,
489
+ membershipId: rest[0] as string
490
+ };
491
+ }
492
+
493
+ const teamId = params.teamId;
494
+ const membershipId = params.membershipId;
495
+
273
496
  if (typeof teamId === 'undefined') {
274
497
  throw new AppwriteException('Missing required parameter: "teamId"');
275
498
  }
@@ -287,18 +510,48 @@ export class Teams extends Service {
287
510
  }
288
511
 
289
512
  /**
290
- * Modify the roles of a team member. Only team members with the owner role
291
- * have access to this endpoint. Learn more about [roles and
292
- * permissions](https://appwrite.io/docs/permissions).
513
+ * 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).
293
514
  *
294
515
  *
295
- * @param {string} teamId
296
- * @param {string} membershipId
297
- * @param {string[]} roles
516
+ * @param {string} params.teamId - Team ID.
517
+ * @param {string} params.membershipId - Membership ID.
518
+ * @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.
298
519
  * @throws {AppwriteException}
299
520
  * @returns {Promise}
300
521
  */
301
- updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership> {
522
+ updateMembership(params: { teamId: string, membershipId: string, roles: string[] }): Promise<Models.Membership>;
523
+ /**
524
+ * 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).
525
+ *
526
+ *
527
+ * @param {string} teamId - Team ID.
528
+ * @param {string} membershipId - Membership ID.
529
+ * @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.
530
+ * @throws {AppwriteException}
531
+ * @returns {Promise<Models.Membership>}
532
+ * @deprecated Use the object parameter style method for a better developer experience.
533
+ */
534
+ updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>;
535
+ updateMembership(
536
+ paramsOrFirst: { teamId: string, membershipId: string, roles: string[] } | string,
537
+ ...rest: [(string)?, (string[])?]
538
+ ): Promise<Models.Membership> {
539
+ let params: { teamId: string, membershipId: string, roles: string[] };
540
+
541
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
542
+ params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: string[] };
543
+ } else {
544
+ params = {
545
+ teamId: paramsOrFirst as string,
546
+ membershipId: rest[0] as string,
547
+ roles: rest[1] as string[]
548
+ };
549
+ }
550
+
551
+ const teamId = params.teamId;
552
+ const membershipId = params.membershipId;
553
+ const roles = params.roles;
554
+
302
555
  if (typeof teamId === 'undefined') {
303
556
  throw new AppwriteException('Missing required parameter: "teamId"');
304
557
  }
@@ -325,16 +578,42 @@ export class Teams extends Service {
325
578
  }
326
579
 
327
580
  /**
328
- * This endpoint allows a user to leave a team or for a team owner to delete
329
- * the membership of any other team member. You can also use this endpoint to
330
- * delete a user membership even if it is not accepted.
581
+ * 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.
331
582
  *
332
- * @param {string} teamId
333
- * @param {string} membershipId
583
+ * @param {string} params.teamId - Team ID.
584
+ * @param {string} params.membershipId - Membership ID.
334
585
  * @throws {AppwriteException}
335
586
  * @returns {Promise}
336
587
  */
337
- deleteMembership(teamId: string, membershipId: string): Promise<{}> {
588
+ deleteMembership(params: { teamId: string, membershipId: string }): Promise<{}>;
589
+ /**
590
+ * 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.
591
+ *
592
+ * @param {string} teamId - Team ID.
593
+ * @param {string} membershipId - Membership ID.
594
+ * @throws {AppwriteException}
595
+ * @returns {Promise<{}>}
596
+ * @deprecated Use the object parameter style method for a better developer experience.
597
+ */
598
+ deleteMembership(teamId: string, membershipId: string): Promise<{}>;
599
+ deleteMembership(
600
+ paramsOrFirst: { teamId: string, membershipId: string } | string,
601
+ ...rest: [(string)?]
602
+ ): Promise<{}> {
603
+ let params: { teamId: string, membershipId: string };
604
+
605
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
606
+ params = (paramsOrFirst || {}) as { teamId: string, membershipId: string };
607
+ } else {
608
+ params = {
609
+ teamId: paramsOrFirst as string,
610
+ membershipId: rest[0] as string
611
+ };
612
+ }
613
+
614
+ const teamId = params.teamId;
615
+ const membershipId = params.membershipId;
616
+
338
617
  if (typeof teamId === 'undefined') {
339
618
  throw new AppwriteException('Missing required parameter: "teamId"');
340
619
  }
@@ -353,22 +632,56 @@ export class Teams extends Service {
353
632
  }
354
633
 
355
634
  /**
356
- * Use this endpoint to allow a user to accept an invitation to join a team
357
- * after being redirected back to your app from the invitation email received
358
- * by the user.
635
+ * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
359
636
  *
360
- * If the request is successful, a session for the user is automatically
361
- * created.
637
+ * If the request is successful, a session for the user is automatically created.
362
638
  *
363
639
  *
364
- * @param {string} teamId
365
- * @param {string} membershipId
366
- * @param {string} userId
367
- * @param {string} secret
640
+ * @param {string} params.teamId - Team ID.
641
+ * @param {string} params.membershipId - Membership ID.
642
+ * @param {string} params.userId - User ID.
643
+ * @param {string} params.secret - Secret key.
368
644
  * @throws {AppwriteException}
369
645
  * @returns {Promise}
370
646
  */
371
- updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership> {
647
+ updateMembershipStatus(params: { teamId: string, membershipId: string, userId: string, secret: string }): Promise<Models.Membership>;
648
+ /**
649
+ * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
650
+ *
651
+ * If the request is successful, a session for the user is automatically created.
652
+ *
653
+ *
654
+ * @param {string} teamId - Team ID.
655
+ * @param {string} membershipId - Membership ID.
656
+ * @param {string} userId - User ID.
657
+ * @param {string} secret - Secret key.
658
+ * @throws {AppwriteException}
659
+ * @returns {Promise<Models.Membership>}
660
+ * @deprecated Use the object parameter style method for a better developer experience.
661
+ */
662
+ updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership>;
663
+ updateMembershipStatus(
664
+ paramsOrFirst: { teamId: string, membershipId: string, userId: string, secret: string } | string,
665
+ ...rest: [(string)?, (string)?, (string)?]
666
+ ): Promise<Models.Membership> {
667
+ let params: { teamId: string, membershipId: string, userId: string, secret: string };
668
+
669
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
670
+ params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, userId: string, secret: string };
671
+ } else {
672
+ params = {
673
+ teamId: paramsOrFirst as string,
674
+ membershipId: rest[0] as string,
675
+ userId: rest[1] as string,
676
+ secret: rest[2] as string
677
+ };
678
+ }
679
+
680
+ const teamId = params.teamId;
681
+ const membershipId = params.membershipId;
682
+ const userId = params.userId;
683
+ const secret = params.secret;
684
+
372
685
  if (typeof teamId === 'undefined') {
373
686
  throw new AppwriteException('Missing required parameter: "teamId"');
374
687
  }
@@ -403,15 +716,37 @@ export class Teams extends Service {
403
716
  }
404
717
 
405
718
  /**
406
- * Get the team's shared preferences by its unique ID. If a preference doesn't
407
- * need to be shared by all team members, prefer storing them in [user
408
- * preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
719
+ * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
409
720
  *
410
- * @param {string} teamId
721
+ * @param {string} params.teamId - Team ID.
411
722
  * @throws {AppwriteException}
412
723
  * @returns {Promise}
413
724
  */
414
- getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Preferences> {
725
+ getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string }): Promise<Preferences>;
726
+ /**
727
+ * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs).
728
+ *
729
+ * @param {string} teamId - Team ID.
730
+ * @throws {AppwriteException}
731
+ * @returns {Promise<Preferences>}
732
+ * @deprecated Use the object parameter style method for a better developer experience.
733
+ */
734
+ getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Preferences>;
735
+ getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(
736
+ paramsOrFirst: { teamId: string } | string
737
+ ): Promise<Preferences> {
738
+ let params: { teamId: string };
739
+
740
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
741
+ params = (paramsOrFirst || {}) as { teamId: string };
742
+ } else {
743
+ params = {
744
+ teamId: paramsOrFirst as string
745
+ };
746
+ }
747
+
748
+ const teamId = params.teamId;
749
+
415
750
  if (typeof teamId === 'undefined') {
416
751
  throw new AppwriteException('Missing required parameter: "teamId"');
417
752
  }
@@ -425,16 +760,42 @@ export class Teams extends Service {
425
760
  }
426
761
 
427
762
  /**
428
- * Update the team's preferences by its unique ID. The object you pass is
429
- * stored as is and replaces any previous value. The maximum allowed prefs
430
- * size is 64kB and throws an error if exceeded.
763
+ * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
431
764
  *
432
- * @param {string} teamId
433
- * @param {object} prefs
765
+ * @param {string} params.teamId - Team ID.
766
+ * @param {object} params.prefs - Prefs key-value JSON object.
434
767
  * @throws {AppwriteException}
435
768
  * @returns {Promise}
436
769
  */
437
- updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, prefs: object): Promise<Preferences> {
770
+ updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, prefs: object }): Promise<Preferences>;
771
+ /**
772
+ * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
773
+ *
774
+ * @param {string} teamId - Team ID.
775
+ * @param {object} prefs - Prefs key-value JSON object.
776
+ * @throws {AppwriteException}
777
+ * @returns {Promise<Preferences>}
778
+ * @deprecated Use the object parameter style method for a better developer experience.
779
+ */
780
+ updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, prefs: object): Promise<Preferences>;
781
+ updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(
782
+ paramsOrFirst: { teamId: string, prefs: object } | string,
783
+ ...rest: [(object)?]
784
+ ): Promise<Preferences> {
785
+ let params: { teamId: string, prefs: object };
786
+
787
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
788
+ params = (paramsOrFirst || {}) as { teamId: string, prefs: object };
789
+ } else {
790
+ params = {
791
+ teamId: paramsOrFirst as string,
792
+ prefs: rest[0] as object
793
+ };
794
+ }
795
+
796
+ const teamId = params.teamId;
797
+ const prefs = params.prefs;
798
+
438
799
  if (typeof teamId === 'undefined') {
439
800
  throw new AppwriteException('Missing required parameter: "teamId"');
440
801
  }