@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,1020 @@
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 Users extends Service {
7
+
8
+ constructor(client: Client)
9
+ {
10
+ super(client);
11
+ }
12
+
13
+ /**
14
+ * List Users
15
+ *
16
+ * Get a list of all the project's users. You can use the query params to
17
+ * 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.UserList<Preferences>> {
25
+ let path = '/users';
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 User
44
+ *
45
+ * Create a new user.
46
+ *
47
+ * @param {string} userId
48
+ * @param {string} email
49
+ * @param {string} phone
50
+ * @param {string} password
51
+ * @param {string} name
52
+ * @throws {AppwriteException}
53
+ * @returns {Promise}
54
+ */
55
+ async create<Preferences extends Models.Preferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>> {
56
+ if (typeof userId === 'undefined') {
57
+ throw new AppwriteException('Missing required parameter: "userId"');
58
+ }
59
+
60
+ let path = '/users';
61
+ let payload: Payload = {};
62
+
63
+ if (typeof userId !== 'undefined') {
64
+ payload['userId'] = userId;
65
+ }
66
+
67
+ if (typeof email !== 'undefined') {
68
+ payload['email'] = email;
69
+ }
70
+
71
+ if (typeof phone !== 'undefined') {
72
+ payload['phone'] = phone;
73
+ }
74
+
75
+ if (typeof password !== 'undefined') {
76
+ payload['password'] = password;
77
+ }
78
+
79
+ if (typeof name !== 'undefined') {
80
+ payload['name'] = name;
81
+ }
82
+
83
+ const uri = new URL(this.client.config.endpoint + path);
84
+ return await this.client.call('post', uri, {
85
+ 'content-type': 'application/json',
86
+ }, payload);
87
+ }
88
+
89
+ /**
90
+ * Create User with Argon2 Password
91
+ *
92
+ * Create a new user. Password provided must be hashed with the
93
+ * [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST
94
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
95
+ * plain text password.
96
+ *
97
+ * @param {string} userId
98
+ * @param {string} email
99
+ * @param {string} password
100
+ * @param {string} name
101
+ * @throws {AppwriteException}
102
+ * @returns {Promise}
103
+ */
104
+ async createArgon2User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
105
+ if (typeof userId === 'undefined') {
106
+ throw new AppwriteException('Missing required parameter: "userId"');
107
+ }
108
+
109
+ if (typeof email === 'undefined') {
110
+ throw new AppwriteException('Missing required parameter: "email"');
111
+ }
112
+
113
+ if (typeof password === 'undefined') {
114
+ throw new AppwriteException('Missing required parameter: "password"');
115
+ }
116
+
117
+ let path = '/users/argon2';
118
+ let payload: Payload = {};
119
+
120
+ if (typeof userId !== 'undefined') {
121
+ payload['userId'] = userId;
122
+ }
123
+
124
+ if (typeof email !== 'undefined') {
125
+ payload['email'] = email;
126
+ }
127
+
128
+ if (typeof password !== 'undefined') {
129
+ payload['password'] = password;
130
+ }
131
+
132
+ if (typeof name !== 'undefined') {
133
+ payload['name'] = name;
134
+ }
135
+
136
+ const uri = new URL(this.client.config.endpoint + path);
137
+ return await this.client.call('post', uri, {
138
+ 'content-type': 'application/json',
139
+ }, payload);
140
+ }
141
+
142
+ /**
143
+ * Create User with Bcrypt Password
144
+ *
145
+ * Create a new user. Password provided must be hashed with the
146
+ * [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST
147
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
148
+ * plain text password.
149
+ *
150
+ * @param {string} userId
151
+ * @param {string} email
152
+ * @param {string} password
153
+ * @param {string} name
154
+ * @throws {AppwriteException}
155
+ * @returns {Promise}
156
+ */
157
+ async createBcryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
158
+ if (typeof userId === 'undefined') {
159
+ throw new AppwriteException('Missing required parameter: "userId"');
160
+ }
161
+
162
+ if (typeof email === 'undefined') {
163
+ throw new AppwriteException('Missing required parameter: "email"');
164
+ }
165
+
166
+ if (typeof password === 'undefined') {
167
+ throw new AppwriteException('Missing required parameter: "password"');
168
+ }
169
+
170
+ let path = '/users/bcrypt';
171
+ let payload: Payload = {};
172
+
173
+ if (typeof userId !== 'undefined') {
174
+ payload['userId'] = userId;
175
+ }
176
+
177
+ if (typeof email !== 'undefined') {
178
+ payload['email'] = email;
179
+ }
180
+
181
+ if (typeof password !== 'undefined') {
182
+ payload['password'] = password;
183
+ }
184
+
185
+ if (typeof name !== 'undefined') {
186
+ payload['name'] = name;
187
+ }
188
+
189
+ const uri = new URL(this.client.config.endpoint + path);
190
+ return await this.client.call('post', uri, {
191
+ 'content-type': 'application/json',
192
+ }, payload);
193
+ }
194
+
195
+ /**
196
+ * Create User with MD5 Password
197
+ *
198
+ * Create a new user. Password provided must be hashed with the
199
+ * [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST
200
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
201
+ * plain text password.
202
+ *
203
+ * @param {string} userId
204
+ * @param {string} email
205
+ * @param {string} password
206
+ * @param {string} name
207
+ * @throws {AppwriteException}
208
+ * @returns {Promise}
209
+ */
210
+ async createMD5User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
211
+ if (typeof userId === 'undefined') {
212
+ throw new AppwriteException('Missing required parameter: "userId"');
213
+ }
214
+
215
+ if (typeof email === 'undefined') {
216
+ throw new AppwriteException('Missing required parameter: "email"');
217
+ }
218
+
219
+ if (typeof password === 'undefined') {
220
+ throw new AppwriteException('Missing required parameter: "password"');
221
+ }
222
+
223
+ let path = '/users/md5';
224
+ let payload: Payload = {};
225
+
226
+ if (typeof userId !== 'undefined') {
227
+ payload['userId'] = userId;
228
+ }
229
+
230
+ if (typeof email !== 'undefined') {
231
+ payload['email'] = email;
232
+ }
233
+
234
+ if (typeof password !== 'undefined') {
235
+ payload['password'] = password;
236
+ }
237
+
238
+ if (typeof name !== 'undefined') {
239
+ payload['name'] = name;
240
+ }
241
+
242
+ const uri = new URL(this.client.config.endpoint + path);
243
+ return await this.client.call('post', uri, {
244
+ 'content-type': 'application/json',
245
+ }, payload);
246
+ }
247
+
248
+ /**
249
+ * Create User with PHPass Password
250
+ *
251
+ * Create a new user. Password provided must be hashed with the
252
+ * [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST
253
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
254
+ * plain text password.
255
+ *
256
+ * @param {string} userId
257
+ * @param {string} email
258
+ * @param {string} password
259
+ * @param {string} name
260
+ * @throws {AppwriteException}
261
+ * @returns {Promise}
262
+ */
263
+ async createPHPassUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
264
+ if (typeof userId === 'undefined') {
265
+ throw new AppwriteException('Missing required parameter: "userId"');
266
+ }
267
+
268
+ if (typeof email === 'undefined') {
269
+ throw new AppwriteException('Missing required parameter: "email"');
270
+ }
271
+
272
+ if (typeof password === 'undefined') {
273
+ throw new AppwriteException('Missing required parameter: "password"');
274
+ }
275
+
276
+ let path = '/users/phpass';
277
+ let payload: Payload = {};
278
+
279
+ if (typeof userId !== 'undefined') {
280
+ payload['userId'] = userId;
281
+ }
282
+
283
+ if (typeof email !== 'undefined') {
284
+ payload['email'] = email;
285
+ }
286
+
287
+ if (typeof password !== 'undefined') {
288
+ payload['password'] = password;
289
+ }
290
+
291
+ if (typeof name !== 'undefined') {
292
+ payload['name'] = name;
293
+ }
294
+
295
+ const uri = new URL(this.client.config.endpoint + path);
296
+ return await this.client.call('post', uri, {
297
+ 'content-type': 'application/json',
298
+ }, payload);
299
+ }
300
+
301
+ /**
302
+ * Create User with Scrypt Password
303
+ *
304
+ * Create a new user. Password provided must be hashed with the
305
+ * [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST
306
+ * /users](/docs/server/users#usersCreate) endpoint to create users with a
307
+ * plain text password.
308
+ *
309
+ * @param {string} userId
310
+ * @param {string} email
311
+ * @param {string} password
312
+ * @param {string} passwordSalt
313
+ * @param {number} passwordCpu
314
+ * @param {number} passwordMemory
315
+ * @param {number} passwordParallel
316
+ * @param {number} passwordLength
317
+ * @param {string} name
318
+ * @throws {AppwriteException}
319
+ * @returns {Promise}
320
+ */
321
+ async createScryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>> {
322
+ if (typeof userId === 'undefined') {
323
+ throw new AppwriteException('Missing required parameter: "userId"');
324
+ }
325
+
326
+ if (typeof email === 'undefined') {
327
+ throw new AppwriteException('Missing required parameter: "email"');
328
+ }
329
+
330
+ if (typeof password === 'undefined') {
331
+ throw new AppwriteException('Missing required parameter: "password"');
332
+ }
333
+
334
+ if (typeof passwordSalt === 'undefined') {
335
+ throw new AppwriteException('Missing required parameter: "passwordSalt"');
336
+ }
337
+
338
+ if (typeof passwordCpu === 'undefined') {
339
+ throw new AppwriteException('Missing required parameter: "passwordCpu"');
340
+ }
341
+
342
+ if (typeof passwordMemory === 'undefined') {
343
+ throw new AppwriteException('Missing required parameter: "passwordMemory"');
344
+ }
345
+
346
+ if (typeof passwordParallel === 'undefined') {
347
+ throw new AppwriteException('Missing required parameter: "passwordParallel"');
348
+ }
349
+
350
+ if (typeof passwordLength === 'undefined') {
351
+ throw new AppwriteException('Missing required parameter: "passwordLength"');
352
+ }
353
+
354
+ let path = '/users/scrypt';
355
+ let payload: Payload = {};
356
+
357
+ if (typeof userId !== 'undefined') {
358
+ payload['userId'] = userId;
359
+ }
360
+
361
+ if (typeof email !== 'undefined') {
362
+ payload['email'] = email;
363
+ }
364
+
365
+ if (typeof password !== 'undefined') {
366
+ payload['password'] = password;
367
+ }
368
+
369
+ if (typeof passwordSalt !== 'undefined') {
370
+ payload['passwordSalt'] = passwordSalt;
371
+ }
372
+
373
+ if (typeof passwordCpu !== 'undefined') {
374
+ payload['passwordCpu'] = passwordCpu;
375
+ }
376
+
377
+ if (typeof passwordMemory !== 'undefined') {
378
+ payload['passwordMemory'] = passwordMemory;
379
+ }
380
+
381
+ if (typeof passwordParallel !== 'undefined') {
382
+ payload['passwordParallel'] = passwordParallel;
383
+ }
384
+
385
+ if (typeof passwordLength !== 'undefined') {
386
+ payload['passwordLength'] = passwordLength;
387
+ }
388
+
389
+ if (typeof name !== 'undefined') {
390
+ payload['name'] = name;
391
+ }
392
+
393
+ const uri = new URL(this.client.config.endpoint + path);
394
+ return await this.client.call('post', uri, {
395
+ 'content-type': 'application/json',
396
+ }, payload);
397
+ }
398
+
399
+ /**
400
+ * Create User with Scrypt Modified Password
401
+ *
402
+ * Create a new user. Password provided must be hashed with the [Scrypt
403
+ * Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc)
404
+ * algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint
405
+ * to create users with a plain text password.
406
+ *
407
+ * @param {string} userId
408
+ * @param {string} email
409
+ * @param {string} password
410
+ * @param {string} passwordSalt
411
+ * @param {string} passwordSaltSeparator
412
+ * @param {string} passwordSignerKey
413
+ * @param {string} name
414
+ * @throws {AppwriteException}
415
+ * @returns {Promise}
416
+ */
417
+ async createScryptModifiedUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>> {
418
+ if (typeof userId === 'undefined') {
419
+ throw new AppwriteException('Missing required parameter: "userId"');
420
+ }
421
+
422
+ if (typeof email === 'undefined') {
423
+ throw new AppwriteException('Missing required parameter: "email"');
424
+ }
425
+
426
+ if (typeof password === 'undefined') {
427
+ throw new AppwriteException('Missing required parameter: "password"');
428
+ }
429
+
430
+ if (typeof passwordSalt === 'undefined') {
431
+ throw new AppwriteException('Missing required parameter: "passwordSalt"');
432
+ }
433
+
434
+ if (typeof passwordSaltSeparator === 'undefined') {
435
+ throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"');
436
+ }
437
+
438
+ if (typeof passwordSignerKey === 'undefined') {
439
+ throw new AppwriteException('Missing required parameter: "passwordSignerKey"');
440
+ }
441
+
442
+ let path = '/users/scrypt-modified';
443
+ let payload: Payload = {};
444
+
445
+ if (typeof userId !== 'undefined') {
446
+ payload['userId'] = userId;
447
+ }
448
+
449
+ if (typeof email !== 'undefined') {
450
+ payload['email'] = email;
451
+ }
452
+
453
+ if (typeof password !== 'undefined') {
454
+ payload['password'] = password;
455
+ }
456
+
457
+ if (typeof passwordSalt !== 'undefined') {
458
+ payload['passwordSalt'] = passwordSalt;
459
+ }
460
+
461
+ if (typeof passwordSaltSeparator !== 'undefined') {
462
+ payload['passwordSaltSeparator'] = passwordSaltSeparator;
463
+ }
464
+
465
+ if (typeof passwordSignerKey !== 'undefined') {
466
+ payload['passwordSignerKey'] = passwordSignerKey;
467
+ }
468
+
469
+ if (typeof name !== 'undefined') {
470
+ payload['name'] = name;
471
+ }
472
+
473
+ const uri = new URL(this.client.config.endpoint + path);
474
+ return await this.client.call('post', uri, {
475
+ 'content-type': 'application/json',
476
+ }, payload);
477
+ }
478
+
479
+ /**
480
+ * Create User with SHA Password
481
+ *
482
+ * Create a new user. Password provided must be hashed with the
483
+ * [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use
484
+ * the [POST /users](/docs/server/users#usersCreate) endpoint to create users
485
+ * with a plain text password.
486
+ *
487
+ * @param {string} userId
488
+ * @param {string} email
489
+ * @param {string} password
490
+ * @param {string} passwordVersion
491
+ * @param {string} name
492
+ * @throws {AppwriteException}
493
+ * @returns {Promise}
494
+ */
495
+ async createSHAUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordVersion?: string, name?: string): Promise<Models.User<Preferences>> {
496
+ if (typeof userId === 'undefined') {
497
+ throw new AppwriteException('Missing required parameter: "userId"');
498
+ }
499
+
500
+ if (typeof email === 'undefined') {
501
+ throw new AppwriteException('Missing required parameter: "email"');
502
+ }
503
+
504
+ if (typeof password === 'undefined') {
505
+ throw new AppwriteException('Missing required parameter: "password"');
506
+ }
507
+
508
+ let path = '/users/sha';
509
+ let payload: Payload = {};
510
+
511
+ if (typeof userId !== 'undefined') {
512
+ payload['userId'] = userId;
513
+ }
514
+
515
+ if (typeof email !== 'undefined') {
516
+ payload['email'] = email;
517
+ }
518
+
519
+ if (typeof password !== 'undefined') {
520
+ payload['password'] = password;
521
+ }
522
+
523
+ if (typeof passwordVersion !== 'undefined') {
524
+ payload['passwordVersion'] = passwordVersion;
525
+ }
526
+
527
+ if (typeof name !== 'undefined') {
528
+ payload['name'] = name;
529
+ }
530
+
531
+ const uri = new URL(this.client.config.endpoint + path);
532
+ return await this.client.call('post', uri, {
533
+ 'content-type': 'application/json',
534
+ }, payload);
535
+ }
536
+
537
+ /**
538
+ * Get usage stats for the users API
539
+ *
540
+ *
541
+ * @param {string} range
542
+ * @param {string} provider
543
+ * @throws {AppwriteException}
544
+ * @returns {Promise}
545
+ */
546
+ async getUsage(range?: string, provider?: string): Promise<Models.UsageUsers> {
547
+ let path = '/users/usage';
548
+ let payload: Payload = {};
549
+
550
+ if (typeof range !== 'undefined') {
551
+ payload['range'] = range;
552
+ }
553
+
554
+ if (typeof provider !== 'undefined') {
555
+ payload['provider'] = provider;
556
+ }
557
+
558
+ const uri = new URL(this.client.config.endpoint + path);
559
+ return await this.client.call('get', uri, {
560
+ 'content-type': 'application/json',
561
+ }, payload);
562
+ }
563
+
564
+ /**
565
+ * Get User
566
+ *
567
+ * Get a user by its unique ID.
568
+ *
569
+ * @param {string} userId
570
+ * @throws {AppwriteException}
571
+ * @returns {Promise}
572
+ */
573
+ async get<Preferences extends Models.Preferences>(userId: string): Promise<Models.User<Preferences>> {
574
+ if (typeof userId === 'undefined') {
575
+ throw new AppwriteException('Missing required parameter: "userId"');
576
+ }
577
+
578
+ let path = '/users/{userId}'.replace('{userId}', userId);
579
+ let payload: Payload = {};
580
+
581
+ const uri = new URL(this.client.config.endpoint + path);
582
+ return await this.client.call('get', uri, {
583
+ 'content-type': 'application/json',
584
+ }, payload);
585
+ }
586
+
587
+ /**
588
+ * Delete User
589
+ *
590
+ * Delete a user by its unique ID, thereby releasing it's ID. Since ID is
591
+ * released and can be reused, all user-related resources like documents or
592
+ * storage files should be deleted before user deletion. If you want to keep
593
+ * ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
594
+ * endpoint instead.
595
+ *
596
+ * @param {string} userId
597
+ * @throws {AppwriteException}
598
+ * @returns {Promise}
599
+ */
600
+ async delete(userId: string): Promise<{}> {
601
+ if (typeof userId === 'undefined') {
602
+ throw new AppwriteException('Missing required parameter: "userId"');
603
+ }
604
+
605
+ let path = '/users/{userId}'.replace('{userId}', userId);
606
+ let payload: Payload = {};
607
+
608
+ const uri = new URL(this.client.config.endpoint + path);
609
+ return await this.client.call('delete', uri, {
610
+ 'content-type': 'application/json',
611
+ }, payload);
612
+ }
613
+
614
+ /**
615
+ * Update Email
616
+ *
617
+ * Update the user email by its unique ID.
618
+ *
619
+ * @param {string} userId
620
+ * @param {string} email
621
+ * @throws {AppwriteException}
622
+ * @returns {Promise}
623
+ */
624
+ async updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>> {
625
+ if (typeof userId === 'undefined') {
626
+ throw new AppwriteException('Missing required parameter: "userId"');
627
+ }
628
+
629
+ if (typeof email === 'undefined') {
630
+ throw new AppwriteException('Missing required parameter: "email"');
631
+ }
632
+
633
+ let path = '/users/{userId}/email'.replace('{userId}', userId);
634
+ let payload: Payload = {};
635
+
636
+ if (typeof email !== 'undefined') {
637
+ payload['email'] = email;
638
+ }
639
+
640
+ const uri = new URL(this.client.config.endpoint + path);
641
+ return await this.client.call('patch', uri, {
642
+ 'content-type': 'application/json',
643
+ }, payload);
644
+ }
645
+
646
+ /**
647
+ * List User Logs
648
+ *
649
+ * Get the user activity logs list by its unique ID.
650
+ *
651
+ * @param {string} userId
652
+ * @param {string[]} queries
653
+ * @throws {AppwriteException}
654
+ * @returns {Promise}
655
+ */
656
+ async listLogs(userId: string, queries?: string[]): Promise<Models.LogList> {
657
+ if (typeof userId === 'undefined') {
658
+ throw new AppwriteException('Missing required parameter: "userId"');
659
+ }
660
+
661
+ let path = '/users/{userId}/logs'.replace('{userId}', userId);
662
+ let payload: Payload = {};
663
+
664
+ if (typeof queries !== 'undefined') {
665
+ payload['queries'] = queries;
666
+ }
667
+
668
+ const uri = new URL(this.client.config.endpoint + path);
669
+ return await this.client.call('get', uri, {
670
+ 'content-type': 'application/json',
671
+ }, payload);
672
+ }
673
+
674
+ /**
675
+ * List User Memberships
676
+ *
677
+ * Get the user membership list by its unique ID.
678
+ *
679
+ * @param {string} userId
680
+ * @throws {AppwriteException}
681
+ * @returns {Promise}
682
+ */
683
+ async listMemberships(userId: string): Promise<Models.MembershipList> {
684
+ if (typeof userId === 'undefined') {
685
+ throw new AppwriteException('Missing required parameter: "userId"');
686
+ }
687
+
688
+ let path = '/users/{userId}/memberships'.replace('{userId}', userId);
689
+ let payload: Payload = {};
690
+
691
+ const uri = new URL(this.client.config.endpoint + path);
692
+ return await this.client.call('get', uri, {
693
+ 'content-type': 'application/json',
694
+ }, payload);
695
+ }
696
+
697
+ /**
698
+ * Update Name
699
+ *
700
+ * Update the user name by its unique ID.
701
+ *
702
+ * @param {string} userId
703
+ * @param {string} name
704
+ * @throws {AppwriteException}
705
+ * @returns {Promise}
706
+ */
707
+ async updateName<Preferences extends Models.Preferences>(userId: string, name: string): Promise<Models.User<Preferences>> {
708
+ if (typeof userId === 'undefined') {
709
+ throw new AppwriteException('Missing required parameter: "userId"');
710
+ }
711
+
712
+ if (typeof name === 'undefined') {
713
+ throw new AppwriteException('Missing required parameter: "name"');
714
+ }
715
+
716
+ let path = '/users/{userId}/name'.replace('{userId}', userId);
717
+ let payload: Payload = {};
718
+
719
+ if (typeof name !== 'undefined') {
720
+ payload['name'] = name;
721
+ }
722
+
723
+ const uri = new URL(this.client.config.endpoint + path);
724
+ return await this.client.call('patch', uri, {
725
+ 'content-type': 'application/json',
726
+ }, payload);
727
+ }
728
+
729
+ /**
730
+ * Update Password
731
+ *
732
+ * Update the user password by its unique ID.
733
+ *
734
+ * @param {string} userId
735
+ * @param {string} password
736
+ * @throws {AppwriteException}
737
+ * @returns {Promise}
738
+ */
739
+ async updatePassword<Preferences extends Models.Preferences>(userId: string, password: string): Promise<Models.User<Preferences>> {
740
+ if (typeof userId === 'undefined') {
741
+ throw new AppwriteException('Missing required parameter: "userId"');
742
+ }
743
+
744
+ if (typeof password === 'undefined') {
745
+ throw new AppwriteException('Missing required parameter: "password"');
746
+ }
747
+
748
+ let path = '/users/{userId}/password'.replace('{userId}', userId);
749
+ let payload: Payload = {};
750
+
751
+ if (typeof password !== 'undefined') {
752
+ payload['password'] = password;
753
+ }
754
+
755
+ const uri = new URL(this.client.config.endpoint + path);
756
+ return await this.client.call('patch', uri, {
757
+ 'content-type': 'application/json',
758
+ }, payload);
759
+ }
760
+
761
+ /**
762
+ * Update Phone
763
+ *
764
+ * Update the user phone by its unique ID.
765
+ *
766
+ * @param {string} userId
767
+ * @param {string} number
768
+ * @throws {AppwriteException}
769
+ * @returns {Promise}
770
+ */
771
+ async updatePhone<Preferences extends Models.Preferences>(userId: string, number: string): Promise<Models.User<Preferences>> {
772
+ if (typeof userId === 'undefined') {
773
+ throw new AppwriteException('Missing required parameter: "userId"');
774
+ }
775
+
776
+ if (typeof number === 'undefined') {
777
+ throw new AppwriteException('Missing required parameter: "number"');
778
+ }
779
+
780
+ let path = '/users/{userId}/phone'.replace('{userId}', userId);
781
+ let payload: Payload = {};
782
+
783
+ if (typeof number !== 'undefined') {
784
+ payload['number'] = number;
785
+ }
786
+
787
+ const uri = new URL(this.client.config.endpoint + path);
788
+ return await this.client.call('patch', uri, {
789
+ 'content-type': 'application/json',
790
+ }, payload);
791
+ }
792
+
793
+ /**
794
+ * Get User Preferences
795
+ *
796
+ * Get the user preferences by its unique ID.
797
+ *
798
+ * @param {string} userId
799
+ * @throws {AppwriteException}
800
+ * @returns {Promise}
801
+ */
802
+ async getPrefs<Preferences extends Models.Preferences>(userId: string): Promise<Preferences> {
803
+ if (typeof userId === 'undefined') {
804
+ throw new AppwriteException('Missing required parameter: "userId"');
805
+ }
806
+
807
+ let path = '/users/{userId}/prefs'.replace('{userId}', userId);
808
+ let payload: Payload = {};
809
+
810
+ const uri = new URL(this.client.config.endpoint + path);
811
+ return await this.client.call('get', uri, {
812
+ 'content-type': 'application/json',
813
+ }, payload);
814
+ }
815
+
816
+ /**
817
+ * Update User Preferences
818
+ *
819
+ * Update the user preferences by its unique ID. The object you pass is stored
820
+ * as is, and replaces any previous value. The maximum allowed prefs size is
821
+ * 64kB and throws error if exceeded.
822
+ *
823
+ * @param {string} userId
824
+ * @param {object} prefs
825
+ * @throws {AppwriteException}
826
+ * @returns {Promise}
827
+ */
828
+ async updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences> {
829
+ if (typeof userId === 'undefined') {
830
+ throw new AppwriteException('Missing required parameter: "userId"');
831
+ }
832
+
833
+ if (typeof prefs === 'undefined') {
834
+ throw new AppwriteException('Missing required parameter: "prefs"');
835
+ }
836
+
837
+ let path = '/users/{userId}/prefs'.replace('{userId}', userId);
838
+ let payload: Payload = {};
839
+
840
+ if (typeof prefs !== 'undefined') {
841
+ payload['prefs'] = prefs;
842
+ }
843
+
844
+ const uri = new URL(this.client.config.endpoint + path);
845
+ return await this.client.call('patch', uri, {
846
+ 'content-type': 'application/json',
847
+ }, payload);
848
+ }
849
+
850
+ /**
851
+ * List User Sessions
852
+ *
853
+ * Get the user sessions list by its unique ID.
854
+ *
855
+ * @param {string} userId
856
+ * @throws {AppwriteException}
857
+ * @returns {Promise}
858
+ */
859
+ async listSessions(userId: string): Promise<Models.SessionList> {
860
+ if (typeof userId === 'undefined') {
861
+ throw new AppwriteException('Missing required parameter: "userId"');
862
+ }
863
+
864
+ let path = '/users/{userId}/sessions'.replace('{userId}', userId);
865
+ let payload: Payload = {};
866
+
867
+ const uri = new URL(this.client.config.endpoint + path);
868
+ return await this.client.call('get', uri, {
869
+ 'content-type': 'application/json',
870
+ }, payload);
871
+ }
872
+
873
+ /**
874
+ * Delete User Sessions
875
+ *
876
+ * Delete all user's sessions by using the user's unique ID.
877
+ *
878
+ * @param {string} userId
879
+ * @throws {AppwriteException}
880
+ * @returns {Promise}
881
+ */
882
+ async deleteSessions(userId: string): Promise<{}> {
883
+ if (typeof userId === 'undefined') {
884
+ throw new AppwriteException('Missing required parameter: "userId"');
885
+ }
886
+
887
+ let path = '/users/{userId}/sessions'.replace('{userId}', userId);
888
+ let payload: Payload = {};
889
+
890
+ const uri = new URL(this.client.config.endpoint + path);
891
+ return await this.client.call('delete', uri, {
892
+ 'content-type': 'application/json',
893
+ }, payload);
894
+ }
895
+
896
+ /**
897
+ * Delete User Session
898
+ *
899
+ * Delete a user sessions by its unique ID.
900
+ *
901
+ * @param {string} userId
902
+ * @param {string} sessionId
903
+ * @throws {AppwriteException}
904
+ * @returns {Promise}
905
+ */
906
+ async deleteSession(userId: string, sessionId: string): Promise<{}> {
907
+ if (typeof userId === 'undefined') {
908
+ throw new AppwriteException('Missing required parameter: "userId"');
909
+ }
910
+
911
+ if (typeof sessionId === 'undefined') {
912
+ throw new AppwriteException('Missing required parameter: "sessionId"');
913
+ }
914
+
915
+ let path = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
916
+ let payload: Payload = {};
917
+
918
+ const uri = new URL(this.client.config.endpoint + path);
919
+ return await this.client.call('delete', uri, {
920
+ 'content-type': 'application/json',
921
+ }, payload);
922
+ }
923
+
924
+ /**
925
+ * Update User Status
926
+ *
927
+ * Update the user status by its unique ID. Use this endpoint as an
928
+ * alternative to deleting a user if you want to keep user's ID reserved.
929
+ *
930
+ * @param {string} userId
931
+ * @param {boolean} status
932
+ * @throws {AppwriteException}
933
+ * @returns {Promise}
934
+ */
935
+ async updateStatus<Preferences extends Models.Preferences>(userId: string, status: boolean): Promise<Models.User<Preferences>> {
936
+ if (typeof userId === 'undefined') {
937
+ throw new AppwriteException('Missing required parameter: "userId"');
938
+ }
939
+
940
+ if (typeof status === 'undefined') {
941
+ throw new AppwriteException('Missing required parameter: "status"');
942
+ }
943
+
944
+ let path = '/users/{userId}/status'.replace('{userId}', userId);
945
+ let payload: Payload = {};
946
+
947
+ if (typeof status !== 'undefined') {
948
+ payload['status'] = status;
949
+ }
950
+
951
+ const uri = new URL(this.client.config.endpoint + path);
952
+ return await this.client.call('patch', uri, {
953
+ 'content-type': 'application/json',
954
+ }, payload);
955
+ }
956
+
957
+ /**
958
+ * Update Email Verification
959
+ *
960
+ * Update the user email verification status by its unique ID.
961
+ *
962
+ * @param {string} userId
963
+ * @param {boolean} emailVerification
964
+ * @throws {AppwriteException}
965
+ * @returns {Promise}
966
+ */
967
+ async updateEmailVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>> {
968
+ if (typeof userId === 'undefined') {
969
+ throw new AppwriteException('Missing required parameter: "userId"');
970
+ }
971
+
972
+ if (typeof emailVerification === 'undefined') {
973
+ throw new AppwriteException('Missing required parameter: "emailVerification"');
974
+ }
975
+
976
+ let path = '/users/{userId}/verification'.replace('{userId}', userId);
977
+ let payload: Payload = {};
978
+
979
+ if (typeof emailVerification !== 'undefined') {
980
+ payload['emailVerification'] = emailVerification;
981
+ }
982
+
983
+ const uri = new URL(this.client.config.endpoint + path);
984
+ return await this.client.call('patch', uri, {
985
+ 'content-type': 'application/json',
986
+ }, payload);
987
+ }
988
+
989
+ /**
990
+ * Update Phone Verification
991
+ *
992
+ * Update the user phone verification status by its unique ID.
993
+ *
994
+ * @param {string} userId
995
+ * @param {boolean} phoneVerification
996
+ * @throws {AppwriteException}
997
+ * @returns {Promise}
998
+ */
999
+ async updatePhoneVerification<Preferences extends Models.Preferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>> {
1000
+ if (typeof userId === 'undefined') {
1001
+ throw new AppwriteException('Missing required parameter: "userId"');
1002
+ }
1003
+
1004
+ if (typeof phoneVerification === 'undefined') {
1005
+ throw new AppwriteException('Missing required parameter: "phoneVerification"');
1006
+ }
1007
+
1008
+ let path = '/users/{userId}/verification/phone'.replace('{userId}', userId);
1009
+ let payload: Payload = {};
1010
+
1011
+ if (typeof phoneVerification !== 'undefined') {
1012
+ payload['phoneVerification'] = phoneVerification;
1013
+ }
1014
+
1015
+ const uri = new URL(this.client.config.endpoint + path);
1016
+ return await this.client.call('patch', uri, {
1017
+ 'content-type': 'application/json',
1018
+ }, payload);
1019
+ }
1020
+ };