node-appwrite 12.0.1 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (526) hide show
  1. package/README.md +1 -1
  2. package/dist/client.d.mts +131 -0
  3. package/dist/client.d.ts +131 -0
  4. package/dist/client.js +302 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/client.mjs +296 -0
  7. package/dist/client.mjs.map +1 -0
  8. package/dist/enums/authentication-factor.d.mts +8 -0
  9. package/dist/enums/authentication-factor.d.ts +8 -0
  10. package/dist/enums/authentication-factor.js +13 -0
  11. package/dist/enums/authentication-factor.js.map +1 -0
  12. package/dist/enums/authentication-factor.mjs +12 -0
  13. package/dist/enums/authentication-factor.mjs.map +1 -0
  14. package/dist/enums/authenticator-type.d.mts +5 -0
  15. package/dist/enums/authenticator-type.d.ts +5 -0
  16. package/dist/enums/authenticator-type.js +10 -0
  17. package/dist/enums/authenticator-type.js.map +1 -0
  18. package/dist/enums/authenticator-type.mjs +9 -0
  19. package/dist/enums/authenticator-type.mjs.map +1 -0
  20. package/dist/enums/browser.d.mts +18 -0
  21. package/dist/enums/browser.d.ts +18 -0
  22. package/dist/enums/browser.js +23 -0
  23. package/dist/enums/browser.js.map +1 -0
  24. package/dist/enums/browser.mjs +22 -0
  25. package/dist/enums/browser.mjs.map +1 -0
  26. package/dist/enums/compression.d.mts +7 -0
  27. package/dist/enums/compression.d.ts +7 -0
  28. package/dist/enums/compression.js +12 -0
  29. package/dist/enums/compression.js.map +1 -0
  30. package/dist/enums/compression.mjs +11 -0
  31. package/dist/enums/compression.mjs.map +1 -0
  32. package/dist/enums/credit-card.d.mts +20 -0
  33. package/dist/enums/credit-card.d.ts +20 -0
  34. package/dist/enums/credit-card.js +25 -0
  35. package/dist/enums/credit-card.js.map +1 -0
  36. package/dist/enums/credit-card.mjs +24 -0
  37. package/dist/enums/credit-card.mjs.map +1 -0
  38. package/dist/enums/execution-method.d.mts +10 -0
  39. package/dist/enums/execution-method.d.ts +10 -0
  40. package/dist/enums/execution-method.js +15 -0
  41. package/dist/enums/execution-method.js.map +1 -0
  42. package/dist/enums/execution-method.mjs +14 -0
  43. package/dist/enums/execution-method.mjs.map +1 -0
  44. package/dist/enums/flag.d.mts +199 -0
  45. package/dist/enums/flag.d.ts +199 -0
  46. package/dist/enums/flag.js +204 -0
  47. package/dist/enums/flag.js.map +1 -0
  48. package/dist/enums/flag.mjs +203 -0
  49. package/dist/enums/flag.mjs.map +1 -0
  50. package/dist/enums/image-format.d.mts +9 -0
  51. package/dist/enums/image-format.d.ts +9 -0
  52. package/dist/enums/image-format.js +14 -0
  53. package/dist/enums/image-format.js.map +1 -0
  54. package/dist/enums/image-format.mjs +13 -0
  55. package/dist/enums/image-format.mjs.map +1 -0
  56. package/dist/enums/image-gravity.d.mts +13 -0
  57. package/dist/enums/image-gravity.d.ts +13 -0
  58. package/dist/enums/image-gravity.js +18 -0
  59. package/dist/enums/image-gravity.js.map +1 -0
  60. package/dist/enums/image-gravity.mjs +17 -0
  61. package/dist/enums/image-gravity.mjs.map +1 -0
  62. package/dist/enums/index-type.d.mts +7 -0
  63. package/dist/enums/index-type.d.ts +7 -0
  64. package/dist/enums/index-type.js +12 -0
  65. package/dist/enums/index-type.js.map +1 -0
  66. package/dist/enums/index-type.mjs +11 -0
  67. package/dist/enums/index-type.mjs.map +1 -0
  68. package/dist/enums/messaging-provider-type.d.mts +7 -0
  69. package/dist/enums/messaging-provider-type.d.ts +7 -0
  70. package/dist/enums/messaging-provider-type.js +12 -0
  71. package/dist/enums/messaging-provider-type.js.map +1 -0
  72. package/dist/enums/messaging-provider-type.mjs +11 -0
  73. package/dist/enums/messaging-provider-type.mjs.map +1 -0
  74. package/dist/enums/name.d.mts +16 -0
  75. package/dist/enums/name.d.ts +16 -0
  76. package/dist/enums/name.js +21 -0
  77. package/dist/enums/name.js.map +1 -0
  78. package/dist/enums/name.mjs +20 -0
  79. package/dist/enums/name.mjs.map +1 -0
  80. package/dist/enums/o-auth-provider.d.mts +43 -0
  81. package/dist/enums/o-auth-provider.d.ts +43 -0
  82. package/dist/enums/o-auth-provider.js +48 -0
  83. package/dist/enums/o-auth-provider.js.map +1 -0
  84. package/dist/enums/o-auth-provider.mjs +47 -0
  85. package/dist/enums/o-auth-provider.mjs.map +1 -0
  86. package/dist/enums/password-hash.d.mts +15 -0
  87. package/dist/enums/password-hash.d.ts +15 -0
  88. package/dist/enums/password-hash.js +20 -0
  89. package/dist/enums/password-hash.js.map +1 -0
  90. package/dist/enums/password-hash.mjs +19 -0
  91. package/dist/enums/password-hash.mjs.map +1 -0
  92. package/dist/enums/relation-mutate.d.mts +7 -0
  93. package/dist/enums/relation-mutate.d.ts +7 -0
  94. package/dist/enums/relation-mutate.js +12 -0
  95. package/dist/enums/relation-mutate.js.map +1 -0
  96. package/dist/enums/relation-mutate.mjs +11 -0
  97. package/dist/enums/relation-mutate.mjs.map +1 -0
  98. package/dist/enums/relationship-type.d.mts +8 -0
  99. package/dist/enums/relationship-type.d.ts +8 -0
  100. package/dist/enums/relationship-type.js +13 -0
  101. package/dist/enums/relationship-type.js.map +1 -0
  102. package/dist/enums/relationship-type.mjs +12 -0
  103. package/dist/enums/relationship-type.mjs.map +1 -0
  104. package/dist/enums/runtime.d.mts +49 -0
  105. package/dist/enums/runtime.d.ts +49 -0
  106. package/dist/enums/runtime.js +54 -0
  107. package/dist/enums/runtime.js.map +1 -0
  108. package/dist/enums/runtime.mjs +53 -0
  109. package/dist/enums/runtime.mjs.map +1 -0
  110. package/dist/enums/smtp-encryption.d.mts +7 -0
  111. package/dist/enums/smtp-encryption.d.ts +7 -0
  112. package/dist/enums/smtp-encryption.js +12 -0
  113. package/dist/enums/smtp-encryption.js.map +1 -0
  114. package/dist/enums/smtp-encryption.mjs +11 -0
  115. package/dist/enums/smtp-encryption.mjs.map +1 -0
  116. package/dist/id.d.mts +7 -0
  117. package/dist/id.d.ts +7 -0
  118. package/dist/id.js +29 -0
  119. package/dist/id.js.map +1 -0
  120. package/dist/id.mjs +28 -0
  121. package/dist/id.mjs.map +1 -0
  122. package/dist/index.d.mts +35 -0
  123. package/dist/index.d.ts +35 -0
  124. package/dist/index.js +180 -0
  125. package/dist/index.js.map +1 -0
  126. package/dist/index.mjs +35 -0
  127. package/dist/index.mjs.map +1 -0
  128. package/dist/inputFile.d.mts +9 -0
  129. package/dist/inputFile.d.ts +9 -0
  130. package/dist/inputFile.js +23 -0
  131. package/dist/inputFile.js.map +1 -0
  132. package/dist/inputFile.mjs +22 -0
  133. package/dist/inputFile.mjs.map +1 -0
  134. package/dist/models.d.mts +2414 -0
  135. package/dist/models.d.ts +2414 -0
  136. package/dist/models.js +4 -0
  137. package/dist/models.js.map +1 -0
  138. package/dist/models.mjs +3 -0
  139. package/dist/models.mjs.map +1 -0
  140. package/dist/permission.d.mts +9 -0
  141. package/dist/permission.d.ts +9 -0
  142. package/dist/permission.js +23 -0
  143. package/dist/permission.js.map +1 -0
  144. package/dist/permission.mjs +22 -0
  145. package/dist/permission.mjs.map +1 -0
  146. package/dist/query.d.mts +35 -0
  147. package/dist/query.d.ts +35 -0
  148. package/dist/query.js +49 -0
  149. package/dist/query.js.map +1 -0
  150. package/dist/query.mjs +48 -0
  151. package/dist/query.mjs.map +1 -0
  152. package/{lib/role.js → dist/role.d.mts} +18 -48
  153. package/dist/role.d.ts +72 -0
  154. package/dist/role.js +96 -0
  155. package/dist/role.js.map +1 -0
  156. package/dist/role.mjs +95 -0
  157. package/dist/role.mjs.map +1 -0
  158. package/dist/services/account.d.mts +478 -0
  159. package/dist/services/account.d.ts +478 -0
  160. package/dist/services/account.js +1331 -0
  161. package/dist/services/account.js.map +1 -0
  162. package/dist/services/account.mjs +1330 -0
  163. package/dist/services/account.mjs.map +1 -0
  164. package/dist/services/avatars.d.mts +118 -0
  165. package/dist/services/avatars.d.ts +118 -0
  166. package/dist/services/avatars.js +297 -0
  167. package/dist/services/avatars.js.map +1 -0
  168. package/dist/services/avatars.mjs +296 -0
  169. package/dist/services/avatars.mjs.map +1 -0
  170. package/dist/services/databases.d.mts +606 -0
  171. package/dist/services/databases.d.ts +606 -0
  172. package/dist/services/databases.js +1908 -0
  173. package/dist/services/databases.js.map +1 -0
  174. package/dist/services/databases.mjs +1907 -0
  175. package/dist/services/databases.mjs.map +1 -0
  176. package/dist/services/functions.d.mts +287 -0
  177. package/dist/services/functions.d.ts +287 -0
  178. package/dist/services/functions.js +837 -0
  179. package/dist/services/functions.js.map +1 -0
  180. package/dist/services/functions.mjs +836 -0
  181. package/dist/services/functions.mjs.map +1 -0
  182. package/dist/services/graphql.d.mts +30 -0
  183. package/dist/services/graphql.d.ts +30 -0
  184. package/dist/services/graphql.js +73 -0
  185. package/dist/services/graphql.js.map +1 -0
  186. package/dist/services/graphql.mjs +72 -0
  187. package/dist/services/graphql.mjs.map +1 -0
  188. package/dist/services/health.d.mts +235 -0
  189. package/dist/services/health.d.ts +235 -0
  190. package/dist/services/health.js +584 -0
  191. package/dist/services/health.js.map +1 -0
  192. package/dist/services/health.mjs +583 -0
  193. package/dist/services/health.mjs.map +1 -0
  194. package/dist/services/locale.d.mts +84 -0
  195. package/dist/services/locale.d.ts +84 -0
  196. package/dist/services/locale.js +189 -0
  197. package/dist/services/locale.js.map +1 -0
  198. package/dist/services/locale.mjs +188 -0
  199. package/dist/services/locale.mjs.map +1 -0
  200. package/dist/services/messaging.d.mts +689 -0
  201. package/dist/services/messaging.d.ts +689 -0
  202. package/dist/services/messaging.js +2156 -0
  203. package/dist/services/messaging.js.map +1 -0
  204. package/dist/services/messaging.mjs +2155 -0
  205. package/dist/services/messaging.mjs.map +1 -0
  206. package/dist/services/storage.d.mts +193 -0
  207. package/dist/services/storage.d.ts +193 -0
  208. package/dist/services/storage.js +550 -0
  209. package/dist/services/storage.js.map +1 -0
  210. package/dist/services/storage.mjs +549 -0
  211. package/dist/services/storage.mjs.map +1 -0
  212. package/dist/services/teams.d.mts +171 -0
  213. package/dist/services/teams.d.ts +171 -0
  214. package/dist/services/teams.js +466 -0
  215. package/dist/services/teams.js.map +1 -0
  216. package/dist/services/teams.mjs +465 -0
  217. package/dist/services/teams.mjs.map +1 -0
  218. package/dist/services/users.d.mts +491 -0
  219. package/dist/services/users.d.ts +491 -0
  220. package/dist/services/users.js +1465 -0
  221. package/dist/services/users.js.map +1 -0
  222. package/dist/services/users.mjs +1464 -0
  223. package/dist/services/users.mjs.map +1 -0
  224. package/package.json +39 -5
  225. package/.github/ISSUE_TEMPLATE/bug.yaml +0 -82
  226. package/.github/ISSUE_TEMPLATE/documentation.yaml +0 -32
  227. package/.github/ISSUE_TEMPLATE/feature.yaml +0 -40
  228. package/.travis.yml +0 -25
  229. package/CHANGELOG.md +0 -1
  230. package/docs/examples/account/create-anonymous-session.md +0 -9
  231. package/docs/examples/account/create-email-password-session.md +0 -12
  232. package/docs/examples/account/create-email-token.md +0 -13
  233. package/docs/examples/account/create-j-w-t.md +0 -9
  234. package/docs/examples/account/create-magic-u-r-l-token.md +0 -14
  235. package/docs/examples/account/create-mfa-authenticator.md +0 -12
  236. package/docs/examples/account/create-mfa-challenge.md +0 -11
  237. package/docs/examples/account/create-mfa-recovery-codes.md +0 -10
  238. package/docs/examples/account/create-o-auth2token.md +0 -14
  239. package/docs/examples/account/create-phone-token.md +0 -12
  240. package/docs/examples/account/create-phone-verification.md +0 -10
  241. package/docs/examples/account/create-recovery.md +0 -13
  242. package/docs/examples/account/create-session.md +0 -12
  243. package/docs/examples/account/create-verification.md +0 -12
  244. package/docs/examples/account/create.md +0 -14
  245. package/docs/examples/account/delete-identity.md +0 -12
  246. package/docs/examples/account/delete-mfa-authenticator.md +0 -13
  247. package/docs/examples/account/delete-session.md +0 -12
  248. package/docs/examples/account/delete-sessions.md +0 -10
  249. package/docs/examples/account/get-mfa-recovery-codes.md +0 -10
  250. package/docs/examples/account/get-prefs.md +0 -10
  251. package/docs/examples/account/get-session.md +0 -12
  252. package/docs/examples/account/get.md +0 -10
  253. package/docs/examples/account/list-identities.md +0 -12
  254. package/docs/examples/account/list-logs.md +0 -12
  255. package/docs/examples/account/list-mfa-factors.md +0 -10
  256. package/docs/examples/account/list-sessions.md +0 -10
  257. package/docs/examples/account/update-email.md +0 -13
  258. package/docs/examples/account/update-m-f-a.md +0 -12
  259. package/docs/examples/account/update-magic-u-r-l-session.md +0 -12
  260. package/docs/examples/account/update-mfa-authenticator.md +0 -13
  261. package/docs/examples/account/update-mfa-challenge.md +0 -13
  262. package/docs/examples/account/update-mfa-recovery-codes.md +0 -10
  263. package/docs/examples/account/update-name.md +0 -12
  264. package/docs/examples/account/update-password.md +0 -13
  265. package/docs/examples/account/update-phone-session.md +0 -12
  266. package/docs/examples/account/update-phone-verification.md +0 -13
  267. package/docs/examples/account/update-phone.md +0 -13
  268. package/docs/examples/account/update-prefs.md +0 -12
  269. package/docs/examples/account/update-recovery.md +0 -14
  270. package/docs/examples/account/update-session.md +0 -12
  271. package/docs/examples/account/update-status.md +0 -10
  272. package/docs/examples/account/update-verification.md +0 -13
  273. package/docs/examples/avatars/get-browser.md +0 -15
  274. package/docs/examples/avatars/get-credit-card.md +0 -15
  275. package/docs/examples/avatars/get-favicon.md +0 -12
  276. package/docs/examples/avatars/get-flag.md +0 -15
  277. package/docs/examples/avatars/get-image.md +0 -14
  278. package/docs/examples/avatars/get-initials.md +0 -15
  279. package/docs/examples/avatars/get-q-r.md +0 -15
  280. package/docs/examples/databases/create-boolean-attribute.md +0 -17
  281. package/docs/examples/databases/create-collection.md +0 -17
  282. package/docs/examples/databases/create-datetime-attribute.md +0 -17
  283. package/docs/examples/databases/create-document.md +0 -16
  284. package/docs/examples/databases/create-email-attribute.md +0 -17
  285. package/docs/examples/databases/create-enum-attribute.md +0 -18
  286. package/docs/examples/databases/create-float-attribute.md +0 -19
  287. package/docs/examples/databases/create-index.md +0 -17
  288. package/docs/examples/databases/create-integer-attribute.md +0 -19
  289. package/docs/examples/databases/create-ip-attribute.md +0 -17
  290. package/docs/examples/databases/create-relationship-attribute.md +0 -19
  291. package/docs/examples/databases/create-string-attribute.md +0 -19
  292. package/docs/examples/databases/create-url-attribute.md +0 -17
  293. package/docs/examples/databases/create.md +0 -14
  294. package/docs/examples/databases/delete-attribute.md +0 -14
  295. package/docs/examples/databases/delete-collection.md +0 -13
  296. package/docs/examples/databases/delete-document.md +0 -14
  297. package/docs/examples/databases/delete-index.md +0 -14
  298. package/docs/examples/databases/delete.md +0 -12
  299. package/docs/examples/databases/get-attribute.md +0 -14
  300. package/docs/examples/databases/get-collection.md +0 -13
  301. package/docs/examples/databases/get-document.md +0 -15
  302. package/docs/examples/databases/get-index.md +0 -14
  303. package/docs/examples/databases/get.md +0 -12
  304. package/docs/examples/databases/list-attributes.md +0 -14
  305. package/docs/examples/databases/list-collections.md +0 -14
  306. package/docs/examples/databases/list-documents.md +0 -14
  307. package/docs/examples/databases/list-indexes.md +0 -14
  308. package/docs/examples/databases/list.md +0 -13
  309. package/docs/examples/databases/update-boolean-attribute.md +0 -16
  310. package/docs/examples/databases/update-collection.md +0 -17
  311. package/docs/examples/databases/update-datetime-attribute.md +0 -16
  312. package/docs/examples/databases/update-document.md +0 -16
  313. package/docs/examples/databases/update-email-attribute.md +0 -16
  314. package/docs/examples/databases/update-enum-attribute.md +0 -17
  315. package/docs/examples/databases/update-float-attribute.md +0 -18
  316. package/docs/examples/databases/update-integer-attribute.md +0 -18
  317. package/docs/examples/databases/update-ip-attribute.md +0 -16
  318. package/docs/examples/databases/update-relationship-attribute.md +0 -15
  319. package/docs/examples/databases/update-string-attribute.md +0 -16
  320. package/docs/examples/databases/update-url-attribute.md +0 -16
  321. package/docs/examples/databases/update.md +0 -14
  322. package/docs/examples/functions/create-build.md +0 -14
  323. package/docs/examples/functions/create-deployment.md +0 -17
  324. package/docs/examples/functions/create-execution.md +0 -17
  325. package/docs/examples/functions/create-variable.md +0 -14
  326. package/docs/examples/functions/create.md +0 -31
  327. package/docs/examples/functions/delete-deployment.md +0 -13
  328. package/docs/examples/functions/delete-variable.md +0 -13
  329. package/docs/examples/functions/delete.md +0 -12
  330. package/docs/examples/functions/download-deployment.md +0 -13
  331. package/docs/examples/functions/get-deployment.md +0 -13
  332. package/docs/examples/functions/get-execution.md +0 -13
  333. package/docs/examples/functions/get-variable.md +0 -13
  334. package/docs/examples/functions/get.md +0 -12
  335. package/docs/examples/functions/list-deployments.md +0 -14
  336. package/docs/examples/functions/list-executions.md +0 -14
  337. package/docs/examples/functions/list-runtimes.md +0 -10
  338. package/docs/examples/functions/list-variables.md +0 -12
  339. package/docs/examples/functions/list.md +0 -13
  340. package/docs/examples/functions/update-deployment.md +0 -13
  341. package/docs/examples/functions/update-variable.md +0 -15
  342. package/docs/examples/functions/update.md +0 -27
  343. package/docs/examples/graphql/mutation.md +0 -12
  344. package/docs/examples/graphql/query.md +0 -12
  345. package/docs/examples/health/get-antivirus.md +0 -10
  346. package/docs/examples/health/get-cache.md +0 -10
  347. package/docs/examples/health/get-certificate.md +0 -12
  348. package/docs/examples/health/get-d-b.md +0 -10
  349. package/docs/examples/health/get-failed-jobs.md +0 -13
  350. package/docs/examples/health/get-pub-sub.md +0 -10
  351. package/docs/examples/health/get-queue-builds.md +0 -12
  352. package/docs/examples/health/get-queue-certificates.md +0 -12
  353. package/docs/examples/health/get-queue-databases.md +0 -13
  354. package/docs/examples/health/get-queue-deletes.md +0 -12
  355. package/docs/examples/health/get-queue-functions.md +0 -12
  356. package/docs/examples/health/get-queue-logs.md +0 -12
  357. package/docs/examples/health/get-queue-mails.md +0 -12
  358. package/docs/examples/health/get-queue-messaging.md +0 -12
  359. package/docs/examples/health/get-queue-migrations.md +0 -12
  360. package/docs/examples/health/get-queue-usage-dump.md +0 -12
  361. package/docs/examples/health/get-queue-usage.md +0 -12
  362. package/docs/examples/health/get-queue-webhooks.md +0 -12
  363. package/docs/examples/health/get-queue.md +0 -10
  364. package/docs/examples/health/get-storage-local.md +0 -10
  365. package/docs/examples/health/get-storage.md +0 -10
  366. package/docs/examples/health/get-time.md +0 -10
  367. package/docs/examples/health/get.md +0 -10
  368. package/docs/examples/locale/get.md +0 -10
  369. package/docs/examples/locale/list-codes.md +0 -10
  370. package/docs/examples/locale/list-continents.md +0 -10
  371. package/docs/examples/locale/list-countries-e-u.md +0 -10
  372. package/docs/examples/locale/list-countries-phones.md +0 -10
  373. package/docs/examples/locale/list-countries.md +0 -10
  374. package/docs/examples/locale/list-currencies.md +0 -10
  375. package/docs/examples/locale/list-languages.md +0 -10
  376. package/docs/examples/messaging/create-apns-provider.md +0 -19
  377. package/docs/examples/messaging/create-email.md +0 -23
  378. package/docs/examples/messaging/create-fcm-provider.md +0 -15
  379. package/docs/examples/messaging/create-mailgun-provider.md +0 -21
  380. package/docs/examples/messaging/create-msg91provider.md +0 -17
  381. package/docs/examples/messaging/create-push.md +0 -27
  382. package/docs/examples/messaging/create-sendgrid-provider.md +0 -19
  383. package/docs/examples/messaging/create-sms.md +0 -18
  384. package/docs/examples/messaging/create-smtp-provider.md +0 -25
  385. package/docs/examples/messaging/create-subscriber.md +0 -14
  386. package/docs/examples/messaging/create-telesign-provider.md +0 -17
  387. package/docs/examples/messaging/create-textmagic-provider.md +0 -17
  388. package/docs/examples/messaging/create-topic.md +0 -14
  389. package/docs/examples/messaging/create-twilio-provider.md +0 -17
  390. package/docs/examples/messaging/create-vonage-provider.md +0 -17
  391. package/docs/examples/messaging/delete-provider.md +0 -12
  392. package/docs/examples/messaging/delete-subscriber.md +0 -13
  393. package/docs/examples/messaging/delete-topic.md +0 -12
  394. package/docs/examples/messaging/delete.md +0 -12
  395. package/docs/examples/messaging/get-message.md +0 -12
  396. package/docs/examples/messaging/get-provider.md +0 -12
  397. package/docs/examples/messaging/get-subscriber.md +0 -13
  398. package/docs/examples/messaging/get-topic.md +0 -12
  399. package/docs/examples/messaging/list-message-logs.md +0 -13
  400. package/docs/examples/messaging/list-messages.md +0 -13
  401. package/docs/examples/messaging/list-provider-logs.md +0 -13
  402. package/docs/examples/messaging/list-providers.md +0 -13
  403. package/docs/examples/messaging/list-subscriber-logs.md +0 -13
  404. package/docs/examples/messaging/list-subscribers.md +0 -14
  405. package/docs/examples/messaging/list-targets.md +0 -13
  406. package/docs/examples/messaging/list-topic-logs.md +0 -13
  407. package/docs/examples/messaging/list-topics.md +0 -13
  408. package/docs/examples/messaging/update-apns-provider.md +0 -19
  409. package/docs/examples/messaging/update-email.md +0 -22
  410. package/docs/examples/messaging/update-fcm-provider.md +0 -15
  411. package/docs/examples/messaging/update-mailgun-provider.md +0 -21
  412. package/docs/examples/messaging/update-msg91provider.md +0 -17
  413. package/docs/examples/messaging/update-push.md +0 -27
  414. package/docs/examples/messaging/update-sendgrid-provider.md +0 -19
  415. package/docs/examples/messaging/update-sms.md +0 -18
  416. package/docs/examples/messaging/update-smtp-provider.md +0 -25
  417. package/docs/examples/messaging/update-telesign-provider.md +0 -17
  418. package/docs/examples/messaging/update-textmagic-provider.md +0 -17
  419. package/docs/examples/messaging/update-topic.md +0 -14
  420. package/docs/examples/messaging/update-twilio-provider.md +0 -17
  421. package/docs/examples/messaging/update-vonage-provider.md +0 -17
  422. package/docs/examples/storage/create-bucket.md +0 -21
  423. package/docs/examples/storage/create-file.md +0 -16
  424. package/docs/examples/storage/delete-bucket.md +0 -12
  425. package/docs/examples/storage/delete-file.md +0 -13
  426. package/docs/examples/storage/get-bucket.md +0 -12
  427. package/docs/examples/storage/get-file-download.md +0 -13
  428. package/docs/examples/storage/get-file-preview.md +0 -24
  429. package/docs/examples/storage/get-file-view.md +0 -13
  430. package/docs/examples/storage/get-file.md +0 -13
  431. package/docs/examples/storage/list-buckets.md +0 -13
  432. package/docs/examples/storage/list-files.md +0 -14
  433. package/docs/examples/storage/update-bucket.md +0 -21
  434. package/docs/examples/storage/update-file.md +0 -15
  435. package/docs/examples/teams/create-membership.md +0 -18
  436. package/docs/examples/teams/create.md +0 -14
  437. package/docs/examples/teams/delete-membership.md +0 -13
  438. package/docs/examples/teams/delete.md +0 -12
  439. package/docs/examples/teams/get-membership.md +0 -13
  440. package/docs/examples/teams/get-prefs.md +0 -12
  441. package/docs/examples/teams/get.md +0 -12
  442. package/docs/examples/teams/list-memberships.md +0 -14
  443. package/docs/examples/teams/list.md +0 -13
  444. package/docs/examples/teams/update-membership-status.md +0 -15
  445. package/docs/examples/teams/update-membership.md +0 -14
  446. package/docs/examples/teams/update-name.md +0 -13
  447. package/docs/examples/teams/update-prefs.md +0 -13
  448. package/docs/examples/users/create-argon2user.md +0 -15
  449. package/docs/examples/users/create-bcrypt-user.md +0 -15
  450. package/docs/examples/users/create-m-d5user.md +0 -15
  451. package/docs/examples/users/create-mfa-recovery-codes.md +0 -12
  452. package/docs/examples/users/create-p-h-pass-user.md +0 -15
  453. package/docs/examples/users/create-s-h-a-user.md +0 -16
  454. package/docs/examples/users/create-scrypt-modified-user.md +0 -18
  455. package/docs/examples/users/create-scrypt-user.md +0 -20
  456. package/docs/examples/users/create-session.md +0 -12
  457. package/docs/examples/users/create-target.md +0 -17
  458. package/docs/examples/users/create-token.md +0 -14
  459. package/docs/examples/users/create.md +0 -16
  460. package/docs/examples/users/delete-identity.md +0 -12
  461. package/docs/examples/users/delete-mfa-authenticator.md +0 -13
  462. package/docs/examples/users/delete-session.md +0 -13
  463. package/docs/examples/users/delete-sessions.md +0 -12
  464. package/docs/examples/users/delete-target.md +0 -13
  465. package/docs/examples/users/delete.md +0 -12
  466. package/docs/examples/users/get-mfa-recovery-codes.md +0 -12
  467. package/docs/examples/users/get-prefs.md +0 -12
  468. package/docs/examples/users/get-target.md +0 -13
  469. package/docs/examples/users/get.md +0 -12
  470. package/docs/examples/users/list-identities.md +0 -13
  471. package/docs/examples/users/list-logs.md +0 -13
  472. package/docs/examples/users/list-memberships.md +0 -12
  473. package/docs/examples/users/list-mfa-factors.md +0 -12
  474. package/docs/examples/users/list-sessions.md +0 -12
  475. package/docs/examples/users/list-targets.md +0 -13
  476. package/docs/examples/users/list.md +0 -13
  477. package/docs/examples/users/update-email-verification.md +0 -13
  478. package/docs/examples/users/update-email.md +0 -13
  479. package/docs/examples/users/update-labels.md +0 -13
  480. package/docs/examples/users/update-mfa-recovery-codes.md +0 -12
  481. package/docs/examples/users/update-mfa.md +0 -13
  482. package/docs/examples/users/update-name.md +0 -13
  483. package/docs/examples/users/update-password.md +0 -13
  484. package/docs/examples/users/update-phone-verification.md +0 -13
  485. package/docs/examples/users/update-phone.md +0 -13
  486. package/docs/examples/users/update-prefs.md +0 -13
  487. package/docs/examples/users/update-status.md +0 -13
  488. package/docs/examples/users/update-target.md +0 -16
  489. package/index.d.ts +0 -6656
  490. package/index.js +0 -75
  491. package/lib/client.js +0 -245
  492. package/lib/enums/authentication-factor.js +0 -8
  493. package/lib/enums/authenticator-type.js +0 -5
  494. package/lib/enums/browser.js +0 -18
  495. package/lib/enums/compression.js +0 -7
  496. package/lib/enums/credit-card.js +0 -20
  497. package/lib/enums/execution-method.js +0 -10
  498. package/lib/enums/flag.js +0 -198
  499. package/lib/enums/image-format.js +0 -9
  500. package/lib/enums/image-gravity.js +0 -13
  501. package/lib/enums/index-type.js +0 -7
  502. package/lib/enums/messaging-provider-type.js +0 -7
  503. package/lib/enums/name.js +0 -17
  504. package/lib/enums/o-auth-provider.js +0 -43
  505. package/lib/enums/password-hash.js +0 -15
  506. package/lib/enums/relation-mutate.js +0 -7
  507. package/lib/enums/relationship-type.js +0 -8
  508. package/lib/enums/runtime.js +0 -48
  509. package/lib/enums/smtp-encryption.js +0 -7
  510. package/lib/exception.js +0 -10
  511. package/lib/id.js +0 -32
  512. package/lib/inputFile.js +0 -117
  513. package/lib/permission.js +0 -24
  514. package/lib/query.js +0 -90
  515. package/lib/service.js +0 -10
  516. package/lib/services/account.js +0 -1365
  517. package/lib/services/avatars.js +0 -325
  518. package/lib/services/databases.js +0 -1987
  519. package/lib/services/functions.js +0 -930
  520. package/lib/services/graphql.js +0 -74
  521. package/lib/services/health.js +0 -513
  522. package/lib/services/locale.js +0 -169
  523. package/lib/services/messaging.js +0 -2218
  524. package/lib/services/storage.js +0 -663
  525. package/lib/services/teams.js +0 -479
  526. package/lib/services/users.js +0 -1463
