@appwrite.io/console 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/.github/workflows/publish.yml +18 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/sdk.js +2417 -630
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +2413 -631
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +2417 -630
  8. package/docs/examples/account/create-anonymous-session.md +1 -1
  9. package/docs/examples/account/create-email-session.md +1 -1
  10. package/docs/examples/account/create-j-w-t.md +1 -1
  11. package/docs/examples/account/create-magic-u-r-l-session.md +1 -1
  12. package/docs/examples/account/create-o-auth2session.md +1 -1
  13. package/docs/examples/account/create-phone-session.md +1 -1
  14. package/docs/examples/account/create-phone-verification.md +1 -1
  15. package/docs/examples/account/create-recovery.md +1 -1
  16. package/docs/examples/account/create-verification.md +1 -1
  17. package/docs/examples/account/create-with-invite-code.md +18 -0
  18. package/docs/examples/account/create.md +1 -1
  19. package/docs/examples/account/delete-identity.md +18 -0
  20. package/docs/examples/account/delete-session.md +1 -1
  21. package/docs/examples/account/delete-sessions.md +1 -1
  22. package/docs/examples/account/get-prefs.md +1 -1
  23. package/docs/examples/account/get-session.md +1 -1
  24. package/docs/examples/account/get.md +1 -1
  25. package/docs/examples/account/list-identities.md +18 -0
  26. package/docs/examples/account/list-logs.md +1 -1
  27. package/docs/examples/account/list-sessions.md +1 -1
  28. package/docs/examples/account/update-email.md +1 -1
  29. package/docs/examples/account/update-magic-u-r-l-session.md +1 -1
  30. package/docs/examples/account/update-name.md +1 -1
  31. package/docs/examples/account/update-password.md +1 -1
  32. package/docs/examples/account/update-phone-session.md +1 -1
  33. package/docs/examples/account/update-phone-verification.md +1 -1
  34. package/docs/examples/account/update-phone.md +1 -1
  35. package/docs/examples/account/update-prefs.md +1 -1
  36. package/docs/examples/account/update-recovery.md +1 -1
  37. package/docs/examples/account/update-session.md +1 -1
  38. package/docs/examples/account/update-status.md +1 -1
  39. package/docs/examples/account/update-verification.md +1 -1
  40. package/docs/examples/assistant/chat.md +18 -0
  41. package/docs/examples/avatars/get-browser.md +1 -1
  42. package/docs/examples/avatars/get-credit-card.md +1 -1
  43. package/docs/examples/avatars/get-favicon.md +1 -1
  44. package/docs/examples/avatars/get-flag.md +1 -1
  45. package/docs/examples/avatars/get-image.md +1 -1
  46. package/docs/examples/avatars/get-initials.md +1 -1
  47. package/docs/examples/avatars/get-q-r.md +1 -1
  48. package/docs/examples/console/variables.md +1 -1
  49. package/docs/examples/databases/create-boolean-attribute.md +1 -1
  50. package/docs/examples/databases/create-collection.md +1 -1
  51. package/docs/examples/databases/create-datetime-attribute.md +1 -1
  52. package/docs/examples/databases/create-document.md +1 -1
  53. package/docs/examples/databases/create-email-attribute.md +1 -1
  54. package/docs/examples/databases/create-enum-attribute.md +1 -1
  55. package/docs/examples/databases/create-float-attribute.md +1 -1
  56. package/docs/examples/databases/create-index.md +1 -1
  57. package/docs/examples/databases/create-integer-attribute.md +1 -1
  58. package/docs/examples/databases/create-ip-attribute.md +1 -1
  59. package/docs/examples/databases/create-relationship-attribute.md +1 -1
  60. package/docs/examples/databases/create-string-attribute.md +1 -1
  61. package/docs/examples/databases/create-url-attribute.md +1 -1
  62. package/docs/examples/databases/create.md +1 -1
  63. package/docs/examples/databases/delete-attribute.md +1 -1
  64. package/docs/examples/databases/delete-collection.md +1 -1
  65. package/docs/examples/databases/delete-document.md +1 -1
  66. package/docs/examples/databases/delete-index.md +1 -1
  67. package/docs/examples/databases/delete.md +1 -1
  68. package/docs/examples/databases/get-attribute.md +1 -1
  69. package/docs/examples/databases/get-collection-usage.md +1 -1
  70. package/docs/examples/databases/get-collection.md +1 -1
  71. package/docs/examples/databases/get-database-usage.md +1 -1
  72. package/docs/examples/databases/get-document.md +1 -1
  73. package/docs/examples/databases/get-index.md +1 -1
  74. package/docs/examples/databases/get-usage.md +1 -1
  75. package/docs/examples/databases/get.md +1 -1
  76. package/docs/examples/databases/list-attributes.md +1 -1
  77. package/docs/examples/databases/list-collection-logs.md +1 -1
  78. package/docs/examples/databases/list-collections.md +1 -1
  79. package/docs/examples/databases/list-document-logs.md +1 -1
  80. package/docs/examples/databases/list-documents.md +1 -1
  81. package/docs/examples/databases/list-indexes.md +1 -1
  82. package/docs/examples/databases/list-logs.md +1 -1
  83. package/docs/examples/databases/list.md +1 -1
  84. package/docs/examples/databases/update-boolean-attribute.md +1 -1
  85. package/docs/examples/databases/update-collection.md +1 -1
  86. package/docs/examples/databases/update-datetime-attribute.md +1 -1
  87. package/docs/examples/databases/update-document.md +1 -1
  88. package/docs/examples/databases/update-email-attribute.md +1 -1
  89. package/docs/examples/databases/update-enum-attribute.md +1 -1
  90. package/docs/examples/databases/update-float-attribute.md +1 -1
  91. package/docs/examples/databases/update-integer-attribute.md +1 -1
  92. package/docs/examples/databases/update-ip-attribute.md +1 -1
  93. package/docs/examples/databases/update-relationship-attribute.md +1 -1
  94. package/docs/examples/databases/update-string-attribute.md +1 -1
  95. package/docs/examples/databases/update-url-attribute.md +1 -1
  96. package/docs/examples/databases/update.md +1 -1
  97. package/docs/examples/functions/create-build.md +1 -1
  98. package/docs/examples/functions/create-deployment.md +2 -2
  99. package/docs/examples/functions/create-execution.md +1 -1
  100. package/docs/examples/functions/create-variable.md +1 -1
  101. package/docs/examples/functions/create.md +1 -1
  102. package/docs/examples/functions/delete-deployment.md +1 -1
  103. package/docs/examples/functions/delete-variable.md +1 -1
  104. package/docs/examples/functions/delete.md +1 -1
  105. package/docs/examples/functions/download-deployment.md +14 -0
  106. package/docs/examples/functions/get-deployment.md +1 -1
  107. package/docs/examples/functions/get-execution.md +1 -1
  108. package/docs/examples/functions/get-function-usage.md +1 -1
  109. package/docs/examples/functions/get-usage.md +1 -1
  110. package/docs/examples/functions/get-variable.md +1 -1
  111. package/docs/examples/functions/get.md +1 -1
  112. package/docs/examples/functions/list-deployments.md +1 -1
  113. package/docs/examples/functions/list-executions.md +1 -1
  114. package/docs/examples/functions/list-runtimes.md +1 -1
  115. package/docs/examples/functions/list-variables.md +1 -1
  116. package/docs/examples/functions/list.md +1 -1
  117. package/docs/examples/functions/update-deployment.md +1 -1
  118. package/docs/examples/functions/update-variable.md +1 -1
  119. package/docs/examples/functions/update.md +2 -2
  120. package/docs/examples/graphql/mutation.md +1 -1
  121. package/docs/examples/graphql/query.md +1 -1
  122. package/docs/examples/health/get-antivirus.md +1 -1
  123. package/docs/examples/health/get-cache.md +1 -1
  124. package/docs/examples/health/get-d-b.md +1 -1
  125. package/docs/examples/health/get-pub-sub.md +18 -0
  126. package/docs/examples/health/get-queue-certificates.md +1 -1
  127. package/docs/examples/health/get-queue-functions.md +1 -1
  128. package/docs/examples/health/get-queue-logs.md +1 -1
  129. package/docs/examples/health/get-queue-webhooks.md +1 -1
  130. package/docs/examples/health/get-queue.md +18 -0
  131. package/docs/examples/health/get-storage-local.md +1 -1
  132. package/docs/examples/health/get-time.md +1 -1
  133. package/docs/examples/health/get.md +1 -1
  134. package/docs/examples/locale/get.md +1 -1
  135. package/docs/examples/locale/list-codes.md +18 -0
  136. package/docs/examples/locale/list-continents.md +1 -1
  137. package/docs/examples/locale/list-countries-e-u.md +1 -1
  138. package/docs/examples/locale/list-countries-phones.md +1 -1
  139. package/docs/examples/locale/list-countries.md +1 -1
  140. package/docs/examples/locale/list-currencies.md +1 -1
  141. package/docs/examples/locale/list-languages.md +1 -1
  142. package/docs/examples/migrations/create-appwrite-migration.md +18 -0
  143. package/docs/examples/migrations/create-firebase-migration.md +18 -0
  144. package/docs/examples/migrations/create-firebase-o-auth-migration.md +18 -0
  145. package/docs/examples/migrations/create-n-host-migration.md +18 -0
  146. package/docs/examples/migrations/create-supabase-migration.md +18 -0
  147. package/docs/examples/migrations/delete-firebase-auth.md +18 -0
  148. package/docs/examples/migrations/delete.md +18 -0
  149. package/docs/examples/migrations/get-appwrite-report.md +18 -0
  150. package/docs/examples/migrations/get-firebase-report-o-auth.md +18 -0
  151. package/docs/examples/migrations/get-firebase-report.md +18 -0
  152. package/docs/examples/migrations/get-n-host-report.md +18 -0
  153. package/docs/examples/migrations/get-supabase-report.md +18 -0
  154. package/docs/examples/migrations/get.md +18 -0
  155. package/docs/examples/migrations/list-firebase-projects.md +18 -0
  156. package/docs/examples/migrations/list.md +18 -0
  157. package/docs/examples/migrations/retry.md +18 -0
  158. package/docs/examples/project/create-variable.md +18 -0
  159. package/docs/examples/project/delete-variable.md +18 -0
  160. package/docs/examples/project/get-usage.md +18 -0
  161. package/docs/examples/project/get-variable.md +18 -0
  162. package/docs/examples/project/list-variables.md +18 -0
  163. package/docs/examples/project/update-variable.md +18 -0
  164. package/docs/examples/projects/create-key.md +1 -1
  165. package/docs/examples/projects/create-platform.md +1 -1
  166. package/docs/examples/projects/create-webhook.md +1 -1
  167. package/docs/examples/projects/create.md +2 -2
  168. package/docs/examples/projects/delete-email-template.md +18 -0
  169. package/docs/examples/projects/delete-key.md +1 -1
  170. package/docs/examples/projects/delete-platform.md +1 -1
  171. package/docs/examples/projects/delete-sms-template.md +18 -0
  172. package/docs/examples/projects/delete-webhook.md +1 -1
  173. package/docs/examples/projects/delete.md +2 -2
  174. package/docs/examples/projects/get-email-template.md +18 -0
  175. package/docs/examples/projects/get-key.md +1 -1
  176. package/docs/examples/projects/get-platform.md +1 -1
  177. package/docs/examples/projects/get-sms-template.md +18 -0
  178. package/docs/examples/projects/get-usage.md +1 -1
  179. package/docs/examples/projects/get-webhook.md +1 -1
  180. package/docs/examples/projects/get.md +1 -1
  181. package/docs/examples/projects/list-keys.md +1 -1
  182. package/docs/examples/projects/list-platforms.md +1 -1
  183. package/docs/examples/projects/list-webhooks.md +1 -1
  184. package/docs/examples/projects/list.md +1 -1
  185. package/docs/examples/projects/update-auth-duration.md +1 -1
  186. package/docs/examples/projects/update-auth-limit.md +1 -1
  187. package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
  188. package/docs/examples/projects/update-auth-password-history.md +1 -1
  189. package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
  190. package/docs/examples/projects/update-auth-status.md +1 -1
  191. package/docs/examples/projects/update-email-template.md +18 -0
  192. package/docs/examples/projects/update-key.md +1 -1
  193. package/docs/examples/projects/update-o-auth2.md +1 -1
  194. package/docs/examples/projects/{delete-domain.md → update-personal-data-check.md} +2 -2
  195. package/docs/examples/projects/update-platform.md +1 -1
  196. package/docs/examples/projects/{create-domain.md → update-service-status-all.md} +2 -2
  197. package/docs/examples/projects/update-service-status.md +1 -1
  198. package/docs/examples/projects/update-sms-template.md +18 -0
  199. package/docs/examples/projects/{get-domain.md → update-smtp-configuration.md} +2 -2
  200. package/docs/examples/projects/{list-domains.md → update-team.md} +2 -2
  201. package/docs/examples/projects/update-webhook-signature.md +1 -1
  202. package/docs/examples/projects/update-webhook.md +1 -1
  203. package/docs/examples/projects/update.md +1 -1
  204. package/docs/examples/proxy/create-rule.md +18 -0
  205. package/docs/examples/proxy/delete-rule.md +18 -0
  206. package/docs/examples/proxy/get-rule.md +18 -0
  207. package/docs/examples/proxy/list-rules.md +18 -0
  208. package/docs/examples/proxy/update-rule-verification.md +18 -0
  209. package/docs/examples/storage/create-bucket.md +1 -1
  210. package/docs/examples/storage/create-file.md +1 -1
  211. package/docs/examples/storage/delete-bucket.md +1 -1
  212. package/docs/examples/storage/delete-file.md +1 -1
  213. package/docs/examples/storage/get-bucket-usage.md +1 -1
  214. package/docs/examples/storage/get-bucket.md +1 -1
  215. package/docs/examples/storage/get-file-download.md +1 -1
  216. package/docs/examples/storage/get-file-preview.md +1 -1
  217. package/docs/examples/storage/get-file-view.md +1 -1
  218. package/docs/examples/storage/get-file.md +1 -1
  219. package/docs/examples/storage/get-usage.md +1 -1
  220. package/docs/examples/storage/list-buckets.md +1 -1
  221. package/docs/examples/storage/list-files.md +1 -1
  222. package/docs/examples/storage/update-bucket.md +1 -1
  223. package/docs/examples/storage/update-file.md +1 -1
  224. package/docs/examples/teams/create-membership.md +1 -1
  225. package/docs/examples/teams/create.md +1 -1
  226. package/docs/examples/teams/delete-membership.md +1 -1
  227. package/docs/examples/teams/delete.md +1 -1
  228. package/docs/examples/teams/get-membership.md +1 -1
  229. package/docs/examples/teams/get-prefs.md +1 -1
  230. package/docs/examples/teams/get.md +1 -1
  231. package/docs/examples/teams/list-logs.md +1 -1
  232. package/docs/examples/teams/list-memberships.md +1 -1
  233. package/docs/examples/teams/list.md +1 -1
  234. package/docs/examples/teams/update-membership-status.md +1 -1
  235. package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
  236. package/docs/examples/teams/update-name.md +1 -1
  237. package/docs/examples/teams/update-prefs.md +1 -1
  238. package/docs/examples/users/create-argon2user.md +1 -1
  239. package/docs/examples/users/create-bcrypt-user.md +1 -1
  240. package/docs/examples/users/create-m-d5user.md +1 -1
  241. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  242. package/docs/examples/users/create-s-h-a-user.md +1 -1
  243. package/docs/examples/users/create-scrypt-modified-user.md +1 -1
  244. package/docs/examples/users/create-scrypt-user.md +1 -1
  245. package/docs/examples/users/create.md +1 -1
  246. package/docs/examples/users/delete-identity.md +18 -0
  247. package/docs/examples/users/delete-session.md +1 -1
  248. package/docs/examples/users/delete-sessions.md +1 -1
  249. package/docs/examples/users/delete.md +1 -1
  250. package/docs/examples/users/get-prefs.md +1 -1
  251. package/docs/examples/users/get-usage.md +1 -1
  252. package/docs/examples/users/get.md +1 -1
  253. package/docs/examples/users/list-identities.md +18 -0
  254. package/docs/examples/users/list-logs.md +1 -1
  255. package/docs/examples/users/list-memberships.md +1 -1
  256. package/docs/examples/users/list-sessions.md +1 -1
  257. package/docs/examples/users/list.md +1 -1
  258. package/docs/examples/users/update-email-verification.md +1 -1
  259. package/docs/examples/users/update-email.md +1 -1
  260. package/docs/examples/users/update-labels.md +18 -0
  261. package/docs/examples/users/update-name.md +1 -1
  262. package/docs/examples/users/update-password.md +1 -1
  263. package/docs/examples/users/update-phone-verification.md +1 -1
  264. package/docs/examples/users/update-phone.md +1 -1
  265. package/docs/examples/users/update-prefs.md +1 -1
  266. package/docs/examples/users/update-status.md +1 -1
  267. package/docs/examples/vcs/create-repository-detection.md +18 -0
  268. package/docs/examples/vcs/create-repository.md +18 -0
  269. package/docs/examples/vcs/delete-installation.md +18 -0
  270. package/docs/examples/vcs/get-installation.md +18 -0
  271. package/docs/examples/vcs/get-repository.md +18 -0
  272. package/docs/examples/vcs/list-installations.md +18 -0
  273. package/docs/examples/vcs/list-repositories.md +18 -0
  274. package/docs/examples/vcs/list-repository-branches.md +18 -0
  275. package/docs/examples/vcs/update-external-deployments.md +18 -0
  276. package/package.json +1 -1
  277. package/src/client.ts +2 -2
  278. package/src/index.ts +5 -0
  279. package/src/models.ts +750 -78
  280. package/src/services/account.ts +1102 -995
  281. package/src/services/assistant.ts +38 -0
  282. package/src/services/avatars.ts +337 -337
  283. package/src/services/console.ts +16 -16
  284. package/src/services/databases.ts +2170 -2140
  285. package/src/services/functions.ts +808 -652
  286. package/src/services/graphql.ts +47 -47
  287. package/src/services/health.ts +226 -189
  288. package/src/services/locale.ts +156 -137
  289. package/src/services/migrations.ts +707 -0
  290. package/src/services/project.ts +174 -0
  291. package/src/services/projects.ts +1538 -1283
  292. package/src/services/proxy.ts +150 -0
  293. package/src/services/storage.ts +576 -571
  294. package/src/services/teams.ts +502 -501
  295. package/src/services/users.ts +1094 -1006
  296. package/src/services/vcs.ts +272 -0
  297. package/types/index.d.ts +5 -0
  298. package/types/models.d.ts +750 -78
  299. package/types/services/account.d.ts +80 -40
  300. package/types/services/assistant.d.ts +14 -0
  301. package/types/services/avatars.d.ts +7 -7
  302. package/types/services/console.d.ts +1 -1
  303. package/types/services/databases.d.ts +60 -54
  304. package/types/services/functions.d.ts +66 -31
  305. package/types/services/graphql.d.ts +2 -2
  306. package/types/services/health.d.ts +31 -12
  307. package/types/services/locale.d.ts +17 -7
  308. package/types/services/migrations.d.ts +185 -0
  309. package/types/services/project.d.ts +70 -0
  310. package/types/services/projects.d.ts +150 -80
  311. package/types/services/proxy.d.ts +59 -0
  312. package/types/services/storage.d.ts +17 -16
  313. package/types/services/teams.d.ts +17 -16
  314. package/types/services/users.d.ts +63 -26
  315. package/types/services/vcs.d.ts +97 -0
  316. package/.travis.yml +0 -32
  317. package/docs/examples/projects/update-domain-verification.md +0 -18
