@appwrite.io/console 8.1.0 → 8.1.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 (898) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/sdk.js +1 -1
  3. package/dist/cjs/sdk.js.map +1 -0
  4. package/dist/esm/sdk.js +29705 -0
  5. package/dist/esm/sdk.js.map +1 -0
  6. package/dist/iife/sdk.js +33515 -0
  7. package/package.json +5 -1
  8. package/types/channel.d.ts +74 -0
  9. package/types/client.d.ts +302 -0
  10. package/types/enums/adapter.d.ts +4 -0
  11. package/types/enums/api-service.d.ts +15 -0
  12. package/types/enums/api.d.ts +5 -0
  13. package/types/enums/appwrite-migration-resource.d.ts +27 -0
  14. package/types/enums/attribute-status.d.ts +7 -0
  15. package/types/enums/auth-method.d.ts +9 -0
  16. package/types/enums/authentication-factor.d.ts +6 -0
  17. package/types/enums/authenticator-type.d.ts +3 -0
  18. package/types/enums/backup-services.d.ts +8 -0
  19. package/types/enums/billing-plan-group.d.ts +5 -0
  20. package/types/enums/browser-permission.d.ts +22 -0
  21. package/types/enums/browser.d.ts +16 -0
  22. package/types/enums/build-runtime.d.ts +88 -0
  23. package/types/enums/column-status.d.ts +7 -0
  24. package/types/enums/compression.d.ts +5 -0
  25. package/types/enums/console-resource-type.d.ts +3 -0
  26. package/types/enums/credit-card.d.ts +19 -0
  27. package/types/enums/database-type.d.ts +6 -0
  28. package/types/enums/databases-index-type.d.ts +6 -0
  29. package/types/enums/deployment-download-type.d.ts +4 -0
  30. package/types/enums/deployment-status.d.ts +8 -0
  31. package/types/enums/domain-purchase-status.d.ts +6 -0
  32. package/types/enums/domain-transfer-status-enum.d.ts +10 -0
  33. package/types/enums/email-template-locale.d.ts +133 -0
  34. package/types/enums/email-template-type.d.ts +9 -0
  35. package/types/enums/execution-method.d.ts +9 -0
  36. package/types/enums/execution-status.d.ts +7 -0
  37. package/types/enums/execution-trigger.d.ts +5 -0
  38. package/types/enums/filter-type.d.ts +4 -0
  39. package/types/enums/firebase-migration-resource.d.ts +12 -0
  40. package/types/enums/flag.d.ts +197 -0
  41. package/types/enums/framework.d.ts +17 -0
  42. package/types/enums/frameworks.d.ts +17 -0
  43. package/types/enums/health-antivirus-status.d.ts +5 -0
  44. package/types/enums/health-check-status.d.ts +4 -0
  45. package/types/enums/image-format.d.ts +9 -0
  46. package/types/enums/image-gravity.d.ts +11 -0
  47. package/types/enums/index-status.d.ts +7 -0
  48. package/types/enums/message-priority.d.ts +4 -0
  49. package/types/enums/message-status.d.ts +7 -0
  50. package/types/enums/messaging-provider-type.d.ts +5 -0
  51. package/types/enums/n-host-migration-resource.d.ts +13 -0
  52. package/types/enums/name.d.ts +15 -0
  53. package/types/enums/o-auth-provider.d.ts +41 -0
  54. package/types/enums/order-by.d.ts +4 -0
  55. package/types/enums/password-hash.d.ts +13 -0
  56. package/types/enums/platform-type.d.ts +17 -0
  57. package/types/enums/platform.d.ts +4 -0
  58. package/types/enums/project-usage-range.d.ts +4 -0
  59. package/types/enums/proxy-resource-type.d.ts +4 -0
  60. package/types/enums/proxy-rule-deployment-resource-type.d.ts +4 -0
  61. package/types/enums/proxy-rule-status.d.ts +6 -0
  62. package/types/enums/region.d.ts +8 -0
  63. package/types/enums/registration-type.d.ts +6 -0
  64. package/types/enums/relation-mutate.d.ts +5 -0
  65. package/types/enums/relationship-type.d.ts +6 -0
  66. package/types/enums/resource-type.d.ts +6 -0
  67. package/types/enums/runtime.d.ts +88 -0
  68. package/types/enums/runtimes.d.ts +88 -0
  69. package/types/enums/scopes.d.ts +81 -0
  70. package/types/enums/sms-template-locale.d.ts +133 -0
  71. package/types/enums/sms-template-type.d.ts +6 -0
  72. package/types/enums/smtp-encryption.d.ts +5 -0
  73. package/types/enums/smtp-secure.d.ts +4 -0
  74. package/types/enums/status-code.d.ts +6 -0
  75. package/types/enums/status.d.ts +3 -0
  76. package/types/enums/supabase-migration-resource.d.ts +13 -0
  77. package/types/enums/tables-db-index-type.d.ts +6 -0
  78. package/types/enums/template-reference-type.d.ts +5 -0
  79. package/types/enums/theme.d.ts +4 -0
  80. package/types/enums/timezone.d.ts +421 -0
  81. package/types/enums/usage-range.d.ts +5 -0
  82. package/types/enums/use-cases.d.ts +16 -0
  83. package/types/enums/vcs-detection-type.d.ts +4 -0
  84. package/types/enums/vcs-reference-type.d.ts +5 -0
  85. package/types/id.d.ts +20 -0
  86. package/{src/index.ts → types/index.d.ts} +1 -1
  87. package/{src/models.ts → types/models.d.ts} +268 -518
  88. package/types/operator.d.ts +180 -0
  89. package/{src/permission.ts → types/permission.d.ts} +6 -20
  90. package/types/query.d.ts +442 -0
  91. package/{src/role.ts → types/role.d.ts} +28 -58
  92. package/types/service.d.ts +11 -0
  93. package/types/services/account.d.ts +1536 -0
  94. package/types/services/activities.d.ts +46 -0
  95. package/types/services/assistant.d.ts +24 -0
  96. package/{src/services/avatars.ts → types/services/avatars.d.ts} +91 -525
  97. package/types/services/backups.d.ts +277 -0
  98. package/types/services/console.d.ts +248 -0
  99. package/types/services/databases.d.ts +2435 -0
  100. package/types/services/domains.d.ts +1527 -0
  101. package/types/services/functions.d.ts +842 -0
  102. package/types/services/graphql.d.ts +43 -0
  103. package/types/services/health.d.ts +475 -0
  104. package/types/services/locale.d.ts +64 -0
  105. package/types/services/messaging.d.ts +1989 -0
  106. package/types/services/migrations.d.ts +417 -0
  107. package/types/services/organizations.d.ts +1009 -0
  108. package/types/services/project.d.ts +148 -0
  109. package/types/services/projects.d.ts +1626 -0
  110. package/types/services/proxy.d.ts +190 -0
  111. package/types/services/realtime.d.ts +134 -0
  112. package/types/services/sites.d.ts +800 -0
  113. package/types/services/storage.d.ts +467 -0
  114. package/types/services/tables-db.d.ts +2352 -0
  115. package/types/services/teams.d.ts +366 -0
  116. package/types/services/tokens.d.ts +119 -0
  117. package/types/services/users.d.ts +1208 -0
  118. package/types/services/vcs.d.ts +252 -0
  119. package/types/services/webhooks.d.ts +165 -0
  120. package/.github/workflows/autoclose.yml +0 -11
  121. package/.github/workflows/publish.yml +0 -43
  122. package/CHANGELOG.md +0 -169
  123. package/docs/examples/account/create-anonymous-session.md +0 -13
  124. package/docs/examples/account/create-billing-address.md +0 -20
  125. package/docs/examples/account/create-email-password-session.md +0 -16
  126. package/docs/examples/account/create-email-token.md +0 -17
  127. package/docs/examples/account/create-email-verification.md +0 -15
  128. package/docs/examples/account/create-jwt.md +0 -15
  129. package/docs/examples/account/create-key.md +0 -17
  130. package/docs/examples/account/create-magic-url-token.md +0 -18
  131. package/docs/examples/account/create-mfa-authenticator.md +0 -15
  132. package/docs/examples/account/create-mfa-challenge.md +0 -15
  133. package/docs/examples/account/create-mfa-recovery-codes.md +0 -13
  134. package/docs/examples/account/create-o-auth-2-session.md +0 -17
  135. package/docs/examples/account/create-o-auth-2-token.md +0 -17
  136. package/docs/examples/account/create-payment-method.md +0 -13
  137. package/docs/examples/account/create-phone-token.md +0 -16
  138. package/docs/examples/account/create-phone-verification.md +0 -13
  139. package/docs/examples/account/create-push-target.md +0 -17
  140. package/docs/examples/account/create-recovery.md +0 -16
  141. package/docs/examples/account/create-session.md +0 -16
  142. package/docs/examples/account/create-verification.md +0 -15
  143. package/docs/examples/account/create.md +0 -18
  144. package/docs/examples/account/delete-billing-address.md +0 -15
  145. package/docs/examples/account/delete-identity.md +0 -15
  146. package/docs/examples/account/delete-key.md +0 -15
  147. package/docs/examples/account/delete-mfa-authenticator.md +0 -15
  148. package/docs/examples/account/delete-payment-method.md +0 -15
  149. package/docs/examples/account/delete-push-target.md +0 -15
  150. package/docs/examples/account/delete-session.md +0 -15
  151. package/docs/examples/account/delete-sessions.md +0 -13
  152. package/docs/examples/account/delete.md +0 -13
  153. package/docs/examples/account/get-billing-address.md +0 -15
  154. package/docs/examples/account/get-coupon.md +0 -15
  155. package/docs/examples/account/get-key.md +0 -15
  156. package/docs/examples/account/get-mfa-recovery-codes.md +0 -13
  157. package/docs/examples/account/get-payment-method.md +0 -15
  158. package/docs/examples/account/get-prefs.md +0 -13
  159. package/docs/examples/account/get-session.md +0 -15
  160. package/docs/examples/account/get.md +0 -13
  161. package/docs/examples/account/list-billing-addresses.md +0 -15
  162. package/docs/examples/account/list-identities.md +0 -16
  163. package/docs/examples/account/list-invoices.md +0 -15
  164. package/docs/examples/account/list-keys.md +0 -15
  165. package/docs/examples/account/list-logs.md +0 -16
  166. package/docs/examples/account/list-mfa-factors.md +0 -13
  167. package/docs/examples/account/list-payment-methods.md +0 -15
  168. package/docs/examples/account/list-sessions.md +0 -13
  169. package/docs/examples/account/update-billing-address.md +0 -21
  170. package/docs/examples/account/update-email-verification.md +0 -16
  171. package/docs/examples/account/update-email.md +0 -16
  172. package/docs/examples/account/update-key.md +0 -18
  173. package/docs/examples/account/update-magic-url-session.md +0 -16
  174. package/docs/examples/account/update-mfa-authenticator.md +0 -16
  175. package/docs/examples/account/update-mfa-challenge.md +0 -16
  176. package/docs/examples/account/update-mfa-recovery-codes.md +0 -13
  177. package/docs/examples/account/update-mfa.md +0 -15
  178. package/docs/examples/account/update-name.md +0 -15
  179. package/docs/examples/account/update-password.md +0 -16
  180. package/docs/examples/account/update-payment-method-mandate-options.md +0 -15
  181. package/docs/examples/account/update-payment-method-provider.md +0 -18
  182. package/docs/examples/account/update-payment-method.md +0 -18
  183. package/docs/examples/account/update-phone-session.md +0 -16
  184. package/docs/examples/account/update-phone-verification.md +0 -16
  185. package/docs/examples/account/update-phone.md +0 -16
  186. package/docs/examples/account/update-prefs.md +0 -19
  187. package/docs/examples/account/update-push-target.md +0 -16
  188. package/docs/examples/account/update-recovery.md +0 -17
  189. package/docs/examples/account/update-session.md +0 -15
  190. package/docs/examples/account/update-status.md +0 -13
  191. package/docs/examples/account/update-verification.md +0 -16
  192. package/docs/examples/activities/get-event.md +0 -15
  193. package/docs/examples/activities/list-events.md +0 -15
  194. package/docs/examples/assistant/chat.md +0 -15
  195. package/docs/examples/avatars/get-browser.md +0 -18
  196. package/docs/examples/avatars/get-credit-card.md +0 -18
  197. package/docs/examples/avatars/get-favicon.md +0 -15
  198. package/docs/examples/avatars/get-flag.md +0 -18
  199. package/docs/examples/avatars/get-image.md +0 -17
  200. package/docs/examples/avatars/get-initials.md +0 -18
  201. package/docs/examples/avatars/get-qr.md +0 -18
  202. package/docs/examples/avatars/get-screenshot.md +0 -37
  203. package/docs/examples/backups/create-archive.md +0 -16
  204. package/docs/examples/backups/create-policy.md +0 -21
  205. package/docs/examples/backups/create-restoration.md +0 -18
  206. package/docs/examples/backups/delete-archive.md +0 -15
  207. package/docs/examples/backups/delete-policy.md +0 -15
  208. package/docs/examples/backups/get-archive.md +0 -15
  209. package/docs/examples/backups/get-policy.md +0 -15
  210. package/docs/examples/backups/get-restoration.md +0 -15
  211. package/docs/examples/backups/list-archives.md +0 -15
  212. package/docs/examples/backups/list-policies.md +0 -15
  213. package/docs/examples/backups/list-restorations.md +0 -15
  214. package/docs/examples/backups/update-policy.md +0 -19
  215. package/docs/examples/console/create-program-membership.md +0 -15
  216. package/docs/examples/console/create-source.md +0 -19
  217. package/docs/examples/console/get-campaign.md +0 -15
  218. package/docs/examples/console/get-coupon.md +0 -15
  219. package/docs/examples/console/get-plan.md +0 -15
  220. package/docs/examples/console/get-plans.md +0 -15
  221. package/docs/examples/console/get-program.md +0 -15
  222. package/docs/examples/console/get-resource.md +0 -16
  223. package/docs/examples/console/list-regions.md +0 -13
  224. package/docs/examples/console/suggest-columns.md +0 -19
  225. package/docs/examples/console/suggest-indexes.md +0 -18
  226. package/docs/examples/console/variables.md +0 -13
  227. package/docs/examples/databases/create-boolean-attribute.md +0 -20
  228. package/docs/examples/databases/create-collection.md +0 -22
  229. package/docs/examples/databases/create-datetime-attribute.md +0 -20
  230. package/docs/examples/databases/create-document.md +0 -26
  231. package/docs/examples/databases/create-documents.md +0 -18
  232. package/docs/examples/databases/create-email-attribute.md +0 -20
  233. package/docs/examples/databases/create-enum-attribute.md +0 -21
  234. package/docs/examples/databases/create-float-attribute.md +0 -22
  235. package/docs/examples/databases/create-index.md +0 -21
  236. package/docs/examples/databases/create-integer-attribute.md +0 -22
  237. package/docs/examples/databases/create-ip-attribute.md +0 -20
  238. package/docs/examples/databases/create-line-attribute.md +0 -19
  239. package/docs/examples/databases/create-longtext-attribute.md +0 -21
  240. package/docs/examples/databases/create-mediumtext-attribute.md +0 -21
  241. package/docs/examples/databases/create-operations.md +0 -26
  242. package/docs/examples/databases/create-point-attribute.md +0 -19
  243. package/docs/examples/databases/create-polygon-attribute.md +0 -19
  244. package/docs/examples/databases/create-relationship-attribute.md +0 -22
  245. package/docs/examples/databases/create-string-attribute.md +0 -22
  246. package/docs/examples/databases/create-text-attribute.md +0 -21
  247. package/docs/examples/databases/create-transaction.md +0 -15
  248. package/docs/examples/databases/create-url-attribute.md +0 -20
  249. package/docs/examples/databases/create-varchar-attribute.md +0 -22
  250. package/docs/examples/databases/create.md +0 -17
  251. package/docs/examples/databases/decrement-document-attribute.md +0 -21
  252. package/docs/examples/databases/delete-attribute.md +0 -17
  253. package/docs/examples/databases/delete-collection.md +0 -16
  254. package/docs/examples/databases/delete-document.md +0 -18
  255. package/docs/examples/databases/delete-documents.md +0 -18
  256. package/docs/examples/databases/delete-index.md +0 -17
  257. package/docs/examples/databases/delete-transaction.md +0 -15
  258. package/docs/examples/databases/delete.md +0 -15
  259. package/docs/examples/databases/get-attribute.md +0 -17
  260. package/docs/examples/databases/get-collection-usage.md +0 -17
  261. package/docs/examples/databases/get-collection.md +0 -16
  262. package/docs/examples/databases/get-document.md +0 -19
  263. package/docs/examples/databases/get-index.md +0 -17
  264. package/docs/examples/databases/get-transaction.md +0 -15
  265. package/docs/examples/databases/get-usage.md +0 -16
  266. package/docs/examples/databases/get.md +0 -15
  267. package/docs/examples/databases/increment-document-attribute.md +0 -21
  268. package/docs/examples/databases/list-attributes.md +0 -18
  269. package/docs/examples/databases/list-collection-logs.md +0 -17
  270. package/docs/examples/databases/list-collections.md +0 -18
  271. package/docs/examples/databases/list-document-logs.md +0 -18
  272. package/docs/examples/databases/list-documents.md +0 -20
  273. package/docs/examples/databases/list-indexes.md +0 -18
  274. package/docs/examples/databases/list-logs.md +0 -16
  275. package/docs/examples/databases/list-transactions.md +0 -15
  276. package/docs/examples/databases/list-usage.md +0 -15
  277. package/docs/examples/databases/list.md +0 -17
  278. package/docs/examples/databases/update-boolean-attribute.md +0 -20
  279. package/docs/examples/databases/update-collection.md +0 -20
  280. package/docs/examples/databases/update-datetime-attribute.md +0 -20
  281. package/docs/examples/databases/update-document.md +0 -26
  282. package/docs/examples/databases/update-documents.md +0 -25
  283. package/docs/examples/databases/update-email-attribute.md +0 -20
  284. package/docs/examples/databases/update-enum-attribute.md +0 -21
  285. package/docs/examples/databases/update-float-attribute.md +0 -22
  286. package/docs/examples/databases/update-integer-attribute.md +0 -22
  287. package/docs/examples/databases/update-ip-attribute.md +0 -20
  288. package/docs/examples/databases/update-line-attribute.md +0 -20
  289. package/docs/examples/databases/update-longtext-attribute.md +0 -20
  290. package/docs/examples/databases/update-mediumtext-attribute.md +0 -20
  291. package/docs/examples/databases/update-point-attribute.md +0 -20
  292. package/docs/examples/databases/update-polygon-attribute.md +0 -20
  293. package/docs/examples/databases/update-relationship-attribute.md +0 -19
  294. package/docs/examples/databases/update-string-attribute.md +0 -21
  295. package/docs/examples/databases/update-text-attribute.md +0 -20
  296. package/docs/examples/databases/update-transaction.md +0 -17
  297. package/docs/examples/databases/update-url-attribute.md +0 -20
  298. package/docs/examples/databases/update-varchar-attribute.md +0 -21
  299. package/docs/examples/databases/update.md +0 -17
  300. package/docs/examples/databases/upsert-document.md +0 -26
  301. package/docs/examples/databases/upsert-documents.md +0 -18
  302. package/docs/examples/domains/create-preset-google-workspace.md +0 -15
  303. package/docs/examples/domains/create-preset-i-cloud.md +0 -15
  304. package/docs/examples/domains/create-preset-mailgun.md +0 -15
  305. package/docs/examples/domains/create-preset-outlook.md +0 -15
  306. package/docs/examples/domains/create-preset-proton-mail.md +0 -15
  307. package/docs/examples/domains/create-preset-zoho.md +0 -15
  308. package/docs/examples/domains/create-purchase.md +0 -26
  309. package/docs/examples/domains/create-record-a.md +0 -19
  310. package/docs/examples/domains/create-record-aaaa.md +0 -19
  311. package/docs/examples/domains/create-record-alias.md +0 -19
  312. package/docs/examples/domains/create-record-caa.md +0 -19
  313. package/docs/examples/domains/create-record-cname.md +0 -19
  314. package/docs/examples/domains/create-record-https.md +0 -19
  315. package/docs/examples/domains/create-record-mx.md +0 -20
  316. package/docs/examples/domains/create-record-ns.md +0 -19
  317. package/docs/examples/domains/create-record-srv.md +0 -22
  318. package/docs/examples/domains/create-record-txt.md +0 -19
  319. package/docs/examples/domains/create-transfer-in.md +0 -19
  320. package/docs/examples/domains/create-transfer-out.md +0 -16
  321. package/docs/examples/domains/create.md +0 -16
  322. package/docs/examples/domains/delete-record.md +0 -16
  323. package/docs/examples/domains/delete.md +0 -15
  324. package/docs/examples/domains/get-preset-google-workspace.md +0 -15
  325. package/docs/examples/domains/get-preset-i-cloud.md +0 -15
  326. package/docs/examples/domains/get-preset-mailgun.md +0 -15
  327. package/docs/examples/domains/get-preset-outlook.md +0 -15
  328. package/docs/examples/domains/get-preset-proton-mail.md +0 -15
  329. package/docs/examples/domains/get-preset-zoho.md +0 -15
  330. package/docs/examples/domains/get-price.md +0 -17
  331. package/docs/examples/domains/get-record.md +0 -16
  332. package/docs/examples/domains/get-transfer-status.md +0 -15
  333. package/docs/examples/domains/get-zone.md +0 -15
  334. package/docs/examples/domains/get.md +0 -15
  335. package/docs/examples/domains/list-records.md +0 -16
  336. package/docs/examples/domains/list-suggestions.md +0 -20
  337. package/docs/examples/domains/list.md +0 -16
  338. package/docs/examples/domains/update-auto-renewal.md +0 -16
  339. package/docs/examples/domains/update-nameservers.md +0 -15
  340. package/docs/examples/domains/update-purchase.md +0 -16
  341. package/docs/examples/domains/update-record-a.md +0 -20
  342. package/docs/examples/domains/update-record-aaaa.md +0 -20
  343. package/docs/examples/domains/update-record-alias.md +0 -20
  344. package/docs/examples/domains/update-record-caa.md +0 -20
  345. package/docs/examples/domains/update-record-cname.md +0 -20
  346. package/docs/examples/domains/update-record-https.md +0 -20
  347. package/docs/examples/domains/update-record-mx.md +0 -21
  348. package/docs/examples/domains/update-record-ns.md +0 -20
  349. package/docs/examples/domains/update-record-srv.md +0 -23
  350. package/docs/examples/domains/update-record-txt.md +0 -20
  351. package/docs/examples/domains/update-team.md +0 -16
  352. package/docs/examples/domains/update-transfer-in.md +0 -16
  353. package/docs/examples/domains/update-zone.md +0 -16
  354. package/docs/examples/functions/create-deployment.md +0 -19
  355. package/docs/examples/functions/create-duplicate-deployment.md +0 -17
  356. package/docs/examples/functions/create-execution.md +0 -21
  357. package/docs/examples/functions/create-template-deployment.md +0 -21
  358. package/docs/examples/functions/create-variable.md +0 -18
  359. package/docs/examples/functions/create-vcs-deployment.md +0 -18
  360. package/docs/examples/functions/create.md +0 -34
  361. package/docs/examples/functions/delete-deployment.md +0 -16
  362. package/docs/examples/functions/delete-execution.md +0 -16
  363. package/docs/examples/functions/delete-variable.md +0 -16
  364. package/docs/examples/functions/delete.md +0 -15
  365. package/docs/examples/functions/get-deployment-download.md +0 -17
  366. package/docs/examples/functions/get-deployment.md +0 -16
  367. package/docs/examples/functions/get-execution.md +0 -16
  368. package/docs/examples/functions/get-template.md +0 -15
  369. package/docs/examples/functions/get-usage.md +0 -16
  370. package/docs/examples/functions/get-variable.md +0 -16
  371. package/docs/examples/functions/get.md +0 -15
  372. package/docs/examples/functions/list-deployments.md +0 -18
  373. package/docs/examples/functions/list-executions.md +0 -17
  374. package/docs/examples/functions/list-runtimes.md +0 -13
  375. package/docs/examples/functions/list-specifications.md +0 -13
  376. package/docs/examples/functions/list-templates.md +0 -19
  377. package/docs/examples/functions/list-usage.md +0 -15
  378. package/docs/examples/functions/list-variables.md +0 -15
  379. package/docs/examples/functions/list.md +0 -17
  380. package/docs/examples/functions/update-deployment-status.md +0 -16
  381. package/docs/examples/functions/update-function-deployment.md +0 -16
  382. package/docs/examples/functions/update-variable.md +0 -19
  383. package/docs/examples/functions/update.md +0 -34
  384. package/docs/examples/graphql/mutation.md +0 -15
  385. package/docs/examples/graphql/query.md +0 -15
  386. package/docs/examples/health/get-antivirus.md +0 -13
  387. package/docs/examples/health/get-cache.md +0 -13
  388. package/docs/examples/health/get-certificate.md +0 -15
  389. package/docs/examples/health/get-console-pausing.md +0 -16
  390. package/docs/examples/health/get-db.md +0 -13
  391. package/docs/examples/health/get-failed-jobs.md +0 -16
  392. package/docs/examples/health/get-pub-sub.md +0 -13
  393. package/docs/examples/health/get-queue-audits.md +0 -15
  394. package/docs/examples/health/get-queue-billing-project-aggregation.md +0 -15
  395. package/docs/examples/health/get-queue-billing-team-aggregation.md +0 -15
  396. package/docs/examples/health/get-queue-builds.md +0 -15
  397. package/docs/examples/health/get-queue-certificates.md +0 -15
  398. package/docs/examples/health/get-queue-databases.md +0 -16
  399. package/docs/examples/health/get-queue-deletes.md +0 -15
  400. package/docs/examples/health/get-queue-functions.md +0 -15
  401. package/docs/examples/health/get-queue-logs.md +0 -15
  402. package/docs/examples/health/get-queue-mails.md +0 -15
  403. package/docs/examples/health/get-queue-messaging.md +0 -15
  404. package/docs/examples/health/get-queue-migrations.md +0 -15
  405. package/docs/examples/health/get-queue-priority-builds.md +0 -15
  406. package/docs/examples/health/get-queue-region-manager.md +0 -15
  407. package/docs/examples/health/get-queue-stats-resources.md +0 -15
  408. package/docs/examples/health/get-queue-threats.md +0 -15
  409. package/docs/examples/health/get-queue-usage.md +0 -15
  410. package/docs/examples/health/get-queue-webhooks.md +0 -15
  411. package/docs/examples/health/get-storage-local.md +0 -13
  412. package/docs/examples/health/get-storage.md +0 -13
  413. package/docs/examples/health/get-time.md +0 -13
  414. package/docs/examples/health/get.md +0 -13
  415. package/docs/examples/locale/get.md +0 -13
  416. package/docs/examples/locale/list-codes.md +0 -13
  417. package/docs/examples/locale/list-continents.md +0 -13
  418. package/docs/examples/locale/list-countries-eu.md +0 -13
  419. package/docs/examples/locale/list-countries-phones.md +0 -13
  420. package/docs/examples/locale/list-countries.md +0 -13
  421. package/docs/examples/locale/list-currencies.md +0 -13
  422. package/docs/examples/locale/list-languages.md +0 -13
  423. package/docs/examples/messaging/create-apns-provider.md +0 -22
  424. package/docs/examples/messaging/create-email.md +0 -26
  425. package/docs/examples/messaging/create-fcm-provider.md +0 -18
  426. package/docs/examples/messaging/create-mailgun-provider.md +0 -24
  427. package/docs/examples/messaging/create-msg-91-provider.md +0 -20
  428. package/docs/examples/messaging/create-push.md +0 -33
  429. package/docs/examples/messaging/create-resend-provider.md +0 -22
  430. package/docs/examples/messaging/create-sendgrid-provider.md +0 -22
  431. package/docs/examples/messaging/create-sms.md +0 -21
  432. package/docs/examples/messaging/create-smtp-provider.md +0 -28
  433. package/docs/examples/messaging/create-subscriber.md +0 -17
  434. package/docs/examples/messaging/create-telesign-provider.md +0 -20
  435. package/docs/examples/messaging/create-textmagic-provider.md +0 -20
  436. package/docs/examples/messaging/create-topic.md +0 -17
  437. package/docs/examples/messaging/create-twilio-provider.md +0 -20
  438. package/docs/examples/messaging/create-vonage-provider.md +0 -20
  439. package/docs/examples/messaging/delete-provider.md +0 -15
  440. package/docs/examples/messaging/delete-subscriber.md +0 -16
  441. package/docs/examples/messaging/delete-topic.md +0 -15
  442. package/docs/examples/messaging/delete.md +0 -15
  443. package/docs/examples/messaging/get-message.md +0 -15
  444. package/docs/examples/messaging/get-provider.md +0 -15
  445. package/docs/examples/messaging/get-subscriber.md +0 -16
  446. package/docs/examples/messaging/get-topic.md +0 -15
  447. package/docs/examples/messaging/list-message-logs.md +0 -17
  448. package/docs/examples/messaging/list-messages.md +0 -17
  449. package/docs/examples/messaging/list-provider-logs.md +0 -17
  450. package/docs/examples/messaging/list-providers.md +0 -17
  451. package/docs/examples/messaging/list-subscriber-logs.md +0 -17
  452. package/docs/examples/messaging/list-subscribers.md +0 -18
  453. package/docs/examples/messaging/list-targets.md +0 -17
  454. package/docs/examples/messaging/list-topic-logs.md +0 -17
  455. package/docs/examples/messaging/list-topics.md +0 -17
  456. package/docs/examples/messaging/update-apns-provider.md +0 -22
  457. package/docs/examples/messaging/update-email.md +0 -26
  458. package/docs/examples/messaging/update-fcm-provider.md +0 -18
  459. package/docs/examples/messaging/update-mailgun-provider.md +0 -24
  460. package/docs/examples/messaging/update-msg-91-provider.md +0 -20
  461. package/docs/examples/messaging/update-push.md +0 -33
  462. package/docs/examples/messaging/update-resend-provider.md +0 -22
  463. package/docs/examples/messaging/update-sendgrid-provider.md +0 -22
  464. package/docs/examples/messaging/update-sms.md +0 -21
  465. package/docs/examples/messaging/update-smtp-provider.md +0 -28
  466. package/docs/examples/messaging/update-telesign-provider.md +0 -20
  467. package/docs/examples/messaging/update-textmagic-provider.md +0 -20
  468. package/docs/examples/messaging/update-topic.md +0 -17
  469. package/docs/examples/messaging/update-twilio-provider.md +0 -20
  470. package/docs/examples/messaging/update-vonage-provider.md +0 -20
  471. package/docs/examples/migrations/create-appwrite-migration.md +0 -18
  472. package/docs/examples/migrations/create-csv-export.md +0 -23
  473. package/docs/examples/migrations/create-csv-import.md +0 -18
  474. package/docs/examples/migrations/create-firebase-migration.md +0 -16
  475. package/docs/examples/migrations/create-n-host-migration.md +0 -22
  476. package/docs/examples/migrations/create-supabase-migration.md +0 -21
  477. package/docs/examples/migrations/delete.md +0 -15
  478. package/docs/examples/migrations/get-appwrite-report.md +0 -18
  479. package/docs/examples/migrations/get-firebase-report.md +0 -16
  480. package/docs/examples/migrations/get-n-host-report.md +0 -22
  481. package/docs/examples/migrations/get-supabase-report.md +0 -21
  482. package/docs/examples/migrations/get.md +0 -15
  483. package/docs/examples/migrations/list.md +0 -17
  484. package/docs/examples/migrations/retry.md +0 -15
  485. package/docs/examples/organizations/add-credit.md +0 -16
  486. package/docs/examples/organizations/cancel-downgrade.md +0 -15
  487. package/docs/examples/organizations/create-downgrade-feedback.md +0 -19
  488. package/docs/examples/organizations/create-invoice-payment.md +0 -17
  489. package/docs/examples/organizations/create-key.md +0 -18
  490. package/docs/examples/organizations/create.md +0 -24
  491. package/docs/examples/organizations/delete-backup-payment-method.md +0 -15
  492. package/docs/examples/organizations/delete-billing-address.md +0 -15
  493. package/docs/examples/organizations/delete-default-payment-method.md +0 -15
  494. package/docs/examples/organizations/delete-key.md +0 -16
  495. package/docs/examples/organizations/delete.md +0 -15
  496. package/docs/examples/organizations/estimation-create-organization.md +0 -19
  497. package/docs/examples/organizations/estimation-delete-organization.md +0 -15
  498. package/docs/examples/organizations/estimation-update-plan.md +0 -18
  499. package/docs/examples/organizations/get-aggregation.md +0 -18
  500. package/docs/examples/organizations/get-available-credits.md +0 -15
  501. package/docs/examples/organizations/get-billing-address.md +0 -16
  502. package/docs/examples/organizations/get-credit.md +0 -16
  503. package/docs/examples/organizations/get-invoice-download.md +0 -16
  504. package/docs/examples/organizations/get-invoice-view.md +0 -16
  505. package/docs/examples/organizations/get-invoice.md +0 -16
  506. package/docs/examples/organizations/get-key.md +0 -16
  507. package/docs/examples/organizations/get-payment-method.md +0 -16
  508. package/docs/examples/organizations/get-plan.md +0 -15
  509. package/docs/examples/organizations/get-scopes.md +0 -16
  510. package/docs/examples/organizations/get-usage.md +0 -17
  511. package/docs/examples/organizations/list-aggregations.md +0 -16
  512. package/docs/examples/organizations/list-credits.md +0 -16
  513. package/docs/examples/organizations/list-invoices.md +0 -16
  514. package/docs/examples/organizations/list-keys.md +0 -16
  515. package/docs/examples/organizations/list-regions.md +0 -15
  516. package/docs/examples/organizations/list.md +0 -16
  517. package/docs/examples/organizations/set-backup-payment-method.md +0 -16
  518. package/docs/examples/organizations/set-billing-address.md +0 -16
  519. package/docs/examples/organizations/set-billing-email.md +0 -16
  520. package/docs/examples/organizations/set-billing-tax-id.md +0 -16
  521. package/docs/examples/organizations/set-default-payment-method.md +0 -16
  522. package/docs/examples/organizations/update-budget.md +0 -17
  523. package/docs/examples/organizations/update-key.md +0 -19
  524. package/docs/examples/organizations/update-plan.md +0 -22
  525. package/docs/examples/organizations/validate-invoice.md +0 -16
  526. package/docs/examples/organizations/validate-payment.md +0 -16
  527. package/docs/examples/project/create-variable.md +0 -18
  528. package/docs/examples/project/delete-variable.md +0 -15
  529. package/docs/examples/project/get-usage.md +0 -17
  530. package/docs/examples/project/get-variable.md +0 -15
  531. package/docs/examples/project/list-variables.md +0 -16
  532. package/docs/examples/project/update-variable.md +0 -18
  533. package/docs/examples/projects/create-dev-key.md +0 -17
  534. package/docs/examples/projects/create-jwt.md +0 -17
  535. package/docs/examples/projects/create-key.md +0 -19
  536. package/docs/examples/projects/create-platform.md +0 -20
  537. package/docs/examples/projects/create-schedule.md +0 -20
  538. package/docs/examples/projects/create-smtp-test.md +0 -24
  539. package/docs/examples/projects/create.md +0 -27
  540. package/docs/examples/projects/delete-dev-key.md +0 -16
  541. package/docs/examples/projects/delete-email-template.md +0 -17
  542. package/docs/examples/projects/delete-key.md +0 -16
  543. package/docs/examples/projects/delete-platform.md +0 -16
  544. package/docs/examples/projects/delete-sms-template.md +0 -17
  545. package/docs/examples/projects/delete.md +0 -15
  546. package/docs/examples/projects/get-dev-key.md +0 -16
  547. package/docs/examples/projects/get-email-template.md +0 -17
  548. package/docs/examples/projects/get-key.md +0 -16
  549. package/docs/examples/projects/get-platform.md +0 -16
  550. package/docs/examples/projects/get-schedule.md +0 -16
  551. package/docs/examples/projects/get-sms-template.md +0 -17
  552. package/docs/examples/projects/get.md +0 -15
  553. package/docs/examples/projects/list-dev-keys.md +0 -16
  554. package/docs/examples/projects/list-keys.md +0 -17
  555. package/docs/examples/projects/list-platforms.md +0 -16
  556. package/docs/examples/projects/list-schedules.md +0 -17
  557. package/docs/examples/projects/list.md +0 -17
  558. package/docs/examples/projects/update-api-status-all.md +0 -16
  559. package/docs/examples/projects/update-api-status.md +0 -17
  560. package/docs/examples/projects/update-auth-duration.md +0 -16
  561. package/docs/examples/projects/update-auth-limit.md +0 -16
  562. package/docs/examples/projects/update-auth-password-dictionary.md +0 -16
  563. package/docs/examples/projects/update-auth-password-history.md +0 -16
  564. package/docs/examples/projects/update-auth-sessions-limit.md +0 -16
  565. package/docs/examples/projects/update-auth-status.md +0 -17
  566. package/docs/examples/projects/update-console-access.md +0 -15
  567. package/docs/examples/projects/update-dev-key.md +0 -18
  568. package/docs/examples/projects/update-email-template.md +0 -22
  569. package/docs/examples/projects/update-key.md +0 -19
  570. package/docs/examples/projects/update-labels.md +0 -16
  571. package/docs/examples/projects/update-memberships-privacy.md +0 -18
  572. package/docs/examples/projects/update-mock-numbers.md +0 -16
  573. package/docs/examples/projects/update-o-auth-2.md +0 -19
  574. package/docs/examples/projects/update-personal-data-check.md +0 -16
  575. package/docs/examples/projects/update-platform.md +0 -20
  576. package/docs/examples/projects/update-service-status-all.md +0 -16
  577. package/docs/examples/projects/update-service-status.md +0 -17
  578. package/docs/examples/projects/update-session-alerts.md +0 -16
  579. package/docs/examples/projects/update-session-invalidation.md +0 -16
  580. package/docs/examples/projects/update-sms-template.md +0 -18
  581. package/docs/examples/projects/update-smtp.md +0 -24
  582. package/docs/examples/projects/update-status.md +0 -16
  583. package/docs/examples/projects/update-team.md +0 -16
  584. package/docs/examples/projects/update.md +0 -25
  585. package/docs/examples/proxy/create-api-rule.md +0 -15
  586. package/docs/examples/proxy/create-function-rule.md +0 -17
  587. package/docs/examples/proxy/create-redirect-rule.md +0 -19
  588. package/docs/examples/proxy/create-site-rule.md +0 -17
  589. package/docs/examples/proxy/delete-rule.md +0 -15
  590. package/docs/examples/proxy/get-rule.md +0 -15
  591. package/docs/examples/proxy/list-rules.md +0 -17
  592. package/docs/examples/proxy/update-rule-verification.md +0 -15
  593. package/docs/examples/sites/create-deployment.md +0 -20
  594. package/docs/examples/sites/create-duplicate-deployment.md +0 -16
  595. package/docs/examples/sites/create-template-deployment.md +0 -21
  596. package/docs/examples/sites/create-variable.md +0 -18
  597. package/docs/examples/sites/create-vcs-deployment.md +0 -18
  598. package/docs/examples/sites/create.md +0 -35
  599. package/docs/examples/sites/delete-deployment.md +0 -16
  600. package/docs/examples/sites/delete-log.md +0 -16
  601. package/docs/examples/sites/delete-variable.md +0 -16
  602. package/docs/examples/sites/delete.md +0 -15
  603. package/docs/examples/sites/get-deployment-download.md +0 -17
  604. package/docs/examples/sites/get-deployment.md +0 -16
  605. package/docs/examples/sites/get-log.md +0 -16
  606. package/docs/examples/sites/get-template.md +0 -15
  607. package/docs/examples/sites/get-usage.md +0 -16
  608. package/docs/examples/sites/get-variable.md +0 -16
  609. package/docs/examples/sites/get.md +0 -15
  610. package/docs/examples/sites/list-deployments.md +0 -18
  611. package/docs/examples/sites/list-frameworks.md +0 -13
  612. package/docs/examples/sites/list-logs.md +0 -17
  613. package/docs/examples/sites/list-specifications.md +0 -13
  614. package/docs/examples/sites/list-templates.md +0 -18
  615. package/docs/examples/sites/list-usage.md +0 -15
  616. package/docs/examples/sites/list-variables.md +0 -15
  617. package/docs/examples/sites/list.md +0 -17
  618. package/docs/examples/sites/update-deployment-status.md +0 -16
  619. package/docs/examples/sites/update-site-deployment.md +0 -16
  620. package/docs/examples/sites/update-variable.md +0 -19
  621. package/docs/examples/sites/update.md +0 -35
  622. package/docs/examples/storage/create-bucket.md +0 -25
  623. package/docs/examples/storage/create-file.md +0 -18
  624. package/docs/examples/storage/delete-bucket.md +0 -15
  625. package/docs/examples/storage/delete-file.md +0 -16
  626. package/docs/examples/storage/get-bucket-usage.md +0 -16
  627. package/docs/examples/storage/get-bucket.md +0 -15
  628. package/docs/examples/storage/get-file-download.md +0 -17
  629. package/docs/examples/storage/get-file-preview.md +0 -28
  630. package/docs/examples/storage/get-file-view.md +0 -17
  631. package/docs/examples/storage/get-file.md +0 -16
  632. package/docs/examples/storage/get-usage.md +0 -15
  633. package/docs/examples/storage/list-buckets.md +0 -17
  634. package/docs/examples/storage/list-files.md +0 -18
  635. package/docs/examples/storage/update-bucket.md +0 -25
  636. package/docs/examples/storage/update-file.md +0 -18
  637. package/docs/examples/tablesdb/create-boolean-column.md +0 -20
  638. package/docs/examples/tablesdb/create-datetime-column.md +0 -20
  639. package/docs/examples/tablesdb/create-email-column.md +0 -20
  640. package/docs/examples/tablesdb/create-enum-column.md +0 -21
  641. package/docs/examples/tablesdb/create-float-column.md +0 -22
  642. package/docs/examples/tablesdb/create-index.md +0 -21
  643. package/docs/examples/tablesdb/create-integer-column.md +0 -22
  644. package/docs/examples/tablesdb/create-ip-column.md +0 -20
  645. package/docs/examples/tablesdb/create-line-column.md +0 -19
  646. package/docs/examples/tablesdb/create-longtext-column.md +0 -21
  647. package/docs/examples/tablesdb/create-mediumtext-column.md +0 -21
  648. package/docs/examples/tablesdb/create-operations.md +0 -26
  649. package/docs/examples/tablesdb/create-point-column.md +0 -19
  650. package/docs/examples/tablesdb/create-polygon-column.md +0 -19
  651. package/docs/examples/tablesdb/create-relationship-column.md +0 -22
  652. package/docs/examples/tablesdb/create-row.md +0 -26
  653. package/docs/examples/tablesdb/create-rows.md +0 -18
  654. package/docs/examples/tablesdb/create-string-column.md +0 -22
  655. package/docs/examples/tablesdb/create-table.md +0 -22
  656. package/docs/examples/tablesdb/create-text-column.md +0 -21
  657. package/docs/examples/tablesdb/create-transaction.md +0 -15
  658. package/docs/examples/tablesdb/create-url-column.md +0 -20
  659. package/docs/examples/tablesdb/create-varchar-column.md +0 -22
  660. package/docs/examples/tablesdb/create.md +0 -17
  661. package/docs/examples/tablesdb/decrement-row-column.md +0 -21
  662. package/docs/examples/tablesdb/delete-column.md +0 -17
  663. package/docs/examples/tablesdb/delete-index.md +0 -17
  664. package/docs/examples/tablesdb/delete-row.md +0 -18
  665. package/docs/examples/tablesdb/delete-rows.md +0 -18
  666. package/docs/examples/tablesdb/delete-table.md +0 -16
  667. package/docs/examples/tablesdb/delete-transaction.md +0 -15
  668. package/docs/examples/tablesdb/delete.md +0 -15
  669. package/docs/examples/tablesdb/get-column.md +0 -17
  670. package/docs/examples/tablesdb/get-index.md +0 -17
  671. package/docs/examples/tablesdb/get-row.md +0 -19
  672. package/docs/examples/tablesdb/get-table-usage.md +0 -17
  673. package/docs/examples/tablesdb/get-table.md +0 -16
  674. package/docs/examples/tablesdb/get-transaction.md +0 -15
  675. package/docs/examples/tablesdb/get-usage.md +0 -16
  676. package/docs/examples/tablesdb/get.md +0 -15
  677. package/docs/examples/tablesdb/increment-row-column.md +0 -21
  678. package/docs/examples/tablesdb/list-columns.md +0 -18
  679. package/docs/examples/tablesdb/list-indexes.md +0 -18
  680. package/docs/examples/tablesdb/list-row-logs.md +0 -18
  681. package/docs/examples/tablesdb/list-rows.md +0 -20
  682. package/docs/examples/tablesdb/list-table-logs.md +0 -17
  683. package/docs/examples/tablesdb/list-tables.md +0 -18
  684. package/docs/examples/tablesdb/list-transactions.md +0 -15
  685. package/docs/examples/tablesdb/list-usage.md +0 -15
  686. package/docs/examples/tablesdb/list.md +0 -17
  687. package/docs/examples/tablesdb/update-boolean-column.md +0 -20
  688. package/docs/examples/tablesdb/update-datetime-column.md +0 -20
  689. package/docs/examples/tablesdb/update-email-column.md +0 -20
  690. package/docs/examples/tablesdb/update-enum-column.md +0 -21
  691. package/docs/examples/tablesdb/update-float-column.md +0 -22
  692. package/docs/examples/tablesdb/update-integer-column.md +0 -22
  693. package/docs/examples/tablesdb/update-ip-column.md +0 -20
  694. package/docs/examples/tablesdb/update-line-column.md +0 -20
  695. package/docs/examples/tablesdb/update-longtext-column.md +0 -20
  696. package/docs/examples/tablesdb/update-mediumtext-column.md +0 -20
  697. package/docs/examples/tablesdb/update-point-column.md +0 -20
  698. package/docs/examples/tablesdb/update-polygon-column.md +0 -20
  699. package/docs/examples/tablesdb/update-relationship-column.md +0 -19
  700. package/docs/examples/tablesdb/update-row.md +0 -26
  701. package/docs/examples/tablesdb/update-rows.md +0 -25
  702. package/docs/examples/tablesdb/update-string-column.md +0 -21
  703. package/docs/examples/tablesdb/update-table.md +0 -20
  704. package/docs/examples/tablesdb/update-text-column.md +0 -20
  705. package/docs/examples/tablesdb/update-transaction.md +0 -17
  706. package/docs/examples/tablesdb/update-url-column.md +0 -20
  707. package/docs/examples/tablesdb/update-varchar-column.md +0 -21
  708. package/docs/examples/tablesdb/update.md +0 -17
  709. package/docs/examples/tablesdb/upsert-row.md +0 -26
  710. package/docs/examples/tablesdb/upsert-rows.md +0 -18
  711. package/docs/examples/teams/create-membership.md +0 -21
  712. package/docs/examples/teams/create.md +0 -17
  713. package/docs/examples/teams/delete-membership.md +0 -16
  714. package/docs/examples/teams/delete.md +0 -15
  715. package/docs/examples/teams/get-membership.md +0 -16
  716. package/docs/examples/teams/get-prefs.md +0 -15
  717. package/docs/examples/teams/get.md +0 -15
  718. package/docs/examples/teams/list-logs.md +0 -17
  719. package/docs/examples/teams/list-memberships.md +0 -18
  720. package/docs/examples/teams/list.md +0 -17
  721. package/docs/examples/teams/update-membership-status.md +0 -18
  722. package/docs/examples/teams/update-membership.md +0 -17
  723. package/docs/examples/teams/update-name.md +0 -16
  724. package/docs/examples/teams/update-prefs.md +0 -16
  725. package/docs/examples/tokens/create-file-token.md +0 -17
  726. package/docs/examples/tokens/delete.md +0 -15
  727. package/docs/examples/tokens/get.md +0 -15
  728. package/docs/examples/tokens/list.md +0 -18
  729. package/docs/examples/tokens/update.md +0 -16
  730. package/docs/examples/users/create-argon-2-user.md +0 -18
  731. package/docs/examples/users/create-bcrypt-user.md +0 -18
  732. package/docs/examples/users/create-jwt.md +0 -17
  733. package/docs/examples/users/create-md-5-user.md +0 -18
  734. package/docs/examples/users/create-mfa-recovery-codes.md +0 -15
  735. package/docs/examples/users/create-ph-pass-user.md +0 -18
  736. package/docs/examples/users/create-scrypt-modified-user.md +0 -21
  737. package/docs/examples/users/create-scrypt-user.md +0 -23
  738. package/docs/examples/users/create-session.md +0 -15
  739. package/docs/examples/users/create-sha-user.md +0 -19
  740. package/docs/examples/users/create-target.md +0 -20
  741. package/docs/examples/users/create-token.md +0 -17
  742. package/docs/examples/users/create.md +0 -19
  743. package/docs/examples/users/delete-identity.md +0 -15
  744. package/docs/examples/users/delete-mfa-authenticator.md +0 -16
  745. package/docs/examples/users/delete-session.md +0 -16
  746. package/docs/examples/users/delete-sessions.md +0 -15
  747. package/docs/examples/users/delete-target.md +0 -16
  748. package/docs/examples/users/delete.md +0 -15
  749. package/docs/examples/users/get-mfa-recovery-codes.md +0 -15
  750. package/docs/examples/users/get-prefs.md +0 -15
  751. package/docs/examples/users/get-target.md +0 -16
  752. package/docs/examples/users/get-usage.md +0 -15
  753. package/docs/examples/users/get.md +0 -15
  754. package/docs/examples/users/list-identities.md +0 -17
  755. package/docs/examples/users/list-logs.md +0 -17
  756. package/docs/examples/users/list-memberships.md +0 -18
  757. package/docs/examples/users/list-mfa-factors.md +0 -15
  758. package/docs/examples/users/list-sessions.md +0 -16
  759. package/docs/examples/users/list-targets.md +0 -17
  760. package/docs/examples/users/list.md +0 -17
  761. package/docs/examples/users/update-email-verification.md +0 -16
  762. package/docs/examples/users/update-email.md +0 -16
  763. package/docs/examples/users/update-impersonator.md +0 -16
  764. package/docs/examples/users/update-labels.md +0 -16
  765. package/docs/examples/users/update-mfa-recovery-codes.md +0 -15
  766. package/docs/examples/users/update-mfa.md +0 -16
  767. package/docs/examples/users/update-name.md +0 -16
  768. package/docs/examples/users/update-password.md +0 -16
  769. package/docs/examples/users/update-phone-verification.md +0 -16
  770. package/docs/examples/users/update-phone.md +0 -16
  771. package/docs/examples/users/update-prefs.md +0 -16
  772. package/docs/examples/users/update-status.md +0 -16
  773. package/docs/examples/users/update-target.md +0 -19
  774. package/docs/examples/vcs/create-repository-detection.md +0 -18
  775. package/docs/examples/vcs/create-repository.md +0 -17
  776. package/docs/examples/vcs/delete-installation.md +0 -15
  777. package/docs/examples/vcs/get-installation.md +0 -15
  778. package/docs/examples/vcs/get-repository-contents.md +0 -18
  779. package/docs/examples/vcs/get-repository.md +0 -16
  780. package/docs/examples/vcs/list-installations.md +0 -17
  781. package/docs/examples/vcs/list-repositories.md +0 -18
  782. package/docs/examples/vcs/list-repository-branches.md +0 -16
  783. package/docs/examples/vcs/update-external-deployments.md +0 -17
  784. package/docs/examples/webhooks/create.md +0 -22
  785. package/docs/examples/webhooks/delete.md +0 -15
  786. package/docs/examples/webhooks/get.md +0 -15
  787. package/docs/examples/webhooks/list.md +0 -16
  788. package/docs/examples/webhooks/update-signature.md +0 -15
  789. package/docs/examples/webhooks/update.md +0 -22
  790. package/rollup.config.js +0 -44
  791. package/src/channel.ts +0 -158
  792. package/src/client.ts +0 -1085
  793. package/src/enums/adapter.ts +0 -4
  794. package/src/enums/api-service.ts +0 -15
  795. package/src/enums/api.ts +0 -5
  796. package/src/enums/appwrite-migration-resource.ts +0 -27
  797. package/src/enums/attribute-status.ts +0 -7
  798. package/src/enums/auth-method.ts +0 -9
  799. package/src/enums/authentication-factor.ts +0 -6
  800. package/src/enums/authenticator-type.ts +0 -3
  801. package/src/enums/backup-services.ts +0 -8
  802. package/src/enums/billing-plan-group.ts +0 -5
  803. package/src/enums/browser-permission.ts +0 -22
  804. package/src/enums/browser.ts +0 -16
  805. package/src/enums/build-runtime.ts +0 -88
  806. package/src/enums/column-status.ts +0 -7
  807. package/src/enums/compression.ts +0 -5
  808. package/src/enums/console-resource-type.ts +0 -3
  809. package/src/enums/credit-card.ts +0 -19
  810. package/src/enums/database-type.ts +0 -6
  811. package/src/enums/databases-index-type.ts +0 -6
  812. package/src/enums/deployment-download-type.ts +0 -4
  813. package/src/enums/deployment-status.ts +0 -8
  814. package/src/enums/domain-purchase-status.ts +0 -6
  815. package/src/enums/domain-transfer-status-enum.ts +0 -10
  816. package/src/enums/email-template-locale.ts +0 -133
  817. package/src/enums/email-template-type.ts +0 -9
  818. package/src/enums/execution-method.ts +0 -9
  819. package/src/enums/execution-status.ts +0 -7
  820. package/src/enums/execution-trigger.ts +0 -5
  821. package/src/enums/filter-type.ts +0 -4
  822. package/src/enums/firebase-migration-resource.ts +0 -12
  823. package/src/enums/flag.ts +0 -197
  824. package/src/enums/framework.ts +0 -17
  825. package/src/enums/frameworks.ts +0 -17
  826. package/src/enums/health-antivirus-status.ts +0 -5
  827. package/src/enums/health-check-status.ts +0 -4
  828. package/src/enums/image-format.ts +0 -9
  829. package/src/enums/image-gravity.ts +0 -11
  830. package/src/enums/index-status.ts +0 -7
  831. package/src/enums/message-priority.ts +0 -4
  832. package/src/enums/message-status.ts +0 -7
  833. package/src/enums/messaging-provider-type.ts +0 -5
  834. package/src/enums/n-host-migration-resource.ts +0 -13
  835. package/src/enums/name.ts +0 -15
  836. package/src/enums/o-auth-provider.ts +0 -41
  837. package/src/enums/order-by.ts +0 -4
  838. package/src/enums/password-hash.ts +0 -13
  839. package/src/enums/platform-type.ts +0 -17
  840. package/src/enums/platform.ts +0 -4
  841. package/src/enums/project-usage-range.ts +0 -4
  842. package/src/enums/proxy-resource-type.ts +0 -4
  843. package/src/enums/proxy-rule-deployment-resource-type.ts +0 -4
  844. package/src/enums/proxy-rule-status.ts +0 -6
  845. package/src/enums/region.ts +0 -8
  846. package/src/enums/registration-type.ts +0 -6
  847. package/src/enums/relation-mutate.ts +0 -5
  848. package/src/enums/relationship-type.ts +0 -6
  849. package/src/enums/resource-type.ts +0 -6
  850. package/src/enums/runtime.ts +0 -88
  851. package/src/enums/runtimes.ts +0 -88
  852. package/src/enums/scopes.ts +0 -81
  853. package/src/enums/sms-template-locale.ts +0 -133
  854. package/src/enums/sms-template-type.ts +0 -6
  855. package/src/enums/smtp-encryption.ts +0 -5
  856. package/src/enums/smtp-secure.ts +0 -4
  857. package/src/enums/status-code.ts +0 -6
  858. package/src/enums/status.ts +0 -3
  859. package/src/enums/supabase-migration-resource.ts +0 -13
  860. package/src/enums/tables-db-index-type.ts +0 -6
  861. package/src/enums/template-reference-type.ts +0 -5
  862. package/src/enums/theme.ts +0 -4
  863. package/src/enums/timezone.ts +0 -421
  864. package/src/enums/usage-range.ts +0 -5
  865. package/src/enums/use-cases.ts +0 -16
  866. package/src/enums/vcs-detection-type.ts +0 -4
  867. package/src/enums/vcs-reference-type.ts +0 -5
  868. package/src/id.ts +0 -47
  869. package/src/operator.ts +0 -308
  870. package/src/query.ts +0 -576
  871. package/src/service.ts +0 -30
  872. package/src/services/account.ts +0 -4293
  873. package/src/services/activities.ts +0 -116
  874. package/src/services/assistant.ts +0 -67
  875. package/src/services/backups.ts +0 -754
  876. package/src/services/console.ts +0 -678
  877. package/src/services/databases.ts +0 -6376
  878. package/src/services/domains.ts +0 -4064
  879. package/src/services/functions.ts +0 -2224
  880. package/src/services/graphql.ts +0 -124
  881. package/src/services/health.ts +0 -1296
  882. package/src/services/locale.ts +0 -198
  883. package/src/services/messaging.ts +0 -5194
  884. package/src/services/migrations.ts +0 -1207
  885. package/src/services/organizations.ts +0 -2742
  886. package/src/services/project.ts +0 -404
  887. package/src/services/projects.ts +0 -4431
  888. package/src/services/proxy.ts +0 -532
  889. package/src/services/realtime.ts +0 -537
  890. package/src/services/sites.ts +0 -2131
  891. package/src/services/storage.ts +0 -1196
  892. package/src/services/tables-db.ts +0 -6256
  893. package/src/services/teams.ts +0 -959
  894. package/src/services/tokens.ts +0 -315
  895. package/src/services/users.ts +0 -3324
  896. package/src/services/vcs.ts +0 -676
  897. package/src/services/webhooks.ts +0 -451
  898. package/tsconfig.json +0 -24
