@appwrite.io/console 0.0.1

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 (228) hide show
  1. package/.github/workflows/publish.yml +18 -0
  2. package/CHANGELOG.md +1 -0
  3. package/LICENSE +12 -0
  4. package/README.md +111 -0
  5. package/dist/cjs/package.json +3 -0
  6. package/dist/esm/package.json +3 -0
  7. package/docs/examples/account/create-anonymous-session.md +18 -0
  8. package/docs/examples/account/create-email-session.md +18 -0
  9. package/docs/examples/account/create-j-w-t.md +18 -0
  10. package/docs/examples/account/create-magic-u-r-l-session.md +18 -0
  11. package/docs/examples/account/create-o-auth2session.md +14 -0
  12. package/docs/examples/account/create-phone-session.md +18 -0
  13. package/docs/examples/account/create-phone-verification.md +18 -0
  14. package/docs/examples/account/create-recovery.md +18 -0
  15. package/docs/examples/account/create-verification.md +18 -0
  16. package/docs/examples/account/create.md +18 -0
  17. package/docs/examples/account/delete-session.md +18 -0
  18. package/docs/examples/account/delete-sessions.md +18 -0
  19. package/docs/examples/account/get-prefs.md +18 -0
  20. package/docs/examples/account/get-session.md +18 -0
  21. package/docs/examples/account/get.md +18 -0
  22. package/docs/examples/account/list-logs.md +18 -0
  23. package/docs/examples/account/list-sessions.md +18 -0
  24. package/docs/examples/account/update-email.md +18 -0
  25. package/docs/examples/account/update-magic-u-r-l-session.md +18 -0
  26. package/docs/examples/account/update-name.md +18 -0
  27. package/docs/examples/account/update-password.md +18 -0
  28. package/docs/examples/account/update-phone-session.md +18 -0
  29. package/docs/examples/account/update-phone-verification.md +18 -0
  30. package/docs/examples/account/update-phone.md +18 -0
  31. package/docs/examples/account/update-prefs.md +18 -0
  32. package/docs/examples/account/update-recovery.md +18 -0
  33. package/docs/examples/account/update-session.md +18 -0
  34. package/docs/examples/account/update-status.md +18 -0
  35. package/docs/examples/account/update-verification.md +18 -0
  36. package/docs/examples/avatars/get-browser.md +14 -0
  37. package/docs/examples/avatars/get-credit-card.md +14 -0
  38. package/docs/examples/avatars/get-favicon.md +14 -0
  39. package/docs/examples/avatars/get-flag.md +14 -0
  40. package/docs/examples/avatars/get-image.md +14 -0
  41. package/docs/examples/avatars/get-initials.md +14 -0
  42. package/docs/examples/avatars/get-q-r.md +14 -0
  43. package/docs/examples/databases/create-boolean-attribute.md +18 -0
  44. package/docs/examples/databases/create-collection.md +18 -0
  45. package/docs/examples/databases/create-datetime-attribute.md +18 -0
  46. package/docs/examples/databases/create-document.md +18 -0
  47. package/docs/examples/databases/create-email-attribute.md +18 -0
  48. package/docs/examples/databases/create-enum-attribute.md +18 -0
  49. package/docs/examples/databases/create-float-attribute.md +18 -0
  50. package/docs/examples/databases/create-index.md +18 -0
  51. package/docs/examples/databases/create-integer-attribute.md +18 -0
  52. package/docs/examples/databases/create-ip-attribute.md +18 -0
  53. package/docs/examples/databases/create-string-attribute.md +18 -0
  54. package/docs/examples/databases/create-url-attribute.md +18 -0
  55. package/docs/examples/databases/create.md +18 -0
  56. package/docs/examples/databases/delete-attribute.md +18 -0
  57. package/docs/examples/databases/delete-collection.md +18 -0
  58. package/docs/examples/databases/delete-document.md +18 -0
  59. package/docs/examples/databases/delete-index.md +18 -0
  60. package/docs/examples/databases/delete.md +18 -0
  61. package/docs/examples/databases/get-attribute.md +18 -0
  62. package/docs/examples/databases/get-collection-usage.md +18 -0
  63. package/docs/examples/databases/get-collection.md +18 -0
  64. package/docs/examples/databases/get-database-usage.md +18 -0
  65. package/docs/examples/databases/get-document.md +18 -0
  66. package/docs/examples/databases/get-index.md +18 -0
  67. package/docs/examples/databases/get-usage.md +18 -0
  68. package/docs/examples/databases/get.md +18 -0
  69. package/docs/examples/databases/list-attributes.md +18 -0
  70. package/docs/examples/databases/list-collection-logs.md +18 -0
  71. package/docs/examples/databases/list-collections.md +18 -0
  72. package/docs/examples/databases/list-document-logs.md +18 -0
  73. package/docs/examples/databases/list-documents.md +18 -0
  74. package/docs/examples/databases/list-indexes.md +18 -0
  75. package/docs/examples/databases/list-logs.md +18 -0
  76. package/docs/examples/databases/list.md +18 -0
  77. package/docs/examples/databases/update-collection.md +18 -0
  78. package/docs/examples/databases/update-document.md +18 -0
  79. package/docs/examples/databases/update.md +18 -0
  80. package/docs/examples/functions/create-build.md +18 -0
  81. package/docs/examples/functions/create-deployment.md +18 -0
  82. package/docs/examples/functions/create-execution.md +18 -0
  83. package/docs/examples/functions/create-variable.md +18 -0
  84. package/docs/examples/functions/create.md +18 -0
  85. package/docs/examples/functions/delete-deployment.md +18 -0
  86. package/docs/examples/functions/delete-variable.md +18 -0
  87. package/docs/examples/functions/delete.md +18 -0
  88. package/docs/examples/functions/get-deployment.md +18 -0
  89. package/docs/examples/functions/get-execution.md +18 -0
  90. package/docs/examples/functions/get-function-usage.md +18 -0
  91. package/docs/examples/functions/get-usage.md +18 -0
  92. package/docs/examples/functions/get-variable.md +18 -0
  93. package/docs/examples/functions/get.md +18 -0
  94. package/docs/examples/functions/list-deployments.md +18 -0
  95. package/docs/examples/functions/list-executions.md +18 -0
  96. package/docs/examples/functions/list-runtimes.md +18 -0
  97. package/docs/examples/functions/list-variables.md +18 -0
  98. package/docs/examples/functions/list.md +18 -0
  99. package/docs/examples/functions/update-deployment.md +18 -0
  100. package/docs/examples/functions/update-variable.md +18 -0
  101. package/docs/examples/functions/update.md +18 -0
  102. package/docs/examples/graphql/mutation.md +18 -0
  103. package/docs/examples/graphql/query.md +18 -0
  104. package/docs/examples/health/get-antivirus.md +18 -0
  105. package/docs/examples/health/get-cache.md +18 -0
  106. package/docs/examples/health/get-d-b.md +18 -0
  107. package/docs/examples/health/get-queue-certificates.md +18 -0
  108. package/docs/examples/health/get-queue-functions.md +18 -0
  109. package/docs/examples/health/get-queue-logs.md +18 -0
  110. package/docs/examples/health/get-queue-webhooks.md +18 -0
  111. package/docs/examples/health/get-storage-local.md +18 -0
  112. package/docs/examples/health/get-time.md +18 -0
  113. package/docs/examples/health/get.md +18 -0
  114. package/docs/examples/locale/get.md +18 -0
  115. package/docs/examples/locale/list-continents.md +18 -0
  116. package/docs/examples/locale/list-countries-e-u.md +18 -0
  117. package/docs/examples/locale/list-countries-phones.md +18 -0
  118. package/docs/examples/locale/list-countries.md +18 -0
  119. package/docs/examples/locale/list-currencies.md +18 -0
  120. package/docs/examples/locale/list-languages.md +18 -0
  121. package/docs/examples/projects/create-domain.md +18 -0
  122. package/docs/examples/projects/create-key.md +18 -0
  123. package/docs/examples/projects/create-platform.md +18 -0
  124. package/docs/examples/projects/create-webhook.md +18 -0
  125. package/docs/examples/projects/create.md +18 -0
  126. package/docs/examples/projects/delete-domain.md +18 -0
  127. package/docs/examples/projects/delete-key.md +18 -0
  128. package/docs/examples/projects/delete-platform.md +18 -0
  129. package/docs/examples/projects/delete-webhook.md +18 -0
  130. package/docs/examples/projects/delete.md +18 -0
  131. package/docs/examples/projects/get-domain.md +18 -0
  132. package/docs/examples/projects/get-key.md +18 -0
  133. package/docs/examples/projects/get-platform.md +18 -0
  134. package/docs/examples/projects/get-usage.md +18 -0
  135. package/docs/examples/projects/get-webhook.md +18 -0
  136. package/docs/examples/projects/get.md +18 -0
  137. package/docs/examples/projects/list-domains.md +18 -0
  138. package/docs/examples/projects/list-keys.md +18 -0
  139. package/docs/examples/projects/list-platforms.md +18 -0
  140. package/docs/examples/projects/list-webhooks.md +18 -0
  141. package/docs/examples/projects/list.md +18 -0
  142. package/docs/examples/projects/update-auth-duration.md +18 -0
  143. package/docs/examples/projects/update-auth-limit.md +18 -0
  144. package/docs/examples/projects/update-auth-sessions-limit.md +18 -0
  145. package/docs/examples/projects/update-auth-status.md +18 -0
  146. package/docs/examples/projects/update-domain-verification.md +18 -0
  147. package/docs/examples/projects/update-key.md +18 -0
  148. package/docs/examples/projects/update-o-auth2.md +18 -0
  149. package/docs/examples/projects/update-platform.md +18 -0
  150. package/docs/examples/projects/update-service-status.md +18 -0
  151. package/docs/examples/projects/update-webhook-signature.md +18 -0
  152. package/docs/examples/projects/update-webhook.md +18 -0
  153. package/docs/examples/projects/update.md +18 -0
  154. package/docs/examples/storage/create-bucket.md +18 -0
  155. package/docs/examples/storage/create-file.md +18 -0
  156. package/docs/examples/storage/delete-bucket.md +18 -0
  157. package/docs/examples/storage/delete-file.md +18 -0
  158. package/docs/examples/storage/get-bucket-usage.md +18 -0
  159. package/docs/examples/storage/get-bucket.md +18 -0
  160. package/docs/examples/storage/get-file-download.md +14 -0
  161. package/docs/examples/storage/get-file-preview.md +14 -0
  162. package/docs/examples/storage/get-file-view.md +14 -0
  163. package/docs/examples/storage/get-file.md +18 -0
  164. package/docs/examples/storage/get-usage.md +18 -0
  165. package/docs/examples/storage/list-buckets.md +18 -0
  166. package/docs/examples/storage/list-files.md +18 -0
  167. package/docs/examples/storage/update-bucket.md +18 -0
  168. package/docs/examples/storage/update-file.md +18 -0
  169. package/docs/examples/teams/create-membership.md +18 -0
  170. package/docs/examples/teams/create.md +18 -0
  171. package/docs/examples/teams/delete-membership.md +18 -0
  172. package/docs/examples/teams/delete.md +18 -0
  173. package/docs/examples/teams/get-membership.md +18 -0
  174. package/docs/examples/teams/get.md +18 -0
  175. package/docs/examples/teams/list-logs.md +18 -0
  176. package/docs/examples/teams/list-memberships.md +18 -0
  177. package/docs/examples/teams/list.md +18 -0
  178. package/docs/examples/teams/update-membership-roles.md +18 -0
  179. package/docs/examples/teams/update-membership-status.md +18 -0
  180. package/docs/examples/teams/update.md +18 -0
  181. package/docs/examples/users/create-argon2user.md +18 -0
  182. package/docs/examples/users/create-bcrypt-user.md +18 -0
  183. package/docs/examples/users/create-m-d5user.md +18 -0
  184. package/docs/examples/users/create-p-h-pass-user.md +18 -0
  185. package/docs/examples/users/create-s-h-a-user.md +18 -0
  186. package/docs/examples/users/create-scrypt-modified-user.md +18 -0
  187. package/docs/examples/users/create-scrypt-user.md +18 -0
  188. package/docs/examples/users/create.md +18 -0
  189. package/docs/examples/users/delete-session.md +18 -0
  190. package/docs/examples/users/delete-sessions.md +18 -0
  191. package/docs/examples/users/delete.md +18 -0
  192. package/docs/examples/users/get-prefs.md +18 -0
  193. package/docs/examples/users/get-usage.md +18 -0
  194. package/docs/examples/users/get.md +18 -0
  195. package/docs/examples/users/list-logs.md +18 -0
  196. package/docs/examples/users/list-memberships.md +18 -0
  197. package/docs/examples/users/list-sessions.md +18 -0
  198. package/docs/examples/users/list.md +18 -0
  199. package/docs/examples/users/update-email-verification.md +18 -0
  200. package/docs/examples/users/update-email.md +18 -0
  201. package/docs/examples/users/update-name.md +18 -0
  202. package/docs/examples/users/update-password.md +18 -0
  203. package/docs/examples/users/update-phone-verification.md +18 -0
  204. package/docs/examples/users/update-phone.md +18 -0
  205. package/docs/examples/users/update-prefs.md +18 -0
  206. package/docs/examples/users/update-status.md +18 -0
  207. package/package.json +40 -0
  208. package/rollup.config.js +31 -0
  209. package/src/client.ts +472 -0
  210. package/src/id.ts +9 -0
  211. package/src/index.ts +17 -0
  212. package/src/models.ts +2540 -0
  213. package/src/permission.ts +22 -0
  214. package/src/query.ts +56 -0
  215. package/src/role.ts +34 -0
  216. package/src/service.ts +30 -0
  217. package/src/services/account.ts +1009 -0
  218. package/src/services/avatars.ts +351 -0
  219. package/src/services/databases.ts +1525 -0
  220. package/src/services/functions.ts +814 -0
  221. package/src/services/graphql.ts +68 -0
  222. package/src/services/health.ts +202 -0
  223. package/src/services/locale.ts +150 -0
  224. package/src/services/projects.ts +1235 -0
  225. package/src/services/storage.ts +691 -0
  226. package/src/services/teams.ts +445 -0
  227. package/src/services/users.ts +1020 -0
  228. package/tsconfig.json +24 -0