@@ -10,506 +10,507 @@ export class Teams extends Service {
10
10
  super(client);
11
11
  }
12
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<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
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<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>> {
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<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>> {
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 Name
110
- *
111
- * Update the team's name by its unique ID.
112
- *
113
- * @param {string} teamId
114
- * @param {string} name
115
- * @throws {AppwriteException}
116
- * @returns {Promise}
117
- */
118
- async updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>> {
119
- if (typeof teamId === 'undefined') {
120
- throw new AppwriteException('Missing required parameter: "teamId"');
121
- }
122
-
123
- if (typeof name === 'undefined') {
124
- throw new AppwriteException('Missing required parameter: "name"');
125
- }
126
-
127
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
128
- let payload: Payload = {};
129
-
130
- if (typeof name !== 'undefined') {
131
- payload['name'] = name;
132
- }
133
-
134
- const uri = new URL(this.client.config.endpoint + path);
135
- return await this.client.call('put', uri, {
136
- 'content-type': 'application/json',
137
- }, payload);
138
- }
139
-
140
- /**
141
- * Delete Team
142
- *
143
- * Delete a team using its ID. Only team members with the owner role can
144
- * delete the team.
145
- *
146
- * @param {string} teamId
147
- * @throws {AppwriteException}
148
- * @returns {Promise}
149
- */
150
- async delete(teamId: string): Promise<{}> {
151
- if (typeof teamId === 'undefined') {
152
- throw new AppwriteException('Missing required parameter: "teamId"');
153
- }
154
-
155
- let path = '/teams/{teamId}'.replace('{teamId}', teamId);
156
- let payload: Payload = {};
157
-
158
- const uri = new URL(this.client.config.endpoint + path);
159
- return await this.client.call('delete', uri, {
160
- 'content-type': 'application/json',
161
- }, payload);
162
- }
163
-
164
- /**
165
- * List Team Logs
166
- *
167
- * Get the team activity logs list by its unique ID.
168
- *
169
- * @param {string} teamId
170
- * @param {string[]} queries
171
- * @throws {AppwriteException}
172
- * @returns {Promise}
173
- */
174
- async listLogs(teamId: string, queries?: string[]): Promise<Models.LogList> {
175
- if (typeof teamId === 'undefined') {
176
- throw new AppwriteException('Missing required parameter: "teamId"');
177
- }
178
-
179
- let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
180
- let payload: Payload = {};
181
-
182
- if (typeof queries !== 'undefined') {
183
- payload['queries'] = queries;
184
- }
185
-
186
- const uri = new URL(this.client.config.endpoint + path);
187
- return await this.client.call('get', uri, {
188
- 'content-type': 'application/json',
189
- }, payload);
190
- }
191
-
192
- /**
193
- * List Team Memberships
194
- *
195
- * Use this endpoint to list a team's members using the team's ID. All team
196
- * members have read access to this endpoint.
197
- *
198
- * @param {string} teamId
199
- * @param {string[]} queries
200
- * @param {string} search
201
- * @throws {AppwriteException}
202
- * @returns {Promise}
203
- */
204
- async listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> {
205
- if (typeof teamId === 'undefined') {
206
- throw new AppwriteException('Missing required parameter: "teamId"');
207
- }
208
-
209
- let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
210
- let payload: Payload = {};
211
-
212
- if (typeof queries !== 'undefined') {
213
- payload['queries'] = queries;
214
- }
215
-
216
- if (typeof search !== 'undefined') {
217
- payload['search'] = search;
218
- }
219
-
220
- const uri = new URL(this.client.config.endpoint + path);
221
- return await this.client.call('get', uri, {
222
- 'content-type': 'application/json',
223
- }, payload);
224
- }
225
-
226
- /**
227
- * Create Team Membership
228
- *
229
- * Invite a new member to join your team. Provide an ID for existing users, or
230
- * invite unregistered users using an email or phone number. If initiated from
231
- * a Client SDK, Appwrite will send an email or sms with a link to join the
232
- * team to the invited user, and an account will be created for them if one
233
- * doesn't exist. If initiated from a Server SDK, the new member will be added
234
- * automatically to the team.
235
- *
236
- * You only need to provide one of a user ID, email, or phone number. Appwrite
237
- * will prioritize accepting the user ID > email > phone number if you provide
238
- * more than one of these parameters.
239
- *
240
- * Use the `url` parameter to redirect the user from the invitation email to
241
- * your app. After the user is redirected, use the [Update Team Membership
242
- * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
243
- * the user to accept the invitation to the team.
244
- *
245
- * Please note that to avoid a [Redirect
246
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
247
- * Appwrite will accept the only redirect URLs under the domains you have
248
- * added as a platform on the Appwrite Console.
249
- *
250
- *
251
- * @param {string} teamId
252
- * @param {string[]} roles
253
- * @param {string} url
254
- * @param {string} email
255
- * @param {string} userId
256
- * @param {string} phone
257
- * @param {string} name
258
- * @throws {AppwriteException}
259
- * @returns {Promise}
260
- */
261
- async createMembership(teamId: string, roles: string[], url: string, email?: string, userId?: string, phone?: string, name?: string): Promise<Models.Membership> {
262
- if (typeof teamId === 'undefined') {
263
- throw new AppwriteException('Missing required parameter: "teamId"');
264
- }
265
-
266
- if (typeof roles === 'undefined') {
267
- throw new AppwriteException('Missing required parameter: "roles"');
268
- }
269
-
270
- if (typeof url === 'undefined') {
271
- throw new AppwriteException('Missing required parameter: "url"');
272
- }
273
-
274
- let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
275
- let payload: Payload = {};
276
-
277
- if (typeof email !== 'undefined') {
278
- payload['email'] = email;
279
- }
280
-
281
- if (typeof userId !== 'undefined') {
282
- payload['userId'] = userId;
283
- }
284
-
285
- if (typeof phone !== 'undefined') {
286
- payload['phone'] = phone;
287
- }
288
-
289
- if (typeof roles !== 'undefined') {
290
- payload['roles'] = roles;
291
- }
292
-
293
- if (typeof url !== 'undefined') {
294
- payload['url'] = url;
295
- }
296
-
297
- if (typeof name !== 'undefined') {
298
- payload['name'] = name;
299
- }
300
-
301
- const uri = new URL(this.client.config.endpoint + path);
302
- return await this.client.call('post', uri, {
303
- 'content-type': 'application/json',
304
- }, payload);
305
- }
306
-
307
- /**
308
- * Get Team Membership
309
- *
310
- * Get a team member by the membership unique id. All team members have read
311
- * access for this resource.
312
- *
313
- * @param {string} teamId
314
- * @param {string} membershipId
315
- * @throws {AppwriteException}
316
- * @returns {Promise}
317
- */
318
- async getMembership(teamId: string, membershipId: string): Promise<Models.Membership> {
319
- if (typeof teamId === 'undefined') {
320
- throw new AppwriteException('Missing required parameter: "teamId"');
321
- }
322
-
323
- if (typeof membershipId === 'undefined') {
324
- throw new AppwriteException('Missing required parameter: "membershipId"');
325
- }
326
-
327
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
328
- let payload: Payload = {};
329
-
330
- const uri = new URL(this.client.config.endpoint + path);
331
- return await this.client.call('get', uri, {
332
- 'content-type': 'application/json',
333
- }, payload);
334
- }
335
-
336
- /**
337
- * Update Membership Roles
338
- *
339
- * Modify the roles of a team member. Only team members with the owner role
340
- * have access to this endpoint. Learn more about [roles and
341
- * permissions](/docs/permissions).
342
- *
343
- * @param {string} teamId
344
- * @param {string} membershipId
345
- * @param {string[]} roles
346
- * @throws {AppwriteException}
347
- * @returns {Promise}
348
- */
349
- async updateMembershipRoles(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership> {
350
- if (typeof teamId === 'undefined') {
351
- throw new AppwriteException('Missing required parameter: "teamId"');
352
- }
353
-
354
- if (typeof membershipId === 'undefined') {
355
- throw new AppwriteException('Missing required parameter: "membershipId"');
356
- }
357
-
358
- if (typeof roles === 'undefined') {
359
- throw new AppwriteException('Missing required parameter: "roles"');
360
- }
361
-
362
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
363
- let payload: Payload = {};
364
-
365
- if (typeof roles !== 'undefined') {
366
- payload['roles'] = roles;
367
- }
368
-
369
- const uri = new URL(this.client.config.endpoint + path);
370
- return await this.client.call('patch', uri, {
371
- 'content-type': 'application/json',
372
- }, payload);
373
- }
374
-
375
- /**
376
- * Delete Team Membership
377
- *
378
- * This endpoint allows a user to leave a team or for a team owner to delete
379
- * the membership of any other team member. You can also use this endpoint to
380
- * delete a user membership even if it is not accepted.
381
- *
382
- * @param {string} teamId
383
- * @param {string} membershipId
384
- * @throws {AppwriteException}
385
- * @returns {Promise}
386
- */
387
- async deleteMembership(teamId: string, membershipId: string): Promise<{}> {
388
- if (typeof teamId === 'undefined') {
389
- throw new AppwriteException('Missing required parameter: "teamId"');
390
- }
391
-
392
- if (typeof membershipId === 'undefined') {
393
- throw new AppwriteException('Missing required parameter: "membershipId"');
394
- }
395
-
396
- let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
397
- let payload: Payload = {};
398
-
399
- const uri = new URL(this.client.config.endpoint + path);
400
- return await this.client.call('delete', uri, {
401
- 'content-type': 'application/json',
402
- }, payload);
403
- }
404
-
405
- /**
406
- * Update Team Membership Status
407
- *
408
- * Use this endpoint to allow a user to accept an invitation to join a team
409
- * after being redirected back to your app from the invitation email received
410
- * by the user.
411
- *
412
- * If the request is successful, a session for the user is automatically
413
- * created.
414
- *
415
- *
416
- * @param {string} teamId
417
- * @param {string} membershipId
418
- * @param {string} userId
419
- * @param {string} secret
420
- * @throws {AppwriteException}
421
- * @returns {Promise}
422
- */
423
- async updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership> {
424
- if (typeof teamId === 'undefined') {
425
- throw new AppwriteException('Missing required parameter: "teamId"');
426
- }
427
-
428
- if (typeof membershipId === 'undefined') {
429
- throw new AppwriteException('Missing required parameter: "membershipId"');
430
- }
431
-
432
- if (typeof userId === 'undefined') {
433
- throw new AppwriteException('Missing required parameter: "userId"');
434
- }
435
-
436
- if (typeof secret === 'undefined') {
437
- throw new AppwriteException('Missing required parameter: "secret"');
438
- }
439
-
440
- let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
441
- let payload: Payload = {};
442
-
443
- if (typeof userId !== 'undefined') {
444
- payload['userId'] = userId;
445
- }
446
-
447
- if (typeof secret !== 'undefined') {
448
- payload['secret'] = secret;
449
- }
450
-
451
- const uri = new URL(this.client.config.endpoint + path);
452
- return await this.client.call('patch', uri, {
453
- 'content-type': 'application/json',
454
- }, payload);
455
- }
456
-
457
- /**
458
- * Get Team Preferences
459
- *
460
- * Get the team's shared preferences by its unique ID. If a preference doesn't
461
- * need to be shared by all team members, prefer storing them in [user
462
- * preferences](/docs/client/account#accountGetPrefs).
463
- *
464
- * @param {string} teamId
465
- * @throws {AppwriteException}
466
- * @returns {Promise}
467
- */
468
- async getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences> {
469
- if (typeof teamId === 'undefined') {
470
- throw new AppwriteException('Missing required parameter: "teamId"');
471
- }
472
-
473
- let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
474
- let payload: Payload = {};
475
-
476
- const uri = new URL(this.client.config.endpoint + path);
477
- return await this.client.call('get', uri, {
478
- 'content-type': 'application/json',
479
- }, payload);
480
- }
481
-
482
- /**
483
- * Update Preferences
484
- *
485
- * Update the team's preferences by its unique ID. The object you pass is
486
- * stored as is and replaces any previous value. The maximum allowed prefs
487
- * size is 64kB and throws an error if exceeded.
488
- *
489
- * @param {string} teamId
490
- * @param {object} prefs
491
- * @throws {AppwriteException}
492
- * @returns {Promise}
493
- */
494
- async updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences> {
495
- if (typeof teamId === 'undefined') {
496
- throw new AppwriteException('Missing required parameter: "teamId"');
497
- }
498
-
499
- if (typeof prefs === 'undefined') {
500
- throw new AppwriteException('Missing required parameter: "prefs"');
501
- }
502
-
503
- let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
504
- let payload: Payload = {};
505
-
506
- if (typeof prefs !== 'undefined') {
507
- payload['prefs'] = prefs;
508
- }
509
-
510
- const uri = new URL(this.client.config.endpoint + path);
511
- return await this.client.call('put', uri, {
512
- 'content-type': 'application/json',
513
- }, payload);
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<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.TeamList<Preferences>> {
25
+ let path = '/teams';
26
+ let payload: Payload = {};
27
+
28
+ if (typeof queries !== 'undefined') {
29
+ payload['queries'] = queries;
514
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<Preferences extends Models.Preferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>> {
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<Preferences extends Models.Preferences>(teamId: string): Promise<Models.Team<Preferences>> {
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 Name
110
+ *
111
+ * Update the team's name by its unique ID.
112
+ *
113
+ * @param {string} teamId
114
+ * @param {string} name
115
+ * @throws {AppwriteException}
116
+ * @returns {Promise}
117
+ */
118
+ async updateName<Preferences extends Models.Preferences>(teamId: string, name: string): Promise<Models.Team<Preferences>> {
119
+ if (typeof teamId === 'undefined') {
120
+ throw new AppwriteException('Missing required parameter: "teamId"');
121
+ }
122
+
123
+ if (typeof name === 'undefined') {
124
+ throw new AppwriteException('Missing required parameter: "name"');
125
+ }
126
+
127
+ let path = '/teams/{teamId}'.replace('{teamId}', teamId);
128
+ let payload: Payload = {};
129
+
130
+ if (typeof name !== 'undefined') {
131
+ payload['name'] = name;
132
+ }
133
+
134
+ const uri = new URL(this.client.config.endpoint + path);
135
+ return await this.client.call('put', uri, {
136
+ 'content-type': 'application/json',
137
+ }, payload);
138
+ }
139
+
140
+ /**
141
+ * Delete Team
142
+ *
143
+ * Delete a team using its ID. Only team members with the owner role can
144
+ * delete the team.
145
+ *
146
+ * @param {string} teamId
147
+ * @throws {AppwriteException}
148
+ * @returns {Promise}
149
+ */
150
+ async delete(teamId: string): Promise<{}> {
151
+ if (typeof teamId === 'undefined') {
152
+ throw new AppwriteException('Missing required parameter: "teamId"');
153
+ }
154
+
155
+ let path = '/teams/{teamId}'.replace('{teamId}', teamId);
156
+ let payload: Payload = {};
157
+
158
+ const uri = new URL(this.client.config.endpoint + path);
159
+ return await this.client.call('delete', uri, {
160
+ 'content-type': 'application/json',
161
+ }, payload);
162
+ }
163
+
164
+ /**
165
+ * List Team Logs
166
+ *
167
+ * Get the team activity logs list by its unique ID.
168
+ *
169
+ * @param {string} teamId
170
+ * @param {string[]} queries
171
+ * @throws {AppwriteException}
172
+ * @returns {Promise}
173
+ */
174
+ async listLogs(teamId: string, queries?: string[]): Promise<Models.LogList> {
175
+ if (typeof teamId === 'undefined') {
176
+ throw new AppwriteException('Missing required parameter: "teamId"');
177
+ }
178
+
179
+ let path = '/teams/{teamId}/logs'.replace('{teamId}', teamId);
180
+ let payload: Payload = {};
181
+
182
+ if (typeof queries !== 'undefined') {
183
+ payload['queries'] = queries;
184
+ }
185
+
186
+ const uri = new URL(this.client.config.endpoint + path);
187
+ return await this.client.call('get', uri, {
188
+ 'content-type': 'application/json',
189
+ }, payload);
190
+ }
191
+
192
+ /**
193
+ * List Team Memberships
194
+ *
195
+ * Use this endpoint to list a team's members using the team's ID. All team
196
+ * members have read access to this endpoint.
197
+ *
198
+ * @param {string} teamId
199
+ * @param {string[]} queries
200
+ * @param {string} search
201
+ * @throws {AppwriteException}
202
+ * @returns {Promise}
203
+ */
204
+ async listMemberships(teamId: string, queries?: string[], search?: string): Promise<Models.MembershipList> {
205
+ if (typeof teamId === 'undefined') {
206
+ throw new AppwriteException('Missing required parameter: "teamId"');
207
+ }
208
+
209
+ let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
210
+ let payload: Payload = {};
211
+
212
+ if (typeof queries !== 'undefined') {
213
+ payload['queries'] = queries;
214
+ }
215
+
216
+ if (typeof search !== 'undefined') {
217
+ payload['search'] = search;
218
+ }
219
+
220
+ const uri = new URL(this.client.config.endpoint + path);
221
+ return await this.client.call('get', uri, {
222
+ 'content-type': 'application/json',
223
+ }, payload);
224
+ }
225
+
226
+ /**
227
+ * Create Team Membership
228
+ *
229
+ * Invite a new member to join your team. Provide an ID for existing users, or
230
+ * invite unregistered users using an email or phone number. If initiated from
231
+ * a Client SDK, Appwrite will send an email or sms with a link to join the
232
+ * team to the invited user, and an account will be created for them if one
233
+ * doesn't exist. If initiated from a Server SDK, the new member will be added
234
+ * automatically to the team.
235
+ *
236
+ * You only need to provide one of a user ID, email, or phone number. Appwrite
237
+ * will prioritize accepting the user ID > email > phone number if you provide
238
+ * more than one of these parameters.
239
+ *
240
+ * Use the `url` parameter to redirect the user from the invitation email to
241
+ * your app. After the user is redirected, use the [Update Team Membership
242
+ * Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
243
+ * the user to accept the invitation to the team.
244
+ *
245
+ * Please note that to avoid a [Redirect
246
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
247
+ * Appwrite will accept the only redirect URLs under the domains you have
248
+ * added as a platform on the Appwrite Console.
249
+ *
250
+ *
251
+ * @param {string} teamId
252
+ * @param {string[]} roles
253
+ * @param {string} url
254
+ * @param {string} email
255
+ * @param {string} userId
256
+ * @param {string} phone
257
+ * @param {string} name
258
+ * @throws {AppwriteException}
259
+ * @returns {Promise}
260
+ */
261
+ async createMembership(teamId: string, roles: string[], url: string, email?: string, userId?: string, phone?: string, name?: string): Promise<Models.Membership> {
262
+ if (typeof teamId === 'undefined') {
263
+ throw new AppwriteException('Missing required parameter: "teamId"');
264
+ }
265
+
266
+ if (typeof roles === 'undefined') {
267
+ throw new AppwriteException('Missing required parameter: "roles"');
268
+ }
269
+
270
+ if (typeof url === 'undefined') {
271
+ throw new AppwriteException('Missing required parameter: "url"');
272
+ }
273
+
274
+ let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
275
+ let payload: Payload = {};
276
+
277
+ if (typeof email !== 'undefined') {
278
+ payload['email'] = email;
279
+ }
280
+
281
+ if (typeof userId !== 'undefined') {
282
+ payload['userId'] = userId;
283
+ }
284
+
285
+ if (typeof phone !== 'undefined') {
286
+ payload['phone'] = phone;
287
+ }
288
+
289
+ if (typeof roles !== 'undefined') {
290
+ payload['roles'] = roles;
291
+ }
292
+
293
+ if (typeof url !== 'undefined') {
294
+ payload['url'] = url;
295
+ }
296
+
297
+ if (typeof name !== 'undefined') {
298
+ payload['name'] = name;
299
+ }
300
+
301
+ const uri = new URL(this.client.config.endpoint + path);
302
+ return await this.client.call('post', uri, {
303
+ 'content-type': 'application/json',
304
+ }, payload);
305
+ }
306
+
307
+ /**
308
+ * Get Team Membership
309
+ *
310
+ * Get a team member by the membership unique id. All team members have read
311
+ * access for this resource.
312
+ *
313
+ * @param {string} teamId
314
+ * @param {string} membershipId
315
+ * @throws {AppwriteException}
316
+ * @returns {Promise}
317
+ */
318
+ async getMembership(teamId: string, membershipId: string): Promise<Models.Membership> {
319
+ if (typeof teamId === 'undefined') {
320
+ throw new AppwriteException('Missing required parameter: "teamId"');
321
+ }
322
+
323
+ if (typeof membershipId === 'undefined') {
324
+ throw new AppwriteException('Missing required parameter: "membershipId"');
325
+ }
326
+
327
+ let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
328
+ let payload: Payload = {};
329
+
330
+ const uri = new URL(this.client.config.endpoint + path);
331
+ return await this.client.call('get', uri, {
332
+ 'content-type': 'application/json',
333
+ }, payload);
334
+ }
335
+
336
+ /**
337
+ * Update Membership
338
+ *
339
+ * Modify the roles of a team member. Only team members with the owner role
340
+ * have access to this endpoint. Learn more about [roles and
341
+ * permissions](/docs/permissions).
342
+ *
343
+ *
344
+ * @param {string} teamId
345
+ * @param {string} membershipId
346
+ * @param {string[]} roles
347
+ * @throws {AppwriteException}
348
+ * @returns {Promise}
349
+ */
350
+ async updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership> {
351
+ if (typeof teamId === 'undefined') {
352
+ throw new AppwriteException('Missing required parameter: "teamId"');
353
+ }
354
+
355
+ if (typeof membershipId === 'undefined') {
356
+ throw new AppwriteException('Missing required parameter: "membershipId"');
357
+ }
358
+
359
+ if (typeof roles === 'undefined') {
360
+ throw new AppwriteException('Missing required parameter: "roles"');
361
+ }
362
+
363
+ let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
364
+ let payload: Payload = {};
365
+
366
+ if (typeof roles !== 'undefined') {
367
+ payload['roles'] = roles;
368
+ }
369
+
370
+ const uri = new URL(this.client.config.endpoint + path);
371
+ return await this.client.call('patch', uri, {
372
+ 'content-type': 'application/json',
373
+ }, payload);
374
+ }
375
+
376
+ /**
377
+ * Delete Team Membership
378
+ *
379
+ * This endpoint allows a user to leave a team or for a team owner to delete
380
+ * the membership of any other team member. You can also use this endpoint to
381
+ * delete a user membership even if it is not accepted.
382
+ *
383
+ * @param {string} teamId
384
+ * @param {string} membershipId
385
+ * @throws {AppwriteException}
386
+ * @returns {Promise}
387
+ */
388
+ async deleteMembership(teamId: string, membershipId: string): Promise<{}> {
389
+ if (typeof teamId === 'undefined') {
390
+ throw new AppwriteException('Missing required parameter: "teamId"');
391
+ }
392
+
393
+ if (typeof membershipId === 'undefined') {
394
+ throw new AppwriteException('Missing required parameter: "membershipId"');
395
+ }
396
+
397
+ let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
398
+ let payload: Payload = {};
399
+
400
+ const uri = new URL(this.client.config.endpoint + path);
401
+ return await this.client.call('delete', uri, {
402
+ 'content-type': 'application/json',
403
+ }, payload);
404
+ }
405
+
406
+ /**
407
+ * Update Team Membership Status
408
+ *
409
+ * Use this endpoint to allow a user to accept an invitation to join a team
410
+ * after being redirected back to your app from the invitation email received
411
+ * by the user.
412
+ *
413
+ * If the request is successful, a session for the user is automatically
414
+ * created.
415
+ *
416
+ *
417
+ * @param {string} teamId
418
+ * @param {string} membershipId
419
+ * @param {string} userId
420
+ * @param {string} secret
421
+ * @throws {AppwriteException}
422
+ * @returns {Promise}
423
+ */
424
+ async updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership> {
425
+ if (typeof teamId === 'undefined') {
426
+ throw new AppwriteException('Missing required parameter: "teamId"');
427
+ }
428
+
429
+ if (typeof membershipId === 'undefined') {
430
+ throw new AppwriteException('Missing required parameter: "membershipId"');
431
+ }
432
+
433
+ if (typeof userId === 'undefined') {
434
+ throw new AppwriteException('Missing required parameter: "userId"');
435
+ }
436
+
437
+ if (typeof secret === 'undefined') {
438
+ throw new AppwriteException('Missing required parameter: "secret"');
439
+ }
440
+
441
+ let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
442
+ let payload: Payload = {};
443
+
444
+ if (typeof userId !== 'undefined') {
445
+ payload['userId'] = userId;
446
+ }
447
+
448
+ if (typeof secret !== 'undefined') {
449
+ payload['secret'] = secret;
450
+ }
451
+
452
+ const uri = new URL(this.client.config.endpoint + path);
453
+ return await this.client.call('patch', uri, {
454
+ 'content-type': 'application/json',
455
+ }, payload);
456
+ }
457
+
458
+ /**
459
+ * Get Team Preferences
460
+ *
461
+ * Get the team's shared preferences by its unique ID. If a preference doesn't
462
+ * need to be shared by all team members, prefer storing them in [user
463
+ * preferences](/docs/client/account#accountGetPrefs).
464
+ *
465
+ * @param {string} teamId
466
+ * @throws {AppwriteException}
467
+ * @returns {Promise}
468
+ */
469
+ async getPrefs<Preferences extends Models.Preferences>(teamId: string): Promise<Preferences> {
470
+ if (typeof teamId === 'undefined') {
471
+ throw new AppwriteException('Missing required parameter: "teamId"');
472
+ }
473
+
474
+ let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
475
+ let payload: Payload = {};
476
+
477
+ const uri = new URL(this.client.config.endpoint + path);
478
+ return await this.client.call('get', uri, {
479
+ 'content-type': 'application/json',
480
+ }, payload);
481
+ }
482
+
483
+ /**
484
+ * Update Preferences
485
+ *
486
+ * Update the team's preferences by its unique ID. The object you pass is
487
+ * stored as is and replaces any previous value. The maximum allowed prefs
488
+ * size is 64kB and throws an error if exceeded.
489
+ *
490
+ * @param {string} teamId
491
+ * @param {object} prefs
492
+ * @throws {AppwriteException}
493
+ * @returns {Promise}
494
+ */
495
+ async updatePrefs<Preferences extends Models.Preferences>(teamId: string, prefs: object): Promise<Preferences> {
496
+ if (typeof teamId === 'undefined') {
497
+ throw new AppwriteException('Missing required parameter: "teamId"');
498
+ }
499
+
500
+ if (typeof prefs === 'undefined') {
501
+ throw new AppwriteException('Missing required parameter: "prefs"');
502
+ }
503
+
504
+ let path = '/teams/{teamId}/prefs'.replace('{teamId}', teamId);
505
+ let payload: Payload = {};
506
+
507
+ if (typeof prefs !== 'undefined') {
508
+ payload['prefs'] = prefs;
509
+ }
510
+
511
+ const uri = new URL(this.client.config.endpoint + path);
512
+ return await this.client.call('put', uri, {
513
+ 'content-type': 'application/json',
514
+ }, payload);
515
+ }
515
516
  };