@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,1009 @@
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 Account extends Service {
7
+
8
+ constructor(client: Client)
9
+ {
10
+ super(client);
11
+ }
12
+
13
+ /**
14
+ * Get Account
15
+ *
16
+ * Get currently logged in user data as JSON object.
17
+ *
18
+ * @throws {AppwriteException}
19
+ * @returns {Promise}
20
+ */
21
+ async get<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>> {
22
+ let path = '/account';
23
+ let payload: Payload = {};
24
+
25
+ const uri = new URL(this.client.config.endpoint + path);
26
+ return await this.client.call('get', uri, {
27
+ 'content-type': 'application/json',
28
+ }, payload);
29
+ }
30
+
31
+ /**
32
+ * Create Account
33
+ *
34
+ * Use this endpoint to allow a new user to register a new account in your
35
+ * project. After the user registration completes successfully, you can use
36
+ * the [/account/verfication](/docs/client/account#accountCreateVerification)
37
+ * route to start verifying the user email address. To allow the new user to
38
+ * login to their new account, you need to create a new [account
39
+ * session](/docs/client/account#accountCreateSession).
40
+ *
41
+ * @param {string} userId
42
+ * @param {string} email
43
+ * @param {string} password
44
+ * @param {string} name
45
+ * @throws {AppwriteException}
46
+ * @returns {Promise}
47
+ */
48
+ async create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.Account<Preferences>> {
49
+ if (typeof userId === 'undefined') {
50
+ throw new AppwriteException('Missing required parameter: "userId"');
51
+ }
52
+
53
+ if (typeof email === 'undefined') {
54
+ throw new AppwriteException('Missing required parameter: "email"');
55
+ }
56
+
57
+ if (typeof password === 'undefined') {
58
+ throw new AppwriteException('Missing required parameter: "password"');
59
+ }
60
+
61
+ let path = '/account';
62
+ let payload: Payload = {};
63
+
64
+ if (typeof userId !== 'undefined') {
65
+ payload['userId'] = userId;
66
+ }
67
+
68
+ if (typeof email !== 'undefined') {
69
+ payload['email'] = email;
70
+ }
71
+
72
+ if (typeof password !== 'undefined') {
73
+ payload['password'] = password;
74
+ }
75
+
76
+ if (typeof name !== 'undefined') {
77
+ payload['name'] = name;
78
+ }
79
+
80
+ const uri = new URL(this.client.config.endpoint + path);
81
+ return await this.client.call('post', uri, {
82
+ 'content-type': 'application/json',
83
+ }, payload);
84
+ }
85
+
86
+ /**
87
+ * Update Email
88
+ *
89
+ * Update currently logged in user account email address. After changing user
90
+ * address, the user confirmation status will get reset. A new confirmation
91
+ * email is not sent automatically however you can use the send confirmation
92
+ * email endpoint again to send the confirmation email. For security measures,
93
+ * user password is required to complete this request.
94
+ * This endpoint can also be used to convert an anonymous account to a normal
95
+ * one, by passing an email address and a new password.
96
+ *
97
+ *
98
+ * @param {string} email
99
+ * @param {string} password
100
+ * @throws {AppwriteException}
101
+ * @returns {Promise}
102
+ */
103
+ async updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.Account<Preferences>> {
104
+ if (typeof email === 'undefined') {
105
+ throw new AppwriteException('Missing required parameter: "email"');
106
+ }
107
+
108
+ if (typeof password === 'undefined') {
109
+ throw new AppwriteException('Missing required parameter: "password"');
110
+ }
111
+
112
+ let path = '/account/email';
113
+ let payload: Payload = {};
114
+
115
+ if (typeof email !== 'undefined') {
116
+ payload['email'] = email;
117
+ }
118
+
119
+ if (typeof password !== 'undefined') {
120
+ payload['password'] = password;
121
+ }
122
+
123
+ const uri = new URL(this.client.config.endpoint + path);
124
+ return await this.client.call('patch', uri, {
125
+ 'content-type': 'application/json',
126
+ }, payload);
127
+ }
128
+
129
+ /**
130
+ * Create JWT
131
+ *
132
+ * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
133
+ * to authenticate on behalf of the current user when working with the
134
+ * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
135
+ * from its creation and will be invalid if the user will logout in that time
136
+ * frame.
137
+ *
138
+ * @throws {AppwriteException}
139
+ * @returns {Promise}
140
+ */
141
+ async createJWT(): Promise<Models.Jwt> {
142
+ let path = '/account/jwt';
143
+ let payload: Payload = {};
144
+
145
+ const uri = new URL(this.client.config.endpoint + path);
146
+ return await this.client.call('post', uri, {
147
+ 'content-type': 'application/json',
148
+ }, payload);
149
+ }
150
+
151
+ /**
152
+ * List Logs
153
+ *
154
+ * Get currently logged in user list of latest security activity logs. Each
155
+ * log returns user IP address, location and date and time of log.
156
+ *
157
+ * @param {string[]} queries
158
+ * @throws {AppwriteException}
159
+ * @returns {Promise}
160
+ */
161
+ async listLogs(queries?: string[]): Promise<Models.LogList> {
162
+ let path = '/account/logs';
163
+ let payload: Payload = {};
164
+
165
+ if (typeof queries !== 'undefined') {
166
+ payload['queries'] = queries;
167
+ }
168
+
169
+ const uri = new URL(this.client.config.endpoint + path);
170
+ return await this.client.call('get', uri, {
171
+ 'content-type': 'application/json',
172
+ }, payload);
173
+ }
174
+
175
+ /**
176
+ * Update Name
177
+ *
178
+ * Update currently logged in user account name.
179
+ *
180
+ * @param {string} name
181
+ * @throws {AppwriteException}
182
+ * @returns {Promise}
183
+ */
184
+ async updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.Account<Preferences>> {
185
+ if (typeof name === 'undefined') {
186
+ throw new AppwriteException('Missing required parameter: "name"');
187
+ }
188
+
189
+ let path = '/account/name';
190
+ let payload: Payload = {};
191
+
192
+ if (typeof name !== 'undefined') {
193
+ payload['name'] = name;
194
+ }
195
+
196
+ const uri = new URL(this.client.config.endpoint + path);
197
+ return await this.client.call('patch', uri, {
198
+ 'content-type': 'application/json',
199
+ }, payload);
200
+ }
201
+
202
+ /**
203
+ * Update Password
204
+ *
205
+ * Update currently logged in user password. For validation, user is required
206
+ * to pass in the new password, and the old password. For users created with
207
+ * OAuth, Team Invites and Magic URL, oldPassword is optional.
208
+ *
209
+ * @param {string} password
210
+ * @param {string} oldPassword
211
+ * @throws {AppwriteException}
212
+ * @returns {Promise}
213
+ */
214
+ async updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.Account<Preferences>> {
215
+ if (typeof password === 'undefined') {
216
+ throw new AppwriteException('Missing required parameter: "password"');
217
+ }
218
+
219
+ let path = '/account/password';
220
+ let payload: Payload = {};
221
+
222
+ if (typeof password !== 'undefined') {
223
+ payload['password'] = password;
224
+ }
225
+
226
+ if (typeof oldPassword !== 'undefined') {
227
+ payload['oldPassword'] = oldPassword;
228
+ }
229
+
230
+ const uri = new URL(this.client.config.endpoint + path);
231
+ return await this.client.call('patch', uri, {
232
+ 'content-type': 'application/json',
233
+ }, payload);
234
+ }
235
+
236
+ /**
237
+ * Update Phone
238
+ *
239
+ * Update the currently logged in user's phone number. After updating the
240
+ * phone number, the phone verification status will be reset. A confirmation
241
+ * SMS is not sent automatically, however you can use the [POST
242
+ * /account/verification/phone](/docs/client/account#accountCreatePhoneVerification)
243
+ * endpoint to send a confirmation SMS.
244
+ *
245
+ * @param {string} phone
246
+ * @param {string} password
247
+ * @throws {AppwriteException}
248
+ * @returns {Promise}
249
+ */
250
+ async updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.Account<Preferences>> {
251
+ if (typeof phone === 'undefined') {
252
+ throw new AppwriteException('Missing required parameter: "phone"');
253
+ }
254
+
255
+ if (typeof password === 'undefined') {
256
+ throw new AppwriteException('Missing required parameter: "password"');
257
+ }
258
+
259
+ let path = '/account/phone';
260
+ let payload: Payload = {};
261
+
262
+ if (typeof phone !== 'undefined') {
263
+ payload['phone'] = phone;
264
+ }
265
+
266
+ if (typeof password !== 'undefined') {
267
+ payload['password'] = password;
268
+ }
269
+
270
+ const uri = new URL(this.client.config.endpoint + path);
271
+ return await this.client.call('patch', uri, {
272
+ 'content-type': 'application/json',
273
+ }, payload);
274
+ }
275
+
276
+ /**
277
+ * Get Account Preferences
278
+ *
279
+ * Get currently logged in user preferences as a key-value object.
280
+ *
281
+ * @throws {AppwriteException}
282
+ * @returns {Promise}
283
+ */
284
+ async getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
285
+ let path = '/account/prefs';
286
+ let payload: Payload = {};
287
+
288
+ const uri = new URL(this.client.config.endpoint + path);
289
+ return await this.client.call('get', uri, {
290
+ 'content-type': 'application/json',
291
+ }, payload);
292
+ }
293
+
294
+ /**
295
+ * Update Preferences
296
+ *
297
+ * Update currently logged in user account preferences. The object you pass is
298
+ * stored as is, and replaces any previous value. The maximum allowed prefs
299
+ * size is 64kB and throws error if exceeded.
300
+ *
301
+ * @param {object} prefs
302
+ * @throws {AppwriteException}
303
+ * @returns {Promise}
304
+ */
305
+ async updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.Account<Preferences>> {
306
+ if (typeof prefs === 'undefined') {
307
+ throw new AppwriteException('Missing required parameter: "prefs"');
308
+ }
309
+
310
+ let path = '/account/prefs';
311
+ let payload: Payload = {};
312
+
313
+ if (typeof prefs !== 'undefined') {
314
+ payload['prefs'] = prefs;
315
+ }
316
+
317
+ const uri = new URL(this.client.config.endpoint + path);
318
+ return await this.client.call('patch', uri, {
319
+ 'content-type': 'application/json',
320
+ }, payload);
321
+ }
322
+
323
+ /**
324
+ * Create Password Recovery
325
+ *
326
+ * Sends the user an email with a temporary secret key for password reset.
327
+ * When the user clicks the confirmation link he is redirected back to your
328
+ * app password reset URL with the secret key and email address values
329
+ * attached to the URL query string. Use the query string params to submit a
330
+ * request to the [PUT
331
+ * /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to
332
+ * complete the process. The verification link sent to the user's email
333
+ * address is valid for 1 hour.
334
+ *
335
+ * @param {string} email
336
+ * @param {string} url
337
+ * @throws {AppwriteException}
338
+ * @returns {Promise}
339
+ */
340
+ async createRecovery(email: string, url: string): Promise<Models.Token> {
341
+ if (typeof email === 'undefined') {
342
+ throw new AppwriteException('Missing required parameter: "email"');
343
+ }
344
+
345
+ if (typeof url === 'undefined') {
346
+ throw new AppwriteException('Missing required parameter: "url"');
347
+ }
348
+
349
+ let path = '/account/recovery';
350
+ let payload: Payload = {};
351
+
352
+ if (typeof email !== 'undefined') {
353
+ payload['email'] = email;
354
+ }
355
+
356
+ if (typeof url !== 'undefined') {
357
+ payload['url'] = url;
358
+ }
359
+
360
+ const uri = new URL(this.client.config.endpoint + path);
361
+ return await this.client.call('post', uri, {
362
+ 'content-type': 'application/json',
363
+ }, payload);
364
+ }
365
+
366
+ /**
367
+ * Create Password Recovery (confirmation)
368
+ *
369
+ * Use this endpoint to complete the user account password reset. Both the
370
+ * **userId** and **secret** arguments will be passed as query parameters to
371
+ * the redirect URL you have provided when sending your request to the [POST
372
+ * /account/recovery](/docs/client/account#accountCreateRecovery) endpoint.
373
+ *
374
+ * Please note that in order to avoid a [Redirect
375
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
376
+ * the only valid redirect URLs are the ones from domains you have set when
377
+ * adding your platforms in the console interface.
378
+ *
379
+ * @param {string} userId
380
+ * @param {string} secret
381
+ * @param {string} password
382
+ * @param {string} passwordAgain
383
+ * @throws {AppwriteException}
384
+ * @returns {Promise}
385
+ */
386
+ async updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise<Models.Token> {
387
+ if (typeof userId === 'undefined') {
388
+ throw new AppwriteException('Missing required parameter: "userId"');
389
+ }
390
+
391
+ if (typeof secret === 'undefined') {
392
+ throw new AppwriteException('Missing required parameter: "secret"');
393
+ }
394
+
395
+ if (typeof password === 'undefined') {
396
+ throw new AppwriteException('Missing required parameter: "password"');
397
+ }
398
+
399
+ if (typeof passwordAgain === 'undefined') {
400
+ throw new AppwriteException('Missing required parameter: "passwordAgain"');
401
+ }
402
+
403
+ let path = '/account/recovery';
404
+ let payload: Payload = {};
405
+
406
+ if (typeof userId !== 'undefined') {
407
+ payload['userId'] = userId;
408
+ }
409
+
410
+ if (typeof secret !== 'undefined') {
411
+ payload['secret'] = secret;
412
+ }
413
+
414
+ if (typeof password !== 'undefined') {
415
+ payload['password'] = password;
416
+ }
417
+
418
+ if (typeof passwordAgain !== 'undefined') {
419
+ payload['passwordAgain'] = passwordAgain;
420
+ }
421
+
422
+ const uri = new URL(this.client.config.endpoint + path);
423
+ return await this.client.call('put', uri, {
424
+ 'content-type': 'application/json',
425
+ }, payload);
426
+ }
427
+
428
+ /**
429
+ * List Sessions
430
+ *
431
+ * Get currently logged in user list of active sessions across different
432
+ * devices.
433
+ *
434
+ * @throws {AppwriteException}
435
+ * @returns {Promise}
436
+ */
437
+ async listSessions(): Promise<Models.SessionList> {
438
+ let path = '/account/sessions';
439
+ let payload: Payload = {};
440
+
441
+ const uri = new URL(this.client.config.endpoint + path);
442
+ return await this.client.call('get', uri, {
443
+ 'content-type': 'application/json',
444
+ }, payload);
445
+ }
446
+
447
+ /**
448
+ * Delete Sessions
449
+ *
450
+ * Delete all sessions from the user account and remove any sessions cookies
451
+ * from the end client.
452
+ *
453
+ * @throws {AppwriteException}
454
+ * @returns {Promise}
455
+ */
456
+ async deleteSessions(): Promise<{}> {
457
+ let path = '/account/sessions';
458
+ let payload: Payload = {};
459
+
460
+ const uri = new URL(this.client.config.endpoint + path);
461
+ return await this.client.call('delete', uri, {
462
+ 'content-type': 'application/json',
463
+ }, payload);
464
+ }
465
+
466
+ /**
467
+ * Create Anonymous Session
468
+ *
469
+ * Use this endpoint to allow a new user to register an anonymous account in
470
+ * your project. This route will also create a new session for the user. To
471
+ * allow the new user to convert an anonymous account to a normal account, you
472
+ * need to update its [email and
473
+ * password](/docs/client/account#accountUpdateEmail) or create an [OAuth2
474
+ * session](/docs/client/account#accountCreateOAuth2Session).
475
+ *
476
+ * @throws {AppwriteException}
477
+ * @returns {Promise}
478
+ */
479
+ async createAnonymousSession(): Promise<Models.Session> {
480
+ let path = '/account/sessions/anonymous';
481
+ let payload: Payload = {};
482
+
483
+ const uri = new URL(this.client.config.endpoint + path);
484
+ return await this.client.call('post', uri, {
485
+ 'content-type': 'application/json',
486
+ }, payload);
487
+ }
488
+
489
+ /**
490
+ * Create Email Session
491
+ *
492
+ * Allow the user to login into their account by providing a valid email and
493
+ * password combination. This route will create a new session for the user.
494
+ *
495
+ * A user is limited to 10 active sessions at a time by default. [Learn more
496
+ * about session limits](/docs/authentication#limits).
497
+ *
498
+ * @param {string} email
499
+ * @param {string} password
500
+ * @throws {AppwriteException}
501
+ * @returns {Promise}
502
+ */
503
+ async createEmailSession(email: string, password: string): Promise<Models.Session> {
504
+ if (typeof email === 'undefined') {
505
+ throw new AppwriteException('Missing required parameter: "email"');
506
+ }
507
+
508
+ if (typeof password === 'undefined') {
509
+ throw new AppwriteException('Missing required parameter: "password"');
510
+ }
511
+
512
+ let path = '/account/sessions/email';
513
+ let payload: Payload = {};
514
+
515
+ if (typeof email !== 'undefined') {
516
+ payload['email'] = email;
517
+ }
518
+
519
+ if (typeof password !== 'undefined') {
520
+ payload['password'] = password;
521
+ }
522
+
523
+ const uri = new URL(this.client.config.endpoint + path);
524
+ return await this.client.call('post', uri, {
525
+ 'content-type': 'application/json',
526
+ }, payload);
527
+ }
528
+
529
+ /**
530
+ * Create Magic URL session
531
+ *
532
+ * Sends the user an email with a secret key for creating a session. If the
533
+ * provided user ID has not be registered, a new user will be created. When
534
+ * the user clicks the link in the email, the user is redirected back to the
535
+ * URL you provided with the secret key and userId values attached to the URL
536
+ * query string. Use the query string parameters to submit a request to the
537
+ * [PUT
538
+ * /account/sessions/magic-url](/docs/client/account#accountUpdateMagicURLSession)
539
+ * endpoint to complete the login process. The link sent to the user's email
540
+ * address is valid for 1 hour. If you are on a mobile device you can leave
541
+ * the URL parameter empty, so that the login completion will be handled by
542
+ * your Appwrite instance by default.
543
+ *
544
+ * A user is limited to 10 active sessions at a time by default. [Learn more
545
+ * about session limits](/docs/authentication#limits).
546
+ *
547
+ * @param {string} userId
548
+ * @param {string} email
549
+ * @param {string} url
550
+ * @throws {AppwriteException}
551
+ * @returns {Promise}
552
+ */
553
+ async createMagicURLSession(userId: string, email: string, url?: string): Promise<Models.Token> {
554
+ if (typeof userId === 'undefined') {
555
+ throw new AppwriteException('Missing required parameter: "userId"');
556
+ }
557
+
558
+ if (typeof email === 'undefined') {
559
+ throw new AppwriteException('Missing required parameter: "email"');
560
+ }
561
+
562
+ let path = '/account/sessions/magic-url';
563
+ let payload: Payload = {};
564
+
565
+ if (typeof userId !== 'undefined') {
566
+ payload['userId'] = userId;
567
+ }
568
+
569
+ if (typeof email !== 'undefined') {
570
+ payload['email'] = email;
571
+ }
572
+
573
+ if (typeof url !== 'undefined') {
574
+ payload['url'] = url;
575
+ }
576
+
577
+ const uri = new URL(this.client.config.endpoint + path);
578
+ return await this.client.call('post', uri, {
579
+ 'content-type': 'application/json',
580
+ }, payload);
581
+ }
582
+
583
+ /**
584
+ * Create Magic URL session (confirmation)
585
+ *
586
+ * Use this endpoint to complete creating the session with the Magic URL. Both
587
+ * the **userId** and **secret** arguments will be passed as query parameters
588
+ * to the redirect URL you have provided when sending your request to the
589
+ * [POST
590
+ * /account/sessions/magic-url](/docs/client/account#accountCreateMagicURLSession)
591
+ * endpoint.
592
+ *
593
+ * Please note that in order to avoid a [Redirect
594
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
595
+ * the only valid redirect URLs are the ones from domains you have set when
596
+ * adding your platforms in the console interface.
597
+ *
598
+ * @param {string} userId
599
+ * @param {string} secret
600
+ * @throws {AppwriteException}
601
+ * @returns {Promise}
602
+ */
603
+ async updateMagicURLSession(userId: string, secret: string): Promise<Models.Session> {
604
+ if (typeof userId === 'undefined') {
605
+ throw new AppwriteException('Missing required parameter: "userId"');
606
+ }
607
+
608
+ if (typeof secret === 'undefined') {
609
+ throw new AppwriteException('Missing required parameter: "secret"');
610
+ }
611
+
612
+ let path = '/account/sessions/magic-url';
613
+ let payload: Payload = {};
614
+
615
+ if (typeof userId !== 'undefined') {
616
+ payload['userId'] = userId;
617
+ }
618
+
619
+ if (typeof secret !== 'undefined') {
620
+ payload['secret'] = secret;
621
+ }
622
+
623
+ const uri = new URL(this.client.config.endpoint + path);
624
+ return await this.client.call('put', uri, {
625
+ 'content-type': 'application/json',
626
+ }, payload);
627
+ }
628
+
629
+ /**
630
+ * Create OAuth2 Session
631
+ *
632
+ * Allow the user to login to their account using the OAuth2 provider of their
633
+ * choice. Each OAuth2 provider should be enabled from the Appwrite console
634
+ * first. Use the success and failure arguments to provide a redirect URL's
635
+ * back to your app when login is completed.
636
+ *
637
+ * If there is already an active session, the new session will be attached to
638
+ * the logged-in account. If there are no active sessions, the server will
639
+ * attempt to look for a user with the same email address as the email
640
+ * received from the OAuth2 provider and attach the new session to the
641
+ * existing user. If no matching user is found - the server will create a new
642
+ * user.
643
+ *
644
+ * A user is limited to 10 active sessions at a time by default. [Learn more
645
+ * about session limits](/docs/authentication#limits).
646
+ *
647
+ *
648
+ * @param {string} provider
649
+ * @param {string} success
650
+ * @param {string} failure
651
+ * @param {string[]} scopes
652
+ * @throws {AppwriteException}
653
+ * @returns {void|string}
654
+ */
655
+ createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: string[]): void | URL {
656
+ if (typeof provider === 'undefined') {
657
+ throw new AppwriteException('Missing required parameter: "provider"');
658
+ }
659
+
660
+ let path = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
661
+ let payload: Payload = {};
662
+
663
+ if (typeof success !== 'undefined') {
664
+ payload['success'] = success;
665
+ }
666
+
667
+ if (typeof failure !== 'undefined') {
668
+ payload['failure'] = failure;
669
+ }
670
+
671
+ if (typeof scopes !== 'undefined') {
672
+ payload['scopes'] = scopes;
673
+ }
674
+
675
+ const uri = new URL(this.client.config.endpoint + path);
676
+ payload['project'] = this.client.config.project;
677
+
678
+
679
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
680
+ uri.searchParams.append(key, value);
681
+ }
682
+ if (typeof window !== 'undefined' && window?.location) {
683
+ window.location.href = uri.toString();
684
+ } else {
685
+ return uri;
686
+ }
687
+ }
688
+
689
+ /**
690
+ * Create Phone session
691
+ *
692
+ * Sends the user an SMS with a secret key for creating a session. If the
693
+ * provided user ID has not be registered, a new user will be created. Use the
694
+ * returned user ID and secret and submit a request to the [PUT
695
+ * /account/sessions/phone](/docs/client/account#accountUpdatePhoneSession)
696
+ * endpoint to complete the login process. The secret sent to the user's phone
697
+ * is valid for 15 minutes.
698
+ *
699
+ * A user is limited to 10 active sessions at a time by default. [Learn more
700
+ * about session limits](/docs/authentication#limits).
701
+ *
702
+ * @param {string} userId
703
+ * @param {string} phone
704
+ * @throws {AppwriteException}
705
+ * @returns {Promise}
706
+ */
707
+ async createPhoneSession(userId: string, phone: string): Promise<Models.Token> {
708
+ if (typeof userId === 'undefined') {
709
+ throw new AppwriteException('Missing required parameter: "userId"');
710
+ }
711
+
712
+ if (typeof phone === 'undefined') {
713
+ throw new AppwriteException('Missing required parameter: "phone"');
714
+ }
715
+
716
+ let path = '/account/sessions/phone';
717
+ let payload: Payload = {};
718
+
719
+ if (typeof userId !== 'undefined') {
720
+ payload['userId'] = userId;
721
+ }
722
+
723
+ if (typeof phone !== 'undefined') {
724
+ payload['phone'] = phone;
725
+ }
726
+
727
+ const uri = new URL(this.client.config.endpoint + path);
728
+ return await this.client.call('post', uri, {
729
+ 'content-type': 'application/json',
730
+ }, payload);
731
+ }
732
+
733
+ /**
734
+ * Create Phone Session (confirmation)
735
+ *
736
+ * Use this endpoint to complete creating a session with SMS. Use the
737
+ * **userId** from the
738
+ * [createPhoneSession](/docs/client/account#accountCreatePhoneSession)
739
+ * endpoint and the **secret** received via SMS to successfully update and
740
+ * confirm the phone session.
741
+ *
742
+ * @param {string} userId
743
+ * @param {string} secret
744
+ * @throws {AppwriteException}
745
+ * @returns {Promise}
746
+ */
747
+ async updatePhoneSession(userId: string, secret: string): Promise<Models.Session> {
748
+ if (typeof userId === 'undefined') {
749
+ throw new AppwriteException('Missing required parameter: "userId"');
750
+ }
751
+
752
+ if (typeof secret === 'undefined') {
753
+ throw new AppwriteException('Missing required parameter: "secret"');
754
+ }
755
+
756
+ let path = '/account/sessions/phone';
757
+ let payload: Payload = {};
758
+
759
+ if (typeof userId !== 'undefined') {
760
+ payload['userId'] = userId;
761
+ }
762
+
763
+ if (typeof secret !== 'undefined') {
764
+ payload['secret'] = secret;
765
+ }
766
+
767
+ const uri = new URL(this.client.config.endpoint + path);
768
+ return await this.client.call('put', uri, {
769
+ 'content-type': 'application/json',
770
+ }, payload);
771
+ }
772
+
773
+ /**
774
+ * Get Session
775
+ *
776
+ * Use this endpoint to get a logged in user's session using a Session ID.
777
+ * Inputting 'current' will return the current session being used.
778
+ *
779
+ * @param {string} sessionId
780
+ * @throws {AppwriteException}
781
+ * @returns {Promise}
782
+ */
783
+ async getSession(sessionId: string): Promise<Models.Session> {
784
+ if (typeof sessionId === 'undefined') {
785
+ throw new AppwriteException('Missing required parameter: "sessionId"');
786
+ }
787
+
788
+ let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
789
+ let payload: Payload = {};
790
+
791
+ const uri = new URL(this.client.config.endpoint + path);
792
+ return await this.client.call('get', uri, {
793
+ 'content-type': 'application/json',
794
+ }, payload);
795
+ }
796
+
797
+ /**
798
+ * Update OAuth Session (Refresh Tokens)
799
+ *
800
+ * Access tokens have limited lifespan and expire to mitigate security risks.
801
+ * If session was created using an OAuth provider, this route can be used to
802
+ * "refresh" the access token.
803
+ *
804
+ * @param {string} sessionId
805
+ * @throws {AppwriteException}
806
+ * @returns {Promise}
807
+ */
808
+ async updateSession(sessionId: string): Promise<Models.Session> {
809
+ if (typeof sessionId === 'undefined') {
810
+ throw new AppwriteException('Missing required parameter: "sessionId"');
811
+ }
812
+
813
+ let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
814
+ let payload: Payload = {};
815
+
816
+ const uri = new URL(this.client.config.endpoint + path);
817
+ return await this.client.call('patch', uri, {
818
+ 'content-type': 'application/json',
819
+ }, payload);
820
+ }
821
+
822
+ /**
823
+ * Delete Session
824
+ *
825
+ * Use this endpoint to log out the currently logged in user from all their
826
+ * account sessions across all of their different devices. When using the
827
+ * Session ID argument, only the unique session ID provided is deleted.
828
+ *
829
+ *
830
+ * @param {string} sessionId
831
+ * @throws {AppwriteException}
832
+ * @returns {Promise}
833
+ */
834
+ async deleteSession(sessionId: string): Promise<{}> {
835
+ if (typeof sessionId === 'undefined') {
836
+ throw new AppwriteException('Missing required parameter: "sessionId"');
837
+ }
838
+
839
+ let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
840
+ let payload: Payload = {};
841
+
842
+ const uri = new URL(this.client.config.endpoint + path);
843
+ return await this.client.call('delete', uri, {
844
+ 'content-type': 'application/json',
845
+ }, payload);
846
+ }
847
+
848
+ /**
849
+ * Update Status
850
+ *
851
+ * Block the currently logged in user account. Behind the scene, the user
852
+ * record is not deleted but permanently blocked from any access. To
853
+ * completely delete a user, use the Users API instead.
854
+ *
855
+ * @throws {AppwriteException}
856
+ * @returns {Promise}
857
+ */
858
+ async updateStatus<Preferences extends Models.Preferences>(): Promise<Models.Account<Preferences>> {
859
+ let path = '/account/status';
860
+ let payload: Payload = {};
861
+
862
+ const uri = new URL(this.client.config.endpoint + path);
863
+ return await this.client.call('patch', uri, {
864
+ 'content-type': 'application/json',
865
+ }, payload);
866
+ }
867
+
868
+ /**
869
+ * Create Email Verification
870
+ *
871
+ * Use this endpoint to send a verification message to your user email address
872
+ * to confirm they are the valid owners of that address. Both the **userId**
873
+ * and **secret** arguments will be passed as query parameters to the URL you
874
+ * have provided to be attached to the verification email. The provided URL
875
+ * should redirect the user back to your app and allow you to complete the
876
+ * verification process by verifying both the **userId** and **secret**
877
+ * parameters. Learn more about how to [complete the verification
878
+ * process](/docs/client/account#accountUpdateEmailVerification). The
879
+ * verification link sent to the user's email address is valid for 7 days.
880
+ *
881
+ * Please note that in order to avoid a [Redirect
882
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
883
+ * the only valid redirect URLs are the ones from domains you have set when
884
+ * adding your platforms in the console interface.
885
+ *
886
+ *
887
+ * @param {string} url
888
+ * @throws {AppwriteException}
889
+ * @returns {Promise}
890
+ */
891
+ async createVerification(url: string): Promise<Models.Token> {
892
+ if (typeof url === 'undefined') {
893
+ throw new AppwriteException('Missing required parameter: "url"');
894
+ }
895
+
896
+ let path = '/account/verification';
897
+ let payload: Payload = {};
898
+
899
+ if (typeof url !== 'undefined') {
900
+ payload['url'] = url;
901
+ }
902
+
903
+ const uri = new URL(this.client.config.endpoint + path);
904
+ return await this.client.call('post', uri, {
905
+ 'content-type': 'application/json',
906
+ }, payload);
907
+ }
908
+
909
+ /**
910
+ * Create Email Verification (confirmation)
911
+ *
912
+ * Use this endpoint to complete the user email verification process. Use both
913
+ * the **userId** and **secret** parameters that were attached to your app URL
914
+ * to verify the user email ownership. If confirmed this route will return a
915
+ * 200 status code.
916
+ *
917
+ * @param {string} userId
918
+ * @param {string} secret
919
+ * @throws {AppwriteException}
920
+ * @returns {Promise}
921
+ */
922
+ async updateVerification(userId: string, secret: string): Promise<Models.Token> {
923
+ if (typeof userId === 'undefined') {
924
+ throw new AppwriteException('Missing required parameter: "userId"');
925
+ }
926
+
927
+ if (typeof secret === 'undefined') {
928
+ throw new AppwriteException('Missing required parameter: "secret"');
929
+ }
930
+
931
+ let path = '/account/verification';
932
+ let payload: Payload = {};
933
+
934
+ if (typeof userId !== 'undefined') {
935
+ payload['userId'] = userId;
936
+ }
937
+
938
+ if (typeof secret !== 'undefined') {
939
+ payload['secret'] = secret;
940
+ }
941
+
942
+ const uri = new URL(this.client.config.endpoint + path);
943
+ return await this.client.call('put', uri, {
944
+ 'content-type': 'application/json',
945
+ }, payload);
946
+ }
947
+
948
+ /**
949
+ * Create Phone Verification
950
+ *
951
+ * Use this endpoint to send a verification SMS to the currently logged in
952
+ * user. This endpoint is meant for use after updating a user's phone number
953
+ * using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone)
954
+ * endpoint. Learn more about how to [complete the verification
955
+ * process](/docs/client/account#accountUpdatePhoneVerification). The
956
+ * verification code sent to the user's phone number is valid for 15 minutes.
957
+ *
958
+ * @throws {AppwriteException}
959
+ * @returns {Promise}
960
+ */
961
+ async createPhoneVerification(): Promise<Models.Token> {
962
+ let path = '/account/verification/phone';
963
+ let payload: Payload = {};
964
+
965
+ const uri = new URL(this.client.config.endpoint + path);
966
+ return await this.client.call('post', uri, {
967
+ 'content-type': 'application/json',
968
+ }, payload);
969
+ }
970
+
971
+ /**
972
+ * Create Phone Verification (confirmation)
973
+ *
974
+ * Use this endpoint to complete the user phone verification process. Use the
975
+ * **userId** and **secret** that were sent to your user's phone number to
976
+ * verify the user email ownership. If confirmed this route will return a 200
977
+ * status code.
978
+ *
979
+ * @param {string} userId
980
+ * @param {string} secret
981
+ * @throws {AppwriteException}
982
+ * @returns {Promise}
983
+ */
984
+ async updatePhoneVerification(userId: string, secret: string): Promise<Models.Token> {
985
+ if (typeof userId === 'undefined') {
986
+ throw new AppwriteException('Missing required parameter: "userId"');
987
+ }
988
+
989
+ if (typeof secret === 'undefined') {
990
+ throw new AppwriteException('Missing required parameter: "secret"');
991
+ }
992
+
993
+ let path = '/account/verification/phone';
994
+ let payload: Payload = {};
995
+
996
+ if (typeof userId !== 'undefined') {
997
+ payload['userId'] = userId;
998
+ }
999
+
1000
+ if (typeof secret !== 'undefined') {
1001
+ payload['secret'] = secret;
1002
+ }
1003
+
1004
+ const uri = new URL(this.client.config.endpoint + path);
1005
+ return await this.client.call('put', uri, {
1006
+ 'content-type': 'application/json',
1007
+ }, payload);
1008
+ }
1009
+ };