@@ -0,0 +1,445 @@
1
+ import { Service } from '../service';
2
+ import { AppwriteException, Client } from '../client';
3
+ import type { Models } from '../models';
4
+ import type { UploadProgress, Payload } from '../client';
5
+
6
+ export class Teams extends Service {
7
+
8
+ constructor(client: Client)
9
+ {
10
+ super(client);
11
+ }
12
+
13
+ /**
14
+ * List Teams
15
+ *
16
+ * Get a list of all the teams in which the current user is a member. You can
17
+ * use the parameters to filter your results.
18
+ *
19
+ * @param {string[]} queries
20
+ * @param {string} search
21
+ * @throws {AppwriteException}
22
+ * @returns {Promise}
23
+ */
24
+ async list(queries?: string[], search?: string): Promise<Models.TeamList> {
25
+ let path = '/teams';
26
+ let payload: Payload = {};
27
+
28
+ if (typeof queries !== 'undefined') {
29
+ payload['queries'] = queries;
30
+ }
31
+
32
+ if (typeof search !== 'undefined') {
33
+ payload['search'] = search;
34
+ }
35
+
36
+ const uri = new URL(this.client.config.endpoint + path);
37
+ return await this.client.call('get', uri, {
38
+ 'content-type': 'application/json',
39
+ }, payload);
40
+ }
41
+
42
+ /**
43
+ * Create Team
44
+ *
45
+ * Create a new team. The user who creates the team will automatically be
46
+ * assigned as the owner of the team. Only the users with the owner role can
47
+ * invite new members, add new owners and delete or update the team.
48
+ *
49
+ * @param {string} teamId
50
+ * @param {string} name
51
+ * @param {string[]} roles
52
+ * @throws {AppwriteException}
53
+ * @returns {Promise}
54
+ */
55
+ async create(teamId: string, name: string, roles?: string[]): Promise<Models.Team> {
56
+ if (typeof teamId === 'undefined') {
57
+ throw new AppwriteException('Missing required parameter: "teamId"');
58
+ }
59
+
60
+ if (typeof name === 'undefined') {
61
+ throw new AppwriteException('Missing required parameter: "name"');
62
+ }
63
+
64
+ let path = '/teams';
65
+ let payload: Payload = {};
66
+
67
+ if (typeof teamId !== 'undefined') {
68
+ payload['teamId'] = teamId;
69
+ }
70
+
71
+ if (typeof name !== 'undefined') {
72
+ payload['name'] = name;
73
+ }
74
+
75
+ if (typeof roles !== 'undefined') {
76
+ payload['roles'] = roles;
77
+ }
78
+
79
+ const uri = new URL(this.client.config.endpoint + path);
80
+ return await this.client.call('post', uri, {
81
+ 'content-type': 'application/json',
82
+ }, payload);
83
+ }
84
+
85
+ /**
86
+ * Get Team
87
+ *
88
+ * Get a team by its ID. All team members have read access for this resource.
89
+ *
90
+ * @param {string} teamId
91
+ * @throws {AppwriteException}
92
+ * @returns {Promise}
93
+ */
94
+ async get(teamId: string): Promise<Models.Team> {
95
+ if (typeof teamId === 'undefined') {
96
+ throw new AppwriteException('Missing required parameter: "teamId"');
97
+ }
98
+
99
+ let path = '/teams/{teamId}'.replace('{teamId}', teamId);
100
+ let payload: Payload = {};
101
+
102
+ const uri = new URL(this.client.config.endpoint + path);
103
+ return await this.client.call('get', uri, {
104
+ 'content-type': 'application/json',
105
+ }, payload);
106
+ }
107
+
108
+ /**
109
+ * Update Team
110
+ *
111
+ * Update a team using its ID. Only members with the owner role can update the
112
+ * team.
113
+ *
114
+ * @param {string} teamId
115
+ * @param {string} name
116
+ * @throws {AppwriteException}
117
+ * @returns {Promise}
118
+ */
119
+ async update(teamId: string, name: string): Promise<Models.Team> {
120
+ if (typeof teamId === 'undefined') {
121
+ throw new AppwriteException('Missing required parameter: "teamId"');
122
+ }
123
+
124
+ if (typeof name === 'undefined') {
125
+ throw new AppwriteException('Missing required parameter: "name"');
126
+ }
127
+
128
+ let path = '/teams/{teamId}'.replace('{teamId}', teamId);
129
+ let payload: Payload = {};
130
+
131
+ if (typeof name !== 'undefined') {
132
+ payload['name'] = name;
133
+ }
134
+
135
+ const uri = new URL(this.client.config.endpoint + path);
136
+ return await this.client.call('put', uri, {
137
+ 'content-type': 'application/json',
138
+ }, payload);
139
+ }
140
+
141
+ /**
142
+ * Delete Team
143
+ *
144
+ * Delete a team using its ID. Only team members with the owner role can
145
+ * delete the team.
146
+ *
147
+ * @param {string} teamId
148
+ * @throws {AppwriteException}
149
+ * @returns {Promise}
150
+ */
151
+ async delete(teamId: string): Promise<{}> {
152
+ if (typeof teamId === 'undefined') {
153
+ throw new AppwriteException('Missing required parameter: "teamId"');
154
+ }
155
+
156
+ let path = '/teams/{teamId}'.replace('{teamId}', teamId);
157
+ let payload: Payload = {};
158
+
159
+ const uri = new URL(this.client.config.endpoint + path);
160
+ return await this.client.call('delete', uri, {
161
+ 'content-type': 'application/json',
162
+ }, payload);
163
+ }
164
+
165
+ /**
166
+ * List Team Logs
167
+ *
168
+ * Get the team activity logs list by its unique ID.
169
+ *
170
+ * @param {string} teamId
171
+ * @param {string[]} queries
172
+ * @throws {AppwriteException}
173
+ * @returns {Promise}
174
+ */
175
+ async listLogs(teamId: string, queries?: string[]): Promise<Models.LogList> {
176
+ if (typeof teamId === 'undefined') {
177
+ throw new AppwriteException('Missing required parameter: "teamId"');
178
+ }
179
+
180
+ let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
181
+ let payload: Payload = {};
182
+
183
+ if (typeof queries !== 'undefined') {
184
+ payload['queries'] = queries;
185
+ }
186
+
187
+ const uri = new URL(this.client.config.endpoint + path);
188
+ return await this.client.call('get', uri, {
189
+ 'content-type': 'application/json',
190
+ }, payload);
191
+ }
192
+
193
+ /**
194
+ * List Team Memberships
195
+ *
196
+ * Use this endpoint to list a team's members using the team's ID. All team
197
+ * members have read access to this endpoint.
198
+ *
199
+ * @param {string} teamId
200
+ * @param {string[]} queries
201
+ * @param {string} search
202
+ * @throws {AppwriteException}
203
+ * @returns {Promise}
204
+ */
205
+ async listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> {
206
+ if (typeof teamId === 'undefined') {
207
+ throw new AppwriteException('Missing required parameter: "teamId"');
208
+ }
209
+
210
+ let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
211
+ let payload: Payload = {};
212
+
213
+ if (typeof queries !== 'undefined') {
214
+ payload['queries'] = queries;
215
+ }
216
+
217
+ if (typeof search !== 'undefined') {
218
+ payload['search'] = search;
219
+ }
220
+
221
+ const uri = new URL(this.client.config.endpoint + path);
222
+ return await this.client.call('get', uri, {
223
+ 'content-type': 'application/json',
224
+ }, payload);
225
+ }
226
+
227
+ /**
228
+ * Create Team Membership
229
+ *
230
+ * Invite a new member to join your team. If initiated from the client SDK, an
231
+ * email with a link to join the team will be sent to the member's email
232
+ * address and an account will be created for them should they not be signed
233
+ * up already. If initiated from server-side SDKs, the new member will
234
+ * automatically be added to the team.
235
+ *
236
+ * Use the 'url' parameter to redirect the user from the invitation email back
237
+ * to your app. When the user is redirected, use the [Update Team Membership
238
+ * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
239
+ * the user to accept the invitation to the team.
240
+ *
241
+ * Please note that to avoid a [Redirect
242
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
243
+ * the only valid redirect URL's are the once from domains you have set when
244
+ * adding your platforms in the console interface.
245
+ *
246
+ * @param {string} teamId
247
+ * @param {string} email
248
+ * @param {string[]} roles
249
+ * @param {string} url
250
+ * @param {string} name
251
+ * @throws {AppwriteException}
252
+ * @returns {Promise}
253
+ */
254
+ async createMembership(teamId: string, email: string, roles: string[], url: string, name?: string): Promise<Models.Membership> {
255
+ if (typeof teamId === 'undefined') {
256
+ throw new AppwriteException('Missing required parameter: "teamId"');
257
+ }
258
+
259
+ if (typeof email === 'undefined') {
260
+ throw new AppwriteException('Missing required parameter: "email"');
261
+ }
262
+
263
+ if (typeof roles === 'undefined') {
264
+ throw new AppwriteException('Missing required parameter: "roles"');
265
+ }
266
+
267
+ if (typeof url === 'undefined') {
268
+ throw new AppwriteException('Missing required parameter: "url"');
269
+ }
270
+
271
+ let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
272
+ let payload: Payload = {};
273
+
274
+ if (typeof email !== 'undefined') {
275
+ payload['email'] = email;
276
+ }
277
+
278
+ if (typeof roles !== 'undefined') {
279
+ payload['roles'] = roles;
280
+ }
281
+
282
+ if (typeof url !== 'undefined') {
283
+ payload['url'] = url;
284
+ }
285
+
286
+ if (typeof name !== 'undefined') {
287
+ payload['name'] = name;
288
+ }
289
+
290
+ const uri = new URL(this.client.config.endpoint + path);
291
+ return await this.client.call('post', uri, {
292
+ 'content-type': 'application/json',
293
+ }, payload);
294
+ }
295
+
296
+ /**
297
+ * Get Team Membership
298
+ *
299
+ * Get a team member by the membership unique id. All team members have read
300
+ * access for this resource.
301
+ *
302
+ * @param {string} teamId
303
+ * @param {string} membershipId
304
+ * @throws {AppwriteException}
305
+ * @returns {Promise}
306
+ */
307
+ async getMembership(teamId: string, membershipId: string): Promise<Models.Membership> {
308
+ if (typeof teamId === 'undefined') {
309
+ throw new AppwriteException('Missing required parameter: "teamId"');
310
+ }
311
+
312
+ if (typeof membershipId === 'undefined') {
313
+ throw new AppwriteException('Missing required parameter: "membershipId"');
314
+ }
315
+
316
+ let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
317
+ let payload: Payload = {};
318
+
319
+ const uri = new URL(this.client.config.endpoint + path);
320
+ return await this.client.call('get', uri, {
321
+ 'content-type': 'application/json',
322
+ }, payload);
323
+ }
324
+
325
+ /**
326
+ * Update Membership Roles
327
+ *
328
+ * Modify the roles of a team member. Only team members with the owner role
329
+ * have access to this endpoint. Learn more about [roles and
330
+ * permissions](/docs/permissions).
331
+ *
332
+ * @param {string} teamId
333
+ * @param {string} membershipId
334
+ * @param {string[]} roles
335
+ * @throws {AppwriteException}
336
+ * @returns {Promise}
337
+ */
338
+ async updateMembershipRoles(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership> {
339
+ if (typeof teamId === 'undefined') {
340
+ throw new AppwriteException('Missing required parameter: "teamId"');
341
+ }
342
+
343
+ if (typeof membershipId === 'undefined') {
344
+ throw new AppwriteException('Missing required parameter: "membershipId"');
345
+ }
346
+
347
+ if (typeof roles === 'undefined') {
348
+ throw new AppwriteException('Missing required parameter: "roles"');
349
+ }
350
+
351
+ let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
352
+ let payload: Payload = {};
353
+
354
+ if (typeof roles !== 'undefined') {
355
+ payload['roles'] = roles;
356
+ }
357
+
358
+ const uri = new URL(this.client.config.endpoint + path);
359
+ return await this.client.call('patch', uri, {
360
+ 'content-type': 'application/json',
361
+ }, payload);
362
+ }
363
+
364
+ /**
365
+ * Delete Team Membership
366
+ *
367
+ * This endpoint allows a user to leave a team or for a team owner to delete
368
+ * the membership of any other team member. You can also use this endpoint to
369
+ * delete a user membership even if it is not accepted.
370
+ *
371
+ * @param {string} teamId
372
+ * @param {string} membershipId
373
+ * @throws {AppwriteException}
374
+ * @returns {Promise}
375
+ */
376
+ async deleteMembership(teamId: string, membershipId: string): Promise<{}> {
377
+ if (typeof teamId === 'undefined') {
378
+ throw new AppwriteException('Missing required parameter: "teamId"');
379
+ }
380
+
381
+ if (typeof membershipId === 'undefined') {
382
+ throw new AppwriteException('Missing required parameter: "membershipId"');
383
+ }
384
+
385
+ let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
386
+ let payload: Payload = {};
387
+
388
+ const uri = new URL(this.client.config.endpoint + path);
389
+ return await this.client.call('delete', uri, {
390
+ 'content-type': 'application/json',
391
+ }, payload);
392
+ }
393
+
394
+ /**
395
+ * Update Team Membership Status
396
+ *
397
+ * Use this endpoint to allow a user to accept an invitation to join a team
398
+ * after being redirected back to your app from the invitation email received
399
+ * by the user.
400
+ *
401
+ * If the request is successful, a session for the user is automatically
402
+ * created.
403
+ *
404
+ *
405
+ * @param {string} teamId
406
+ * @param {string} membershipId
407
+ * @param {string} userId
408
+ * @param {string} secret
409
+ * @throws {AppwriteException}
410
+ * @returns {Promise}
411
+ */
412
+ async updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership> {
413
+ if (typeof teamId === 'undefined') {
414
+ throw new AppwriteException('Missing required parameter: "teamId"');
415
+ }
416
+
417
+ if (typeof membershipId === 'undefined') {
418
+ throw new AppwriteException('Missing required parameter: "membershipId"');
419
+ }
420
+
421
+ if (typeof userId === 'undefined') {
422
+ throw new AppwriteException('Missing required parameter: "userId"');
423
+ }
424
+
425
+ if (typeof secret === 'undefined') {
426
+ throw new AppwriteException('Missing required parameter: "secret"');
427
+ }
428
+
429
+ let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
430
+ let payload: Payload = {};
431
+
432
+ if (typeof userId !== 'undefined') {
433
+ payload['userId'] = userId;
434
+ }
435
+
436
+ if (typeof secret !== 'undefined') {
437
+ payload['secret'] = secret;
438
+ }
439
+
440
+ const uri = new URL(this.client.config.endpoint + path);
441
+ return await this.client.call('patch', uri, {
442
+ 'content-type': 'application/json',
443
+ }, payload);
444
+ }
445
+ };