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,1465 @@
1
+ 'use strict';
2
+
3
+ var client = require('../client');
4
+
5
+ class Users {
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * List users
11
+ *
12
+ * Get a list of all the project's users. You can use the query params to filter your results.
13
+ *
14
+ * @param {string[]} queries
15
+ * @param {string} search
16
+ * @throws {AppwriteException}
17
+ * @returns {Promise<Models.UserList<Preferences>>}
18
+ */
19
+ async list(queries, search) {
20
+ const apiPath = "/users";
21
+ const payload = {};
22
+ if (typeof queries !== "undefined") {
23
+ payload["queries"] = queries;
24
+ }
25
+ if (typeof search !== "undefined") {
26
+ payload["search"] = search;
27
+ }
28
+ const uri = new URL(this.client.config.endpoint + apiPath);
29
+ const apiHeaders = {
30
+ "content-type": "application/json"
31
+ };
32
+ return await this.client.call(
33
+ "get",
34
+ uri,
35
+ apiHeaders,
36
+ payload
37
+ );
38
+ }
39
+ /**
40
+ * Create user
41
+ *
42
+ * Create a new user.
43
+ *
44
+ * @param {string} userId
45
+ * @param {string} email
46
+ * @param {string} phone
47
+ * @param {string} password
48
+ * @param {string} name
49
+ * @throws {AppwriteException}
50
+ * @returns {Promise<Models.User<Preferences>>}
51
+ */
52
+ async create(userId, email, phone, password, name) {
53
+ if (typeof userId === "undefined") {
54
+ throw new client.AppwriteException('Missing required parameter: "userId"');
55
+ }
56
+ const apiPath = "/users";
57
+ const payload = {};
58
+ if (typeof userId !== "undefined") {
59
+ payload["userId"] = userId;
60
+ }
61
+ if (typeof email !== "undefined") {
62
+ payload["email"] = email;
63
+ }
64
+ if (typeof phone !== "undefined") {
65
+ payload["phone"] = phone;
66
+ }
67
+ if (typeof password !== "undefined") {
68
+ payload["password"] = password;
69
+ }
70
+ if (typeof name !== "undefined") {
71
+ payload["name"] = name;
72
+ }
73
+ const uri = new URL(this.client.config.endpoint + apiPath);
74
+ const apiHeaders = {
75
+ "content-type": "application/json"
76
+ };
77
+ return await this.client.call(
78
+ "post",
79
+ uri,
80
+ apiHeaders,
81
+ payload
82
+ );
83
+ }
84
+ /**
85
+ * Create user with Argon2 password
86
+ *
87
+ * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
88
+ *
89
+ * @param {string} userId
90
+ * @param {string} email
91
+ * @param {string} password
92
+ * @param {string} name
93
+ * @throws {AppwriteException}
94
+ * @returns {Promise<Models.User<Preferences>>}
95
+ */
96
+ async createArgon2User(userId, email, password, name) {
97
+ if (typeof userId === "undefined") {
98
+ throw new client.AppwriteException('Missing required parameter: "userId"');
99
+ }
100
+ if (typeof email === "undefined") {
101
+ throw new client.AppwriteException('Missing required parameter: "email"');
102
+ }
103
+ if (typeof password === "undefined") {
104
+ throw new client.AppwriteException('Missing required parameter: "password"');
105
+ }
106
+ const apiPath = "/users/argon2";
107
+ const payload = {};
108
+ if (typeof userId !== "undefined") {
109
+ payload["userId"] = userId;
110
+ }
111
+ if (typeof email !== "undefined") {
112
+ payload["email"] = email;
113
+ }
114
+ if (typeof password !== "undefined") {
115
+ payload["password"] = password;
116
+ }
117
+ if (typeof name !== "undefined") {
118
+ payload["name"] = name;
119
+ }
120
+ const uri = new URL(this.client.config.endpoint + apiPath);
121
+ const apiHeaders = {
122
+ "content-type": "application/json"
123
+ };
124
+ return await this.client.call(
125
+ "post",
126
+ uri,
127
+ apiHeaders,
128
+ payload
129
+ );
130
+ }
131
+ /**
132
+ * Create user with bcrypt password
133
+ *
134
+ * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
135
+ *
136
+ * @param {string} userId
137
+ * @param {string} email
138
+ * @param {string} password
139
+ * @param {string} name
140
+ * @throws {AppwriteException}
141
+ * @returns {Promise<Models.User<Preferences>>}
142
+ */
143
+ async createBcryptUser(userId, email, password, name) {
144
+ if (typeof userId === "undefined") {
145
+ throw new client.AppwriteException('Missing required parameter: "userId"');
146
+ }
147
+ if (typeof email === "undefined") {
148
+ throw new client.AppwriteException('Missing required parameter: "email"');
149
+ }
150
+ if (typeof password === "undefined") {
151
+ throw new client.AppwriteException('Missing required parameter: "password"');
152
+ }
153
+ const apiPath = "/users/bcrypt";
154
+ const payload = {};
155
+ if (typeof userId !== "undefined") {
156
+ payload["userId"] = userId;
157
+ }
158
+ if (typeof email !== "undefined") {
159
+ payload["email"] = email;
160
+ }
161
+ if (typeof password !== "undefined") {
162
+ payload["password"] = password;
163
+ }
164
+ if (typeof name !== "undefined") {
165
+ payload["name"] = name;
166
+ }
167
+ const uri = new URL(this.client.config.endpoint + apiPath);
168
+ const apiHeaders = {
169
+ "content-type": "application/json"
170
+ };
171
+ return await this.client.call(
172
+ "post",
173
+ uri,
174
+ apiHeaders,
175
+ payload
176
+ );
177
+ }
178
+ /**
179
+ * List Identities
180
+ *
181
+ * Get identities for all users.
182
+ *
183
+ * @param {string[]} queries
184
+ * @param {string} search
185
+ * @throws {AppwriteException}
186
+ * @returns {Promise<Models.IdentityList>}
187
+ */
188
+ async listIdentities(queries, search) {
189
+ const apiPath = "/users/identities";
190
+ const payload = {};
191
+ if (typeof queries !== "undefined") {
192
+ payload["queries"] = queries;
193
+ }
194
+ if (typeof search !== "undefined") {
195
+ payload["search"] = search;
196
+ }
197
+ const uri = new URL(this.client.config.endpoint + apiPath);
198
+ const apiHeaders = {
199
+ "content-type": "application/json"
200
+ };
201
+ return await this.client.call(
202
+ "get",
203
+ uri,
204
+ apiHeaders,
205
+ payload
206
+ );
207
+ }
208
+ /**
209
+ * Delete identity
210
+ *
211
+ * Delete an identity by its unique ID.
212
+ *
213
+ * @param {string} identityId
214
+ * @throws {AppwriteException}
215
+ * @returns {Promise<{}>}
216
+ */
217
+ async deleteIdentity(identityId) {
218
+ if (typeof identityId === "undefined") {
219
+ throw new client.AppwriteException('Missing required parameter: "identityId"');
220
+ }
221
+ const apiPath = "/users/identities/{identityId}".replace("{identityId}", identityId);
222
+ const payload = {};
223
+ const uri = new URL(this.client.config.endpoint + apiPath);
224
+ const apiHeaders = {
225
+ "content-type": "application/json"
226
+ };
227
+ return await this.client.call(
228
+ "delete",
229
+ uri,
230
+ apiHeaders,
231
+ payload
232
+ );
233
+ }
234
+ /**
235
+ * Create user with MD5 password
236
+ *
237
+ * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
238
+ *
239
+ * @param {string} userId
240
+ * @param {string} email
241
+ * @param {string} password
242
+ * @param {string} name
243
+ * @throws {AppwriteException}
244
+ * @returns {Promise<Models.User<Preferences>>}
245
+ */
246
+ async createMD5User(userId, email, password, name) {
247
+ if (typeof userId === "undefined") {
248
+ throw new client.AppwriteException('Missing required parameter: "userId"');
249
+ }
250
+ if (typeof email === "undefined") {
251
+ throw new client.AppwriteException('Missing required parameter: "email"');
252
+ }
253
+ if (typeof password === "undefined") {
254
+ throw new client.AppwriteException('Missing required parameter: "password"');
255
+ }
256
+ const apiPath = "/users/md5";
257
+ const payload = {};
258
+ if (typeof userId !== "undefined") {
259
+ payload["userId"] = userId;
260
+ }
261
+ if (typeof email !== "undefined") {
262
+ payload["email"] = email;
263
+ }
264
+ if (typeof password !== "undefined") {
265
+ payload["password"] = password;
266
+ }
267
+ if (typeof name !== "undefined") {
268
+ payload["name"] = name;
269
+ }
270
+ const uri = new URL(this.client.config.endpoint + apiPath);
271
+ const apiHeaders = {
272
+ "content-type": "application/json"
273
+ };
274
+ return await this.client.call(
275
+ "post",
276
+ uri,
277
+ apiHeaders,
278
+ payload
279
+ );
280
+ }
281
+ /**
282
+ * Create user with PHPass password
283
+ *
284
+ * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
285
+ *
286
+ * @param {string} userId
287
+ * @param {string} email
288
+ * @param {string} password
289
+ * @param {string} name
290
+ * @throws {AppwriteException}
291
+ * @returns {Promise<Models.User<Preferences>>}
292
+ */
293
+ async createPHPassUser(userId, email, password, name) {
294
+ if (typeof userId === "undefined") {
295
+ throw new client.AppwriteException('Missing required parameter: "userId"');
296
+ }
297
+ if (typeof email === "undefined") {
298
+ throw new client.AppwriteException('Missing required parameter: "email"');
299
+ }
300
+ if (typeof password === "undefined") {
301
+ throw new client.AppwriteException('Missing required parameter: "password"');
302
+ }
303
+ const apiPath = "/users/phpass";
304
+ const payload = {};
305
+ if (typeof userId !== "undefined") {
306
+ payload["userId"] = userId;
307
+ }
308
+ if (typeof email !== "undefined") {
309
+ payload["email"] = email;
310
+ }
311
+ if (typeof password !== "undefined") {
312
+ payload["password"] = password;
313
+ }
314
+ if (typeof name !== "undefined") {
315
+ payload["name"] = name;
316
+ }
317
+ const uri = new URL(this.client.config.endpoint + apiPath);
318
+ const apiHeaders = {
319
+ "content-type": "application/json"
320
+ };
321
+ return await this.client.call(
322
+ "post",
323
+ uri,
324
+ apiHeaders,
325
+ payload
326
+ );
327
+ }
328
+ /**
329
+ * Create user with Scrypt password
330
+ *
331
+ * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
332
+ *
333
+ * @param {string} userId
334
+ * @param {string} email
335
+ * @param {string} password
336
+ * @param {string} passwordSalt
337
+ * @param {number} passwordCpu
338
+ * @param {number} passwordMemory
339
+ * @param {number} passwordParallel
340
+ * @param {number} passwordLength
341
+ * @param {string} name
342
+ * @throws {AppwriteException}
343
+ * @returns {Promise<Models.User<Preferences>>}
344
+ */
345
+ async createScryptUser(userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name) {
346
+ if (typeof userId === "undefined") {
347
+ throw new client.AppwriteException('Missing required parameter: "userId"');
348
+ }
349
+ if (typeof email === "undefined") {
350
+ throw new client.AppwriteException('Missing required parameter: "email"');
351
+ }
352
+ if (typeof password === "undefined") {
353
+ throw new client.AppwriteException('Missing required parameter: "password"');
354
+ }
355
+ if (typeof passwordSalt === "undefined") {
356
+ throw new client.AppwriteException('Missing required parameter: "passwordSalt"');
357
+ }
358
+ if (typeof passwordCpu === "undefined") {
359
+ throw new client.AppwriteException('Missing required parameter: "passwordCpu"');
360
+ }
361
+ if (typeof passwordMemory === "undefined") {
362
+ throw new client.AppwriteException('Missing required parameter: "passwordMemory"');
363
+ }
364
+ if (typeof passwordParallel === "undefined") {
365
+ throw new client.AppwriteException('Missing required parameter: "passwordParallel"');
366
+ }
367
+ if (typeof passwordLength === "undefined") {
368
+ throw new client.AppwriteException('Missing required parameter: "passwordLength"');
369
+ }
370
+ const apiPath = "/users/scrypt";
371
+ const payload = {};
372
+ if (typeof userId !== "undefined") {
373
+ payload["userId"] = userId;
374
+ }
375
+ if (typeof email !== "undefined") {
376
+ payload["email"] = email;
377
+ }
378
+ if (typeof password !== "undefined") {
379
+ payload["password"] = password;
380
+ }
381
+ if (typeof passwordSalt !== "undefined") {
382
+ payload["passwordSalt"] = passwordSalt;
383
+ }
384
+ if (typeof passwordCpu !== "undefined") {
385
+ payload["passwordCpu"] = passwordCpu;
386
+ }
387
+ if (typeof passwordMemory !== "undefined") {
388
+ payload["passwordMemory"] = passwordMemory;
389
+ }
390
+ if (typeof passwordParallel !== "undefined") {
391
+ payload["passwordParallel"] = passwordParallel;
392
+ }
393
+ if (typeof passwordLength !== "undefined") {
394
+ payload["passwordLength"] = passwordLength;
395
+ }
396
+ if (typeof name !== "undefined") {
397
+ payload["name"] = name;
398
+ }
399
+ const uri = new URL(this.client.config.endpoint + apiPath);
400
+ const apiHeaders = {
401
+ "content-type": "application/json"
402
+ };
403
+ return await this.client.call(
404
+ "post",
405
+ uri,
406
+ apiHeaders,
407
+ payload
408
+ );
409
+ }
410
+ /**
411
+ * Create user with Scrypt modified password
412
+ *
413
+ * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
414
+ *
415
+ * @param {string} userId
416
+ * @param {string} email
417
+ * @param {string} password
418
+ * @param {string} passwordSalt
419
+ * @param {string} passwordSaltSeparator
420
+ * @param {string} passwordSignerKey
421
+ * @param {string} name
422
+ * @throws {AppwriteException}
423
+ * @returns {Promise<Models.User<Preferences>>}
424
+ */
425
+ async createScryptModifiedUser(userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name) {
426
+ if (typeof userId === "undefined") {
427
+ throw new client.AppwriteException('Missing required parameter: "userId"');
428
+ }
429
+ if (typeof email === "undefined") {
430
+ throw new client.AppwriteException('Missing required parameter: "email"');
431
+ }
432
+ if (typeof password === "undefined") {
433
+ throw new client.AppwriteException('Missing required parameter: "password"');
434
+ }
435
+ if (typeof passwordSalt === "undefined") {
436
+ throw new client.AppwriteException('Missing required parameter: "passwordSalt"');
437
+ }
438
+ if (typeof passwordSaltSeparator === "undefined") {
439
+ throw new client.AppwriteException('Missing required parameter: "passwordSaltSeparator"');
440
+ }
441
+ if (typeof passwordSignerKey === "undefined") {
442
+ throw new client.AppwriteException('Missing required parameter: "passwordSignerKey"');
443
+ }
444
+ const apiPath = "/users/scrypt-modified";
445
+ const payload = {};
446
+ if (typeof userId !== "undefined") {
447
+ payload["userId"] = userId;
448
+ }
449
+ if (typeof email !== "undefined") {
450
+ payload["email"] = email;
451
+ }
452
+ if (typeof password !== "undefined") {
453
+ payload["password"] = password;
454
+ }
455
+ if (typeof passwordSalt !== "undefined") {
456
+ payload["passwordSalt"] = passwordSalt;
457
+ }
458
+ if (typeof passwordSaltSeparator !== "undefined") {
459
+ payload["passwordSaltSeparator"] = passwordSaltSeparator;
460
+ }
461
+ if (typeof passwordSignerKey !== "undefined") {
462
+ payload["passwordSignerKey"] = passwordSignerKey;
463
+ }
464
+ if (typeof name !== "undefined") {
465
+ payload["name"] = name;
466
+ }
467
+ const uri = new URL(this.client.config.endpoint + apiPath);
468
+ const apiHeaders = {
469
+ "content-type": "application/json"
470
+ };
471
+ return await this.client.call(
472
+ "post",
473
+ uri,
474
+ apiHeaders,
475
+ payload
476
+ );
477
+ }
478
+ /**
479
+ * Create user with SHA password
480
+ *
481
+ * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.
482
+ *
483
+ * @param {string} userId
484
+ * @param {string} email
485
+ * @param {string} password
486
+ * @param {PasswordHash} passwordVersion
487
+ * @param {string} name
488
+ * @throws {AppwriteException}
489
+ * @returns {Promise<Models.User<Preferences>>}
490
+ */
491
+ async createSHAUser(userId, email, password, passwordVersion, name) {
492
+ if (typeof userId === "undefined") {
493
+ throw new client.AppwriteException('Missing required parameter: "userId"');
494
+ }
495
+ if (typeof email === "undefined") {
496
+ throw new client.AppwriteException('Missing required parameter: "email"');
497
+ }
498
+ if (typeof password === "undefined") {
499
+ throw new client.AppwriteException('Missing required parameter: "password"');
500
+ }
501
+ const apiPath = "/users/sha";
502
+ const payload = {};
503
+ if (typeof userId !== "undefined") {
504
+ payload["userId"] = userId;
505
+ }
506
+ if (typeof email !== "undefined") {
507
+ payload["email"] = email;
508
+ }
509
+ if (typeof password !== "undefined") {
510
+ payload["password"] = password;
511
+ }
512
+ if (typeof passwordVersion !== "undefined") {
513
+ payload["passwordVersion"] = passwordVersion;
514
+ }
515
+ if (typeof name !== "undefined") {
516
+ payload["name"] = name;
517
+ }
518
+ const uri = new URL(this.client.config.endpoint + apiPath);
519
+ const apiHeaders = {
520
+ "content-type": "application/json"
521
+ };
522
+ return await this.client.call(
523
+ "post",
524
+ uri,
525
+ apiHeaders,
526
+ payload
527
+ );
528
+ }
529
+ /**
530
+ * Get user
531
+ *
532
+ * Get a user by its unique ID.
533
+ *
534
+ * @param {string} userId
535
+ * @throws {AppwriteException}
536
+ * @returns {Promise<Models.User<Preferences>>}
537
+ */
538
+ async get(userId) {
539
+ if (typeof userId === "undefined") {
540
+ throw new client.AppwriteException('Missing required parameter: "userId"');
541
+ }
542
+ const apiPath = "/users/{userId}".replace("{userId}", userId);
543
+ const payload = {};
544
+ const uri = new URL(this.client.config.endpoint + apiPath);
545
+ const apiHeaders = {
546
+ "content-type": "application/json"
547
+ };
548
+ return await this.client.call(
549
+ "get",
550
+ uri,
551
+ apiHeaders,
552
+ payload
553
+ );
554
+ }
555
+ /**
556
+ * Delete user
557
+ *
558
+ * Delete a user by its unique ID, thereby releasing it&#039;s ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead.
559
+ *
560
+ * @param {string} userId
561
+ * @throws {AppwriteException}
562
+ * @returns {Promise<{}>}
563
+ */
564
+ async delete(userId) {
565
+ if (typeof userId === "undefined") {
566
+ throw new client.AppwriteException('Missing required parameter: "userId"');
567
+ }
568
+ const apiPath = "/users/{userId}".replace("{userId}", userId);
569
+ const payload = {};
570
+ const uri = new URL(this.client.config.endpoint + apiPath);
571
+ const apiHeaders = {
572
+ "content-type": "application/json"
573
+ };
574
+ return await this.client.call(
575
+ "delete",
576
+ uri,
577
+ apiHeaders,
578
+ payload
579
+ );
580
+ }
581
+ /**
582
+ * Update email
583
+ *
584
+ * Update the user email by its unique ID.
585
+ *
586
+ * @param {string} userId
587
+ * @param {string} email
588
+ * @throws {AppwriteException}
589
+ * @returns {Promise<Models.User<Preferences>>}
590
+ */
591
+ async updateEmail(userId, email) {
592
+ if (typeof userId === "undefined") {
593
+ throw new client.AppwriteException('Missing required parameter: "userId"');
594
+ }
595
+ if (typeof email === "undefined") {
596
+ throw new client.AppwriteException('Missing required parameter: "email"');
597
+ }
598
+ const apiPath = "/users/{userId}/email".replace("{userId}", userId);
599
+ const payload = {};
600
+ if (typeof email !== "undefined") {
601
+ payload["email"] = email;
602
+ }
603
+ const uri = new URL(this.client.config.endpoint + apiPath);
604
+ const apiHeaders = {
605
+ "content-type": "application/json"
606
+ };
607
+ return await this.client.call(
608
+ "patch",
609
+ uri,
610
+ apiHeaders,
611
+ payload
612
+ );
613
+ }
614
+ /**
615
+ * Update user labels
616
+ *
617
+ * Update the user labels by its unique ID.
618
+
619
+ Labels can be used to grant access to resources. While teams are a way for user&#039;s to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info.
620
+ *
621
+ * @param {string} userId
622
+ * @param {string[]} labels
623
+ * @throws {AppwriteException}
624
+ * @returns {Promise<Models.User<Preferences>>}
625
+ */
626
+ async updateLabels(userId, labels) {
627
+ if (typeof userId === "undefined") {
628
+ throw new client.AppwriteException('Missing required parameter: "userId"');
629
+ }
630
+ if (typeof labels === "undefined") {
631
+ throw new client.AppwriteException('Missing required parameter: "labels"');
632
+ }
633
+ const apiPath = "/users/{userId}/labels".replace("{userId}", userId);
634
+ const payload = {};
635
+ if (typeof labels !== "undefined") {
636
+ payload["labels"] = labels;
637
+ }
638
+ const uri = new URL(this.client.config.endpoint + apiPath);
639
+ const apiHeaders = {
640
+ "content-type": "application/json"
641
+ };
642
+ return await this.client.call(
643
+ "put",
644
+ uri,
645
+ apiHeaders,
646
+ payload
647
+ );
648
+ }
649
+ /**
650
+ * List user logs
651
+ *
652
+ * Get the user activity logs list by its unique ID.
653
+ *
654
+ * @param {string} userId
655
+ * @param {string[]} queries
656
+ * @throws {AppwriteException}
657
+ * @returns {Promise<Models.LogList>}
658
+ */
659
+ async listLogs(userId, queries) {
660
+ if (typeof userId === "undefined") {
661
+ throw new client.AppwriteException('Missing required parameter: "userId"');
662
+ }
663
+ const apiPath = "/users/{userId}/logs".replace("{userId}", userId);
664
+ const payload = {};
665
+ if (typeof queries !== "undefined") {
666
+ payload["queries"] = queries;
667
+ }
668
+ const uri = new URL(this.client.config.endpoint + apiPath);
669
+ const apiHeaders = {
670
+ "content-type": "application/json"
671
+ };
672
+ return await this.client.call(
673
+ "get",
674
+ uri,
675
+ apiHeaders,
676
+ payload
677
+ );
678
+ }
679
+ /**
680
+ * List user memberships
681
+ *
682
+ * Get the user membership list by its unique ID.
683
+ *
684
+ * @param {string} userId
685
+ * @throws {AppwriteException}
686
+ * @returns {Promise<Models.MembershipList>}
687
+ */
688
+ async listMemberships(userId) {
689
+ if (typeof userId === "undefined") {
690
+ throw new client.AppwriteException('Missing required parameter: "userId"');
691
+ }
692
+ const apiPath = "/users/{userId}/memberships".replace("{userId}", userId);
693
+ const payload = {};
694
+ const uri = new URL(this.client.config.endpoint + apiPath);
695
+ const apiHeaders = {
696
+ "content-type": "application/json"
697
+ };
698
+ return await this.client.call(
699
+ "get",
700
+ uri,
701
+ apiHeaders,
702
+ payload
703
+ );
704
+ }
705
+ /**
706
+ * Update MFA
707
+ *
708
+ * Enable or disable MFA on a user account.
709
+ *
710
+ * @param {string} userId
711
+ * @param {boolean} mfa
712
+ * @throws {AppwriteException}
713
+ * @returns {Promise<Models.User<Preferences>>}
714
+ */
715
+ async updateMfa(userId, mfa) {
716
+ if (typeof userId === "undefined") {
717
+ throw new client.AppwriteException('Missing required parameter: "userId"');
718
+ }
719
+ if (typeof mfa === "undefined") {
720
+ throw new client.AppwriteException('Missing required parameter: "mfa"');
721
+ }
722
+ const apiPath = "/users/{userId}/mfa".replace("{userId}", userId);
723
+ const payload = {};
724
+ if (typeof mfa !== "undefined") {
725
+ payload["mfa"] = mfa;
726
+ }
727
+ const uri = new URL(this.client.config.endpoint + apiPath);
728
+ const apiHeaders = {
729
+ "content-type": "application/json"
730
+ };
731
+ return await this.client.call(
732
+ "patch",
733
+ uri,
734
+ apiHeaders,
735
+ payload
736
+ );
737
+ }
738
+ /**
739
+ * Delete Authenticator
740
+ *
741
+ * Delete an authenticator app.
742
+ *
743
+ * @param {string} userId
744
+ * @param {AuthenticatorType} type
745
+ * @throws {AppwriteException}
746
+ * @returns {Promise<Models.User<Preferences>>}
747
+ */
748
+ async deleteMfaAuthenticator(userId, type) {
749
+ if (typeof userId === "undefined") {
750
+ throw new client.AppwriteException('Missing required parameter: "userId"');
751
+ }
752
+ if (typeof type === "undefined") {
753
+ throw new client.AppwriteException('Missing required parameter: "type"');
754
+ }
755
+ const apiPath = "/users/{userId}/mfa/authenticators/{type}".replace("{userId}", userId).replace("{type}", type);
756
+ const payload = {};
757
+ const uri = new URL(this.client.config.endpoint + apiPath);
758
+ const apiHeaders = {
759
+ "content-type": "application/json"
760
+ };
761
+ return await this.client.call(
762
+ "delete",
763
+ uri,
764
+ apiHeaders,
765
+ payload
766
+ );
767
+ }
768
+ /**
769
+ * List Factors
770
+ *
771
+ * List the factors available on the account to be used as a MFA challange.
772
+ *
773
+ * @param {string} userId
774
+ * @throws {AppwriteException}
775
+ * @returns {Promise<Models.MfaFactors>}
776
+ */
777
+ async listMfaFactors(userId) {
778
+ if (typeof userId === "undefined") {
779
+ throw new client.AppwriteException('Missing required parameter: "userId"');
780
+ }
781
+ const apiPath = "/users/{userId}/mfa/factors".replace("{userId}", userId);
782
+ const payload = {};
783
+ const uri = new URL(this.client.config.endpoint + apiPath);
784
+ const apiHeaders = {
785
+ "content-type": "application/json"
786
+ };
787
+ return await this.client.call(
788
+ "get",
789
+ uri,
790
+ apiHeaders,
791
+ payload
792
+ );
793
+ }
794
+ /**
795
+ * Get MFA Recovery Codes
796
+ *
797
+ * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
798
+ *
799
+ * @param {string} userId
800
+ * @throws {AppwriteException}
801
+ * @returns {Promise<Models.MfaRecoveryCodes>}
802
+ */
803
+ async getMfaRecoveryCodes(userId) {
804
+ if (typeof userId === "undefined") {
805
+ throw new client.AppwriteException('Missing required parameter: "userId"');
806
+ }
807
+ const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId);
808
+ const payload = {};
809
+ const uri = new URL(this.client.config.endpoint + apiPath);
810
+ const apiHeaders = {
811
+ "content-type": "application/json"
812
+ };
813
+ return await this.client.call(
814
+ "get",
815
+ uri,
816
+ apiHeaders,
817
+ payload
818
+ );
819
+ }
820
+ /**
821
+ * Regenerate MFA Recovery Codes
822
+ *
823
+ * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.
824
+ *
825
+ * @param {string} userId
826
+ * @throws {AppwriteException}
827
+ * @returns {Promise<Models.MfaRecoveryCodes>}
828
+ */
829
+ async updateMfaRecoveryCodes(userId) {
830
+ if (typeof userId === "undefined") {
831
+ throw new client.AppwriteException('Missing required parameter: "userId"');
832
+ }
833
+ const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId);
834
+ const payload = {};
835
+ const uri = new URL(this.client.config.endpoint + apiPath);
836
+ const apiHeaders = {
837
+ "content-type": "application/json"
838
+ };
839
+ return await this.client.call(
840
+ "put",
841
+ uri,
842
+ apiHeaders,
843
+ payload
844
+ );
845
+ }
846
+ /**
847
+ * Create MFA Recovery Codes
848
+ *
849
+ * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK.
850
+ *
851
+ * @param {string} userId
852
+ * @throws {AppwriteException}
853
+ * @returns {Promise<Models.MfaRecoveryCodes>}
854
+ */
855
+ async createMfaRecoveryCodes(userId) {
856
+ if (typeof userId === "undefined") {
857
+ throw new client.AppwriteException('Missing required parameter: "userId"');
858
+ }
859
+ const apiPath = "/users/{userId}/mfa/recovery-codes".replace("{userId}", userId);
860
+ const payload = {};
861
+ const uri = new URL(this.client.config.endpoint + apiPath);
862
+ const apiHeaders = {
863
+ "content-type": "application/json"
864
+ };
865
+ return await this.client.call(
866
+ "patch",
867
+ uri,
868
+ apiHeaders,
869
+ payload
870
+ );
871
+ }
872
+ /**
873
+ * Update name
874
+ *
875
+ * Update the user name by its unique ID.
876
+ *
877
+ * @param {string} userId
878
+ * @param {string} name
879
+ * @throws {AppwriteException}
880
+ * @returns {Promise<Models.User<Preferences>>}
881
+ */
882
+ async updateName(userId, name) {
883
+ if (typeof userId === "undefined") {
884
+ throw new client.AppwriteException('Missing required parameter: "userId"');
885
+ }
886
+ if (typeof name === "undefined") {
887
+ throw new client.AppwriteException('Missing required parameter: "name"');
888
+ }
889
+ const apiPath = "/users/{userId}/name".replace("{userId}", userId);
890
+ const payload = {};
891
+ if (typeof name !== "undefined") {
892
+ payload["name"] = name;
893
+ }
894
+ const uri = new URL(this.client.config.endpoint + apiPath);
895
+ const apiHeaders = {
896
+ "content-type": "application/json"
897
+ };
898
+ return await this.client.call(
899
+ "patch",
900
+ uri,
901
+ apiHeaders,
902
+ payload
903
+ );
904
+ }
905
+ /**
906
+ * Update password
907
+ *
908
+ * Update the user password by its unique ID.
909
+ *
910
+ * @param {string} userId
911
+ * @param {string} password
912
+ * @throws {AppwriteException}
913
+ * @returns {Promise<Models.User<Preferences>>}
914
+ */
915
+ async updatePassword(userId, password) {
916
+ if (typeof userId === "undefined") {
917
+ throw new client.AppwriteException('Missing required parameter: "userId"');
918
+ }
919
+ if (typeof password === "undefined") {
920
+ throw new client.AppwriteException('Missing required parameter: "password"');
921
+ }
922
+ const apiPath = "/users/{userId}/password".replace("{userId}", userId);
923
+ const payload = {};
924
+ if (typeof password !== "undefined") {
925
+ payload["password"] = password;
926
+ }
927
+ const uri = new URL(this.client.config.endpoint + apiPath);
928
+ const apiHeaders = {
929
+ "content-type": "application/json"
930
+ };
931
+ return await this.client.call(
932
+ "patch",
933
+ uri,
934
+ apiHeaders,
935
+ payload
936
+ );
937
+ }
938
+ /**
939
+ * Update phone
940
+ *
941
+ * Update the user phone by its unique ID.
942
+ *
943
+ * @param {string} userId
944
+ * @param {string} number
945
+ * @throws {AppwriteException}
946
+ * @returns {Promise<Models.User<Preferences>>}
947
+ */
948
+ async updatePhone(userId, number) {
949
+ if (typeof userId === "undefined") {
950
+ throw new client.AppwriteException('Missing required parameter: "userId"');
951
+ }
952
+ if (typeof number === "undefined") {
953
+ throw new client.AppwriteException('Missing required parameter: "number"');
954
+ }
955
+ const apiPath = "/users/{userId}/phone".replace("{userId}", userId);
956
+ const payload = {};
957
+ if (typeof number !== "undefined") {
958
+ payload["number"] = number;
959
+ }
960
+ const uri = new URL(this.client.config.endpoint + apiPath);
961
+ const apiHeaders = {
962
+ "content-type": "application/json"
963
+ };
964
+ return await this.client.call(
965
+ "patch",
966
+ uri,
967
+ apiHeaders,
968
+ payload
969
+ );
970
+ }
971
+ /**
972
+ * Get user preferences
973
+ *
974
+ * Get the user preferences by its unique ID.
975
+ *
976
+ * @param {string} userId
977
+ * @throws {AppwriteException}
978
+ * @returns {Promise<Preferences>}
979
+ */
980
+ async getPrefs(userId) {
981
+ if (typeof userId === "undefined") {
982
+ throw new client.AppwriteException('Missing required parameter: "userId"');
983
+ }
984
+ const apiPath = "/users/{userId}/prefs".replace("{userId}", userId);
985
+ const payload = {};
986
+ const uri = new URL(this.client.config.endpoint + apiPath);
987
+ const apiHeaders = {
988
+ "content-type": "application/json"
989
+ };
990
+ return await this.client.call(
991
+ "get",
992
+ uri,
993
+ apiHeaders,
994
+ payload
995
+ );
996
+ }
997
+ /**
998
+ * Update user preferences
999
+ *
1000
+ * Update the user preferences by its unique ID. 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.
1001
+ *
1002
+ * @param {string} userId
1003
+ * @param {object} prefs
1004
+ * @throws {AppwriteException}
1005
+ * @returns {Promise<Preferences>}
1006
+ */
1007
+ async updatePrefs(userId, prefs) {
1008
+ if (typeof userId === "undefined") {
1009
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1010
+ }
1011
+ if (typeof prefs === "undefined") {
1012
+ throw new client.AppwriteException('Missing required parameter: "prefs"');
1013
+ }
1014
+ const apiPath = "/users/{userId}/prefs".replace("{userId}", userId);
1015
+ const payload = {};
1016
+ if (typeof prefs !== "undefined") {
1017
+ payload["prefs"] = prefs;
1018
+ }
1019
+ const uri = new URL(this.client.config.endpoint + apiPath);
1020
+ const apiHeaders = {
1021
+ "content-type": "application/json"
1022
+ };
1023
+ return await this.client.call(
1024
+ "patch",
1025
+ uri,
1026
+ apiHeaders,
1027
+ payload
1028
+ );
1029
+ }
1030
+ /**
1031
+ * List user sessions
1032
+ *
1033
+ * Get the user sessions list by its unique ID.
1034
+ *
1035
+ * @param {string} userId
1036
+ * @throws {AppwriteException}
1037
+ * @returns {Promise<Models.SessionList>}
1038
+ */
1039
+ async listSessions(userId) {
1040
+ if (typeof userId === "undefined") {
1041
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1042
+ }
1043
+ const apiPath = "/users/{userId}/sessions".replace("{userId}", userId);
1044
+ const payload = {};
1045
+ const uri = new URL(this.client.config.endpoint + apiPath);
1046
+ const apiHeaders = {
1047
+ "content-type": "application/json"
1048
+ };
1049
+ return await this.client.call(
1050
+ "get",
1051
+ uri,
1052
+ apiHeaders,
1053
+ payload
1054
+ );
1055
+ }
1056
+ /**
1057
+ * Create session
1058
+ *
1059
+ * Creates a session for a user. Returns an immediately usable session object.
1060
+
1061
+ If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint.
1062
+ *
1063
+ * @param {string} userId
1064
+ * @throws {AppwriteException}
1065
+ * @returns {Promise<Models.Session>}
1066
+ */
1067
+ async createSession(userId) {
1068
+ if (typeof userId === "undefined") {
1069
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1070
+ }
1071
+ const apiPath = "/users/{userId}/sessions".replace("{userId}", userId);
1072
+ const payload = {};
1073
+ const uri = new URL(this.client.config.endpoint + apiPath);
1074
+ const apiHeaders = {
1075
+ "content-type": "application/json"
1076
+ };
1077
+ return await this.client.call(
1078
+ "post",
1079
+ uri,
1080
+ apiHeaders,
1081
+ payload
1082
+ );
1083
+ }
1084
+ /**
1085
+ * Delete user sessions
1086
+ *
1087
+ * Delete all user&#039;s sessions by using the user&#039;s unique ID.
1088
+ *
1089
+ * @param {string} userId
1090
+ * @throws {AppwriteException}
1091
+ * @returns {Promise<{}>}
1092
+ */
1093
+ async deleteSessions(userId) {
1094
+ if (typeof userId === "undefined") {
1095
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1096
+ }
1097
+ const apiPath = "/users/{userId}/sessions".replace("{userId}", userId);
1098
+ const payload = {};
1099
+ const uri = new URL(this.client.config.endpoint + apiPath);
1100
+ const apiHeaders = {
1101
+ "content-type": "application/json"
1102
+ };
1103
+ return await this.client.call(
1104
+ "delete",
1105
+ uri,
1106
+ apiHeaders,
1107
+ payload
1108
+ );
1109
+ }
1110
+ /**
1111
+ * Delete user session
1112
+ *
1113
+ * Delete a user sessions by its unique ID.
1114
+ *
1115
+ * @param {string} userId
1116
+ * @param {string} sessionId
1117
+ * @throws {AppwriteException}
1118
+ * @returns {Promise<{}>}
1119
+ */
1120
+ async deleteSession(userId, sessionId) {
1121
+ if (typeof userId === "undefined") {
1122
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1123
+ }
1124
+ if (typeof sessionId === "undefined") {
1125
+ throw new client.AppwriteException('Missing required parameter: "sessionId"');
1126
+ }
1127
+ const apiPath = "/users/{userId}/sessions/{sessionId}".replace("{userId}", userId).replace("{sessionId}", sessionId);
1128
+ const payload = {};
1129
+ const uri = new URL(this.client.config.endpoint + apiPath);
1130
+ const apiHeaders = {
1131
+ "content-type": "application/json"
1132
+ };
1133
+ return await this.client.call(
1134
+ "delete",
1135
+ uri,
1136
+ apiHeaders,
1137
+ payload
1138
+ );
1139
+ }
1140
+ /**
1141
+ * Update user status
1142
+ *
1143
+ * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user&#039;s ID reserved.
1144
+ *
1145
+ * @param {string} userId
1146
+ * @param {boolean} status
1147
+ * @throws {AppwriteException}
1148
+ * @returns {Promise<Models.User<Preferences>>}
1149
+ */
1150
+ async updateStatus(userId, status) {
1151
+ if (typeof userId === "undefined") {
1152
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1153
+ }
1154
+ if (typeof status === "undefined") {
1155
+ throw new client.AppwriteException('Missing required parameter: "status"');
1156
+ }
1157
+ const apiPath = "/users/{userId}/status".replace("{userId}", userId);
1158
+ const payload = {};
1159
+ if (typeof status !== "undefined") {
1160
+ payload["status"] = status;
1161
+ }
1162
+ const uri = new URL(this.client.config.endpoint + apiPath);
1163
+ const apiHeaders = {
1164
+ "content-type": "application/json"
1165
+ };
1166
+ return await this.client.call(
1167
+ "patch",
1168
+ uri,
1169
+ apiHeaders,
1170
+ payload
1171
+ );
1172
+ }
1173
+ /**
1174
+ * List User Targets
1175
+ *
1176
+ * List the messaging targets that are associated with a user.
1177
+ *
1178
+ * @param {string} userId
1179
+ * @param {string[]} queries
1180
+ * @throws {AppwriteException}
1181
+ * @returns {Promise<Models.TargetList>}
1182
+ */
1183
+ async listTargets(userId, queries) {
1184
+ if (typeof userId === "undefined") {
1185
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1186
+ }
1187
+ const apiPath = "/users/{userId}/targets".replace("{userId}", userId);
1188
+ const payload = {};
1189
+ if (typeof queries !== "undefined") {
1190
+ payload["queries"] = queries;
1191
+ }
1192
+ const uri = new URL(this.client.config.endpoint + apiPath);
1193
+ const apiHeaders = {
1194
+ "content-type": "application/json"
1195
+ };
1196
+ return await this.client.call(
1197
+ "get",
1198
+ uri,
1199
+ apiHeaders,
1200
+ payload
1201
+ );
1202
+ }
1203
+ /**
1204
+ * Create User Target
1205
+ *
1206
+ * Create a messaging target.
1207
+ *
1208
+ * @param {string} userId
1209
+ * @param {string} targetId
1210
+ * @param {MessagingProviderType} providerType
1211
+ * @param {string} identifier
1212
+ * @param {string} providerId
1213
+ * @param {string} name
1214
+ * @throws {AppwriteException}
1215
+ * @returns {Promise<Models.Target>}
1216
+ */
1217
+ async createTarget(userId, targetId, providerType, identifier, providerId, name) {
1218
+ if (typeof userId === "undefined") {
1219
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1220
+ }
1221
+ if (typeof targetId === "undefined") {
1222
+ throw new client.AppwriteException('Missing required parameter: "targetId"');
1223
+ }
1224
+ if (typeof providerType === "undefined") {
1225
+ throw new client.AppwriteException('Missing required parameter: "providerType"');
1226
+ }
1227
+ if (typeof identifier === "undefined") {
1228
+ throw new client.AppwriteException('Missing required parameter: "identifier"');
1229
+ }
1230
+ const apiPath = "/users/{userId}/targets".replace("{userId}", userId);
1231
+ const payload = {};
1232
+ if (typeof targetId !== "undefined") {
1233
+ payload["targetId"] = targetId;
1234
+ }
1235
+ if (typeof providerType !== "undefined") {
1236
+ payload["providerType"] = providerType;
1237
+ }
1238
+ if (typeof identifier !== "undefined") {
1239
+ payload["identifier"] = identifier;
1240
+ }
1241
+ if (typeof providerId !== "undefined") {
1242
+ payload["providerId"] = providerId;
1243
+ }
1244
+ if (typeof name !== "undefined") {
1245
+ payload["name"] = name;
1246
+ }
1247
+ const uri = new URL(this.client.config.endpoint + apiPath);
1248
+ const apiHeaders = {
1249
+ "content-type": "application/json"
1250
+ };
1251
+ return await this.client.call(
1252
+ "post",
1253
+ uri,
1254
+ apiHeaders,
1255
+ payload
1256
+ );
1257
+ }
1258
+ /**
1259
+ * Get User Target
1260
+ *
1261
+ * Get a user&#039;s push notification target by ID.
1262
+ *
1263
+ * @param {string} userId
1264
+ * @param {string} targetId
1265
+ * @throws {AppwriteException}
1266
+ * @returns {Promise<Models.Target>}
1267
+ */
1268
+ async getTarget(userId, targetId) {
1269
+ if (typeof userId === "undefined") {
1270
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1271
+ }
1272
+ if (typeof targetId === "undefined") {
1273
+ throw new client.AppwriteException('Missing required parameter: "targetId"');
1274
+ }
1275
+ const apiPath = "/users/{userId}/targets/{targetId}".replace("{userId}", userId).replace("{targetId}", targetId);
1276
+ const payload = {};
1277
+ const uri = new URL(this.client.config.endpoint + apiPath);
1278
+ const apiHeaders = {
1279
+ "content-type": "application/json"
1280
+ };
1281
+ return await this.client.call(
1282
+ "get",
1283
+ uri,
1284
+ apiHeaders,
1285
+ payload
1286
+ );
1287
+ }
1288
+ /**
1289
+ * Update User target
1290
+ *
1291
+ * Update a messaging target.
1292
+ *
1293
+ * @param {string} userId
1294
+ * @param {string} targetId
1295
+ * @param {string} identifier
1296
+ * @param {string} providerId
1297
+ * @param {string} name
1298
+ * @throws {AppwriteException}
1299
+ * @returns {Promise<Models.Target>}
1300
+ */
1301
+ async updateTarget(userId, targetId, identifier, providerId, name) {
1302
+ if (typeof userId === "undefined") {
1303
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1304
+ }
1305
+ if (typeof targetId === "undefined") {
1306
+ throw new client.AppwriteException('Missing required parameter: "targetId"');
1307
+ }
1308
+ const apiPath = "/users/{userId}/targets/{targetId}".replace("{userId}", userId).replace("{targetId}", targetId);
1309
+ const payload = {};
1310
+ if (typeof identifier !== "undefined") {
1311
+ payload["identifier"] = identifier;
1312
+ }
1313
+ if (typeof providerId !== "undefined") {
1314
+ payload["providerId"] = providerId;
1315
+ }
1316
+ if (typeof name !== "undefined") {
1317
+ payload["name"] = name;
1318
+ }
1319
+ const uri = new URL(this.client.config.endpoint + apiPath);
1320
+ const apiHeaders = {
1321
+ "content-type": "application/json"
1322
+ };
1323
+ return await this.client.call(
1324
+ "patch",
1325
+ uri,
1326
+ apiHeaders,
1327
+ payload
1328
+ );
1329
+ }
1330
+ /**
1331
+ * Delete user target
1332
+ *
1333
+ * Delete a messaging target.
1334
+ *
1335
+ * @param {string} userId
1336
+ * @param {string} targetId
1337
+ * @throws {AppwriteException}
1338
+ * @returns {Promise<{}>}
1339
+ */
1340
+ async deleteTarget(userId, targetId) {
1341
+ if (typeof userId === "undefined") {
1342
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1343
+ }
1344
+ if (typeof targetId === "undefined") {
1345
+ throw new client.AppwriteException('Missing required parameter: "targetId"');
1346
+ }
1347
+ const apiPath = "/users/{userId}/targets/{targetId}".replace("{userId}", userId).replace("{targetId}", targetId);
1348
+ const payload = {};
1349
+ const uri = new URL(this.client.config.endpoint + apiPath);
1350
+ const apiHeaders = {
1351
+ "content-type": "application/json"
1352
+ };
1353
+ return await this.client.call(
1354
+ "delete",
1355
+ uri,
1356
+ apiHeaders,
1357
+ payload
1358
+ );
1359
+ }
1360
+ /**
1361
+ * Create token
1362
+ *
1363
+ * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.
1364
+
1365
+ *
1366
+ * @param {string} userId
1367
+ * @param {number} length
1368
+ * @param {number} expire
1369
+ * @throws {AppwriteException}
1370
+ * @returns {Promise<Models.Token>}
1371
+ */
1372
+ async createToken(userId, length, expire) {
1373
+ if (typeof userId === "undefined") {
1374
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1375
+ }
1376
+ const apiPath = "/users/{userId}/tokens".replace("{userId}", userId);
1377
+ const payload = {};
1378
+ if (typeof length !== "undefined") {
1379
+ payload["length"] = length;
1380
+ }
1381
+ if (typeof expire !== "undefined") {
1382
+ payload["expire"] = expire;
1383
+ }
1384
+ const uri = new URL(this.client.config.endpoint + apiPath);
1385
+ const apiHeaders = {
1386
+ "content-type": "application/json"
1387
+ };
1388
+ return await this.client.call(
1389
+ "post",
1390
+ uri,
1391
+ apiHeaders,
1392
+ payload
1393
+ );
1394
+ }
1395
+ /**
1396
+ * Update email verification
1397
+ *
1398
+ * Update the user email verification status by its unique ID.
1399
+ *
1400
+ * @param {string} userId
1401
+ * @param {boolean} emailVerification
1402
+ * @throws {AppwriteException}
1403
+ * @returns {Promise<Models.User<Preferences>>}
1404
+ */
1405
+ async updateEmailVerification(userId, emailVerification) {
1406
+ if (typeof userId === "undefined") {
1407
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1408
+ }
1409
+ if (typeof emailVerification === "undefined") {
1410
+ throw new client.AppwriteException('Missing required parameter: "emailVerification"');
1411
+ }
1412
+ const apiPath = "/users/{userId}/verification".replace("{userId}", userId);
1413
+ const payload = {};
1414
+ if (typeof emailVerification !== "undefined") {
1415
+ payload["emailVerification"] = emailVerification;
1416
+ }
1417
+ const uri = new URL(this.client.config.endpoint + apiPath);
1418
+ const apiHeaders = {
1419
+ "content-type": "application/json"
1420
+ };
1421
+ return await this.client.call(
1422
+ "patch",
1423
+ uri,
1424
+ apiHeaders,
1425
+ payload
1426
+ );
1427
+ }
1428
+ /**
1429
+ * Update phone verification
1430
+ *
1431
+ * Update the user phone verification status by its unique ID.
1432
+ *
1433
+ * @param {string} userId
1434
+ * @param {boolean} phoneVerification
1435
+ * @throws {AppwriteException}
1436
+ * @returns {Promise<Models.User<Preferences>>}
1437
+ */
1438
+ async updatePhoneVerification(userId, phoneVerification) {
1439
+ if (typeof userId === "undefined") {
1440
+ throw new client.AppwriteException('Missing required parameter: "userId"');
1441
+ }
1442
+ if (typeof phoneVerification === "undefined") {
1443
+ throw new client.AppwriteException('Missing required parameter: "phoneVerification"');
1444
+ }
1445
+ const apiPath = "/users/{userId}/verification/phone".replace("{userId}", userId);
1446
+ const payload = {};
1447
+ if (typeof phoneVerification !== "undefined") {
1448
+ payload["phoneVerification"] = phoneVerification;
1449
+ }
1450
+ const uri = new URL(this.client.config.endpoint + apiPath);
1451
+ const apiHeaders = {
1452
+ "content-type": "application/json"
1453
+ };
1454
+ return await this.client.call(
1455
+ "patch",
1456
+ uri,
1457
+ apiHeaders,
1458
+ payload
1459
+ );
1460
+ }
1461
+ }
1462
+
1463
+ exports.Users = Users;
1464
+ //# sourceMappingURL=out.js.map
1465
+ //# sourceMappingURL=users.js.map