@@ -0,0 +1,1330 @@
1
+ import { AppwriteException } from '../client.mjs';
2
+
3
+ // src/services/account.ts
4
+ var Account = class {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get account
10
+ *
11
+ * Get the currently logged in user.
12
+ *
13
+ * @throws {AppwriteException}
14
+ * @returns {Promise<Models.User<Preferences>>}
15
+ */
16
+ async get() {
17
+ const apiPath = "/account";
18
+ const payload = {};
19
+ const uri = new URL(this.client.config.endpoint + apiPath);
20
+ const apiHeaders = {
21
+ "content-type": "application/json"
22
+ };
23
+ return await this.client.call(
24
+ "get",
25
+ uri,
26
+ apiHeaders,
27
+ payload
28
+ );
29
+ }
30
+ /**
31
+ * Create account
32
+ *
33
+ * 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).
34
+ *
35
+ * @param {string} userId
36
+ * @param {string} email
37
+ * @param {string} password
38
+ * @param {string} name
39
+ * @throws {AppwriteException}
40
+ * @returns {Promise<Models.User<Preferences>>}
41
+ */
42
+ async create(userId, email, password, name) {
43
+ if (typeof userId === "undefined") {
44
+ throw new AppwriteException('Missing required parameter: "userId"');
45
+ }
46
+ if (typeof email === "undefined") {
47
+ throw new AppwriteException('Missing required parameter: "email"');
48
+ }
49
+ if (typeof password === "undefined") {
50
+ throw new AppwriteException('Missing required parameter: "password"');
51
+ }
52
+ const apiPath = "/account";
53
+ const payload = {};
54
+ if (typeof userId !== "undefined") {
55
+ payload["userId"] = userId;
56
+ }
57
+ if (typeof email !== "undefined") {
58
+ payload["email"] = email;
59
+ }
60
+ if (typeof password !== "undefined") {
61
+ payload["password"] = password;
62
+ }
63
+ if (typeof name !== "undefined") {
64
+ payload["name"] = name;
65
+ }
66
+ const uri = new URL(this.client.config.endpoint + apiPath);
67
+ const apiHeaders = {
68
+ "content-type": "application/json"
69
+ };
70
+ return await this.client.call(
71
+ "post",
72
+ uri,
73
+ apiHeaders,
74
+ payload
75
+ );
76
+ }
77
+ /**
78
+ * Update email
79
+ *
80
+ * 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.
81
+ This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
82
+
83
+ *
84
+ * @param {string} email
85
+ * @param {string} password
86
+ * @throws {AppwriteException}
87
+ * @returns {Promise<Models.User<Preferences>>}
88
+ */
89
+ async updateEmail(email, password) {
90
+ if (typeof email === "undefined") {
91
+ throw new AppwriteException('Missing required parameter: "email"');
92
+ }
93
+ if (typeof password === "undefined") {
94
+ throw new AppwriteException('Missing required parameter: "password"');
95
+ }
96
+ const apiPath = "/account/email";
97
+ const payload = {};
98
+ if (typeof email !== "undefined") {
99
+ payload["email"] = email;
100
+ }
101
+ if (typeof password !== "undefined") {
102
+ payload["password"] = password;
103
+ }
104
+ const uri = new URL(this.client.config.endpoint + apiPath);
105
+ const apiHeaders = {
106
+ "content-type": "application/json"
107
+ };
108
+ return await this.client.call(
109
+ "patch",
110
+ uri,
111
+ apiHeaders,
112
+ payload
113
+ );
114
+ }
115
+ /**
116
+ * List Identities
117
+ *
118
+ * Get the list of identities for the currently logged in user.
119
+ *
120
+ * @param {string[]} queries
121
+ * @throws {AppwriteException}
122
+ * @returns {Promise<Models.IdentityList>}
123
+ */
124
+ async listIdentities(queries) {
125
+ const apiPath = "/account/identities";
126
+ const payload = {};
127
+ if (typeof queries !== "undefined") {
128
+ payload["queries"] = queries;
129
+ }
130
+ const uri = new URL(this.client.config.endpoint + apiPath);
131
+ const apiHeaders = {
132
+ "content-type": "application/json"
133
+ };
134
+ return await this.client.call(
135
+ "get",
136
+ uri,
137
+ apiHeaders,
138
+ payload
139
+ );
140
+ }
141
+ /**
142
+ * Delete identity
143
+ *
144
+ * Delete an identity by its unique ID.
145
+ *
146
+ * @param {string} identityId
147
+ * @throws {AppwriteException}
148
+ * @returns {Promise<{}>}
149
+ */
150
+ async deleteIdentity(identityId) {
151
+ if (typeof identityId === "undefined") {
152
+ throw new AppwriteException('Missing required parameter: "identityId"');
153
+ }
154
+ const apiPath = "/account/identities/{identityId}".replace("{identityId}", identityId);
155
+ const payload = {};
156
+ const uri = new URL(this.client.config.endpoint + apiPath);
157
+ const apiHeaders = {
158
+ "content-type": "application/json"
159
+ };
160
+ return await this.client.call(
161
+ "delete",
162
+ uri,
163
+ apiHeaders,
164
+ payload
165
+ );
166
+ }
167
+ /**
168
+ * Create JWT
169
+ *
170
+ * 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.
171
+ *
172
+ * @throws {AppwriteException}
173
+ * @returns {Promise<Models.Jwt>}
174
+ */
175
+ async createJWT() {
176
+ const apiPath = "/account/jwt";
177
+ const payload = {};
178
+ const uri = new URL(this.client.config.endpoint + apiPath);
179
+ const apiHeaders = {
180
+ "content-type": "application/json"
181
+ };
182
+ return await this.client.call(
183
+ "post",
184
+ uri,
185
+ apiHeaders,
186
+ payload
187
+ );
188
+ }
189
+ /**
190
+ * List logs
191
+ *
192
+ * 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.
193
+ *
194
+ * @param {string[]} queries
195
+ * @throws {AppwriteException}
196
+ * @returns {Promise<Models.LogList>}
197
+ */
198
+ async listLogs(queries) {
199
+ const apiPath = "/account/logs";
200
+ const payload = {};
201
+ if (typeof queries !== "undefined") {
202
+ payload["queries"] = queries;
203
+ }
204
+ const uri = new URL(this.client.config.endpoint + apiPath);
205
+ const apiHeaders = {
206
+ "content-type": "application/json"
207
+ };
208
+ return await this.client.call(
209
+ "get",
210
+ uri,
211
+ apiHeaders,
212
+ payload
213
+ );
214
+ }
215
+ /**
216
+ * Update MFA
217
+ *
218
+ * Enable or disable MFA on an account.
219
+ *
220
+ * @param {boolean} mfa
221
+ * @throws {AppwriteException}
222
+ * @returns {Promise<Models.User<Preferences>>}
223
+ */
224
+ async updateMFA(mfa) {
225
+ if (typeof mfa === "undefined") {
226
+ throw new AppwriteException('Missing required parameter: "mfa"');
227
+ }
228
+ const apiPath = "/account/mfa";
229
+ const payload = {};
230
+ if (typeof mfa !== "undefined") {
231
+ payload["mfa"] = mfa;
232
+ }
233
+ const uri = new URL(this.client.config.endpoint + apiPath);
234
+ const apiHeaders = {
235
+ "content-type": "application/json"
236
+ };
237
+ return await this.client.call(
238
+ "patch",
239
+ uri,
240
+ apiHeaders,
241
+ payload
242
+ );
243
+ }
244
+ /**
245
+ * Add Authenticator
246
+ *
247
+ * 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.
248
+ *
249
+ * @param {AuthenticatorType} type
250
+ * @throws {AppwriteException}
251
+ * @returns {Promise<Models.MfaType>}
252
+ */
253
+ async createMfaAuthenticator(type) {
254
+ if (typeof type === "undefined") {
255
+ throw new AppwriteException('Missing required parameter: "type"');
256
+ }
257
+ const apiPath = "/account/mfa/authenticators/{type}".replace("{type}", type);
258
+ const payload = {};
259
+ const uri = new URL(this.client.config.endpoint + apiPath);
260
+ const apiHeaders = {
261
+ "content-type": "application/json"
262
+ };
263
+ return await this.client.call(
264
+ "post",
265
+ uri,
266
+ apiHeaders,
267
+ payload
268
+ );
269
+ }
270
+ /**
271
+ * Verify Authenticator
272
+ *
273
+ * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add
274
+ *
275
+ * @param {AuthenticatorType} type
276
+ * @param {string} otp
277
+ * @throws {AppwriteException}
278
+ * @returns {Promise<Models.User<Preferences>>}
279
+ */
280
+ async updateMfaAuthenticator(type, otp) {
281
+ if (typeof type === "undefined") {
282
+ throw new AppwriteException('Missing required parameter: "type"');
283
+ }
284
+ if (typeof otp === "undefined") {
285
+ throw new AppwriteException('Missing required parameter: "otp"');
286
+ }
287
+ const apiPath = "/account/mfa/authenticators/{type}".replace("{type}", type);
288
+ const payload = {};
289
+ if (typeof otp !== "undefined") {
290
+ payload["otp"] = otp;
291
+ }
292
+ const uri = new URL(this.client.config.endpoint + apiPath);
293
+ const apiHeaders = {
294
+ "content-type": "application/json"
295
+ };
296
+ return await this.client.call(
297
+ "put",
298
+ uri,
299
+ apiHeaders,
300
+ payload
301
+ );
302
+ }
303
+ /**
304
+ * Delete Authenticator
305
+ *
306
+ * Delete an authenticator for a user by ID.
307
+ *
308
+ * @param {AuthenticatorType} type
309
+ * @param {string} otp
310
+ * @throws {AppwriteException}
311
+ * @returns {Promise<{}>}
312
+ */
313
+ async deleteMfaAuthenticator(type, otp) {
314
+ if (typeof type === "undefined") {
315
+ throw new AppwriteException('Missing required parameter: "type"');
316
+ }
317
+ if (typeof otp === "undefined") {
318
+ throw new AppwriteException('Missing required parameter: "otp"');
319
+ }
320
+ const apiPath = "/account/mfa/authenticators/{type}".replace("{type}", type);
321
+ const payload = {};
322
+ if (typeof otp !== "undefined") {
323
+ payload["otp"] = otp;
324
+ }
325
+ const uri = new URL(this.client.config.endpoint + apiPath);
326
+ const apiHeaders = {
327
+ "content-type": "application/json"
328
+ };
329
+ return await this.client.call(
330
+ "delete",
331
+ uri,
332
+ apiHeaders,
333
+ payload
334
+ );
335
+ }
336
+ /**
337
+ * Create 2FA Challenge
338
+ *
339
+ * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
340
+ *
341
+ * @param {AuthenticationFactor} factor
342
+ * @throws {AppwriteException}
343
+ * @returns {Promise<Models.MfaChallenge>}
344
+ */
345
+ async createMfaChallenge(factor) {
346
+ if (typeof factor === "undefined") {
347
+ throw new AppwriteException('Missing required parameter: "factor"');
348
+ }
349
+ const apiPath = "/account/mfa/challenge";
350
+ const payload = {};
351
+ if (typeof factor !== "undefined") {
352
+ payload["factor"] = factor;
353
+ }
354
+ const uri = new URL(this.client.config.endpoint + apiPath);
355
+ const apiHeaders = {
356
+ "content-type": "application/json"
357
+ };
358
+ return await this.client.call(
359
+ "post",
360
+ uri,
361
+ apiHeaders,
362
+ payload
363
+ );
364
+ }
365
+ /**
366
+ * Create MFA Challenge (confirmation)
367
+ *
368
+ * 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.
369
+ *
370
+ * @param {string} challengeId
371
+ * @param {string} otp
372
+ * @throws {AppwriteException}
373
+ * @returns {Promise<{}>}
374
+ */
375
+ async updateMfaChallenge(challengeId, otp) {
376
+ if (typeof challengeId === "undefined") {
377
+ throw new AppwriteException('Missing required parameter: "challengeId"');
378
+ }
379
+ if (typeof otp === "undefined") {
380
+ throw new AppwriteException('Missing required parameter: "otp"');
381
+ }
382
+ const apiPath = "/account/mfa/challenge";
383
+ const payload = {};
384
+ if (typeof challengeId !== "undefined") {
385
+ payload["challengeId"] = challengeId;
386
+ }
387
+ if (typeof otp !== "undefined") {
388
+ payload["otp"] = otp;
389
+ }
390
+ const uri = new URL(this.client.config.endpoint + apiPath);
391
+ const apiHeaders = {
392
+ "content-type": "application/json"
393
+ };
394
+ return await this.client.call(
395
+ "put",
396
+ uri,
397
+ apiHeaders,
398
+ payload
399
+ );
400
+ }
401
+ /**
402
+ * List Factors
403
+ *
404
+ * List the factors available on the account to be used as a MFA challange.
405
+ *
406
+ * @throws {AppwriteException}
407
+ * @returns {Promise<Models.MfaFactors>}
408
+ */
409
+ async listMfaFactors() {
410
+ const apiPath = "/account/mfa/factors";
411
+ const payload = {};
412
+ const uri = new URL(this.client.config.endpoint + apiPath);
413
+ const apiHeaders = {
414
+ "content-type": "application/json"
415
+ };
416
+ return await this.client.call(
417
+ "get",
418
+ uri,
419
+ apiHeaders,
420
+ payload
421
+ );
422
+ }
423
+ /**
424
+ * Get MFA Recovery Codes
425
+ *
426
+ * 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.
427
+ *
428
+ * @throws {AppwriteException}
429
+ * @returns {Promise<Models.MfaRecoveryCodes>}
430
+ */
431
+ async getMfaRecoveryCodes() {
432
+ const apiPath = "/account/mfa/recovery-codes";
433
+ const payload = {};
434
+ const uri = new URL(this.client.config.endpoint + apiPath);
435
+ const apiHeaders = {
436
+ "content-type": "application/json"
437
+ };
438
+ return await this.client.call(
439
+ "get",
440
+ uri,
441
+ apiHeaders,
442
+ payload
443
+ );
444
+ }
445
+ /**
446
+ * Create MFA Recovery Codes
447
+ *
448
+ * Generate recovery codes as backup for MFA flow. It&#039;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.
449
+ *
450
+ * @throws {AppwriteException}
451
+ * @returns {Promise<Models.MfaRecoveryCodes>}
452
+ */
453
+ async createMfaRecoveryCodes() {
454
+ const apiPath = "/account/mfa/recovery-codes";
455
+ const payload = {};
456
+ const uri = new URL(this.client.config.endpoint + apiPath);
457
+ const apiHeaders = {
458
+ "content-type": "application/json"
459
+ };
460
+ return await this.client.call(
461
+ "post",
462
+ uri,
463
+ apiHeaders,
464
+ payload
465
+ );
466
+ }
467
+ /**
468
+ * Regenerate MFA Recovery Codes
469
+ *
470
+ * 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.
471
+ *
472
+ * @throws {AppwriteException}
473
+ * @returns {Promise<Models.MfaRecoveryCodes>}
474
+ */
475
+ async updateMfaRecoveryCodes() {
476
+ const apiPath = "/account/mfa/recovery-codes";
477
+ const payload = {};
478
+ const uri = new URL(this.client.config.endpoint + apiPath);
479
+ const apiHeaders = {
480
+ "content-type": "application/json"
481
+ };
482
+ return await this.client.call(
483
+ "patch",
484
+ uri,
485
+ apiHeaders,
486
+ payload
487
+ );
488
+ }
489
+ /**
490
+ * Update name
491
+ *
492
+ * Update currently logged in user account name.
493
+ *
494
+ * @param {string} name
495
+ * @throws {AppwriteException}
496
+ * @returns {Promise<Models.User<Preferences>>}
497
+ */
498
+ async updateName(name) {
499
+ if (typeof name === "undefined") {
500
+ throw new AppwriteException('Missing required parameter: "name"');
501
+ }
502
+ const apiPath = "/account/name";
503
+ const payload = {};
504
+ if (typeof name !== "undefined") {
505
+ payload["name"] = name;
506
+ }
507
+ const uri = new URL(this.client.config.endpoint + apiPath);
508
+ const apiHeaders = {
509
+ "content-type": "application/json"
510
+ };
511
+ return await this.client.call(
512
+ "patch",
513
+ uri,
514
+ apiHeaders,
515
+ payload
516
+ );
517
+ }
518
+ /**
519
+ * Update password
520
+ *
521
+ * 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.
522
+ *
523
+ * @param {string} password
524
+ * @param {string} oldPassword
525
+ * @throws {AppwriteException}
526
+ * @returns {Promise<Models.User<Preferences>>}
527
+ */
528
+ async updatePassword(password, oldPassword) {
529
+ if (typeof password === "undefined") {
530
+ throw new AppwriteException('Missing required parameter: "password"');
531
+ }
532
+ const apiPath = "/account/password";
533
+ const payload = {};
534
+ if (typeof password !== "undefined") {
535
+ payload["password"] = password;
536
+ }
537
+ if (typeof oldPassword !== "undefined") {
538
+ payload["oldPassword"] = oldPassword;
539
+ }
540
+ const uri = new URL(this.client.config.endpoint + apiPath);
541
+ const apiHeaders = {
542
+ "content-type": "application/json"
543
+ };
544
+ return await this.client.call(
545
+ "patch",
546
+ uri,
547
+ apiHeaders,
548
+ payload
549
+ );
550
+ }
551
+ /**
552
+ * Update phone
553
+ *
554
+ * Update the currently logged in user&#039;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.
555
+ *
556
+ * @param {string} phone
557
+ * @param {string} password
558
+ * @throws {AppwriteException}
559
+ * @returns {Promise<Models.User<Preferences>>}
560
+ */
561
+ async updatePhone(phone, password) {
562
+ if (typeof phone === "undefined") {
563
+ throw new AppwriteException('Missing required parameter: "phone"');
564
+ }
565
+ if (typeof password === "undefined") {
566
+ throw new AppwriteException('Missing required parameter: "password"');
567
+ }
568
+ const apiPath = "/account/phone";
569
+ const payload = {};
570
+ if (typeof phone !== "undefined") {
571
+ payload["phone"] = phone;
572
+ }
573
+ if (typeof password !== "undefined") {
574
+ payload["password"] = password;
575
+ }
576
+ const uri = new URL(this.client.config.endpoint + apiPath);
577
+ const apiHeaders = {
578
+ "content-type": "application/json"
579
+ };
580
+ return await this.client.call(
581
+ "patch",
582
+ uri,
583
+ apiHeaders,
584
+ payload
585
+ );
586
+ }
587
+ /**
588
+ * Get account preferences
589
+ *
590
+ * Get the preferences as a key-value object for the currently logged in user.
591
+ *
592
+ * @throws {AppwriteException}
593
+ * @returns {Promise<Preferences>}
594
+ */
595
+ async getPrefs() {
596
+ const apiPath = "/account/prefs";
597
+ const payload = {};
598
+ const uri = new URL(this.client.config.endpoint + apiPath);
599
+ const apiHeaders = {
600
+ "content-type": "application/json"
601
+ };
602
+ return await this.client.call(
603
+ "get",
604
+ uri,
605
+ apiHeaders,
606
+ payload
607
+ );
608
+ }
609
+ /**
610
+ * Update preferences
611
+ *
612
+ * 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.
613
+ *
614
+ * @param {Partial<Preferences>} prefs
615
+ * @throws {AppwriteException}
616
+ * @returns {Promise<Models.User<Preferences>>}
617
+ */
618
+ async updatePrefs(prefs) {
619
+ if (typeof prefs === "undefined") {
620
+ throw new AppwriteException('Missing required parameter: "prefs"');
621
+ }
622
+ const apiPath = "/account/prefs";
623
+ const payload = {};
624
+ if (typeof prefs !== "undefined") {
625
+ payload["prefs"] = prefs;
626
+ }
627
+ const uri = new URL(this.client.config.endpoint + apiPath);
628
+ const apiHeaders = {
629
+ "content-type": "application/json"
630
+ };
631
+ return await this.client.call(
632
+ "patch",
633
+ uri,
634
+ apiHeaders,
635
+ payload
636
+ );
637
+ }
638
+ /**
639
+ * Create password recovery
640
+ *
641
+ * 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&#039;s email address is valid for 1 hour.
642
+ *
643
+ * @param {string} email
644
+ * @param {string} url
645
+ * @throws {AppwriteException}
646
+ * @returns {Promise<Models.Token>}
647
+ */
648
+ async createRecovery(email, url) {
649
+ if (typeof email === "undefined") {
650
+ throw new AppwriteException('Missing required parameter: "email"');
651
+ }
652
+ if (typeof url === "undefined") {
653
+ throw new AppwriteException('Missing required parameter: "url"');
654
+ }
655
+ const apiPath = "/account/recovery";
656
+ const payload = {};
657
+ if (typeof email !== "undefined") {
658
+ payload["email"] = email;
659
+ }
660
+ if (typeof url !== "undefined") {
661
+ payload["url"] = url;
662
+ }
663
+ const uri = new URL(this.client.config.endpoint + apiPath);
664
+ const apiHeaders = {
665
+ "content-type": "application/json"
666
+ };
667
+ return await this.client.call(
668
+ "post",
669
+ uri,
670
+ apiHeaders,
671
+ payload
672
+ );
673
+ }
674
+ /**
675
+ * Create password recovery (confirmation)
676
+ *
677
+ * 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.
678
+
679
+ 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.
680
+ *
681
+ * @param {string} userId
682
+ * @param {string} secret
683
+ * @param {string} password
684
+ * @throws {AppwriteException}
685
+ * @returns {Promise<Models.Token>}
686
+ */
687
+ async updateRecovery(userId, secret, password) {
688
+ if (typeof userId === "undefined") {
689
+ throw new AppwriteException('Missing required parameter: "userId"');
690
+ }
691
+ if (typeof secret === "undefined") {
692
+ throw new AppwriteException('Missing required parameter: "secret"');
693
+ }
694
+ if (typeof password === "undefined") {
695
+ throw new AppwriteException('Missing required parameter: "password"');
696
+ }
697
+ const apiPath = "/account/recovery";
698
+ const payload = {};
699
+ if (typeof userId !== "undefined") {
700
+ payload["userId"] = userId;
701
+ }
702
+ if (typeof secret !== "undefined") {
703
+ payload["secret"] = secret;
704
+ }
705
+ if (typeof password !== "undefined") {
706
+ payload["password"] = password;
707
+ }
708
+ const uri = new URL(this.client.config.endpoint + apiPath);
709
+ const apiHeaders = {
710
+ "content-type": "application/json"
711
+ };
712
+ return await this.client.call(
713
+ "put",
714
+ uri,
715
+ apiHeaders,
716
+ payload
717
+ );
718
+ }
719
+ /**
720
+ * List sessions
721
+ *
722
+ * Get the list of active sessions across different devices for the currently logged in user.
723
+ *
724
+ * @throws {AppwriteException}
725
+ * @returns {Promise<Models.SessionList>}
726
+ */
727
+ async listSessions() {
728
+ const apiPath = "/account/sessions";
729
+ const payload = {};
730
+ const uri = new URL(this.client.config.endpoint + apiPath);
731
+ const apiHeaders = {
732
+ "content-type": "application/json"
733
+ };
734
+ return await this.client.call(
735
+ "get",
736
+ uri,
737
+ apiHeaders,
738
+ payload
739
+ );
740
+ }
741
+ /**
742
+ * Delete sessions
743
+ *
744
+ * Delete all sessions from the user account and remove any sessions cookies from the end client.
745
+ *
746
+ * @throws {AppwriteException}
747
+ * @returns {Promise<{}>}
748
+ */
749
+ async deleteSessions() {
750
+ const apiPath = "/account/sessions";
751
+ const payload = {};
752
+ const uri = new URL(this.client.config.endpoint + apiPath);
753
+ const apiHeaders = {
754
+ "content-type": "application/json"
755
+ };
756
+ return await this.client.call(
757
+ "delete",
758
+ uri,
759
+ apiHeaders,
760
+ payload
761
+ );
762
+ }
763
+ /**
764
+ * Create anonymous session
765
+ *
766
+ * 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).
767
+ *
768
+ * @throws {AppwriteException}
769
+ * @returns {Promise<Models.Session>}
770
+ */
771
+ async createAnonymousSession() {
772
+ const apiPath = "/account/sessions/anonymous";
773
+ const payload = {};
774
+ const uri = new URL(this.client.config.endpoint + apiPath);
775
+ const apiHeaders = {
776
+ "content-type": "application/json"
777
+ };
778
+ return await this.client.call(
779
+ "post",
780
+ uri,
781
+ apiHeaders,
782
+ payload
783
+ );
784
+ }
785
+ /**
786
+ * Create email password session
787
+ *
788
+ * 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.
789
+
790
+ 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).
791
+ *
792
+ * @param {string} email
793
+ * @param {string} password
794
+ * @throws {AppwriteException}
795
+ * @returns {Promise<Models.Session>}
796
+ */
797
+ async createEmailPasswordSession(email, password) {
798
+ if (typeof email === "undefined") {
799
+ throw new AppwriteException('Missing required parameter: "email"');
800
+ }
801
+ if (typeof password === "undefined") {
802
+ throw new AppwriteException('Missing required parameter: "password"');
803
+ }
804
+ const apiPath = "/account/sessions/email";
805
+ const payload = {};
806
+ if (typeof email !== "undefined") {
807
+ payload["email"] = email;
808
+ }
809
+ if (typeof password !== "undefined") {
810
+ payload["password"] = password;
811
+ }
812
+ const uri = new URL(this.client.config.endpoint + apiPath);
813
+ const apiHeaders = {
814
+ "content-type": "application/json"
815
+ };
816
+ return await this.client.call(
817
+ "post",
818
+ uri,
819
+ apiHeaders,
820
+ payload
821
+ );
822
+ }
823
+ /**
824
+ * Update magic URL session
825
+ *
826
+ * 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.
827
+ *
828
+ * @param {string} userId
829
+ * @param {string} secret
830
+ * @throws {AppwriteException}
831
+ * @returns {Promise<Models.Session>}
832
+ */
833
+ async updateMagicURLSession(userId, secret) {
834
+ if (typeof userId === "undefined") {
835
+ throw new AppwriteException('Missing required parameter: "userId"');
836
+ }
837
+ if (typeof secret === "undefined") {
838
+ throw new AppwriteException('Missing required parameter: "secret"');
839
+ }
840
+ const apiPath = "/account/sessions/magic-url";
841
+ const payload = {};
842
+ if (typeof userId !== "undefined") {
843
+ payload["userId"] = userId;
844
+ }
845
+ if (typeof secret !== "undefined") {
846
+ payload["secret"] = secret;
847
+ }
848
+ const uri = new URL(this.client.config.endpoint + apiPath);
849
+ const apiHeaders = {
850
+ "content-type": "application/json"
851
+ };
852
+ return await this.client.call(
853
+ "put",
854
+ uri,
855
+ apiHeaders,
856
+ payload
857
+ );
858
+ }
859
+ /**
860
+ * Update phone session
861
+ *
862
+ * 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.
863
+ *
864
+ * @param {string} userId
865
+ * @param {string} secret
866
+ * @throws {AppwriteException}
867
+ * @returns {Promise<Models.Session>}
868
+ */
869
+ async updatePhoneSession(userId, secret) {
870
+ if (typeof userId === "undefined") {
871
+ throw new AppwriteException('Missing required parameter: "userId"');
872
+ }
873
+ if (typeof secret === "undefined") {
874
+ throw new AppwriteException('Missing required parameter: "secret"');
875
+ }
876
+ const apiPath = "/account/sessions/phone";
877
+ const payload = {};
878
+ if (typeof userId !== "undefined") {
879
+ payload["userId"] = userId;
880
+ }
881
+ if (typeof secret !== "undefined") {
882
+ payload["secret"] = secret;
883
+ }
884
+ const uri = new URL(this.client.config.endpoint + apiPath);
885
+ const apiHeaders = {
886
+ "content-type": "application/json"
887
+ };
888
+ return await this.client.call(
889
+ "put",
890
+ uri,
891
+ apiHeaders,
892
+ payload
893
+ );
894
+ }
895
+ /**
896
+ * Create session
897
+ *
898
+ * 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.
899
+ *
900
+ * @param {string} userId
901
+ * @param {string} secret
902
+ * @throws {AppwriteException}
903
+ * @returns {Promise<Models.Session>}
904
+ */
905
+ async createSession(userId, secret) {
906
+ if (typeof userId === "undefined") {
907
+ throw new AppwriteException('Missing required parameter: "userId"');
908
+ }
909
+ if (typeof secret === "undefined") {
910
+ throw new AppwriteException('Missing required parameter: "secret"');
911
+ }
912
+ const apiPath = "/account/sessions/token";
913
+ const payload = {};
914
+ if (typeof userId !== "undefined") {
915
+ payload["userId"] = userId;
916
+ }
917
+ if (typeof secret !== "undefined") {
918
+ payload["secret"] = secret;
919
+ }
920
+ const uri = new URL(this.client.config.endpoint + apiPath);
921
+ const apiHeaders = {
922
+ "content-type": "application/json"
923
+ };
924
+ return await this.client.call(
925
+ "post",
926
+ uri,
927
+ apiHeaders,
928
+ payload
929
+ );
930
+ }
931
+ /**
932
+ * Get session
933
+ *
934
+ * Use this endpoint to get a logged in user&#039;s session using a Session ID. Inputting &#039;current&#039; will return the current session being used.
935
+ *
936
+ * @param {string} sessionId
937
+ * @throws {AppwriteException}
938
+ * @returns {Promise<Models.Session>}
939
+ */
940
+ async getSession(sessionId) {
941
+ if (typeof sessionId === "undefined") {
942
+ throw new AppwriteException('Missing required parameter: "sessionId"');
943
+ }
944
+ const apiPath = "/account/sessions/{sessionId}".replace("{sessionId}", sessionId);
945
+ const payload = {};
946
+ const uri = new URL(this.client.config.endpoint + apiPath);
947
+ const apiHeaders = {
948
+ "content-type": "application/json"
949
+ };
950
+ return await this.client.call(
951
+ "get",
952
+ uri,
953
+ apiHeaders,
954
+ payload
955
+ );
956
+ }
957
+ /**
958
+ * Update session
959
+ *
960
+ * Use this endpoint to extend a session&#039;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.
961
+ *
962
+ * @param {string} sessionId
963
+ * @throws {AppwriteException}
964
+ * @returns {Promise<Models.Session>}
965
+ */
966
+ async updateSession(sessionId) {
967
+ if (typeof sessionId === "undefined") {
968
+ throw new AppwriteException('Missing required parameter: "sessionId"');
969
+ }
970
+ const apiPath = "/account/sessions/{sessionId}".replace("{sessionId}", sessionId);
971
+ const payload = {};
972
+ const uri = new URL(this.client.config.endpoint + apiPath);
973
+ const apiHeaders = {
974
+ "content-type": "application/json"
975
+ };
976
+ return await this.client.call(
977
+ "patch",
978
+ uri,
979
+ apiHeaders,
980
+ payload
981
+ );
982
+ }
983
+ /**
984
+ * Delete session
985
+ *
986
+ * Logout the user. Use &#039;current&#039; as the session ID to logout on this device, use a session ID to logout on another device. If you&#039;re looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
987
+ *
988
+ * @param {string} sessionId
989
+ * @throws {AppwriteException}
990
+ * @returns {Promise<{}>}
991
+ */
992
+ async deleteSession(sessionId) {
993
+ if (typeof sessionId === "undefined") {
994
+ throw new AppwriteException('Missing required parameter: "sessionId"');
995
+ }
996
+ const apiPath = "/account/sessions/{sessionId}".replace("{sessionId}", sessionId);
997
+ const payload = {};
998
+ const uri = new URL(this.client.config.endpoint + apiPath);
999
+ const apiHeaders = {
1000
+ "content-type": "application/json"
1001
+ };
1002
+ return await this.client.call(
1003
+ "delete",
1004
+ uri,
1005
+ apiHeaders,
1006
+ payload
1007
+ );
1008
+ }
1009
+ /**
1010
+ * Update status
1011
+ *
1012
+ * 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.
1013
+ *
1014
+ * @throws {AppwriteException}
1015
+ * @returns {Promise<Models.User<Preferences>>}
1016
+ */
1017
+ async updateStatus() {
1018
+ const apiPath = "/account/status";
1019
+ const payload = {};
1020
+ const uri = new URL(this.client.config.endpoint + apiPath);
1021
+ const apiHeaders = {
1022
+ "content-type": "application/json"
1023
+ };
1024
+ return await this.client.call(
1025
+ "patch",
1026
+ uri,
1027
+ apiHeaders,
1028
+ payload
1029
+ );
1030
+ }
1031
+ /**
1032
+ * Create email token (OTP)
1033
+ *
1034
+ * Sends the user an email 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&#039;s email is valid for 15 minutes.
1035
+
1036
+ 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).
1037
+ *
1038
+ * @param {string} userId
1039
+ * @param {string} email
1040
+ * @param {boolean} phrase
1041
+ * @throws {AppwriteException}
1042
+ * @returns {Promise<Models.Token>}
1043
+ */
1044
+ async createEmailToken(userId, email, phrase) {
1045
+ if (typeof userId === "undefined") {
1046
+ throw new AppwriteException('Missing required parameter: "userId"');
1047
+ }
1048
+ if (typeof email === "undefined") {
1049
+ throw new AppwriteException('Missing required parameter: "email"');
1050
+ }
1051
+ const apiPath = "/account/tokens/email";
1052
+ const payload = {};
1053
+ if (typeof userId !== "undefined") {
1054
+ payload["userId"] = userId;
1055
+ }
1056
+ if (typeof email !== "undefined") {
1057
+ payload["email"] = email;
1058
+ }
1059
+ if (typeof phrase !== "undefined") {
1060
+ payload["phrase"] = phrase;
1061
+ }
1062
+ const uri = new URL(this.client.config.endpoint + apiPath);
1063
+ const apiHeaders = {
1064
+ "content-type": "application/json"
1065
+ };
1066
+ return await this.client.call(
1067
+ "post",
1068
+ uri,
1069
+ apiHeaders,
1070
+ payload
1071
+ );
1072
+ }
1073
+ /**
1074
+ * Create magic URL token
1075
+ *
1076
+ * 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&#039;s email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.
1077
+
1078
+ 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).
1079
+
1080
+ *
1081
+ * @param {string} userId
1082
+ * @param {string} email
1083
+ * @param {string} url
1084
+ * @param {boolean} phrase
1085
+ * @throws {AppwriteException}
1086
+ * @returns {Promise<Models.Token>}
1087
+ */
1088
+ async createMagicURLToken(userId, email, url, phrase) {
1089
+ if (typeof userId === "undefined") {
1090
+ throw new AppwriteException('Missing required parameter: "userId"');
1091
+ }
1092
+ if (typeof email === "undefined") {
1093
+ throw new AppwriteException('Missing required parameter: "email"');
1094
+ }
1095
+ const apiPath = "/account/tokens/magic-url";
1096
+ const payload = {};
1097
+ if (typeof userId !== "undefined") {
1098
+ payload["userId"] = userId;
1099
+ }
1100
+ if (typeof email !== "undefined") {
1101
+ payload["email"] = email;
1102
+ }
1103
+ if (typeof url !== "undefined") {
1104
+ payload["url"] = url;
1105
+ }
1106
+ if (typeof phrase !== "undefined") {
1107
+ payload["phrase"] = phrase;
1108
+ }
1109
+ const uri = new URL(this.client.config.endpoint + apiPath);
1110
+ const apiHeaders = {
1111
+ "content-type": "application/json"
1112
+ };
1113
+ return await this.client.call(
1114
+ "post",
1115
+ uri,
1116
+ apiHeaders,
1117
+ payload
1118
+ );
1119
+ }
1120
+ /**
1121
+ * Create OAuth2 token
1122
+ *
1123
+ * 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&#039;s back to your app when login is completed.
1124
+
1125
+ 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.
1126
+
1127
+ 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).
1128
+ *
1129
+ * @param {OAuthProvider} provider
1130
+ * @param {string} success
1131
+ * @param {string} failure
1132
+ * @param {string[]} scopes
1133
+ * @throws {AppwriteException}
1134
+ * @returns {Promise<string>}
1135
+ */
1136
+ async createOAuth2Token(provider, success, failure, scopes) {
1137
+ if (typeof provider === "undefined") {
1138
+ throw new AppwriteException('Missing required parameter: "provider"');
1139
+ }
1140
+ const apiPath = "/account/tokens/oauth2/{provider}".replace("{provider}", provider);
1141
+ const payload = {};
1142
+ if (typeof success !== "undefined") {
1143
+ payload["success"] = success;
1144
+ }
1145
+ if (typeof failure !== "undefined") {
1146
+ payload["failure"] = failure;
1147
+ }
1148
+ if (typeof scopes !== "undefined") {
1149
+ payload["scopes"] = scopes;
1150
+ }
1151
+ const uri = new URL(this.client.config.endpoint + apiPath);
1152
+ const apiHeaders = {
1153
+ "content-type": "application/json"
1154
+ };
1155
+ return await this.client.redirect(
1156
+ "get",
1157
+ uri,
1158
+ apiHeaders,
1159
+ payload
1160
+ );
1161
+ }
1162
+ /**
1163
+ * Create phone token
1164
+ *
1165
+ * 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&#039;s phone is valid for 15 minutes.
1166
+
1167
+ 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).
1168
+ *
1169
+ * @param {string} userId
1170
+ * @param {string} phone
1171
+ * @throws {AppwriteException}
1172
+ * @returns {Promise<Models.Token>}
1173
+ */
1174
+ async createPhoneToken(userId, phone) {
1175
+ if (typeof userId === "undefined") {
1176
+ throw new AppwriteException('Missing required parameter: "userId"');
1177
+ }
1178
+ if (typeof phone === "undefined") {
1179
+ throw new AppwriteException('Missing required parameter: "phone"');
1180
+ }
1181
+ const apiPath = "/account/tokens/phone";
1182
+ const payload = {};
1183
+ if (typeof userId !== "undefined") {
1184
+ payload["userId"] = userId;
1185
+ }
1186
+ if (typeof phone !== "undefined") {
1187
+ payload["phone"] = phone;
1188
+ }
1189
+ const uri = new URL(this.client.config.endpoint + apiPath);
1190
+ const apiHeaders = {
1191
+ "content-type": "application/json"
1192
+ };
1193
+ return await this.client.call(
1194
+ "post",
1195
+ uri,
1196
+ apiHeaders,
1197
+ payload
1198
+ );
1199
+ }
1200
+ /**
1201
+ * Create email verification
1202
+ *
1203
+ * 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&#039;s email address is valid for 7 days.
1204
+
1205
+ 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.
1206
+
1207
+ *
1208
+ * @param {string} url
1209
+ * @throws {AppwriteException}
1210
+ * @returns {Promise<Models.Token>}
1211
+ */
1212
+ async createVerification(url) {
1213
+ if (typeof url === "undefined") {
1214
+ throw new AppwriteException('Missing required parameter: "url"');
1215
+ }
1216
+ const apiPath = "/account/verification";
1217
+ const payload = {};
1218
+ if (typeof url !== "undefined") {
1219
+ payload["url"] = url;
1220
+ }
1221
+ const uri = new URL(this.client.config.endpoint + apiPath);
1222
+ const apiHeaders = {
1223
+ "content-type": "application/json"
1224
+ };
1225
+ return await this.client.call(
1226
+ "post",
1227
+ uri,
1228
+ apiHeaders,
1229
+ payload
1230
+ );
1231
+ }
1232
+ /**
1233
+ * Create email verification (confirmation)
1234
+ *
1235
+ * 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.
1236
+ *
1237
+ * @param {string} userId
1238
+ * @param {string} secret
1239
+ * @throws {AppwriteException}
1240
+ * @returns {Promise<Models.Token>}
1241
+ */
1242
+ async updateVerification(userId, secret) {
1243
+ if (typeof userId === "undefined") {
1244
+ throw new AppwriteException('Missing required parameter: "userId"');
1245
+ }
1246
+ if (typeof secret === "undefined") {
1247
+ throw new AppwriteException('Missing required parameter: "secret"');
1248
+ }
1249
+ const apiPath = "/account/verification";
1250
+ const payload = {};
1251
+ if (typeof userId !== "undefined") {
1252
+ payload["userId"] = userId;
1253
+ }
1254
+ if (typeof secret !== "undefined") {
1255
+ payload["secret"] = secret;
1256
+ }
1257
+ const uri = new URL(this.client.config.endpoint + apiPath);
1258
+ const apiHeaders = {
1259
+ "content-type": "application/json"
1260
+ };
1261
+ return await this.client.call(
1262
+ "put",
1263
+ uri,
1264
+ apiHeaders,
1265
+ payload
1266
+ );
1267
+ }
1268
+ /**
1269
+ * Create phone verification
1270
+ *
1271
+ * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user&#039;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&#039;s phone number is valid for 15 minutes.
1272
+ *
1273
+ * @throws {AppwriteException}
1274
+ * @returns {Promise<Models.Token>}
1275
+ */
1276
+ async createPhoneVerification() {
1277
+ const apiPath = "/account/verification/phone";
1278
+ const payload = {};
1279
+ const uri = new URL(this.client.config.endpoint + apiPath);
1280
+ const apiHeaders = {
1281
+ "content-type": "application/json"
1282
+ };
1283
+ return await this.client.call(
1284
+ "post",
1285
+ uri,
1286
+ apiHeaders,
1287
+ payload
1288
+ );
1289
+ }
1290
+ /**
1291
+ * Create phone verification (confirmation)
1292
+ *
1293
+ * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user&#039;s phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
1294
+ *
1295
+ * @param {string} userId
1296
+ * @param {string} secret
1297
+ * @throws {AppwriteException}
1298
+ * @returns {Promise<Models.Token>}
1299
+ */
1300
+ async updatePhoneVerification(userId, secret) {
1301
+ if (typeof userId === "undefined") {
1302
+ throw new AppwriteException('Missing required parameter: "userId"');
1303
+ }
1304
+ if (typeof secret === "undefined") {
1305
+ throw new AppwriteException('Missing required parameter: "secret"');
1306
+ }
1307
+ const apiPath = "/account/verification/phone";
1308
+ const payload = {};
1309
+ if (typeof userId !== "undefined") {
1310
+ payload["userId"] = userId;
1311
+ }
1312
+ if (typeof secret !== "undefined") {
1313
+ payload["secret"] = secret;
1314
+ }
1315
+ const uri = new URL(this.client.config.endpoint + apiPath);
1316
+ const apiHeaders = {
1317
+ "content-type": "application/json"
1318
+ };
1319
+ return await this.client.call(
1320
+ "put",
1321
+ uri,
1322
+ apiHeaders,
1323
+ payload
1324
+ );
1325
+ }
1326
+ };
1327
+
1328
+ export { Account };
1329
+ //# sourceMappingURL=out.js.map
1330
+ //# sourceMappingURL=account.mjs.map