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