@@ -1,4293 +0,0 @@
1
- import { Service } from '../service';
2
- import { AppwriteException, Client, type Payload, UploadProgress } from '../client';
3
- import type { Models } from '../models';
4
-
5
- import { Scopes } from '../enums/scopes';
6
- import { AuthenticatorType } from '../enums/authenticator-type';
7
- import { AuthenticationFactor } from '../enums/authentication-factor';
8
- import { OAuthProvider } from '../enums/o-auth-provider';
9
-
10
- export class Account {
11
- client: Client;
12
-
13
- constructor(client: Client) {
14
- this.client = client;
15
- }
16
-
17
- /**
18
- * Get the currently logged in user.
19
- *
20
- * @throws {AppwriteException}
21
- * @returns {Promise<Models.User<Preferences>>}
22
- */
23
- get<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
24
-
25
- const apiPath = '/account';
26
- const payload: Payload = {};
27
- const uri = new URL(this.client.config.endpoint + apiPath);
28
-
29
- const apiHeaders: { [header: string]: string } = {
30
- }
31
-
32
- return this.client.call(
33
- 'get',
34
- uri,
35
- apiHeaders,
36
- payload
37
- );
38
- }
39
-
40
- /**
41
- * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
42
- *
43
- * @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
44
- * @param {string} params.email - User email.
45
- * @param {string} params.password - New user password. Must be between 8 and 256 chars.
46
- * @param {string} params.name - User name. Max length: 128 chars.
47
- * @throws {AppwriteException}
48
- * @returns {Promise<Models.User<Preferences>>}
49
- */
50
- create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>;
51
- /**
52
- * Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
53
- *
54
- * @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
55
- * @param {string} email - User email.
56
- * @param {string} password - New user password. Must be between 8 and 256 chars.
57
- * @param {string} name - User name. Max length: 128 chars.
58
- * @throws {AppwriteException}
59
- * @returns {Promise<Models.User<Preferences>>}
60
- * @deprecated Use the object parameter style method for a better developer experience.
61
- */
62
- create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
63
- create<Preferences extends Models.Preferences = Models.DefaultPreferences>(
64
- paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string,
65
- ...rest: [(string)?, (string)?, (string)?]
66
- ): Promise<Models.User<Preferences>> {
67
- let params: { userId: string, email: string, password: string, name?: string };
68
-
69
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
70
- params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string };
71
- } else {
72
- params = {
73
- userId: paramsOrFirst as string,
74
- email: rest[0] as string,
75
- password: rest[1] as string,
76
- name: rest[2] as string
77
- };
78
- }
79
-
80
- const userId = params.userId;
81
- const email = params.email;
82
- const password = params.password;
83
- const name = params.name;
84
-
85
- if (typeof userId === 'undefined') {
86
- throw new AppwriteException('Missing required parameter: "userId"');
87
- }
88
- if (typeof email === 'undefined') {
89
- throw new AppwriteException('Missing required parameter: "email"');
90
- }
91
- if (typeof password === 'undefined') {
92
- throw new AppwriteException('Missing required parameter: "password"');
93
- }
94
-
95
- const apiPath = '/account';
96
- const payload: Payload = {};
97
- if (typeof userId !== 'undefined') {
98
- payload['userId'] = userId;
99
- }
100
- if (typeof email !== 'undefined') {
101
- payload['email'] = email;
102
- }
103
- if (typeof password !== 'undefined') {
104
- payload['password'] = password;
105
- }
106
- if (typeof name !== 'undefined') {
107
- payload['name'] = name;
108
- }
109
- const uri = new URL(this.client.config.endpoint + apiPath);
110
-
111
- const apiHeaders: { [header: string]: string } = {
112
- 'content-type': 'application/json',
113
- }
114
-
115
- return this.client.call(
116
- 'post',
117
- uri,
118
- apiHeaders,
119
- payload
120
- );
121
- }
122
-
123
- /**
124
- * Delete the currently logged in user.
125
- *
126
- * @throws {AppwriteException}
127
- * @returns {Promise<{}>}
128
- */
129
- delete(): Promise<{}> {
130
-
131
- const apiPath = '/account';
132
- const payload: Payload = {};
133
- const uri = new URL(this.client.config.endpoint + apiPath);
134
-
135
- const apiHeaders: { [header: string]: string } = {
136
- 'content-type': 'application/json',
137
- }
138
-
139
- return this.client.call(
140
- 'delete',
141
- uri,
142
- apiHeaders,
143
- payload
144
- );
145
- }
146
-
147
- /**
148
- * List all billing addresses for a user.
149
- *
150
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
151
- * @throws {AppwriteException}
152
- * @returns {Promise<Models.BillingAddressList>}
153
- */
154
- listBillingAddresses(params?: { queries?: string[] }): Promise<Models.BillingAddressList>;
155
- /**
156
- * List all billing addresses for a user.
157
- *
158
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
159
- * @throws {AppwriteException}
160
- * @returns {Promise<Models.BillingAddressList>}
161
- * @deprecated Use the object parameter style method for a better developer experience.
162
- */
163
- listBillingAddresses(queries?: string[]): Promise<Models.BillingAddressList>;
164
- listBillingAddresses(
165
- paramsOrFirst?: { queries?: string[] } | string[]
166
- ): Promise<Models.BillingAddressList> {
167
- let params: { queries?: string[] };
168
-
169
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
170
- params = (paramsOrFirst || {}) as { queries?: string[] };
171
- } else {
172
- params = {
173
- queries: paramsOrFirst as string[]
174
- };
175
- }
176
-
177
- const queries = params.queries;
178
-
179
-
180
- const apiPath = '/account/billing-addresses';
181
- const payload: Payload = {};
182
- if (typeof queries !== 'undefined') {
183
- payload['queries'] = queries;
184
- }
185
- const uri = new URL(this.client.config.endpoint + apiPath);
186
-
187
- const apiHeaders: { [header: string]: string } = {
188
- }
189
-
190
- return this.client.call(
191
- 'get',
192
- uri,
193
- apiHeaders,
194
- payload
195
- );
196
- }
197
-
198
- /**
199
- * Add a new billing address to a user's account.
200
- *
201
- * @param {string} params.country - Country
202
- * @param {string} params.city - City
203
- * @param {string} params.streetAddress - Street address
204
- * @param {string} params.addressLine2 - Address line 2
205
- * @param {string} params.state - State or province
206
- * @param {string} params.postalCode - Postal code
207
- * @throws {AppwriteException}
208
- * @returns {Promise<Models.BillingAddress>}
209
- */
210
- createBillingAddress(params: { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string }): Promise<Models.BillingAddress>;
211
- /**
212
- * Add a new billing address to a user's account.
213
- *
214
- * @param {string} country - Country
215
- * @param {string} city - City
216
- * @param {string} streetAddress - Street address
217
- * @param {string} addressLine2 - Address line 2
218
- * @param {string} state - State or province
219
- * @param {string} postalCode - Postal code
220
- * @throws {AppwriteException}
221
- * @returns {Promise<Models.BillingAddress>}
222
- * @deprecated Use the object parameter style method for a better developer experience.
223
- */
224
- createBillingAddress(country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string): Promise<Models.BillingAddress>;
225
- createBillingAddress(
226
- paramsOrFirst: { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string } | string,
227
- ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?]
228
- ): Promise<Models.BillingAddress> {
229
- let params: { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
230
-
231
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
232
- params = (paramsOrFirst || {}) as { country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
233
- } else {
234
- params = {
235
- country: paramsOrFirst as string,
236
- city: rest[0] as string,
237
- streetAddress: rest[1] as string,
238
- addressLine2: rest[2] as string,
239
- state: rest[3] as string,
240
- postalCode: rest[4] as string
241
- };
242
- }
243
-
244
- const country = params.country;
245
- const city = params.city;
246
- const streetAddress = params.streetAddress;
247
- const addressLine2 = params.addressLine2;
248
- const state = params.state;
249
- const postalCode = params.postalCode;
250
-
251
- if (typeof country === 'undefined') {
252
- throw new AppwriteException('Missing required parameter: "country"');
253
- }
254
- if (typeof city === 'undefined') {
255
- throw new AppwriteException('Missing required parameter: "city"');
256
- }
257
- if (typeof streetAddress === 'undefined') {
258
- throw new AppwriteException('Missing required parameter: "streetAddress"');
259
- }
260
-
261
- const apiPath = '/account/billing-addresses';
262
- const payload: Payload = {};
263
- if (typeof country !== 'undefined') {
264
- payload['country'] = country;
265
- }
266
- if (typeof city !== 'undefined') {
267
- payload['city'] = city;
268
- }
269
- if (typeof streetAddress !== 'undefined') {
270
- payload['streetAddress'] = streetAddress;
271
- }
272
- if (typeof addressLine2 !== 'undefined') {
273
- payload['addressLine2'] = addressLine2;
274
- }
275
- if (typeof state !== 'undefined') {
276
- payload['state'] = state;
277
- }
278
- if (typeof postalCode !== 'undefined') {
279
- payload['postalCode'] = postalCode;
280
- }
281
- const uri = new URL(this.client.config.endpoint + apiPath);
282
-
283
- const apiHeaders: { [header: string]: string } = {
284
- 'content-type': 'application/json',
285
- }
286
-
287
- return this.client.call(
288
- 'post',
289
- uri,
290
- apiHeaders,
291
- payload
292
- );
293
- }
294
-
295
- /**
296
- * Get a specific billing address for a user using it's ID.
297
- *
298
- * @param {string} params.billingAddressId - Unique ID of billing address
299
- * @throws {AppwriteException}
300
- * @returns {Promise<Models.BillingAddress>}
301
- */
302
- getBillingAddress(params: { billingAddressId: string }): Promise<Models.BillingAddress>;
303
- /**
304
- * Get a specific billing address for a user using it's ID.
305
- *
306
- * @param {string} billingAddressId - Unique ID of billing address
307
- * @throws {AppwriteException}
308
- * @returns {Promise<Models.BillingAddress>}
309
- * @deprecated Use the object parameter style method for a better developer experience.
310
- */
311
- getBillingAddress(billingAddressId: string): Promise<Models.BillingAddress>;
312
- getBillingAddress(
313
- paramsOrFirst: { billingAddressId: string } | string
314
- ): Promise<Models.BillingAddress> {
315
- let params: { billingAddressId: string };
316
-
317
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
318
- params = (paramsOrFirst || {}) as { billingAddressId: string };
319
- } else {
320
- params = {
321
- billingAddressId: paramsOrFirst as string
322
- };
323
- }
324
-
325
- const billingAddressId = params.billingAddressId;
326
-
327
- if (typeof billingAddressId === 'undefined') {
328
- throw new AppwriteException('Missing required parameter: "billingAddressId"');
329
- }
330
-
331
- const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
332
- const payload: Payload = {};
333
- const uri = new URL(this.client.config.endpoint + apiPath);
334
-
335
- const apiHeaders: { [header: string]: string } = {
336
- }
337
-
338
- return this.client.call(
339
- 'get',
340
- uri,
341
- apiHeaders,
342
- payload
343
- );
344
- }
345
-
346
- /**
347
- * Update a specific billing address using it's ID.
348
- *
349
- * @param {string} params.billingAddressId - Unique ID of billing address
350
- * @param {string} params.country - Country
351
- * @param {string} params.city - City
352
- * @param {string} params.streetAddress - Street address
353
- * @param {string} params.addressLine2 - Address line 2
354
- * @param {string} params.state - State or province
355
- * @param {string} params.postalCode - Postal code
356
- * @throws {AppwriteException}
357
- * @returns {Promise<Models.BillingAddress>}
358
- */
359
- updateBillingAddress(params: { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string }): Promise<Models.BillingAddress>;
360
- /**
361
- * Update a specific billing address using it's ID.
362
- *
363
- * @param {string} billingAddressId - Unique ID of billing address
364
- * @param {string} country - Country
365
- * @param {string} city - City
366
- * @param {string} streetAddress - Street address
367
- * @param {string} addressLine2 - Address line 2
368
- * @param {string} state - State or province
369
- * @param {string} postalCode - Postal code
370
- * @throws {AppwriteException}
371
- * @returns {Promise<Models.BillingAddress>}
372
- * @deprecated Use the object parameter style method for a better developer experience.
373
- */
374
- updateBillingAddress(billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string): Promise<Models.BillingAddress>;
375
- updateBillingAddress(
376
- paramsOrFirst: { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string } | string,
377
- ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?]
378
- ): Promise<Models.BillingAddress> {
379
- let params: { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
380
-
381
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
382
- params = (paramsOrFirst || {}) as { billingAddressId: string, country: string, city: string, streetAddress: string, addressLine2?: string, state?: string, postalCode?: string };
383
- } else {
384
- params = {
385
- billingAddressId: paramsOrFirst as string,
386
- country: rest[0] as string,
387
- city: rest[1] as string,
388
- streetAddress: rest[2] as string,
389
- addressLine2: rest[3] as string,
390
- state: rest[4] as string,
391
- postalCode: rest[5] as string
392
- };
393
- }
394
-
395
- const billingAddressId = params.billingAddressId;
396
- const country = params.country;
397
- const city = params.city;
398
- const streetAddress = params.streetAddress;
399
- const addressLine2 = params.addressLine2;
400
- const state = params.state;
401
- const postalCode = params.postalCode;
402
-
403
- if (typeof billingAddressId === 'undefined') {
404
- throw new AppwriteException('Missing required parameter: "billingAddressId"');
405
- }
406
- if (typeof country === 'undefined') {
407
- throw new AppwriteException('Missing required parameter: "country"');
408
- }
409
- if (typeof city === 'undefined') {
410
- throw new AppwriteException('Missing required parameter: "city"');
411
- }
412
- if (typeof streetAddress === 'undefined') {
413
- throw new AppwriteException('Missing required parameter: "streetAddress"');
414
- }
415
-
416
- const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
417
- const payload: Payload = {};
418
- if (typeof country !== 'undefined') {
419
- payload['country'] = country;
420
- }
421
- if (typeof city !== 'undefined') {
422
- payload['city'] = city;
423
- }
424
- if (typeof streetAddress !== 'undefined') {
425
- payload['streetAddress'] = streetAddress;
426
- }
427
- if (typeof addressLine2 !== 'undefined') {
428
- payload['addressLine2'] = addressLine2;
429
- }
430
- if (typeof state !== 'undefined') {
431
- payload['state'] = state;
432
- }
433
- if (typeof postalCode !== 'undefined') {
434
- payload['postalCode'] = postalCode;
435
- }
436
- const uri = new URL(this.client.config.endpoint + apiPath);
437
-
438
- const apiHeaders: { [header: string]: string } = {
439
- 'content-type': 'application/json',
440
- }
441
-
442
- return this.client.call(
443
- 'put',
444
- uri,
445
- apiHeaders,
446
- payload
447
- );
448
- }
449
-
450
- /**
451
- * Delete a specific billing address using it's ID.
452
- *
453
- * @param {string} params.billingAddressId - Billing address unique ID
454
- * @throws {AppwriteException}
455
- * @returns {Promise<{}>}
456
- */
457
- deleteBillingAddress(params: { billingAddressId: string }): Promise<{}>;
458
- /**
459
- * Delete a specific billing address using it's ID.
460
- *
461
- * @param {string} billingAddressId - Billing address unique ID
462
- * @throws {AppwriteException}
463
- * @returns {Promise<{}>}
464
- * @deprecated Use the object parameter style method for a better developer experience.
465
- */
466
- deleteBillingAddress(billingAddressId: string): Promise<{}>;
467
- deleteBillingAddress(
468
- paramsOrFirst: { billingAddressId: string } | string
469
- ): Promise<{}> {
470
- let params: { billingAddressId: string };
471
-
472
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
473
- params = (paramsOrFirst || {}) as { billingAddressId: string };
474
- } else {
475
- params = {
476
- billingAddressId: paramsOrFirst as string
477
- };
478
- }
479
-
480
- const billingAddressId = params.billingAddressId;
481
-
482
- if (typeof billingAddressId === 'undefined') {
483
- throw new AppwriteException('Missing required parameter: "billingAddressId"');
484
- }
485
-
486
- const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId);
487
- const payload: Payload = {};
488
- const uri = new URL(this.client.config.endpoint + apiPath);
489
-
490
- const apiHeaders: { [header: string]: string } = {
491
- 'content-type': 'application/json',
492
- }
493
-
494
- return this.client.call(
495
- 'delete',
496
- uri,
497
- apiHeaders,
498
- payload
499
- );
500
- }
501
-
502
- /**
503
- * Get coupon details for an account.
504
- *
505
- * @param {string} params.couponId - ID of the coupon
506
- * @throws {AppwriteException}
507
- * @returns {Promise<Models.Coupon>}
508
- */
509
- getCoupon(params: { couponId: string }): Promise<Models.Coupon>;
510
- /**
511
- * Get coupon details for an account.
512
- *
513
- * @param {string} couponId - ID of the coupon
514
- * @throws {AppwriteException}
515
- * @returns {Promise<Models.Coupon>}
516
- * @deprecated Use the object parameter style method for a better developer experience.
517
- */
518
- getCoupon(couponId: string): Promise<Models.Coupon>;
519
- getCoupon(
520
- paramsOrFirst: { couponId: string } | string
521
- ): Promise<Models.Coupon> {
522
- let params: { couponId: string };
523
-
524
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
525
- params = (paramsOrFirst || {}) as { couponId: string };
526
- } else {
527
- params = {
528
- couponId: paramsOrFirst as string
529
- };
530
- }
531
-
532
- const couponId = params.couponId;
533
-
534
- if (typeof couponId === 'undefined') {
535
- throw new AppwriteException('Missing required parameter: "couponId"');
536
- }
537
-
538
- const apiPath = '/account/coupons/{couponId}'.replace('{couponId}', couponId);
539
- const payload: Payload = {};
540
- const uri = new URL(this.client.config.endpoint + apiPath);
541
-
542
- const apiHeaders: { [header: string]: string } = {
543
- }
544
-
545
- return this.client.call(
546
- 'get',
547
- uri,
548
- apiHeaders,
549
- payload
550
- );
551
- }
552
-
553
- /**
554
- * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
555
- * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
556
- *
557
- *
558
- * @param {string} params.email - User email.
559
- * @param {string} params.password - User password. Must be at least 8 chars.
560
- * @throws {AppwriteException}
561
- * @returns {Promise<Models.User<Preferences>>}
562
- */
563
- updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { email: string, password: string }): Promise<Models.User<Preferences>>;
564
- /**
565
- * Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request.
566
- * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
567
- *
568
- *
569
- * @param {string} email - User email.
570
- * @param {string} password - User password. Must be at least 8 chars.
571
- * @throws {AppwriteException}
572
- * @returns {Promise<Models.User<Preferences>>}
573
- * @deprecated Use the object parameter style method for a better developer experience.
574
- */
575
- updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>>;
576
- updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(
577
- paramsOrFirst: { email: string, password: string } | string,
578
- ...rest: [(string)?]
579
- ): Promise<Models.User<Preferences>> {
580
- let params: { email: string, password: string };
581
-
582
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
583
- params = (paramsOrFirst || {}) as { email: string, password: string };
584
- } else {
585
- params = {
586
- email: paramsOrFirst as string,
587
- password: rest[0] as string
588
- };
589
- }
590
-
591
- const email = params.email;
592
- const password = params.password;
593
-
594
- if (typeof email === 'undefined') {
595
- throw new AppwriteException('Missing required parameter: "email"');
596
- }
597
- if (typeof password === 'undefined') {
598
- throw new AppwriteException('Missing required parameter: "password"');
599
- }
600
-
601
- const apiPath = '/account/email';
602
- const payload: Payload = {};
603
- if (typeof email !== 'undefined') {
604
- payload['email'] = email;
605
- }
606
- if (typeof password !== 'undefined') {
607
- payload['password'] = password;
608
- }
609
- const uri = new URL(this.client.config.endpoint + apiPath);
610
-
611
- const apiHeaders: { [header: string]: string } = {
612
- 'content-type': 'application/json',
613
- }
614
-
615
- return this.client.call(
616
- 'patch',
617
- uri,
618
- apiHeaders,
619
- payload
620
- );
621
- }
622
-
623
- /**
624
- * Get the list of identities for the currently logged in user.
625
- *
626
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
627
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
628
- * @throws {AppwriteException}
629
- * @returns {Promise<Models.IdentityList>}
630
- */
631
- listIdentities(params?: { queries?: string[], total?: boolean }): Promise<Models.IdentityList>;
632
- /**
633
- * Get the list of identities for the currently logged in user.
634
- *
635
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
636
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
637
- * @throws {AppwriteException}
638
- * @returns {Promise<Models.IdentityList>}
639
- * @deprecated Use the object parameter style method for a better developer experience.
640
- */
641
- listIdentities(queries?: string[], total?: boolean): Promise<Models.IdentityList>;
642
- listIdentities(
643
- paramsOrFirst?: { queries?: string[], total?: boolean } | string[],
644
- ...rest: [(boolean)?]
645
- ): Promise<Models.IdentityList> {
646
- let params: { queries?: string[], total?: boolean };
647
-
648
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
649
- params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean };
650
- } else {
651
- params = {
652
- queries: paramsOrFirst as string[],
653
- total: rest[0] as boolean
654
- };
655
- }
656
-
657
- const queries = params.queries;
658
- const total = params.total;
659
-
660
-
661
- const apiPath = '/account/identities';
662
- const payload: Payload = {};
663
- if (typeof queries !== 'undefined') {
664
- payload['queries'] = queries;
665
- }
666
- if (typeof total !== 'undefined') {
667
- payload['total'] = total;
668
- }
669
- const uri = new URL(this.client.config.endpoint + apiPath);
670
-
671
- const apiHeaders: { [header: string]: string } = {
672
- }
673
-
674
- return this.client.call(
675
- 'get',
676
- uri,
677
- apiHeaders,
678
- payload
679
- );
680
- }
681
-
682
- /**
683
- * Delete an identity by its unique ID.
684
- *
685
- * @param {string} params.identityId - Identity ID.
686
- * @throws {AppwriteException}
687
- * @returns {Promise<{}>}
688
- */
689
- deleteIdentity(params: { identityId: string }): Promise<{}>;
690
- /**
691
- * Delete an identity by its unique ID.
692
- *
693
- * @param {string} identityId - Identity ID.
694
- * @throws {AppwriteException}
695
- * @returns {Promise<{}>}
696
- * @deprecated Use the object parameter style method for a better developer experience.
697
- */
698
- deleteIdentity(identityId: string): Promise<{}>;
699
- deleteIdentity(
700
- paramsOrFirst: { identityId: string } | string
701
- ): Promise<{}> {
702
- let params: { identityId: string };
703
-
704
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
705
- params = (paramsOrFirst || {}) as { identityId: string };
706
- } else {
707
- params = {
708
- identityId: paramsOrFirst as string
709
- };
710
- }
711
-
712
- const identityId = params.identityId;
713
-
714
- if (typeof identityId === 'undefined') {
715
- throw new AppwriteException('Missing required parameter: "identityId"');
716
- }
717
-
718
- const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
719
- const payload: Payload = {};
720
- const uri = new URL(this.client.config.endpoint + apiPath);
721
-
722
- const apiHeaders: { [header: string]: string } = {
723
- 'content-type': 'application/json',
724
- }
725
-
726
- return this.client.call(
727
- 'delete',
728
- uri,
729
- apiHeaders,
730
- payload
731
- );
732
- }
733
-
734
- /**
735
- * List all invoices tied to an account.
736
- *
737
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, type, amount, currency, from, to, dueAt, attempts, status, grossAmount
738
- * @throws {AppwriteException}
739
- * @returns {Promise<Models.InvoiceList>}
740
- */
741
- listInvoices(params?: { queries?: string[] }): Promise<Models.InvoiceList>;
742
- /**
743
- * List all invoices tied to an account.
744
- *
745
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, type, amount, currency, from, to, dueAt, attempts, status, grossAmount
746
- * @throws {AppwriteException}
747
- * @returns {Promise<Models.InvoiceList>}
748
- * @deprecated Use the object parameter style method for a better developer experience.
749
- */
750
- listInvoices(queries?: string[]): Promise<Models.InvoiceList>;
751
- listInvoices(
752
- paramsOrFirst?: { queries?: string[] } | string[]
753
- ): Promise<Models.InvoiceList> {
754
- let params: { queries?: string[] };
755
-
756
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
757
- params = (paramsOrFirst || {}) as { queries?: string[] };
758
- } else {
759
- params = {
760
- queries: paramsOrFirst as string[]
761
- };
762
- }
763
-
764
- const queries = params.queries;
765
-
766
-
767
- const apiPath = '/account/invoices';
768
- const payload: Payload = {};
769
- if (typeof queries !== 'undefined') {
770
- payload['queries'] = queries;
771
- }
772
- const uri = new URL(this.client.config.endpoint + apiPath);
773
-
774
- const apiHeaders: { [header: string]: string } = {
775
- }
776
-
777
- return this.client.call(
778
- 'get',
779
- uri,
780
- apiHeaders,
781
- payload
782
- );
783
- }
784
-
785
- /**
786
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
787
- *
788
- * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
789
- * @throws {AppwriteException}
790
- * @returns {Promise<Models.Jwt>}
791
- */
792
- createJWT(params?: { duration?: number }): Promise<Models.Jwt>;
793
- /**
794
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
795
- *
796
- * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
797
- * @throws {AppwriteException}
798
- * @returns {Promise<Models.Jwt>}
799
- * @deprecated Use the object parameter style method for a better developer experience.
800
- */
801
- createJWT(duration?: number): Promise<Models.Jwt>;
802
- createJWT(
803
- paramsOrFirst?: { duration?: number } | number
804
- ): Promise<Models.Jwt> {
805
- let params: { duration?: number };
806
-
807
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
808
- params = (paramsOrFirst || {}) as { duration?: number };
809
- } else {
810
- params = {
811
- duration: paramsOrFirst as number
812
- };
813
- }
814
-
815
- const duration = params.duration;
816
-
817
-
818
- const apiPath = '/account/jwts';
819
- const payload: Payload = {};
820
- if (typeof duration !== 'undefined') {
821
- payload['duration'] = duration;
822
- }
823
- const uri = new URL(this.client.config.endpoint + apiPath);
824
-
825
- const apiHeaders: { [header: string]: string } = {
826
- 'content-type': 'application/json',
827
- }
828
-
829
- return this.client.call(
830
- 'post',
831
- uri,
832
- apiHeaders,
833
- payload
834
- );
835
- }
836
-
837
- /**
838
- * Get a list of all API keys from the current account.
839
- *
840
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
841
- * @throws {AppwriteException}
842
- * @returns {Promise<Models.KeyList>}
843
- */
844
- listKeys(params?: { total?: boolean }): Promise<Models.KeyList>;
845
- /**
846
- * Get a list of all API keys from the current account.
847
- *
848
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
849
- * @throws {AppwriteException}
850
- * @returns {Promise<Models.KeyList>}
851
- * @deprecated Use the object parameter style method for a better developer experience.
852
- */
853
- listKeys(total?: boolean): Promise<Models.KeyList>;
854
- listKeys(
855
- paramsOrFirst?: { total?: boolean } | boolean
856
- ): Promise<Models.KeyList> {
857
- let params: { total?: boolean };
858
-
859
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
860
- params = (paramsOrFirst || {}) as { total?: boolean };
861
- } else {
862
- params = {
863
- total: paramsOrFirst as boolean
864
- };
865
- }
866
-
867
- const total = params.total;
868
-
869
-
870
- const apiPath = '/account/keys';
871
- const payload: Payload = {};
872
- if (typeof total !== 'undefined') {
873
- payload['total'] = total;
874
- }
875
- const uri = new URL(this.client.config.endpoint + apiPath);
876
-
877
- const apiHeaders: { [header: string]: string } = {
878
- }
879
-
880
- return this.client.call(
881
- 'get',
882
- uri,
883
- apiHeaders,
884
- payload
885
- );
886
- }
887
-
888
- /**
889
- * Create a new account API key.
890
- *
891
- * @param {string} params.name - Key name. Max length: 128 chars.
892
- * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed.
893
- * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
894
- * @throws {AppwriteException}
895
- * @returns {Promise<Models.Key>}
896
- */
897
- createKey(params: { name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>;
898
- /**
899
- * Create a new account API key.
900
- *
901
- * @param {string} name - Key name. Max length: 128 chars.
902
- * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed.
903
- * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
904
- * @throws {AppwriteException}
905
- * @returns {Promise<Models.Key>}
906
- * @deprecated Use the object parameter style method for a better developer experience.
907
- */
908
- createKey(name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>;
909
- createKey(
910
- paramsOrFirst: { name: string, scopes: Scopes[], expire?: string } | string,
911
- ...rest: [(Scopes[])?, (string)?]
912
- ): Promise<Models.Key> {
913
- let params: { name: string, scopes: Scopes[], expire?: string };
914
-
915
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
916
- params = (paramsOrFirst || {}) as { name: string, scopes: Scopes[], expire?: string };
917
- } else {
918
- params = {
919
- name: paramsOrFirst as string,
920
- scopes: rest[0] as Scopes[],
921
- expire: rest[1] as string
922
- };
923
- }
924
-
925
- const name = params.name;
926
- const scopes = params.scopes;
927
- const expire = params.expire;
928
-
929
- if (typeof name === 'undefined') {
930
- throw new AppwriteException('Missing required parameter: "name"');
931
- }
932
- if (typeof scopes === 'undefined') {
933
- throw new AppwriteException('Missing required parameter: "scopes"');
934
- }
935
-
936
- const apiPath = '/account/keys';
937
- const payload: Payload = {};
938
- if (typeof name !== 'undefined') {
939
- payload['name'] = name;
940
- }
941
- if (typeof scopes !== 'undefined') {
942
- payload['scopes'] = scopes;
943
- }
944
- if (typeof expire !== 'undefined') {
945
- payload['expire'] = expire;
946
- }
947
- const uri = new URL(this.client.config.endpoint + apiPath);
948
-
949
- const apiHeaders: { [header: string]: string } = {
950
- 'content-type': 'application/json',
951
- }
952
-
953
- return this.client.call(
954
- 'post',
955
- uri,
956
- apiHeaders,
957
- payload
958
- );
959
- }
960
-
961
- /**
962
- * Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes.
963
- *
964
- * @param {string} params.keyId - Key unique ID.
965
- * @throws {AppwriteException}
966
- * @returns {Promise<Models.Key>}
967
- */
968
- getKey(params: { keyId: string }): Promise<Models.Key>;
969
- /**
970
- * Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes.
971
- *
972
- * @param {string} keyId - Key unique ID.
973
- * @throws {AppwriteException}
974
- * @returns {Promise<Models.Key>}
975
- * @deprecated Use the object parameter style method for a better developer experience.
976
- */
977
- getKey(keyId: string): Promise<Models.Key>;
978
- getKey(
979
- paramsOrFirst: { keyId: string } | string
980
- ): Promise<Models.Key> {
981
- let params: { keyId: string };
982
-
983
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
984
- params = (paramsOrFirst || {}) as { keyId: string };
985
- } else {
986
- params = {
987
- keyId: paramsOrFirst as string
988
- };
989
- }
990
-
991
- const keyId = params.keyId;
992
-
993
- if (typeof keyId === 'undefined') {
994
- throw new AppwriteException('Missing required parameter: "keyId"');
995
- }
996
-
997
- const apiPath = '/account/keys/{keyId}'.replace('{keyId}', keyId);
998
- const payload: Payload = {};
999
- const uri = new URL(this.client.config.endpoint + apiPath);
1000
-
1001
- const apiHeaders: { [header: string]: string } = {
1002
- }
1003
-
1004
- return this.client.call(
1005
- 'get',
1006
- uri,
1007
- apiHeaders,
1008
- payload
1009
- );
1010
- }
1011
-
1012
- /**
1013
- * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.
1014
- *
1015
- * @param {string} params.keyId - Key unique ID.
1016
- * @param {string} params.name - Key name. Max length: 128 chars.
1017
- * @param {Scopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed.
1018
- * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
1019
- * @throws {AppwriteException}
1020
- * @returns {Promise<Models.Key>}
1021
- */
1022
- updateKey(params: { keyId: string, name: string, scopes: Scopes[], expire?: string }): Promise<Models.Key>;
1023
- /**
1024
- * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.
1025
- *
1026
- * @param {string} keyId - Key unique ID.
1027
- * @param {string} name - Key name. Max length: 128 chars.
1028
- * @param {Scopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed.
1029
- * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
1030
- * @throws {AppwriteException}
1031
- * @returns {Promise<Models.Key>}
1032
- * @deprecated Use the object parameter style method for a better developer experience.
1033
- */
1034
- updateKey(keyId: string, name: string, scopes: Scopes[], expire?: string): Promise<Models.Key>;
1035
- updateKey(
1036
- paramsOrFirst: { keyId: string, name: string, scopes: Scopes[], expire?: string } | string,
1037
- ...rest: [(string)?, (Scopes[])?, (string)?]
1038
- ): Promise<Models.Key> {
1039
- let params: { keyId: string, name: string, scopes: Scopes[], expire?: string };
1040
-
1041
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1042
- params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: Scopes[], expire?: string };
1043
- } else {
1044
- params = {
1045
- keyId: paramsOrFirst as string,
1046
- name: rest[0] as string,
1047
- scopes: rest[1] as Scopes[],
1048
- expire: rest[2] as string
1049
- };
1050
- }
1051
-
1052
- const keyId = params.keyId;
1053
- const name = params.name;
1054
- const scopes = params.scopes;
1055
- const expire = params.expire;
1056
-
1057
- if (typeof keyId === 'undefined') {
1058
- throw new AppwriteException('Missing required parameter: "keyId"');
1059
- }
1060
- if (typeof name === 'undefined') {
1061
- throw new AppwriteException('Missing required parameter: "name"');
1062
- }
1063
- if (typeof scopes === 'undefined') {
1064
- throw new AppwriteException('Missing required parameter: "scopes"');
1065
- }
1066
-
1067
- const apiPath = '/account/keys/{keyId}'.replace('{keyId}', keyId);
1068
- const payload: Payload = {};
1069
- if (typeof name !== 'undefined') {
1070
- payload['name'] = name;
1071
- }
1072
- if (typeof scopes !== 'undefined') {
1073
- payload['scopes'] = scopes;
1074
- }
1075
- if (typeof expire !== 'undefined') {
1076
- payload['expire'] = expire;
1077
- }
1078
- const uri = new URL(this.client.config.endpoint + apiPath);
1079
-
1080
- const apiHeaders: { [header: string]: string } = {
1081
- 'content-type': 'application/json',
1082
- }
1083
-
1084
- return this.client.call(
1085
- 'put',
1086
- uri,
1087
- apiHeaders,
1088
- payload
1089
- );
1090
- }
1091
-
1092
- /**
1093
- * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.
1094
- *
1095
- * @param {string} params.keyId - Key unique ID.
1096
- * @throws {AppwriteException}
1097
- * @returns {Promise<{}>}
1098
- */
1099
- deleteKey(params: { keyId: string }): Promise<{}>;
1100
- /**
1101
- * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.
1102
- *
1103
- * @param {string} keyId - Key unique ID.
1104
- * @throws {AppwriteException}
1105
- * @returns {Promise<{}>}
1106
- * @deprecated Use the object parameter style method for a better developer experience.
1107
- */
1108
- deleteKey(keyId: string): Promise<{}>;
1109
- deleteKey(
1110
- paramsOrFirst: { keyId: string } | string
1111
- ): Promise<{}> {
1112
- let params: { keyId: string };
1113
-
1114
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1115
- params = (paramsOrFirst || {}) as { keyId: string };
1116
- } else {
1117
- params = {
1118
- keyId: paramsOrFirst as string
1119
- };
1120
- }
1121
-
1122
- const keyId = params.keyId;
1123
-
1124
- if (typeof keyId === 'undefined') {
1125
- throw new AppwriteException('Missing required parameter: "keyId"');
1126
- }
1127
-
1128
- const apiPath = '/account/keys/{keyId}'.replace('{keyId}', keyId);
1129
- const payload: Payload = {};
1130
- const uri = new URL(this.client.config.endpoint + apiPath);
1131
-
1132
- const apiHeaders: { [header: string]: string } = {
1133
- 'content-type': 'application/json',
1134
- }
1135
-
1136
- return this.client.call(
1137
- 'delete',
1138
- uri,
1139
- apiHeaders,
1140
- payload
1141
- );
1142
- }
1143
-
1144
- /**
1145
- * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
1146
- *
1147
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1148
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
1149
- * @throws {AppwriteException}
1150
- * @returns {Promise<Models.LogList>}
1151
- */
1152
- listLogs(params?: { queries?: string[], total?: boolean }): Promise<Models.LogList>;
1153
- /**
1154
- * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
1155
- *
1156
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1157
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
1158
- * @throws {AppwriteException}
1159
- * @returns {Promise<Models.LogList>}
1160
- * @deprecated Use the object parameter style method for a better developer experience.
1161
- */
1162
- listLogs(queries?: string[], total?: boolean): Promise<Models.LogList>;
1163
- listLogs(
1164
- paramsOrFirst?: { queries?: string[], total?: boolean } | string[],
1165
- ...rest: [(boolean)?]
1166
- ): Promise<Models.LogList> {
1167
- let params: { queries?: string[], total?: boolean };
1168
-
1169
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1170
- params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean };
1171
- } else {
1172
- params = {
1173
- queries: paramsOrFirst as string[],
1174
- total: rest[0] as boolean
1175
- };
1176
- }
1177
-
1178
- const queries = params.queries;
1179
- const total = params.total;
1180
-
1181
-
1182
- const apiPath = '/account/logs';
1183
- const payload: Payload = {};
1184
- if (typeof queries !== 'undefined') {
1185
- payload['queries'] = queries;
1186
- }
1187
- if (typeof total !== 'undefined') {
1188
- payload['total'] = total;
1189
- }
1190
- const uri = new URL(this.client.config.endpoint + apiPath);
1191
-
1192
- const apiHeaders: { [header: string]: string } = {
1193
- }
1194
-
1195
- return this.client.call(
1196
- 'get',
1197
- uri,
1198
- apiHeaders,
1199
- payload
1200
- );
1201
- }
1202
-
1203
- /**
1204
- * Enable or disable MFA on an account.
1205
- *
1206
- * @param {boolean} params.mfa - Enable or disable MFA.
1207
- * @throws {AppwriteException}
1208
- * @returns {Promise<Models.User<Preferences>>}
1209
- */
1210
- updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { mfa: boolean }): Promise<Models.User<Preferences>>;
1211
- /**
1212
- * Enable or disable MFA on an account.
1213
- *
1214
- * @param {boolean} mfa - Enable or disable MFA.
1215
- * @throws {AppwriteException}
1216
- * @returns {Promise<Models.User<Preferences>>}
1217
- * @deprecated Use the object parameter style method for a better developer experience.
1218
- */
1219
- updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>>;
1220
- updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(
1221
- paramsOrFirst: { mfa: boolean } | boolean
1222
- ): Promise<Models.User<Preferences>> {
1223
- let params: { mfa: boolean };
1224
-
1225
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1226
- params = (paramsOrFirst || {}) as { mfa: boolean };
1227
- } else {
1228
- params = {
1229
- mfa: paramsOrFirst as boolean
1230
- };
1231
- }
1232
-
1233
- const mfa = params.mfa;
1234
-
1235
- if (typeof mfa === 'undefined') {
1236
- throw new AppwriteException('Missing required parameter: "mfa"');
1237
- }
1238
-
1239
- const apiPath = '/account/mfa';
1240
- const payload: Payload = {};
1241
- if (typeof mfa !== 'undefined') {
1242
- payload['mfa'] = mfa;
1243
- }
1244
- const uri = new URL(this.client.config.endpoint + apiPath);
1245
-
1246
- const apiHeaders: { [header: string]: string } = {
1247
- 'content-type': 'application/json',
1248
- }
1249
-
1250
- return this.client.call(
1251
- 'patch',
1252
- uri,
1253
- apiHeaders,
1254
- payload
1255
- );
1256
- }
1257
-
1258
- /**
1259
- * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
1260
- *
1261
- * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
1262
- * @throws {AppwriteException}
1263
- * @returns {Promise<Models.MfaType>}
1264
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.
1265
- */
1266
- createMfaAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>;
1267
- /**
1268
- * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
1269
- *
1270
- * @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
1271
- * @throws {AppwriteException}
1272
- * @returns {Promise<Models.MfaType>}
1273
- * @deprecated Use the object parameter style method for a better developer experience.
1274
- */
1275
- createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
1276
- createMfaAuthenticator(
1277
- paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
1278
- ): Promise<Models.MfaType> {
1279
- let params: { type: AuthenticatorType };
1280
-
1281
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1282
- params = (paramsOrFirst || {}) as { type: AuthenticatorType };
1283
- } else {
1284
- params = {
1285
- type: paramsOrFirst as AuthenticatorType
1286
- };
1287
- }
1288
-
1289
- const type = params.type;
1290
-
1291
- if (typeof type === 'undefined') {
1292
- throw new AppwriteException('Missing required parameter: "type"');
1293
- }
1294
-
1295
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
1296
- const payload: Payload = {};
1297
- const uri = new URL(this.client.config.endpoint + apiPath);
1298
-
1299
- const apiHeaders: { [header: string]: string } = {
1300
- 'content-type': 'application/json',
1301
- }
1302
-
1303
- return this.client.call(
1304
- 'post',
1305
- uri,
1306
- apiHeaders,
1307
- payload
1308
- );
1309
- }
1310
-
1311
- /**
1312
- * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
1313
- *
1314
- * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
1315
- * @throws {AppwriteException}
1316
- * @returns {Promise<Models.MfaType>}
1317
- */
1318
- createMFAAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>;
1319
- /**
1320
- * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
1321
- *
1322
- * @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
1323
- * @throws {AppwriteException}
1324
- * @returns {Promise<Models.MfaType>}
1325
- * @deprecated Use the object parameter style method for a better developer experience.
1326
- */
1327
- createMFAAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
1328
- createMFAAuthenticator(
1329
- paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
1330
- ): Promise<Models.MfaType> {
1331
- let params: { type: AuthenticatorType };
1332
-
1333
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1334
- params = (paramsOrFirst || {}) as { type: AuthenticatorType };
1335
- } else {
1336
- params = {
1337
- type: paramsOrFirst as AuthenticatorType
1338
- };
1339
- }
1340
-
1341
- const type = params.type;
1342
-
1343
- if (typeof type === 'undefined') {
1344
- throw new AppwriteException('Missing required parameter: "type"');
1345
- }
1346
-
1347
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
1348
- const payload: Payload = {};
1349
- const uri = new URL(this.client.config.endpoint + apiPath);
1350
-
1351
- const apiHeaders: { [header: string]: string } = {
1352
- 'content-type': 'application/json',
1353
- }
1354
-
1355
- return this.client.call(
1356
- 'post',
1357
- uri,
1358
- apiHeaders,
1359
- payload
1360
- );
1361
- }
1362
-
1363
- /**
1364
- * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
1365
- *
1366
- * @param {AuthenticatorType} params.type - Type of authenticator.
1367
- * @param {string} params.otp - Valid verification token.
1368
- * @throws {AppwriteException}
1369
- * @returns {Promise<Models.User<Preferences>>}
1370
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.
1371
- */
1372
- updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>;
1373
- /**
1374
- * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
1375
- *
1376
- * @param {AuthenticatorType} type - Type of authenticator.
1377
- * @param {string} otp - Valid verification token.
1378
- * @throws {AppwriteException}
1379
- * @returns {Promise<Models.User<Preferences>>}
1380
- * @deprecated Use the object parameter style method for a better developer experience.
1381
- */
1382
- updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
1383
- updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(
1384
- paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType,
1385
- ...rest: [(string)?]
1386
- ): Promise<Models.User<Preferences>> {
1387
- let params: { type: AuthenticatorType, otp: string };
1388
-
1389
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) {
1390
- params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string };
1391
- } else {
1392
- params = {
1393
- type: paramsOrFirst as AuthenticatorType,
1394
- otp: rest[0] as string
1395
- };
1396
- }
1397
-
1398
- const type = params.type;
1399
- const otp = params.otp;
1400
-
1401
- if (typeof type === 'undefined') {
1402
- throw new AppwriteException('Missing required parameter: "type"');
1403
- }
1404
- if (typeof otp === 'undefined') {
1405
- throw new AppwriteException('Missing required parameter: "otp"');
1406
- }
1407
-
1408
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
1409
- const payload: Payload = {};
1410
- if (typeof otp !== 'undefined') {
1411
- payload['otp'] = otp;
1412
- }
1413
- const uri = new URL(this.client.config.endpoint + apiPath);
1414
-
1415
- const apiHeaders: { [header: string]: string } = {
1416
- 'content-type': 'application/json',
1417
- }
1418
-
1419
- return this.client.call(
1420
- 'put',
1421
- uri,
1422
- apiHeaders,
1423
- payload
1424
- );
1425
- }
1426
-
1427
- /**
1428
- * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
1429
- *
1430
- * @param {AuthenticatorType} params.type - Type of authenticator.
1431
- * @param {string} params.otp - Valid verification token.
1432
- * @throws {AppwriteException}
1433
- * @returns {Promise<Models.User<Preferences>>}
1434
- */
1435
- updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>;
1436
- /**
1437
- * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
1438
- *
1439
- * @param {AuthenticatorType} type - Type of authenticator.
1440
- * @param {string} otp - Valid verification token.
1441
- * @throws {AppwriteException}
1442
- * @returns {Promise<Models.User<Preferences>>}
1443
- * @deprecated Use the object parameter style method for a better developer experience.
1444
- */
1445
- updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
1446
- updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(
1447
- paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType,
1448
- ...rest: [(string)?]
1449
- ): Promise<Models.User<Preferences>> {
1450
- let params: { type: AuthenticatorType, otp: string };
1451
-
1452
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) {
1453
- params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string };
1454
- } else {
1455
- params = {
1456
- type: paramsOrFirst as AuthenticatorType,
1457
- otp: rest[0] as string
1458
- };
1459
- }
1460
-
1461
- const type = params.type;
1462
- const otp = params.otp;
1463
-
1464
- if (typeof type === 'undefined') {
1465
- throw new AppwriteException('Missing required parameter: "type"');
1466
- }
1467
- if (typeof otp === 'undefined') {
1468
- throw new AppwriteException('Missing required parameter: "otp"');
1469
- }
1470
-
1471
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
1472
- const payload: Payload = {};
1473
- if (typeof otp !== 'undefined') {
1474
- payload['otp'] = otp;
1475
- }
1476
- const uri = new URL(this.client.config.endpoint + apiPath);
1477
-
1478
- const apiHeaders: { [header: string]: string } = {
1479
- 'content-type': 'application/json',
1480
- }
1481
-
1482
- return this.client.call(
1483
- 'put',
1484
- uri,
1485
- apiHeaders,
1486
- payload
1487
- );
1488
- }
1489
-
1490
- /**
1491
- * Delete an authenticator for a user by ID.
1492
- *
1493
- * @param {AuthenticatorType} params.type - Type of authenticator.
1494
- * @throws {AppwriteException}
1495
- * @returns {Promise<{}>}
1496
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.
1497
- */
1498
- deleteMfaAuthenticator(params: { type: AuthenticatorType }): Promise<{}>;
1499
- /**
1500
- * Delete an authenticator for a user by ID.
1501
- *
1502
- * @param {AuthenticatorType} type - Type of authenticator.
1503
- * @throws {AppwriteException}
1504
- * @returns {Promise<{}>}
1505
- * @deprecated Use the object parameter style method for a better developer experience.
1506
- */
1507
- deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>;
1508
- deleteMfaAuthenticator(
1509
- paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
1510
- ): Promise<{}> {
1511
- let params: { type: AuthenticatorType };
1512
-
1513
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1514
- params = (paramsOrFirst || {}) as { type: AuthenticatorType };
1515
- } else {
1516
- params = {
1517
- type: paramsOrFirst as AuthenticatorType
1518
- };
1519
- }
1520
-
1521
- const type = params.type;
1522
-
1523
- if (typeof type === 'undefined') {
1524
- throw new AppwriteException('Missing required parameter: "type"');
1525
- }
1526
-
1527
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
1528
- const payload: Payload = {};
1529
- const uri = new URL(this.client.config.endpoint + apiPath);
1530
-
1531
- const apiHeaders: { [header: string]: string } = {
1532
- 'content-type': 'application/json',
1533
- }
1534
-
1535
- return this.client.call(
1536
- 'delete',
1537
- uri,
1538
- apiHeaders,
1539
- payload
1540
- );
1541
- }
1542
-
1543
- /**
1544
- * Delete an authenticator for a user by ID.
1545
- *
1546
- * @param {AuthenticatorType} params.type - Type of authenticator.
1547
- * @throws {AppwriteException}
1548
- * @returns {Promise<{}>}
1549
- */
1550
- deleteMFAAuthenticator(params: { type: AuthenticatorType }): Promise<{}>;
1551
- /**
1552
- * Delete an authenticator for a user by ID.
1553
- *
1554
- * @param {AuthenticatorType} type - Type of authenticator.
1555
- * @throws {AppwriteException}
1556
- * @returns {Promise<{}>}
1557
- * @deprecated Use the object parameter style method for a better developer experience.
1558
- */
1559
- deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>;
1560
- deleteMFAAuthenticator(
1561
- paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
1562
- ): Promise<{}> {
1563
- let params: { type: AuthenticatorType };
1564
-
1565
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1566
- params = (paramsOrFirst || {}) as { type: AuthenticatorType };
1567
- } else {
1568
- params = {
1569
- type: paramsOrFirst as AuthenticatorType
1570
- };
1571
- }
1572
-
1573
- const type = params.type;
1574
-
1575
- if (typeof type === 'undefined') {
1576
- throw new AppwriteException('Missing required parameter: "type"');
1577
- }
1578
-
1579
- const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
1580
- const payload: Payload = {};
1581
- const uri = new URL(this.client.config.endpoint + apiPath);
1582
-
1583
- const apiHeaders: { [header: string]: string } = {
1584
- 'content-type': 'application/json',
1585
- }
1586
-
1587
- return this.client.call(
1588
- 'delete',
1589
- uri,
1590
- apiHeaders,
1591
- payload
1592
- );
1593
- }
1594
-
1595
- /**
1596
- * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
1597
- *
1598
- * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
1599
- * @throws {AppwriteException}
1600
- * @returns {Promise<Models.MfaChallenge>}
1601
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.
1602
- */
1603
- createMfaChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>;
1604
- /**
1605
- * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
1606
- *
1607
- * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
1608
- * @throws {AppwriteException}
1609
- * @returns {Promise<Models.MfaChallenge>}
1610
- * @deprecated Use the object parameter style method for a better developer experience.
1611
- */
1612
- createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
1613
- createMfaChallenge(
1614
- paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor
1615
- ): Promise<Models.MfaChallenge> {
1616
- let params: { factor: AuthenticationFactor };
1617
-
1618
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) {
1619
- params = (paramsOrFirst || {}) as { factor: AuthenticationFactor };
1620
- } else {
1621
- params = {
1622
- factor: paramsOrFirst as AuthenticationFactor
1623
- };
1624
- }
1625
-
1626
- const factor = params.factor;
1627
-
1628
- if (typeof factor === 'undefined') {
1629
- throw new AppwriteException('Missing required parameter: "factor"');
1630
- }
1631
-
1632
- const apiPath = '/account/mfa/challenges';
1633
- const payload: Payload = {};
1634
- if (typeof factor !== 'undefined') {
1635
- payload['factor'] = factor;
1636
- }
1637
- const uri = new URL(this.client.config.endpoint + apiPath);
1638
-
1639
- const apiHeaders: { [header: string]: string } = {
1640
- 'content-type': 'application/json',
1641
- }
1642
-
1643
- return this.client.call(
1644
- 'post',
1645
- uri,
1646
- apiHeaders,
1647
- payload
1648
- );
1649
- }
1650
-
1651
- /**
1652
- * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
1653
- *
1654
- * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
1655
- * @throws {AppwriteException}
1656
- * @returns {Promise<Models.MfaChallenge>}
1657
- */
1658
- createMFAChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>;
1659
- /**
1660
- * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
1661
- *
1662
- * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
1663
- * @throws {AppwriteException}
1664
- * @returns {Promise<Models.MfaChallenge>}
1665
- * @deprecated Use the object parameter style method for a better developer experience.
1666
- */
1667
- createMFAChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
1668
- createMFAChallenge(
1669
- paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor
1670
- ): Promise<Models.MfaChallenge> {
1671
- let params: { factor: AuthenticationFactor };
1672
-
1673
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) {
1674
- params = (paramsOrFirst || {}) as { factor: AuthenticationFactor };
1675
- } else {
1676
- params = {
1677
- factor: paramsOrFirst as AuthenticationFactor
1678
- };
1679
- }
1680
-
1681
- const factor = params.factor;
1682
-
1683
- if (typeof factor === 'undefined') {
1684
- throw new AppwriteException('Missing required parameter: "factor"');
1685
- }
1686
-
1687
- const apiPath = '/account/mfa/challenges';
1688
- const payload: Payload = {};
1689
- if (typeof factor !== 'undefined') {
1690
- payload['factor'] = factor;
1691
- }
1692
- const uri = new URL(this.client.config.endpoint + apiPath);
1693
-
1694
- const apiHeaders: { [header: string]: string } = {
1695
- 'content-type': 'application/json',
1696
- }
1697
-
1698
- return this.client.call(
1699
- 'post',
1700
- uri,
1701
- apiHeaders,
1702
- payload
1703
- );
1704
- }
1705
-
1706
- /**
1707
- * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
1708
- *
1709
- * @param {string} params.challengeId - ID of the challenge.
1710
- * @param {string} params.otp - Valid verification token.
1711
- * @throws {AppwriteException}
1712
- * @returns {Promise<Models.Session>}
1713
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.
1714
- */
1715
- updateMfaChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>;
1716
- /**
1717
- * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
1718
- *
1719
- * @param {string} challengeId - ID of the challenge.
1720
- * @param {string} otp - Valid verification token.
1721
- * @throws {AppwriteException}
1722
- * @returns {Promise<Models.Session>}
1723
- * @deprecated Use the object parameter style method for a better developer experience.
1724
- */
1725
- updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>;
1726
- updateMfaChallenge(
1727
- paramsOrFirst: { challengeId: string, otp: string } | string,
1728
- ...rest: [(string)?]
1729
- ): Promise<Models.Session> {
1730
- let params: { challengeId: string, otp: string };
1731
-
1732
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1733
- params = (paramsOrFirst || {}) as { challengeId: string, otp: string };
1734
- } else {
1735
- params = {
1736
- challengeId: paramsOrFirst as string,
1737
- otp: rest[0] as string
1738
- };
1739
- }
1740
-
1741
- const challengeId = params.challengeId;
1742
- const otp = params.otp;
1743
-
1744
- if (typeof challengeId === 'undefined') {
1745
- throw new AppwriteException('Missing required parameter: "challengeId"');
1746
- }
1747
- if (typeof otp === 'undefined') {
1748
- throw new AppwriteException('Missing required parameter: "otp"');
1749
- }
1750
-
1751
- const apiPath = '/account/mfa/challenges';
1752
- const payload: Payload = {};
1753
- if (typeof challengeId !== 'undefined') {
1754
- payload['challengeId'] = challengeId;
1755
- }
1756
- if (typeof otp !== 'undefined') {
1757
- payload['otp'] = otp;
1758
- }
1759
- const uri = new URL(this.client.config.endpoint + apiPath);
1760
-
1761
- const apiHeaders: { [header: string]: string } = {
1762
- 'content-type': 'application/json',
1763
- }
1764
-
1765
- return this.client.call(
1766
- 'put',
1767
- uri,
1768
- apiHeaders,
1769
- payload
1770
- );
1771
- }
1772
-
1773
- /**
1774
- * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
1775
- *
1776
- * @param {string} params.challengeId - ID of the challenge.
1777
- * @param {string} params.otp - Valid verification token.
1778
- * @throws {AppwriteException}
1779
- * @returns {Promise<Models.Session>}
1780
- */
1781
- updateMFAChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>;
1782
- /**
1783
- * Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
1784
- *
1785
- * @param {string} challengeId - ID of the challenge.
1786
- * @param {string} otp - Valid verification token.
1787
- * @throws {AppwriteException}
1788
- * @returns {Promise<Models.Session>}
1789
- * @deprecated Use the object parameter style method for a better developer experience.
1790
- */
1791
- updateMFAChallenge(challengeId: string, otp: string): Promise<Models.Session>;
1792
- updateMFAChallenge(
1793
- paramsOrFirst: { challengeId: string, otp: string } | string,
1794
- ...rest: [(string)?]
1795
- ): Promise<Models.Session> {
1796
- let params: { challengeId: string, otp: string };
1797
-
1798
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1799
- params = (paramsOrFirst || {}) as { challengeId: string, otp: string };
1800
- } else {
1801
- params = {
1802
- challengeId: paramsOrFirst as string,
1803
- otp: rest[0] as string
1804
- };
1805
- }
1806
-
1807
- const challengeId = params.challengeId;
1808
- const otp = params.otp;
1809
-
1810
- if (typeof challengeId === 'undefined') {
1811
- throw new AppwriteException('Missing required parameter: "challengeId"');
1812
- }
1813
- if (typeof otp === 'undefined') {
1814
- throw new AppwriteException('Missing required parameter: "otp"');
1815
- }
1816
-
1817
- const apiPath = '/account/mfa/challenges';
1818
- const payload: Payload = {};
1819
- if (typeof challengeId !== 'undefined') {
1820
- payload['challengeId'] = challengeId;
1821
- }
1822
- if (typeof otp !== 'undefined') {
1823
- payload['otp'] = otp;
1824
- }
1825
- const uri = new URL(this.client.config.endpoint + apiPath);
1826
-
1827
- const apiHeaders: { [header: string]: string } = {
1828
- 'content-type': 'application/json',
1829
- }
1830
-
1831
- return this.client.call(
1832
- 'put',
1833
- uri,
1834
- apiHeaders,
1835
- payload
1836
- );
1837
- }
1838
-
1839
- /**
1840
- * List the factors available on the account to be used as a MFA challange.
1841
- *
1842
- * @throws {AppwriteException}
1843
- * @returns {Promise<Models.MfaFactors>}
1844
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
1845
- */
1846
- listMfaFactors(): Promise<Models.MfaFactors> {
1847
-
1848
- const apiPath = '/account/mfa/factors';
1849
- const payload: Payload = {};
1850
- const uri = new URL(this.client.config.endpoint + apiPath);
1851
-
1852
- const apiHeaders: { [header: string]: string } = {
1853
- }
1854
-
1855
- return this.client.call(
1856
- 'get',
1857
- uri,
1858
- apiHeaders,
1859
- payload
1860
- );
1861
- }
1862
-
1863
- /**
1864
- * List the factors available on the account to be used as a MFA challange.
1865
- *
1866
- * @throws {AppwriteException}
1867
- * @returns {Promise<Models.MfaFactors>}
1868
- */
1869
- listMFAFactors(): Promise<Models.MfaFactors> {
1870
-
1871
- const apiPath = '/account/mfa/factors';
1872
- const payload: Payload = {};
1873
- const uri = new URL(this.client.config.endpoint + apiPath);
1874
-
1875
- const apiHeaders: { [header: string]: string } = {
1876
- }
1877
-
1878
- return this.client.call(
1879
- 'get',
1880
- uri,
1881
- apiHeaders,
1882
- payload
1883
- );
1884
- }
1885
-
1886
- /**
1887
- * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
1888
- *
1889
- * @throws {AppwriteException}
1890
- * @returns {Promise<Models.MfaRecoveryCodes>}
1891
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
1892
- */
1893
- getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
1894
-
1895
- const apiPath = '/account/mfa/recovery-codes';
1896
- const payload: Payload = {};
1897
- const uri = new URL(this.client.config.endpoint + apiPath);
1898
-
1899
- const apiHeaders: { [header: string]: string } = {
1900
- }
1901
-
1902
- return this.client.call(
1903
- 'get',
1904
- uri,
1905
- apiHeaders,
1906
- payload
1907
- );
1908
- }
1909
-
1910
- /**
1911
- * Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
1912
- *
1913
- * @throws {AppwriteException}
1914
- * @returns {Promise<Models.MfaRecoveryCodes>}
1915
- */
1916
- getMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
1917
-
1918
- const apiPath = '/account/mfa/recovery-codes';
1919
- const payload: Payload = {};
1920
- const uri = new URL(this.client.config.endpoint + apiPath);
1921
-
1922
- const apiHeaders: { [header: string]: string } = {
1923
- }
1924
-
1925
- return this.client.call(
1926
- 'get',
1927
- uri,
1928
- apiHeaders,
1929
- payload
1930
- );
1931
- }
1932
-
1933
- /**
1934
- * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
1935
- *
1936
- * @throws {AppwriteException}
1937
- * @returns {Promise<Models.MfaRecoveryCodes>}
1938
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
1939
- */
1940
- createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
1941
-
1942
- const apiPath = '/account/mfa/recovery-codes';
1943
- const payload: Payload = {};
1944
- const uri = new URL(this.client.config.endpoint + apiPath);
1945
-
1946
- const apiHeaders: { [header: string]: string } = {
1947
- 'content-type': 'application/json',
1948
- }
1949
-
1950
- return this.client.call(
1951
- 'post',
1952
- uri,
1953
- apiHeaders,
1954
- payload
1955
- );
1956
- }
1957
-
1958
- /**
1959
- * Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
1960
- *
1961
- * @throws {AppwriteException}
1962
- * @returns {Promise<Models.MfaRecoveryCodes>}
1963
- */
1964
- createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
1965
-
1966
- const apiPath = '/account/mfa/recovery-codes';
1967
- const payload: Payload = {};
1968
- const uri = new URL(this.client.config.endpoint + apiPath);
1969
-
1970
- const apiHeaders: { [header: string]: string } = {
1971
- 'content-type': 'application/json',
1972
- }
1973
-
1974
- return this.client.call(
1975
- 'post',
1976
- uri,
1977
- apiHeaders,
1978
- payload
1979
- );
1980
- }
1981
-
1982
- /**
1983
- * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
1984
- *
1985
- * @throws {AppwriteException}
1986
- * @returns {Promise<Models.MfaRecoveryCodes>}
1987
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
1988
- */
1989
- updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
1990
-
1991
- const apiPath = '/account/mfa/recovery-codes';
1992
- const payload: Payload = {};
1993
- const uri = new URL(this.client.config.endpoint + apiPath);
1994
-
1995
- const apiHeaders: { [header: string]: string } = {
1996
- 'content-type': 'application/json',
1997
- }
1998
-
1999
- return this.client.call(
2000
- 'patch',
2001
- uri,
2002
- apiHeaders,
2003
- payload
2004
- );
2005
- }
2006
-
2007
- /**
2008
- * Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
2009
- *
2010
- * @throws {AppwriteException}
2011
- * @returns {Promise<Models.MfaRecoveryCodes>}
2012
- */
2013
- updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
2014
-
2015
- const apiPath = '/account/mfa/recovery-codes';
2016
- const payload: Payload = {};
2017
- const uri = new URL(this.client.config.endpoint + apiPath);
2018
-
2019
- const apiHeaders: { [header: string]: string } = {
2020
- 'content-type': 'application/json',
2021
- }
2022
-
2023
- return this.client.call(
2024
- 'patch',
2025
- uri,
2026
- apiHeaders,
2027
- payload
2028
- );
2029
- }
2030
-
2031
- /**
2032
- * Update currently logged in user account name.
2033
- *
2034
- * @param {string} params.name - User name. Max length: 128 chars.
2035
- * @throws {AppwriteException}
2036
- * @returns {Promise<Models.User<Preferences>>}
2037
- */
2038
- updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { name: string }): Promise<Models.User<Preferences>>;
2039
- /**
2040
- * Update currently logged in user account name.
2041
- *
2042
- * @param {string} name - User name. Max length: 128 chars.
2043
- * @throws {AppwriteException}
2044
- * @returns {Promise<Models.User<Preferences>>}
2045
- * @deprecated Use the object parameter style method for a better developer experience.
2046
- */
2047
- updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>>;
2048
- updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(
2049
- paramsOrFirst: { name: string } | string
2050
- ): Promise<Models.User<Preferences>> {
2051
- let params: { name: string };
2052
-
2053
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2054
- params = (paramsOrFirst || {}) as { name: string };
2055
- } else {
2056
- params = {
2057
- name: paramsOrFirst as string
2058
- };
2059
- }
2060
-
2061
- const name = params.name;
2062
-
2063
- if (typeof name === 'undefined') {
2064
- throw new AppwriteException('Missing required parameter: "name"');
2065
- }
2066
-
2067
- const apiPath = '/account/name';
2068
- const payload: Payload = {};
2069
- if (typeof name !== 'undefined') {
2070
- payload['name'] = name;
2071
- }
2072
- const uri = new URL(this.client.config.endpoint + apiPath);
2073
-
2074
- const apiHeaders: { [header: string]: string } = {
2075
- 'content-type': 'application/json',
2076
- }
2077
-
2078
- return this.client.call(
2079
- 'patch',
2080
- uri,
2081
- apiHeaders,
2082
- payload
2083
- );
2084
- }
2085
-
2086
- /**
2087
- * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
2088
- *
2089
- * @param {string} params.password - New user password. Must be at least 8 chars.
2090
- * @param {string} params.oldPassword - Current user password. Must be at least 8 chars.
2091
- * @throws {AppwriteException}
2092
- * @returns {Promise<Models.User<Preferences>>}
2093
- */
2094
- updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { password: string, oldPassword?: string }): Promise<Models.User<Preferences>>;
2095
- /**
2096
- * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
2097
- *
2098
- * @param {string} password - New user password. Must be at least 8 chars.
2099
- * @param {string} oldPassword - Current user password. Must be at least 8 chars.
2100
- * @throws {AppwriteException}
2101
- * @returns {Promise<Models.User<Preferences>>}
2102
- * @deprecated Use the object parameter style method for a better developer experience.
2103
- */
2104
- updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
2105
- updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(
2106
- paramsOrFirst: { password: string, oldPassword?: string } | string,
2107
- ...rest: [(string)?]
2108
- ): Promise<Models.User<Preferences>> {
2109
- let params: { password: string, oldPassword?: string };
2110
-
2111
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2112
- params = (paramsOrFirst || {}) as { password: string, oldPassword?: string };
2113
- } else {
2114
- params = {
2115
- password: paramsOrFirst as string,
2116
- oldPassword: rest[0] as string
2117
- };
2118
- }
2119
-
2120
- const password = params.password;
2121
- const oldPassword = params.oldPassword;
2122
-
2123
- if (typeof password === 'undefined') {
2124
- throw new AppwriteException('Missing required parameter: "password"');
2125
- }
2126
-
2127
- const apiPath = '/account/password';
2128
- const payload: Payload = {};
2129
- if (typeof password !== 'undefined') {
2130
- payload['password'] = password;
2131
- }
2132
- if (typeof oldPassword !== 'undefined') {
2133
- payload['oldPassword'] = oldPassword;
2134
- }
2135
- const uri = new URL(this.client.config.endpoint + apiPath);
2136
-
2137
- const apiHeaders: { [header: string]: string } = {
2138
- 'content-type': 'application/json',
2139
- }
2140
-
2141
- return this.client.call(
2142
- 'patch',
2143
- uri,
2144
- apiHeaders,
2145
- payload
2146
- );
2147
- }
2148
-
2149
- /**
2150
- * List payment methods for this account.
2151
- *
2152
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
2153
- * @throws {AppwriteException}
2154
- * @returns {Promise<Models.PaymentMethodList>}
2155
- */
2156
- listPaymentMethods(params?: { queries?: string[] }): Promise<Models.PaymentMethodList>;
2157
- /**
2158
- * List payment methods for this account.
2159
- *
2160
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
2161
- * @throws {AppwriteException}
2162
- * @returns {Promise<Models.PaymentMethodList>}
2163
- * @deprecated Use the object parameter style method for a better developer experience.
2164
- */
2165
- listPaymentMethods(queries?: string[]): Promise<Models.PaymentMethodList>;
2166
- listPaymentMethods(
2167
- paramsOrFirst?: { queries?: string[] } | string[]
2168
- ): Promise<Models.PaymentMethodList> {
2169
- let params: { queries?: string[] };
2170
-
2171
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2172
- params = (paramsOrFirst || {}) as { queries?: string[] };
2173
- } else {
2174
- params = {
2175
- queries: paramsOrFirst as string[]
2176
- };
2177
- }
2178
-
2179
- const queries = params.queries;
2180
-
2181
-
2182
- const apiPath = '/account/payment-methods';
2183
- const payload: Payload = {};
2184
- if (typeof queries !== 'undefined') {
2185
- payload['queries'] = queries;
2186
- }
2187
- const uri = new URL(this.client.config.endpoint + apiPath);
2188
-
2189
- const apiHeaders: { [header: string]: string } = {
2190
- }
2191
-
2192
- return this.client.call(
2193
- 'get',
2194
- uri,
2195
- apiHeaders,
2196
- payload
2197
- );
2198
- }
2199
-
2200
- /**
2201
- * Create a new payment method for the current user account.
2202
- *
2203
- * @throws {AppwriteException}
2204
- * @returns {Promise<Models.PaymentMethod>}
2205
- */
2206
- createPaymentMethod(): Promise<Models.PaymentMethod> {
2207
-
2208
- const apiPath = '/account/payment-methods';
2209
- const payload: Payload = {};
2210
- const uri = new URL(this.client.config.endpoint + apiPath);
2211
-
2212
- const apiHeaders: { [header: string]: string } = {
2213
- 'content-type': 'application/json',
2214
- }
2215
-
2216
- return this.client.call(
2217
- 'post',
2218
- uri,
2219
- apiHeaders,
2220
- payload
2221
- );
2222
- }
2223
-
2224
- /**
2225
- * Get a specific payment method for the user.
2226
- *
2227
- * @param {string} params.paymentMethodId - Unique ID of payment method
2228
- * @throws {AppwriteException}
2229
- * @returns {Promise<Models.PaymentMethod>}
2230
- */
2231
- getPaymentMethod(params: { paymentMethodId: string }): Promise<Models.PaymentMethod>;
2232
- /**
2233
- * Get a specific payment method for the user.
2234
- *
2235
- * @param {string} paymentMethodId - Unique ID of payment method
2236
- * @throws {AppwriteException}
2237
- * @returns {Promise<Models.PaymentMethod>}
2238
- * @deprecated Use the object parameter style method for a better developer experience.
2239
- */
2240
- getPaymentMethod(paymentMethodId: string): Promise<Models.PaymentMethod>;
2241
- getPaymentMethod(
2242
- paramsOrFirst: { paymentMethodId: string } | string
2243
- ): Promise<Models.PaymentMethod> {
2244
- let params: { paymentMethodId: string };
2245
-
2246
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2247
- params = (paramsOrFirst || {}) as { paymentMethodId: string };
2248
- } else {
2249
- params = {
2250
- paymentMethodId: paramsOrFirst as string
2251
- };
2252
- }
2253
-
2254
- const paymentMethodId = params.paymentMethodId;
2255
-
2256
- if (typeof paymentMethodId === 'undefined') {
2257
- throw new AppwriteException('Missing required parameter: "paymentMethodId"');
2258
- }
2259
-
2260
- const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
2261
- const payload: Payload = {};
2262
- const uri = new URL(this.client.config.endpoint + apiPath);
2263
-
2264
- const apiHeaders: { [header: string]: string } = {
2265
- }
2266
-
2267
- return this.client.call(
2268
- 'get',
2269
- uri,
2270
- apiHeaders,
2271
- payload
2272
- );
2273
- }
2274
-
2275
- /**
2276
- * Update a new payment method for the current user account.
2277
- *
2278
- * @param {string} params.paymentMethodId - Unique ID of payment method
2279
- * @param {number} params.expiryMonth - Payment expiry month
2280
- * @param {number} params.expiryYear - Expiry year
2281
- * @param {string} params.state - State of the payment method country
2282
- * @throws {AppwriteException}
2283
- * @returns {Promise<Models.PaymentMethod>}
2284
- */
2285
- updatePaymentMethod(params: { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string }): Promise<Models.PaymentMethod>;
2286
- /**
2287
- * Update a new payment method for the current user account.
2288
- *
2289
- * @param {string} paymentMethodId - Unique ID of payment method
2290
- * @param {number} expiryMonth - Payment expiry month
2291
- * @param {number} expiryYear - Expiry year
2292
- * @param {string} state - State of the payment method country
2293
- * @throws {AppwriteException}
2294
- * @returns {Promise<Models.PaymentMethod>}
2295
- * @deprecated Use the object parameter style method for a better developer experience.
2296
- */
2297
- updatePaymentMethod(paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string): Promise<Models.PaymentMethod>;
2298
- updatePaymentMethod(
2299
- paramsOrFirst: { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string } | string,
2300
- ...rest: [(number)?, (number)?, (string)?]
2301
- ): Promise<Models.PaymentMethod> {
2302
- let params: { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string };
2303
-
2304
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2305
- params = (paramsOrFirst || {}) as { paymentMethodId: string, expiryMonth: number, expiryYear: number, state?: string };
2306
- } else {
2307
- params = {
2308
- paymentMethodId: paramsOrFirst as string,
2309
- expiryMonth: rest[0] as number,
2310
- expiryYear: rest[1] as number,
2311
- state: rest[2] as string
2312
- };
2313
- }
2314
-
2315
- const paymentMethodId = params.paymentMethodId;
2316
- const expiryMonth = params.expiryMonth;
2317
- const expiryYear = params.expiryYear;
2318
- const state = params.state;
2319
-
2320
- if (typeof paymentMethodId === 'undefined') {
2321
- throw new AppwriteException('Missing required parameter: "paymentMethodId"');
2322
- }
2323
- if (typeof expiryMonth === 'undefined') {
2324
- throw new AppwriteException('Missing required parameter: "expiryMonth"');
2325
- }
2326
- if (typeof expiryYear === 'undefined') {
2327
- throw new AppwriteException('Missing required parameter: "expiryYear"');
2328
- }
2329
-
2330
- const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
2331
- const payload: Payload = {};
2332
- if (typeof expiryMonth !== 'undefined') {
2333
- payload['expiryMonth'] = expiryMonth;
2334
- }
2335
- if (typeof expiryYear !== 'undefined') {
2336
- payload['expiryYear'] = expiryYear;
2337
- }
2338
- if (typeof state !== 'undefined') {
2339
- payload['state'] = state;
2340
- }
2341
- const uri = new URL(this.client.config.endpoint + apiPath);
2342
-
2343
- const apiHeaders: { [header: string]: string } = {
2344
- 'content-type': 'application/json',
2345
- }
2346
-
2347
- return this.client.call(
2348
- 'patch',
2349
- uri,
2350
- apiHeaders,
2351
- payload
2352
- );
2353
- }
2354
-
2355
- /**
2356
- * Delete a specific payment method from a user's account.
2357
- *
2358
- * @param {string} params.paymentMethodId - Unique ID of payment method
2359
- * @throws {AppwriteException}
2360
- * @returns {Promise<{}>}
2361
- */
2362
- deletePaymentMethod(params: { paymentMethodId: string }): Promise<{}>;
2363
- /**
2364
- * Delete a specific payment method from a user's account.
2365
- *
2366
- * @param {string} paymentMethodId - Unique ID of payment method
2367
- * @throws {AppwriteException}
2368
- * @returns {Promise<{}>}
2369
- * @deprecated Use the object parameter style method for a better developer experience.
2370
- */
2371
- deletePaymentMethod(paymentMethodId: string): Promise<{}>;
2372
- deletePaymentMethod(
2373
- paramsOrFirst: { paymentMethodId: string } | string
2374
- ): Promise<{}> {
2375
- let params: { paymentMethodId: string };
2376
-
2377
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2378
- params = (paramsOrFirst || {}) as { paymentMethodId: string };
2379
- } else {
2380
- params = {
2381
- paymentMethodId: paramsOrFirst as string
2382
- };
2383
- }
2384
-
2385
- const paymentMethodId = params.paymentMethodId;
2386
-
2387
- if (typeof paymentMethodId === 'undefined') {
2388
- throw new AppwriteException('Missing required parameter: "paymentMethodId"');
2389
- }
2390
-
2391
- const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId);
2392
- const payload: Payload = {};
2393
- const uri = new URL(this.client.config.endpoint + apiPath);
2394
-
2395
- const apiHeaders: { [header: string]: string } = {
2396
- 'content-type': 'application/json',
2397
- }
2398
-
2399
- return this.client.call(
2400
- 'delete',
2401
- uri,
2402
- apiHeaders,
2403
- payload
2404
- );
2405
- }
2406
-
2407
- /**
2408
- * Update payment method provider.
2409
- *
2410
- * @param {string} params.paymentMethodId - Unique ID of payment method
2411
- * @param {string} params.providerMethodId - Payment method ID from the payment provider
2412
- * @param {string} params.name - Name in the payment method
2413
- * @param {string} params.state - State of the payment method country
2414
- * @throws {AppwriteException}
2415
- * @returns {Promise<Models.PaymentMethod>}
2416
- */
2417
- updatePaymentMethodProvider(params: { paymentMethodId: string, providerMethodId: string, name: string, state?: string }): Promise<Models.PaymentMethod>;
2418
- /**
2419
- * Update payment method provider.
2420
- *
2421
- * @param {string} paymentMethodId - Unique ID of payment method
2422
- * @param {string} providerMethodId - Payment method ID from the payment provider
2423
- * @param {string} name - Name in the payment method
2424
- * @param {string} state - State of the payment method country
2425
- * @throws {AppwriteException}
2426
- * @returns {Promise<Models.PaymentMethod>}
2427
- * @deprecated Use the object parameter style method for a better developer experience.
2428
- */
2429
- updatePaymentMethodProvider(paymentMethodId: string, providerMethodId: string, name: string, state?: string): Promise<Models.PaymentMethod>;
2430
- updatePaymentMethodProvider(
2431
- paramsOrFirst: { paymentMethodId: string, providerMethodId: string, name: string, state?: string } | string,
2432
- ...rest: [(string)?, (string)?, (string)?]
2433
- ): Promise<Models.PaymentMethod> {
2434
- let params: { paymentMethodId: string, providerMethodId: string, name: string, state?: string };
2435
-
2436
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2437
- params = (paramsOrFirst || {}) as { paymentMethodId: string, providerMethodId: string, name: string, state?: string };
2438
- } else {
2439
- params = {
2440
- paymentMethodId: paramsOrFirst as string,
2441
- providerMethodId: rest[0] as string,
2442
- name: rest[1] as string,
2443
- state: rest[2] as string
2444
- };
2445
- }
2446
-
2447
- const paymentMethodId = params.paymentMethodId;
2448
- const providerMethodId = params.providerMethodId;
2449
- const name = params.name;
2450
- const state = params.state;
2451
-
2452
- if (typeof paymentMethodId === 'undefined') {
2453
- throw new AppwriteException('Missing required parameter: "paymentMethodId"');
2454
- }
2455
- if (typeof providerMethodId === 'undefined') {
2456
- throw new AppwriteException('Missing required parameter: "providerMethodId"');
2457
- }
2458
- if (typeof name === 'undefined') {
2459
- throw new AppwriteException('Missing required parameter: "name"');
2460
- }
2461
-
2462
- const apiPath = '/account/payment-methods/{paymentMethodId}/provider'.replace('{paymentMethodId}', paymentMethodId);
2463
- const payload: Payload = {};
2464
- if (typeof providerMethodId !== 'undefined') {
2465
- payload['providerMethodId'] = providerMethodId;
2466
- }
2467
- if (typeof name !== 'undefined') {
2468
- payload['name'] = name;
2469
- }
2470
- if (typeof state !== 'undefined') {
2471
- payload['state'] = state;
2472
- }
2473
- const uri = new URL(this.client.config.endpoint + apiPath);
2474
-
2475
- const apiHeaders: { [header: string]: string } = {
2476
- 'content-type': 'application/json',
2477
- }
2478
-
2479
- return this.client.call(
2480
- 'patch',
2481
- uri,
2482
- apiHeaders,
2483
- payload
2484
- );
2485
- }
2486
-
2487
- /**
2488
- * Update payment method mandate options.
2489
- *
2490
- * @param {string} params.paymentMethodId - Unique ID of payment method
2491
- * @throws {AppwriteException}
2492
- * @returns {Promise<Models.PaymentMethod>}
2493
- */
2494
- updatePaymentMethodMandateOptions(params: { paymentMethodId: string }): Promise<Models.PaymentMethod>;
2495
- /**
2496
- * Update payment method mandate options.
2497
- *
2498
- * @param {string} paymentMethodId - Unique ID of payment method
2499
- * @throws {AppwriteException}
2500
- * @returns {Promise<Models.PaymentMethod>}
2501
- * @deprecated Use the object parameter style method for a better developer experience.
2502
- */
2503
- updatePaymentMethodMandateOptions(paymentMethodId: string): Promise<Models.PaymentMethod>;
2504
- updatePaymentMethodMandateOptions(
2505
- paramsOrFirst: { paymentMethodId: string } | string
2506
- ): Promise<Models.PaymentMethod> {
2507
- let params: { paymentMethodId: string };
2508
-
2509
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2510
- params = (paramsOrFirst || {}) as { paymentMethodId: string };
2511
- } else {
2512
- params = {
2513
- paymentMethodId: paramsOrFirst as string
2514
- };
2515
- }
2516
-
2517
- const paymentMethodId = params.paymentMethodId;
2518
-
2519
- if (typeof paymentMethodId === 'undefined') {
2520
- throw new AppwriteException('Missing required parameter: "paymentMethodId"');
2521
- }
2522
-
2523
- const apiPath = '/account/payment-methods/{paymentMethodId}/setup'.replace('{paymentMethodId}', paymentMethodId);
2524
- const payload: Payload = {};
2525
- const uri = new URL(this.client.config.endpoint + apiPath);
2526
-
2527
- const apiHeaders: { [header: string]: string } = {
2528
- 'content-type': 'application/json',
2529
- }
2530
-
2531
- return this.client.call(
2532
- 'patch',
2533
- uri,
2534
- apiHeaders,
2535
- payload
2536
- );
2537
- }
2538
-
2539
- /**
2540
- * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
2541
- *
2542
- * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
2543
- * @param {string} params.password - User password. Must be at least 8 chars.
2544
- * @throws {AppwriteException}
2545
- * @returns {Promise<Models.User<Preferences>>}
2546
- */
2547
- updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { phone: string, password: string }): Promise<Models.User<Preferences>>;
2548
- /**
2549
- * Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
2550
- *
2551
- * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
2552
- * @param {string} password - User password. Must be at least 8 chars.
2553
- * @throws {AppwriteException}
2554
- * @returns {Promise<Models.User<Preferences>>}
2555
- * @deprecated Use the object parameter style method for a better developer experience.
2556
- */
2557
- updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
2558
- updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(
2559
- paramsOrFirst: { phone: string, password: string } | string,
2560
- ...rest: [(string)?]
2561
- ): Promise<Models.User<Preferences>> {
2562
- let params: { phone: string, password: string };
2563
-
2564
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2565
- params = (paramsOrFirst || {}) as { phone: string, password: string };
2566
- } else {
2567
- params = {
2568
- phone: paramsOrFirst as string,
2569
- password: rest[0] as string
2570
- };
2571
- }
2572
-
2573
- const phone = params.phone;
2574
- const password = params.password;
2575
-
2576
- if (typeof phone === 'undefined') {
2577
- throw new AppwriteException('Missing required parameter: "phone"');
2578
- }
2579
- if (typeof password === 'undefined') {
2580
- throw new AppwriteException('Missing required parameter: "password"');
2581
- }
2582
-
2583
- const apiPath = '/account/phone';
2584
- const payload: Payload = {};
2585
- if (typeof phone !== 'undefined') {
2586
- payload['phone'] = phone;
2587
- }
2588
- if (typeof password !== 'undefined') {
2589
- payload['password'] = password;
2590
- }
2591
- const uri = new URL(this.client.config.endpoint + apiPath);
2592
-
2593
- const apiHeaders: { [header: string]: string } = {
2594
- 'content-type': 'application/json',
2595
- }
2596
-
2597
- return this.client.call(
2598
- 'patch',
2599
- uri,
2600
- apiHeaders,
2601
- payload
2602
- );
2603
- }
2604
-
2605
- /**
2606
- * Get the preferences as a key-value object for the currently logged in user.
2607
- *
2608
- * @throws {AppwriteException}
2609
- * @returns {Promise<Preferences>}
2610
- */
2611
- getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences> {
2612
-
2613
- const apiPath = '/account/prefs';
2614
- const payload: Payload = {};
2615
- const uri = new URL(this.client.config.endpoint + apiPath);
2616
-
2617
- const apiHeaders: { [header: string]: string } = {
2618
- }
2619
-
2620
- return this.client.call(
2621
- 'get',
2622
- uri,
2623
- apiHeaders,
2624
- payload
2625
- );
2626
- }
2627
-
2628
- /**
2629
- * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
2630
- *
2631
- * @param {Partial<Preferences>} params.prefs - Prefs key-value JSON object.
2632
- * @throws {AppwriteException}
2633
- * @returns {Promise<Models.User<Preferences>>}
2634
- */
2635
- updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { prefs: Partial<Preferences> }): Promise<Models.User<Preferences>>;
2636
- /**
2637
- * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
2638
- *
2639
- * @param {Partial<Preferences>} prefs - Prefs key-value JSON object.
2640
- * @throws {AppwriteException}
2641
- * @returns {Promise<Models.User<Preferences>>}
2642
- * @deprecated Use the object parameter style method for a better developer experience.
2643
- */
2644
- updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>;
2645
- updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(
2646
- paramsOrFirst: { prefs: Partial<Preferences> } | Partial<Preferences>
2647
- ): Promise<Models.User<Preferences>> {
2648
- let params: { prefs: Partial<Preferences> };
2649
-
2650
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('prefs' in paramsOrFirst))) {
2651
- params = (paramsOrFirst || {}) as { prefs: Partial<Preferences> };
2652
- } else {
2653
- params = {
2654
- prefs: paramsOrFirst as Partial<Preferences>
2655
- };
2656
- }
2657
-
2658
- const prefs = params.prefs;
2659
-
2660
- if (typeof prefs === 'undefined') {
2661
- throw new AppwriteException('Missing required parameter: "prefs"');
2662
- }
2663
-
2664
- const apiPath = '/account/prefs';
2665
- const payload: Payload = {};
2666
- if (typeof prefs !== 'undefined') {
2667
- payload['prefs'] = prefs;
2668
- }
2669
- const uri = new URL(this.client.config.endpoint + apiPath);
2670
-
2671
- const apiHeaders: { [header: string]: string } = {
2672
- 'content-type': 'application/json',
2673
- }
2674
-
2675
- return this.client.call(
2676
- 'patch',
2677
- uri,
2678
- apiHeaders,
2679
- payload
2680
- );
2681
- }
2682
-
2683
- /**
2684
- * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
2685
- *
2686
- * @param {string} params.email - User email.
2687
- * @param {string} params.url - URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2688
- * @throws {AppwriteException}
2689
- * @returns {Promise<Models.Token>}
2690
- */
2691
- createRecovery(params: { email: string, url: string }): Promise<Models.Token>;
2692
- /**
2693
- * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
2694
- *
2695
- * @param {string} email - User email.
2696
- * @param {string} url - URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2697
- * @throws {AppwriteException}
2698
- * @returns {Promise<Models.Token>}
2699
- * @deprecated Use the object parameter style method for a better developer experience.
2700
- */
2701
- createRecovery(email: string, url: string): Promise<Models.Token>;
2702
- createRecovery(
2703
- paramsOrFirst: { email: string, url: string } | string,
2704
- ...rest: [(string)?]
2705
- ): Promise<Models.Token> {
2706
- let params: { email: string, url: string };
2707
-
2708
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2709
- params = (paramsOrFirst || {}) as { email: string, url: string };
2710
- } else {
2711
- params = {
2712
- email: paramsOrFirst as string,
2713
- url: rest[0] as string
2714
- };
2715
- }
2716
-
2717
- const email = params.email;
2718
- const url = params.url;
2719
-
2720
- if (typeof email === 'undefined') {
2721
- throw new AppwriteException('Missing required parameter: "email"');
2722
- }
2723
- if (typeof url === 'undefined') {
2724
- throw new AppwriteException('Missing required parameter: "url"');
2725
- }
2726
-
2727
- const apiPath = '/account/recovery';
2728
- const payload: Payload = {};
2729
- if (typeof email !== 'undefined') {
2730
- payload['email'] = email;
2731
- }
2732
- if (typeof url !== 'undefined') {
2733
- payload['url'] = url;
2734
- }
2735
- const uri = new URL(this.client.config.endpoint + apiPath);
2736
-
2737
- const apiHeaders: { [header: string]: string } = {
2738
- 'content-type': 'application/json',
2739
- }
2740
-
2741
- return this.client.call(
2742
- 'post',
2743
- uri,
2744
- apiHeaders,
2745
- payload
2746
- );
2747
- }
2748
-
2749
- /**
2750
- * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
2751
- *
2752
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
2753
- *
2754
- * @param {string} params.userId - User ID.
2755
- * @param {string} params.secret - Valid reset token.
2756
- * @param {string} params.password - New user password. Must be between 8 and 256 chars.
2757
- * @throws {AppwriteException}
2758
- * @returns {Promise<Models.Token>}
2759
- */
2760
- updateRecovery(params: { userId: string, secret: string, password: string }): Promise<Models.Token>;
2761
- /**
2762
- * Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
2763
- *
2764
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
2765
- *
2766
- * @param {string} userId - User ID.
2767
- * @param {string} secret - Valid reset token.
2768
- * @param {string} password - New user password. Must be between 8 and 256 chars.
2769
- * @throws {AppwriteException}
2770
- * @returns {Promise<Models.Token>}
2771
- * @deprecated Use the object parameter style method for a better developer experience.
2772
- */
2773
- updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>;
2774
- updateRecovery(
2775
- paramsOrFirst: { userId: string, secret: string, password: string } | string,
2776
- ...rest: [(string)?, (string)?]
2777
- ): Promise<Models.Token> {
2778
- let params: { userId: string, secret: string, password: string };
2779
-
2780
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2781
- params = (paramsOrFirst || {}) as { userId: string, secret: string, password: string };
2782
- } else {
2783
- params = {
2784
- userId: paramsOrFirst as string,
2785
- secret: rest[0] as string,
2786
- password: rest[1] as string
2787
- };
2788
- }
2789
-
2790
- const userId = params.userId;
2791
- const secret = params.secret;
2792
- const password = params.password;
2793
-
2794
- if (typeof userId === 'undefined') {
2795
- throw new AppwriteException('Missing required parameter: "userId"');
2796
- }
2797
- if (typeof secret === 'undefined') {
2798
- throw new AppwriteException('Missing required parameter: "secret"');
2799
- }
2800
- if (typeof password === 'undefined') {
2801
- throw new AppwriteException('Missing required parameter: "password"');
2802
- }
2803
-
2804
- const apiPath = '/account/recovery';
2805
- const payload: Payload = {};
2806
- if (typeof userId !== 'undefined') {
2807
- payload['userId'] = userId;
2808
- }
2809
- if (typeof secret !== 'undefined') {
2810
- payload['secret'] = secret;
2811
- }
2812
- if (typeof password !== 'undefined') {
2813
- payload['password'] = password;
2814
- }
2815
- const uri = new URL(this.client.config.endpoint + apiPath);
2816
-
2817
- const apiHeaders: { [header: string]: string } = {
2818
- 'content-type': 'application/json',
2819
- }
2820
-
2821
- return this.client.call(
2822
- 'put',
2823
- uri,
2824
- apiHeaders,
2825
- payload
2826
- );
2827
- }
2828
-
2829
- /**
2830
- * Get the list of active sessions across different devices for the currently logged in user.
2831
- *
2832
- * @throws {AppwriteException}
2833
- * @returns {Promise<Models.SessionList>}
2834
- */
2835
- listSessions(): Promise<Models.SessionList> {
2836
-
2837
- const apiPath = '/account/sessions';
2838
- const payload: Payload = {};
2839
- const uri = new URL(this.client.config.endpoint + apiPath);
2840
-
2841
- const apiHeaders: { [header: string]: string } = {
2842
- }
2843
-
2844
- return this.client.call(
2845
- 'get',
2846
- uri,
2847
- apiHeaders,
2848
- payload
2849
- );
2850
- }
2851
-
2852
- /**
2853
- * Delete all sessions from the user account and remove any sessions cookies from the end client.
2854
- *
2855
- * @throws {AppwriteException}
2856
- * @returns {Promise<{}>}
2857
- */
2858
- deleteSessions(): Promise<{}> {
2859
-
2860
- const apiPath = '/account/sessions';
2861
- const payload: Payload = {};
2862
- const uri = new URL(this.client.config.endpoint + apiPath);
2863
-
2864
- const apiHeaders: { [header: string]: string } = {
2865
- 'content-type': 'application/json',
2866
- }
2867
-
2868
- return this.client.call(
2869
- 'delete',
2870
- uri,
2871
- apiHeaders,
2872
- payload
2873
- );
2874
- }
2875
-
2876
- /**
2877
- * Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
2878
- *
2879
- * @throws {AppwriteException}
2880
- * @returns {Promise<Models.Session>}
2881
- */
2882
- createAnonymousSession(): Promise<Models.Session> {
2883
-
2884
- const apiPath = '/account/sessions/anonymous';
2885
- const payload: Payload = {};
2886
- const uri = new URL(this.client.config.endpoint + apiPath);
2887
-
2888
- const apiHeaders: { [header: string]: string } = {
2889
- 'content-type': 'application/json',
2890
- }
2891
-
2892
- return this.client.call(
2893
- 'post',
2894
- uri,
2895
- apiHeaders,
2896
- payload
2897
- );
2898
- }
2899
-
2900
- /**
2901
- * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
2902
- *
2903
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
2904
- *
2905
- * @param {string} params.email - User email.
2906
- * @param {string} params.password - User password. Must be at least 8 chars.
2907
- * @throws {AppwriteException}
2908
- * @returns {Promise<Models.Session>}
2909
- */
2910
- createEmailPasswordSession(params: { email: string, password: string }): Promise<Models.Session>;
2911
- /**
2912
- * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
2913
- *
2914
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
2915
- *
2916
- * @param {string} email - User email.
2917
- * @param {string} password - User password. Must be at least 8 chars.
2918
- * @throws {AppwriteException}
2919
- * @returns {Promise<Models.Session>}
2920
- * @deprecated Use the object parameter style method for a better developer experience.
2921
- */
2922
- createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
2923
- createEmailPasswordSession(
2924
- paramsOrFirst: { email: string, password: string } | string,
2925
- ...rest: [(string)?]
2926
- ): Promise<Models.Session> {
2927
- let params: { email: string, password: string };
2928
-
2929
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2930
- params = (paramsOrFirst || {}) as { email: string, password: string };
2931
- } else {
2932
- params = {
2933
- email: paramsOrFirst as string,
2934
- password: rest[0] as string
2935
- };
2936
- }
2937
-
2938
- const email = params.email;
2939
- const password = params.password;
2940
-
2941
- if (typeof email === 'undefined') {
2942
- throw new AppwriteException('Missing required parameter: "email"');
2943
- }
2944
- if (typeof password === 'undefined') {
2945
- throw new AppwriteException('Missing required parameter: "password"');
2946
- }
2947
-
2948
- const apiPath = '/account/sessions/email';
2949
- const payload: Payload = {};
2950
- if (typeof email !== 'undefined') {
2951
- payload['email'] = email;
2952
- }
2953
- if (typeof password !== 'undefined') {
2954
- payload['password'] = password;
2955
- }
2956
- const uri = new URL(this.client.config.endpoint + apiPath);
2957
-
2958
- const apiHeaders: { [header: string]: string } = {
2959
- 'content-type': 'application/json',
2960
- }
2961
-
2962
- return this.client.call(
2963
- 'post',
2964
- uri,
2965
- apiHeaders,
2966
- payload
2967
- );
2968
- }
2969
-
2970
- /**
2971
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
2972
- *
2973
- * @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2974
- * @param {string} params.secret - Valid verification token.
2975
- * @throws {AppwriteException}
2976
- * @returns {Promise<Models.Session>}
2977
- * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
2978
- */
2979
- updateMagicURLSession(params: { userId: string, secret: string }): Promise<Models.Session>;
2980
- /**
2981
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
2982
- *
2983
- * @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2984
- * @param {string} secret - Valid verification token.
2985
- * @throws {AppwriteException}
2986
- * @returns {Promise<Models.Session>}
2987
- * @deprecated Use the object parameter style method for a better developer experience.
2988
- */
2989
- updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>;
2990
- updateMagicURLSession(
2991
- paramsOrFirst: { userId: string, secret: string } | string,
2992
- ...rest: [(string)?]
2993
- ): Promise<Models.Session> {
2994
- let params: { userId: string, secret: string };
2995
-
2996
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2997
- params = (paramsOrFirst || {}) as { userId: string, secret: string };
2998
- } else {
2999
- params = {
3000
- userId: paramsOrFirst as string,
3001
- secret: rest[0] as string
3002
- };
3003
- }
3004
-
3005
- const userId = params.userId;
3006
- const secret = params.secret;
3007
-
3008
- if (typeof userId === 'undefined') {
3009
- throw new AppwriteException('Missing required parameter: "userId"');
3010
- }
3011
- if (typeof secret === 'undefined') {
3012
- throw new AppwriteException('Missing required parameter: "secret"');
3013
- }
3014
-
3015
- const apiPath = '/account/sessions/magic-url';
3016
- const payload: Payload = {};
3017
- if (typeof userId !== 'undefined') {
3018
- payload['userId'] = userId;
3019
- }
3020
- if (typeof secret !== 'undefined') {
3021
- payload['secret'] = secret;
3022
- }
3023
- const uri = new URL(this.client.config.endpoint + apiPath);
3024
-
3025
- const apiHeaders: { [header: string]: string } = {
3026
- 'content-type': 'application/json',
3027
- }
3028
-
3029
- return this.client.call(
3030
- 'put',
3031
- uri,
3032
- apiHeaders,
3033
- payload
3034
- );
3035
- }
3036
-
3037
- /**
3038
- * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
3039
- *
3040
- * If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
3041
- *
3042
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3043
- *
3044
- *
3045
- * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
3046
- * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3047
- * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3048
- * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
3049
- * @throws {AppwriteException}
3050
- * @returns {void | string}
3051
- */
3052
- createOAuth2Session(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | string;
3053
- /**
3054
- * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
3055
- *
3056
- * If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
3057
- *
3058
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3059
- *
3060
- *
3061
- * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
3062
- * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3063
- * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3064
- * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
3065
- * @throws {AppwriteException}
3066
- * @returns {void | string}
3067
- * @deprecated Use the object parameter style method for a better developer experience.
3068
- */
3069
- createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string;
3070
- createOAuth2Session(
3071
- paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider,
3072
- ...rest: [(string)?, (string)?, (string[])?]
3073
- ): void | string {
3074
- let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
3075
-
3076
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) {
3077
- params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
3078
- } else {
3079
- params = {
3080
- provider: paramsOrFirst as OAuthProvider,
3081
- success: rest[0] as string,
3082
- failure: rest[1] as string,
3083
- scopes: rest[2] as string[]
3084
- };
3085
- }
3086
-
3087
- const provider = params.provider;
3088
- const success = params.success;
3089
- const failure = params.failure;
3090
- const scopes = params.scopes;
3091
-
3092
- if (typeof provider === 'undefined') {
3093
- throw new AppwriteException('Missing required parameter: "provider"');
3094
- }
3095
-
3096
- const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
3097
- const payload: Payload = {};
3098
- if (typeof success !== 'undefined') {
3099
- payload['success'] = success;
3100
- }
3101
- if (typeof failure !== 'undefined') {
3102
- payload['failure'] = failure;
3103
- }
3104
- if (typeof scopes !== 'undefined') {
3105
- payload['scopes'] = scopes;
3106
- }
3107
- const uri = new URL(this.client.config.endpoint + apiPath);
3108
-
3109
- const apiHeaders: { [header: string]: string } = {
3110
- }
3111
-
3112
- payload['project'] = this.client.config.project;
3113
-
3114
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
3115
- uri.searchParams.append(key, value);
3116
- }
3117
-
3118
- if (typeof window !== 'undefined' && window?.location) {
3119
- window.location.href = uri.toString();
3120
- return;
3121
- } else {
3122
- return uri.toString();
3123
- }
3124
- }
3125
-
3126
- /**
3127
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
3128
- *
3129
- * @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
3130
- * @param {string} params.secret - Valid verification token.
3131
- * @throws {AppwriteException}
3132
- * @returns {Promise<Models.Session>}
3133
- * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
3134
- */
3135
- updatePhoneSession(params: { userId: string, secret: string }): Promise<Models.Session>;
3136
- /**
3137
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
3138
- *
3139
- * @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
3140
- * @param {string} secret - Valid verification token.
3141
- * @throws {AppwriteException}
3142
- * @returns {Promise<Models.Session>}
3143
- * @deprecated Use the object parameter style method for a better developer experience.
3144
- */
3145
- updatePhoneSession(userId: string, secret: string): Promise<Models.Session>;
3146
- updatePhoneSession(
3147
- paramsOrFirst: { userId: string, secret: string } | string,
3148
- ...rest: [(string)?]
3149
- ): Promise<Models.Session> {
3150
- let params: { userId: string, secret: string };
3151
-
3152
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3153
- params = (paramsOrFirst || {}) as { userId: string, secret: string };
3154
- } else {
3155
- params = {
3156
- userId: paramsOrFirst as string,
3157
- secret: rest[0] as string
3158
- };
3159
- }
3160
-
3161
- const userId = params.userId;
3162
- const secret = params.secret;
3163
-
3164
- if (typeof userId === 'undefined') {
3165
- throw new AppwriteException('Missing required parameter: "userId"');
3166
- }
3167
- if (typeof secret === 'undefined') {
3168
- throw new AppwriteException('Missing required parameter: "secret"');
3169
- }
3170
-
3171
- const apiPath = '/account/sessions/phone';
3172
- const payload: Payload = {};
3173
- if (typeof userId !== 'undefined') {
3174
- payload['userId'] = userId;
3175
- }
3176
- if (typeof secret !== 'undefined') {
3177
- payload['secret'] = secret;
3178
- }
3179
- const uri = new URL(this.client.config.endpoint + apiPath);
3180
-
3181
- const apiHeaders: { [header: string]: string } = {
3182
- 'content-type': 'application/json',
3183
- }
3184
-
3185
- return this.client.call(
3186
- 'put',
3187
- uri,
3188
- apiHeaders,
3189
- payload
3190
- );
3191
- }
3192
-
3193
- /**
3194
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
3195
- *
3196
- * @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
3197
- * @param {string} params.secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
3198
- * @throws {AppwriteException}
3199
- * @returns {Promise<Models.Session>}
3200
- */
3201
- createSession(params: { userId: string, secret: string }): Promise<Models.Session>;
3202
- /**
3203
- * Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
3204
- *
3205
- * @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
3206
- * @param {string} secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
3207
- * @throws {AppwriteException}
3208
- * @returns {Promise<Models.Session>}
3209
- * @deprecated Use the object parameter style method for a better developer experience.
3210
- */
3211
- createSession(userId: string, secret: string): Promise<Models.Session>;
3212
- createSession(
3213
- paramsOrFirst: { userId: string, secret: string } | string,
3214
- ...rest: [(string)?]
3215
- ): Promise<Models.Session> {
3216
- let params: { userId: string, secret: string };
3217
-
3218
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3219
- params = (paramsOrFirst || {}) as { userId: string, secret: string };
3220
- } else {
3221
- params = {
3222
- userId: paramsOrFirst as string,
3223
- secret: rest[0] as string
3224
- };
3225
- }
3226
-
3227
- const userId = params.userId;
3228
- const secret = params.secret;
3229
-
3230
- if (typeof userId === 'undefined') {
3231
- throw new AppwriteException('Missing required parameter: "userId"');
3232
- }
3233
- if (typeof secret === 'undefined') {
3234
- throw new AppwriteException('Missing required parameter: "secret"');
3235
- }
3236
-
3237
- const apiPath = '/account/sessions/token';
3238
- const payload: Payload = {};
3239
- if (typeof userId !== 'undefined') {
3240
- payload['userId'] = userId;
3241
- }
3242
- if (typeof secret !== 'undefined') {
3243
- payload['secret'] = secret;
3244
- }
3245
- const uri = new URL(this.client.config.endpoint + apiPath);
3246
-
3247
- const apiHeaders: { [header: string]: string } = {
3248
- 'content-type': 'application/json',
3249
- }
3250
-
3251
- return this.client.call(
3252
- 'post',
3253
- uri,
3254
- apiHeaders,
3255
- payload
3256
- );
3257
- }
3258
-
3259
- /**
3260
- * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
3261
- *
3262
- * @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session.
3263
- * @throws {AppwriteException}
3264
- * @returns {Promise<Models.Session>}
3265
- */
3266
- getSession(params: { sessionId: string }): Promise<Models.Session>;
3267
- /**
3268
- * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
3269
- *
3270
- * @param {string} sessionId - Session ID. Use the string 'current' to get the current device session.
3271
- * @throws {AppwriteException}
3272
- * @returns {Promise<Models.Session>}
3273
- * @deprecated Use the object parameter style method for a better developer experience.
3274
- */
3275
- getSession(sessionId: string): Promise<Models.Session>;
3276
- getSession(
3277
- paramsOrFirst: { sessionId: string } | string
3278
- ): Promise<Models.Session> {
3279
- let params: { sessionId: string };
3280
-
3281
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3282
- params = (paramsOrFirst || {}) as { sessionId: string };
3283
- } else {
3284
- params = {
3285
- sessionId: paramsOrFirst as string
3286
- };
3287
- }
3288
-
3289
- const sessionId = params.sessionId;
3290
-
3291
- if (typeof sessionId === 'undefined') {
3292
- throw new AppwriteException('Missing required parameter: "sessionId"');
3293
- }
3294
-
3295
- const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
3296
- const payload: Payload = {};
3297
- const uri = new URL(this.client.config.endpoint + apiPath);
3298
-
3299
- const apiHeaders: { [header: string]: string } = {
3300
- }
3301
-
3302
- return this.client.call(
3303
- 'get',
3304
- uri,
3305
- apiHeaders,
3306
- payload
3307
- );
3308
- }
3309
-
3310
- /**
3311
- * Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
3312
- *
3313
- * @param {string} params.sessionId - Session ID. Use the string 'current' to update the current device session.
3314
- * @throws {AppwriteException}
3315
- * @returns {Promise<Models.Session>}
3316
- */
3317
- updateSession(params: { sessionId: string }): Promise<Models.Session>;
3318
- /**
3319
- * Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
3320
- *
3321
- * @param {string} sessionId - Session ID. Use the string 'current' to update the current device session.
3322
- * @throws {AppwriteException}
3323
- * @returns {Promise<Models.Session>}
3324
- * @deprecated Use the object parameter style method for a better developer experience.
3325
- */
3326
- updateSession(sessionId: string): Promise<Models.Session>;
3327
- updateSession(
3328
- paramsOrFirst: { sessionId: string } | string
3329
- ): Promise<Models.Session> {
3330
- let params: { sessionId: string };
3331
-
3332
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3333
- params = (paramsOrFirst || {}) as { sessionId: string };
3334
- } else {
3335
- params = {
3336
- sessionId: paramsOrFirst as string
3337
- };
3338
- }
3339
-
3340
- const sessionId = params.sessionId;
3341
-
3342
- if (typeof sessionId === 'undefined') {
3343
- throw new AppwriteException('Missing required parameter: "sessionId"');
3344
- }
3345
-
3346
- const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
3347
- const payload: Payload = {};
3348
- const uri = new URL(this.client.config.endpoint + apiPath);
3349
-
3350
- const apiHeaders: { [header: string]: string } = {
3351
- 'content-type': 'application/json',
3352
- }
3353
-
3354
- return this.client.call(
3355
- 'patch',
3356
- uri,
3357
- apiHeaders,
3358
- payload
3359
- );
3360
- }
3361
-
3362
- /**
3363
- * Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
3364
- *
3365
- * @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session.
3366
- * @throws {AppwriteException}
3367
- * @returns {Promise<{}>}
3368
- */
3369
- deleteSession(params: { sessionId: string }): Promise<{}>;
3370
- /**
3371
- * Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
3372
- *
3373
- * @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session.
3374
- * @throws {AppwriteException}
3375
- * @returns {Promise<{}>}
3376
- * @deprecated Use the object parameter style method for a better developer experience.
3377
- */
3378
- deleteSession(sessionId: string): Promise<{}>;
3379
- deleteSession(
3380
- paramsOrFirst: { sessionId: string } | string
3381
- ): Promise<{}> {
3382
- let params: { sessionId: string };
3383
-
3384
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3385
- params = (paramsOrFirst || {}) as { sessionId: string };
3386
- } else {
3387
- params = {
3388
- sessionId: paramsOrFirst as string
3389
- };
3390
- }
3391
-
3392
- const sessionId = params.sessionId;
3393
-
3394
- if (typeof sessionId === 'undefined') {
3395
- throw new AppwriteException('Missing required parameter: "sessionId"');
3396
- }
3397
-
3398
- const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
3399
- const payload: Payload = {};
3400
- const uri = new URL(this.client.config.endpoint + apiPath);
3401
-
3402
- const apiHeaders: { [header: string]: string } = {
3403
- 'content-type': 'application/json',
3404
- }
3405
-
3406
- return this.client.call(
3407
- 'delete',
3408
- uri,
3409
- apiHeaders,
3410
- payload
3411
- );
3412
- }
3413
-
3414
- /**
3415
- * Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
3416
- *
3417
- * @throws {AppwriteException}
3418
- * @returns {Promise<Models.User<Preferences>>}
3419
- */
3420
- updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
3421
-
3422
- const apiPath = '/account/status';
3423
- const payload: Payload = {};
3424
- const uri = new URL(this.client.config.endpoint + apiPath);
3425
-
3426
- const apiHeaders: { [header: string]: string } = {
3427
- 'content-type': 'application/json',
3428
- }
3429
-
3430
- return this.client.call(
3431
- 'patch',
3432
- uri,
3433
- apiHeaders,
3434
- payload
3435
- );
3436
- }
3437
-
3438
- /**
3439
- * Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
3440
- *
3441
- * @param {string} params.targetId - Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
3442
- * @param {string} params.identifier - The target identifier (token, email, phone etc.)
3443
- * @param {string} params.providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
3444
- * @throws {AppwriteException}
3445
- * @returns {Promise<Models.Target>}
3446
- */
3447
- createPushTarget(params: { targetId: string, identifier: string, providerId?: string }): Promise<Models.Target>;
3448
- /**
3449
- * Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
3450
- *
3451
- * @param {string} targetId - Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
3452
- * @param {string} identifier - The target identifier (token, email, phone etc.)
3453
- * @param {string} providerId - Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
3454
- * @throws {AppwriteException}
3455
- * @returns {Promise<Models.Target>}
3456
- * @deprecated Use the object parameter style method for a better developer experience.
3457
- */
3458
- createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>;
3459
- createPushTarget(
3460
- paramsOrFirst: { targetId: string, identifier: string, providerId?: string } | string,
3461
- ...rest: [(string)?, (string)?]
3462
- ): Promise<Models.Target> {
3463
- let params: { targetId: string, identifier: string, providerId?: string };
3464
-
3465
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3466
- params = (paramsOrFirst || {}) as { targetId: string, identifier: string, providerId?: string };
3467
- } else {
3468
- params = {
3469
- targetId: paramsOrFirst as string,
3470
- identifier: rest[0] as string,
3471
- providerId: rest[1] as string
3472
- };
3473
- }
3474
-
3475
- const targetId = params.targetId;
3476
- const identifier = params.identifier;
3477
- const providerId = params.providerId;
3478
-
3479
- if (typeof targetId === 'undefined') {
3480
- throw new AppwriteException('Missing required parameter: "targetId"');
3481
- }
3482
- if (typeof identifier === 'undefined') {
3483
- throw new AppwriteException('Missing required parameter: "identifier"');
3484
- }
3485
-
3486
- const apiPath = '/account/targets/push';
3487
- const payload: Payload = {};
3488
- if (typeof targetId !== 'undefined') {
3489
- payload['targetId'] = targetId;
3490
- }
3491
- if (typeof identifier !== 'undefined') {
3492
- payload['identifier'] = identifier;
3493
- }
3494
- if (typeof providerId !== 'undefined') {
3495
- payload['providerId'] = providerId;
3496
- }
3497
- const uri = new URL(this.client.config.endpoint + apiPath);
3498
-
3499
- const apiHeaders: { [header: string]: string } = {
3500
- 'content-type': 'application/json',
3501
- }
3502
-
3503
- return this.client.call(
3504
- 'post',
3505
- uri,
3506
- apiHeaders,
3507
- payload
3508
- );
3509
- }
3510
-
3511
- /**
3512
- * Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
3513
- *
3514
- * @param {string} params.targetId - Target ID.
3515
- * @param {string} params.identifier - The target identifier (token, email, phone etc.)
3516
- * @throws {AppwriteException}
3517
- * @returns {Promise<Models.Target>}
3518
- */
3519
- updatePushTarget(params: { targetId: string, identifier: string }): Promise<Models.Target>;
3520
- /**
3521
- * Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
3522
- *
3523
- * @param {string} targetId - Target ID.
3524
- * @param {string} identifier - The target identifier (token, email, phone etc.)
3525
- * @throws {AppwriteException}
3526
- * @returns {Promise<Models.Target>}
3527
- * @deprecated Use the object parameter style method for a better developer experience.
3528
- */
3529
- updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>;
3530
- updatePushTarget(
3531
- paramsOrFirst: { targetId: string, identifier: string } | string,
3532
- ...rest: [(string)?]
3533
- ): Promise<Models.Target> {
3534
- let params: { targetId: string, identifier: string };
3535
-
3536
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3537
- params = (paramsOrFirst || {}) as { targetId: string, identifier: string };
3538
- } else {
3539
- params = {
3540
- targetId: paramsOrFirst as string,
3541
- identifier: rest[0] as string
3542
- };
3543
- }
3544
-
3545
- const targetId = params.targetId;
3546
- const identifier = params.identifier;
3547
-
3548
- if (typeof targetId === 'undefined') {
3549
- throw new AppwriteException('Missing required parameter: "targetId"');
3550
- }
3551
- if (typeof identifier === 'undefined') {
3552
- throw new AppwriteException('Missing required parameter: "identifier"');
3553
- }
3554
-
3555
- const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
3556
- const payload: Payload = {};
3557
- if (typeof identifier !== 'undefined') {
3558
- payload['identifier'] = identifier;
3559
- }
3560
- const uri = new URL(this.client.config.endpoint + apiPath);
3561
-
3562
- const apiHeaders: { [header: string]: string } = {
3563
- 'content-type': 'application/json',
3564
- }
3565
-
3566
- return this.client.call(
3567
- 'put',
3568
- uri,
3569
- apiHeaders,
3570
- payload
3571
- );
3572
- }
3573
-
3574
- /**
3575
- * Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
3576
- *
3577
- * @param {string} params.targetId - Target ID.
3578
- * @throws {AppwriteException}
3579
- * @returns {Promise<{}>}
3580
- */
3581
- deletePushTarget(params: { targetId: string }): Promise<{}>;
3582
- /**
3583
- * Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
3584
- *
3585
- * @param {string} targetId - Target ID.
3586
- * @throws {AppwriteException}
3587
- * @returns {Promise<{}>}
3588
- * @deprecated Use the object parameter style method for a better developer experience.
3589
- */
3590
- deletePushTarget(targetId: string): Promise<{}>;
3591
- deletePushTarget(
3592
- paramsOrFirst: { targetId: string } | string
3593
- ): Promise<{}> {
3594
- let params: { targetId: string };
3595
-
3596
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3597
- params = (paramsOrFirst || {}) as { targetId: string };
3598
- } else {
3599
- params = {
3600
- targetId: paramsOrFirst as string
3601
- };
3602
- }
3603
-
3604
- const targetId = params.targetId;
3605
-
3606
- if (typeof targetId === 'undefined') {
3607
- throw new AppwriteException('Missing required parameter: "targetId"');
3608
- }
3609
-
3610
- const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
3611
- const payload: Payload = {};
3612
- const uri = new URL(this.client.config.endpoint + apiPath);
3613
-
3614
- const apiHeaders: { [header: string]: string } = {
3615
- 'content-type': 'application/json',
3616
- }
3617
-
3618
- return this.client.call(
3619
- 'delete',
3620
- uri,
3621
- apiHeaders,
3622
- payload
3623
- );
3624
- }
3625
-
3626
- /**
3627
- * Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
3628
- *
3629
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3630
- *
3631
- *
3632
- * @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
3633
- * @param {string} params.email - User email.
3634
- * @param {boolean} params.phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
3635
- * @throws {AppwriteException}
3636
- * @returns {Promise<Models.Token>}
3637
- */
3638
- createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise<Models.Token>;
3639
- /**
3640
- * Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
3641
- *
3642
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3643
- *
3644
- *
3645
- * @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
3646
- * @param {string} email - User email.
3647
- * @param {boolean} phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
3648
- * @throws {AppwriteException}
3649
- * @returns {Promise<Models.Token>}
3650
- * @deprecated Use the object parameter style method for a better developer experience.
3651
- */
3652
- createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>;
3653
- createEmailToken(
3654
- paramsOrFirst: { userId: string, email: string, phrase?: boolean } | string,
3655
- ...rest: [(string)?, (boolean)?]
3656
- ): Promise<Models.Token> {
3657
- let params: { userId: string, email: string, phrase?: boolean };
3658
-
3659
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3660
- params = (paramsOrFirst || {}) as { userId: string, email: string, phrase?: boolean };
3661
- } else {
3662
- params = {
3663
- userId: paramsOrFirst as string,
3664
- email: rest[0] as string,
3665
- phrase: rest[1] as boolean
3666
- };
3667
- }
3668
-
3669
- const userId = params.userId;
3670
- const email = params.email;
3671
- const phrase = params.phrase;
3672
-
3673
- if (typeof userId === 'undefined') {
3674
- throw new AppwriteException('Missing required parameter: "userId"');
3675
- }
3676
- if (typeof email === 'undefined') {
3677
- throw new AppwriteException('Missing required parameter: "email"');
3678
- }
3679
-
3680
- const apiPath = '/account/tokens/email';
3681
- const payload: Payload = {};
3682
- if (typeof userId !== 'undefined') {
3683
- payload['userId'] = userId;
3684
- }
3685
- if (typeof email !== 'undefined') {
3686
- payload['email'] = email;
3687
- }
3688
- if (typeof phrase !== 'undefined') {
3689
- payload['phrase'] = phrase;
3690
- }
3691
- const uri = new URL(this.client.config.endpoint + apiPath);
3692
-
3693
- const apiHeaders: { [header: string]: string } = {
3694
- 'content-type': 'application/json',
3695
- }
3696
-
3697
- return this.client.call(
3698
- 'post',
3699
- uri,
3700
- apiHeaders,
3701
- payload
3702
- );
3703
- }
3704
-
3705
- /**
3706
- * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
3707
- *
3708
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3709
- *
3710
- *
3711
- * @param {string} params.userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
3712
- * @param {string} params.email - User email.
3713
- * @param {string} params.url - URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3714
- * @param {boolean} params.phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
3715
- * @throws {AppwriteException}
3716
- * @returns {Promise<Models.Token>}
3717
- */
3718
- createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise<Models.Token>;
3719
- /**
3720
- * Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
3721
- *
3722
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3723
- *
3724
- *
3725
- * @param {string} userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
3726
- * @param {string} email - User email.
3727
- * @param {string} url - URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3728
- * @param {boolean} phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
3729
- * @throws {AppwriteException}
3730
- * @returns {Promise<Models.Token>}
3731
- * @deprecated Use the object parameter style method for a better developer experience.
3732
- */
3733
- createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>;
3734
- createMagicURLToken(
3735
- paramsOrFirst: { userId: string, email: string, url?: string, phrase?: boolean } | string,
3736
- ...rest: [(string)?, (string)?, (boolean)?]
3737
- ): Promise<Models.Token> {
3738
- let params: { userId: string, email: string, url?: string, phrase?: boolean };
3739
-
3740
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3741
- params = (paramsOrFirst || {}) as { userId: string, email: string, url?: string, phrase?: boolean };
3742
- } else {
3743
- params = {
3744
- userId: paramsOrFirst as string,
3745
- email: rest[0] as string,
3746
- url: rest[1] as string,
3747
- phrase: rest[2] as boolean
3748
- };
3749
- }
3750
-
3751
- const userId = params.userId;
3752
- const email = params.email;
3753
- const url = params.url;
3754
- const phrase = params.phrase;
3755
-
3756
- if (typeof userId === 'undefined') {
3757
- throw new AppwriteException('Missing required parameter: "userId"');
3758
- }
3759
- if (typeof email === 'undefined') {
3760
- throw new AppwriteException('Missing required parameter: "email"');
3761
- }
3762
-
3763
- const apiPath = '/account/tokens/magic-url';
3764
- const payload: Payload = {};
3765
- if (typeof userId !== 'undefined') {
3766
- payload['userId'] = userId;
3767
- }
3768
- if (typeof email !== 'undefined') {
3769
- payload['email'] = email;
3770
- }
3771
- if (typeof url !== 'undefined') {
3772
- payload['url'] = url;
3773
- }
3774
- if (typeof phrase !== 'undefined') {
3775
- payload['phrase'] = phrase;
3776
- }
3777
- const uri = new URL(this.client.config.endpoint + apiPath);
3778
-
3779
- const apiHeaders: { [header: string]: string } = {
3780
- 'content-type': 'application/json',
3781
- }
3782
-
3783
- return this.client.call(
3784
- 'post',
3785
- uri,
3786
- apiHeaders,
3787
- payload
3788
- );
3789
- }
3790
-
3791
- /**
3792
- * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
3793
- *
3794
- * If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
3795
- *
3796
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3797
- *
3798
- * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
3799
- * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3800
- * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3801
- * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
3802
- * @throws {AppwriteException}
3803
- * @returns {void | string}
3804
- */
3805
- createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | string;
3806
- /**
3807
- * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
3808
- *
3809
- * If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
3810
- *
3811
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3812
- *
3813
- * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
3814
- * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3815
- * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3816
- * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
3817
- * @throws {AppwriteException}
3818
- * @returns {void | string}
3819
- * @deprecated Use the object parameter style method for a better developer experience.
3820
- */
3821
- createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | string;
3822
- createOAuth2Token(
3823
- paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider,
3824
- ...rest: [(string)?, (string)?, (string[])?]
3825
- ): void | string {
3826
- let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
3827
-
3828
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) {
3829
- params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
3830
- } else {
3831
- params = {
3832
- provider: paramsOrFirst as OAuthProvider,
3833
- success: rest[0] as string,
3834
- failure: rest[1] as string,
3835
- scopes: rest[2] as string[]
3836
- };
3837
- }
3838
-
3839
- const provider = params.provider;
3840
- const success = params.success;
3841
- const failure = params.failure;
3842
- const scopes = params.scopes;
3843
-
3844
- if (typeof provider === 'undefined') {
3845
- throw new AppwriteException('Missing required parameter: "provider"');
3846
- }
3847
-
3848
- const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
3849
- const payload: Payload = {};
3850
- if (typeof success !== 'undefined') {
3851
- payload['success'] = success;
3852
- }
3853
- if (typeof failure !== 'undefined') {
3854
- payload['failure'] = failure;
3855
- }
3856
- if (typeof scopes !== 'undefined') {
3857
- payload['scopes'] = scopes;
3858
- }
3859
- const uri = new URL(this.client.config.endpoint + apiPath);
3860
-
3861
- const apiHeaders: { [header: string]: string } = {
3862
- }
3863
-
3864
- payload['project'] = this.client.config.project;
3865
-
3866
- for (const [key, value] of Object.entries(Service.flatten(payload))) {
3867
- uri.searchParams.append(key, value);
3868
- }
3869
-
3870
- if (typeof window !== 'undefined' && window?.location) {
3871
- window.location.href = uri.toString();
3872
- return;
3873
- } else {
3874
- return uri.toString();
3875
- }
3876
- }
3877
-
3878
- /**
3879
- * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
3880
- *
3881
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3882
- *
3883
- * @param {string} params.userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
3884
- * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
3885
- * @throws {AppwriteException}
3886
- * @returns {Promise<Models.Token>}
3887
- */
3888
- createPhoneToken(params: { userId: string, phone: string }): Promise<Models.Token>;
3889
- /**
3890
- * Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
3891
- *
3892
- * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3893
- *
3894
- * @param {string} userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
3895
- * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
3896
- * @throws {AppwriteException}
3897
- * @returns {Promise<Models.Token>}
3898
- * @deprecated Use the object parameter style method for a better developer experience.
3899
- */
3900
- createPhoneToken(userId: string, phone: string): Promise<Models.Token>;
3901
- createPhoneToken(
3902
- paramsOrFirst: { userId: string, phone: string } | string,
3903
- ...rest: [(string)?]
3904
- ): Promise<Models.Token> {
3905
- let params: { userId: string, phone: string };
3906
-
3907
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3908
- params = (paramsOrFirst || {}) as { userId: string, phone: string };
3909
- } else {
3910
- params = {
3911
- userId: paramsOrFirst as string,
3912
- phone: rest[0] as string
3913
- };
3914
- }
3915
-
3916
- const userId = params.userId;
3917
- const phone = params.phone;
3918
-
3919
- if (typeof userId === 'undefined') {
3920
- throw new AppwriteException('Missing required parameter: "userId"');
3921
- }
3922
- if (typeof phone === 'undefined') {
3923
- throw new AppwriteException('Missing required parameter: "phone"');
3924
- }
3925
-
3926
- const apiPath = '/account/tokens/phone';
3927
- const payload: Payload = {};
3928
- if (typeof userId !== 'undefined') {
3929
- payload['userId'] = userId;
3930
- }
3931
- if (typeof phone !== 'undefined') {
3932
- payload['phone'] = phone;
3933
- }
3934
- const uri = new URL(this.client.config.endpoint + apiPath);
3935
-
3936
- const apiHeaders: { [header: string]: string } = {
3937
- 'content-type': 'application/json',
3938
- }
3939
-
3940
- return this.client.call(
3941
- 'post',
3942
- uri,
3943
- apiHeaders,
3944
- payload
3945
- );
3946
- }
3947
-
3948
- /**
3949
- * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
3950
- *
3951
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
3952
- *
3953
- *
3954
- * @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3955
- * @throws {AppwriteException}
3956
- * @returns {Promise<Models.Token>}
3957
- */
3958
- createEmailVerification(params: { url: string }): Promise<Models.Token>;
3959
- /**
3960
- * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
3961
- *
3962
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
3963
- *
3964
- *
3965
- * @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3966
- * @throws {AppwriteException}
3967
- * @returns {Promise<Models.Token>}
3968
- * @deprecated Use the object parameter style method for a better developer experience.
3969
- */
3970
- createEmailVerification(url: string): Promise<Models.Token>;
3971
- createEmailVerification(
3972
- paramsOrFirst: { url: string } | string
3973
- ): Promise<Models.Token> {
3974
- let params: { url: string };
3975
-
3976
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3977
- params = (paramsOrFirst || {}) as { url: string };
3978
- } else {
3979
- params = {
3980
- url: paramsOrFirst as string
3981
- };
3982
- }
3983
-
3984
- const url = params.url;
3985
-
3986
- if (typeof url === 'undefined') {
3987
- throw new AppwriteException('Missing required parameter: "url"');
3988
- }
3989
-
3990
- const apiPath = '/account/verifications/email';
3991
- const payload: Payload = {};
3992
- if (typeof url !== 'undefined') {
3993
- payload['url'] = url;
3994
- }
3995
- const uri = new URL(this.client.config.endpoint + apiPath);
3996
-
3997
- const apiHeaders: { [header: string]: string } = {
3998
- 'content-type': 'application/json',
3999
- }
4000
-
4001
- return this.client.call(
4002
- 'post',
4003
- uri,
4004
- apiHeaders,
4005
- payload
4006
- );
4007
- }
4008
-
4009
- /**
4010
- * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
4011
- *
4012
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
4013
- *
4014
- *
4015
- * @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
4016
- * @throws {AppwriteException}
4017
- * @returns {Promise<Models.Token>}
4018
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.
4019
- */
4020
- createVerification(params: { url: string }): Promise<Models.Token>;
4021
- /**
4022
- * Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
4023
- *
4024
- * Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
4025
- *
4026
- *
4027
- * @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
4028
- * @throws {AppwriteException}
4029
- * @returns {Promise<Models.Token>}
4030
- * @deprecated Use the object parameter style method for a better developer experience.
4031
- */
4032
- createVerification(url: string): Promise<Models.Token>;
4033
- createVerification(
4034
- paramsOrFirst: { url: string } | string
4035
- ): Promise<Models.Token> {
4036
- let params: { url: string };
4037
-
4038
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4039
- params = (paramsOrFirst || {}) as { url: string };
4040
- } else {
4041
- params = {
4042
- url: paramsOrFirst as string
4043
- };
4044
- }
4045
-
4046
- const url = params.url;
4047
-
4048
- if (typeof url === 'undefined') {
4049
- throw new AppwriteException('Missing required parameter: "url"');
4050
- }
4051
-
4052
- const apiPath = '/account/verifications/email';
4053
- const payload: Payload = {};
4054
- if (typeof url !== 'undefined') {
4055
- payload['url'] = url;
4056
- }
4057
- const uri = new URL(this.client.config.endpoint + apiPath);
4058
-
4059
- const apiHeaders: { [header: string]: string } = {
4060
- 'content-type': 'application/json',
4061
- }
4062
-
4063
- return this.client.call(
4064
- 'post',
4065
- uri,
4066
- apiHeaders,
4067
- payload
4068
- );
4069
- }
4070
-
4071
- /**
4072
- * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
4073
- *
4074
- * @param {string} params.userId - User ID.
4075
- * @param {string} params.secret - Valid verification token.
4076
- * @throws {AppwriteException}
4077
- * @returns {Promise<Models.Token>}
4078
- */
4079
- updateEmailVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
4080
- /**
4081
- * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
4082
- *
4083
- * @param {string} userId - User ID.
4084
- * @param {string} secret - Valid verification token.
4085
- * @throws {AppwriteException}
4086
- * @returns {Promise<Models.Token>}
4087
- * @deprecated Use the object parameter style method for a better developer experience.
4088
- */
4089
- updateEmailVerification(userId: string, secret: string): Promise<Models.Token>;
4090
- updateEmailVerification(
4091
- paramsOrFirst: { userId: string, secret: string } | string,
4092
- ...rest: [(string)?]
4093
- ): Promise<Models.Token> {
4094
- let params: { userId: string, secret: string };
4095
-
4096
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4097
- params = (paramsOrFirst || {}) as { userId: string, secret: string };
4098
- } else {
4099
- params = {
4100
- userId: paramsOrFirst as string,
4101
- secret: rest[0] as string
4102
- };
4103
- }
4104
-
4105
- const userId = params.userId;
4106
- const secret = params.secret;
4107
-
4108
- if (typeof userId === 'undefined') {
4109
- throw new AppwriteException('Missing required parameter: "userId"');
4110
- }
4111
- if (typeof secret === 'undefined') {
4112
- throw new AppwriteException('Missing required parameter: "secret"');
4113
- }
4114
-
4115
- const apiPath = '/account/verifications/email';
4116
- const payload: Payload = {};
4117
- if (typeof userId !== 'undefined') {
4118
- payload['userId'] = userId;
4119
- }
4120
- if (typeof secret !== 'undefined') {
4121
- payload['secret'] = secret;
4122
- }
4123
- const uri = new URL(this.client.config.endpoint + apiPath);
4124
-
4125
- const apiHeaders: { [header: string]: string } = {
4126
- 'content-type': 'application/json',
4127
- }
4128
-
4129
- return this.client.call(
4130
- 'put',
4131
- uri,
4132
- apiHeaders,
4133
- payload
4134
- );
4135
- }
4136
-
4137
- /**
4138
- * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
4139
- *
4140
- * @param {string} params.userId - User ID.
4141
- * @param {string} params.secret - Valid verification token.
4142
- * @throws {AppwriteException}
4143
- * @returns {Promise<Models.Token>}
4144
- * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.
4145
- */
4146
- updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
4147
- /**
4148
- * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
4149
- *
4150
- * @param {string} userId - User ID.
4151
- * @param {string} secret - Valid verification token.
4152
- * @throws {AppwriteException}
4153
- * @returns {Promise<Models.Token>}
4154
- * @deprecated Use the object parameter style method for a better developer experience.
4155
- */
4156
- updateVerification(userId: string, secret: string): Promise<Models.Token>;
4157
- updateVerification(
4158
- paramsOrFirst: { userId: string, secret: string } | string,
4159
- ...rest: [(string)?]
4160
- ): Promise<Models.Token> {
4161
- let params: { userId: string, secret: string };
4162
-
4163
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4164
- params = (paramsOrFirst || {}) as { userId: string, secret: string };
4165
- } else {
4166
- params = {
4167
- userId: paramsOrFirst as string,
4168
- secret: rest[0] as string
4169
- };
4170
- }
4171
-
4172
- const userId = params.userId;
4173
- const secret = params.secret;
4174
-
4175
- if (typeof userId === 'undefined') {
4176
- throw new AppwriteException('Missing required parameter: "userId"');
4177
- }
4178
- if (typeof secret === 'undefined') {
4179
- throw new AppwriteException('Missing required parameter: "secret"');
4180
- }
4181
-
4182
- const apiPath = '/account/verifications/email';
4183
- const payload: Payload = {};
4184
- if (typeof userId !== 'undefined') {
4185
- payload['userId'] = userId;
4186
- }
4187
- if (typeof secret !== 'undefined') {
4188
- payload['secret'] = secret;
4189
- }
4190
- const uri = new URL(this.client.config.endpoint + apiPath);
4191
-
4192
- const apiHeaders: { [header: string]: string } = {
4193
- 'content-type': 'application/json',
4194
- }
4195
-
4196
- return this.client.call(
4197
- 'put',
4198
- uri,
4199
- apiHeaders,
4200
- payload
4201
- );
4202
- }
4203
-
4204
- /**
4205
- * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
4206
- *
4207
- * @throws {AppwriteException}
4208
- * @returns {Promise<Models.Token>}
4209
- */
4210
- createPhoneVerification(): Promise<Models.Token> {
4211
-
4212
- const apiPath = '/account/verifications/phone';
4213
- const payload: Payload = {};
4214
- const uri = new URL(this.client.config.endpoint + apiPath);
4215
-
4216
- const apiHeaders: { [header: string]: string } = {
4217
- 'content-type': 'application/json',
4218
- }
4219
-
4220
- return this.client.call(
4221
- 'post',
4222
- uri,
4223
- apiHeaders,
4224
- payload
4225
- );
4226
- }
4227
-
4228
- /**
4229
- * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
4230
- *
4231
- * @param {string} params.userId - User ID.
4232
- * @param {string} params.secret - Valid verification token.
4233
- * @throws {AppwriteException}
4234
- * @returns {Promise<Models.Token>}
4235
- */
4236
- updatePhoneVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
4237
- /**
4238
- * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
4239
- *
4240
- * @param {string} userId - User ID.
4241
- * @param {string} secret - Valid verification token.
4242
- * @throws {AppwriteException}
4243
- * @returns {Promise<Models.Token>}
4244
- * @deprecated Use the object parameter style method for a better developer experience.
4245
- */
4246
- updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
4247
- updatePhoneVerification(
4248
- paramsOrFirst: { userId: string, secret: string } | string,
4249
- ...rest: [(string)?]
4250
- ): Promise<Models.Token> {
4251
- let params: { userId: string, secret: string };
4252
-
4253
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
4254
- params = (paramsOrFirst || {}) as { userId: string, secret: string };
4255
- } else {
4256
- params = {
4257
- userId: paramsOrFirst as string,
4258
- secret: rest[0] as string
4259
- };
4260
- }
4261
-
4262
- const userId = params.userId;
4263
- const secret = params.secret;
4264
-
4265
- if (typeof userId === 'undefined') {
4266
- throw new AppwriteException('Missing required parameter: "userId"');
4267
- }
4268
- if (typeof secret === 'undefined') {
4269
- throw new AppwriteException('Missing required parameter: "secret"');
4270
- }
4271
-
4272
- const apiPath = '/account/verifications/phone';
4273
- const payload: Payload = {};
4274
- if (typeof userId !== 'undefined') {
4275
- payload['userId'] = userId;
4276
- }
4277
- if (typeof secret !== 'undefined') {
4278
- payload['secret'] = secret;
4279
- }
4280
- const uri = new URL(this.client.config.endpoint + apiPath);
4281
-
4282
- const apiHeaders: { [header: string]: string } = {
4283
- 'content-type': 'application/json',
4284
- }
4285
-
4286
- return this.client.call(
4287
- 'put',
4288
- uri,
4289
- apiHeaders,
4290
- payload
4291
- );
4292
- }
4293
- }