appwrite-cli 4.2.1 → 5.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 (320) hide show
  1. package/.github/workflows/npm-publish.yml +1 -1
  2. package/README.md +6 -9
  3. package/docs/examples/account/{create-email-session.md → create-email-password-session.md} +1 -1
  4. package/docs/examples/account/create-email-token.md +4 -0
  5. package/docs/examples/account/create-magic-u-r-l-token.md +5 -0
  6. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  7. package/docs/examples/account/create-mfa-challenge.md +2 -0
  8. package/docs/examples/account/create-mfa-recovery-codes.md +1 -0
  9. package/docs/examples/account/create-o-auth2token.md +5 -0
  10. package/docs/examples/account/create-phone-token.md +3 -0
  11. package/docs/examples/account/create-push-target.md +4 -0
  12. package/docs/examples/account/create-session.md +3 -0
  13. package/docs/examples/account/create.md +1 -1
  14. package/docs/examples/account/delete-identity.md +1 -1
  15. package/docs/examples/account/delete-mfa-authenticator.md +3 -0
  16. package/docs/examples/account/delete-push-target.md +2 -0
  17. package/docs/examples/account/delete-session.md +1 -1
  18. package/docs/examples/account/delete.md +1 -0
  19. package/docs/examples/account/get-mfa-recovery-codes.md +1 -0
  20. package/docs/examples/account/get-session.md +1 -1
  21. package/docs/examples/account/list-mfa-factors.md +1 -0
  22. package/docs/examples/account/update-m-f-a.md +2 -0
  23. package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
  24. package/docs/examples/account/update-mfa-authenticator.md +3 -0
  25. package/docs/examples/account/update-mfa-challenge.md +3 -0
  26. package/docs/examples/account/update-mfa-recovery-codes.md +1 -0
  27. package/docs/examples/account/update-name.md +1 -1
  28. package/docs/examples/account/update-phone-session.md +2 -2
  29. package/docs/examples/account/update-phone-verification.md +2 -2
  30. package/docs/examples/account/update-push-target.md +3 -0
  31. package/docs/examples/account/update-recovery.md +3 -4
  32. package/docs/examples/account/update-session.md +1 -1
  33. package/docs/examples/account/update-verification.md +2 -2
  34. package/docs/examples/assistant/chat.md +1 -1
  35. package/docs/examples/avatars/get-q-r.md +1 -1
  36. package/docs/examples/databases/create-boolean-attribute.md +2 -2
  37. package/docs/examples/databases/create-collection.md +3 -3
  38. package/docs/examples/databases/create-datetime-attribute.md +2 -2
  39. package/docs/examples/databases/create-document.md +3 -3
  40. package/docs/examples/databases/create-email-attribute.md +2 -2
  41. package/docs/examples/databases/create-enum-attribute.md +2 -2
  42. package/docs/examples/databases/create-float-attribute.md +2 -2
  43. package/docs/examples/databases/create-index.md +2 -2
  44. package/docs/examples/databases/create-integer-attribute.md +2 -2
  45. package/docs/examples/databases/create-ip-attribute.md +2 -2
  46. package/docs/examples/databases/create-relationship-attribute.md +3 -3
  47. package/docs/examples/databases/create-string-attribute.md +2 -2
  48. package/docs/examples/databases/create-url-attribute.md +2 -2
  49. package/docs/examples/databases/create.md +2 -2
  50. package/docs/examples/databases/delete-attribute.md +2 -2
  51. package/docs/examples/databases/delete-collection.md +2 -2
  52. package/docs/examples/databases/delete-document.md +3 -3
  53. package/docs/examples/databases/delete-index.md +2 -2
  54. package/docs/examples/databases/delete.md +1 -1
  55. package/docs/examples/databases/get-attribute.md +2 -2
  56. package/docs/examples/databases/get-collection-usage.md +2 -2
  57. package/docs/examples/databases/get-collection.md +2 -2
  58. package/docs/examples/databases/get-database-usage.md +1 -1
  59. package/docs/examples/databases/get-document.md +3 -3
  60. package/docs/examples/databases/get-index.md +2 -2
  61. package/docs/examples/databases/get.md +1 -1
  62. package/docs/examples/databases/list-attributes.md +2 -2
  63. package/docs/examples/databases/list-collection-logs.md +2 -2
  64. package/docs/examples/databases/list-collections.md +1 -1
  65. package/docs/examples/databases/list-document-logs.md +3 -3
  66. package/docs/examples/databases/list-documents.md +2 -2
  67. package/docs/examples/databases/list-indexes.md +2 -2
  68. package/docs/examples/databases/list-logs.md +1 -1
  69. package/docs/examples/databases/update-boolean-attribute.md +2 -2
  70. package/docs/examples/databases/update-collection.md +3 -3
  71. package/docs/examples/databases/update-datetime-attribute.md +2 -2
  72. package/docs/examples/databases/update-document.md +3 -3
  73. package/docs/examples/databases/update-email-attribute.md +2 -2
  74. package/docs/examples/databases/update-enum-attribute.md +3 -3
  75. package/docs/examples/databases/update-float-attribute.md +2 -2
  76. package/docs/examples/databases/update-integer-attribute.md +2 -2
  77. package/docs/examples/databases/update-ip-attribute.md +2 -2
  78. package/docs/examples/databases/update-relationship-attribute.md +2 -2
  79. package/docs/examples/databases/update-string-attribute.md +3 -3
  80. package/docs/examples/databases/update-url-attribute.md +2 -2
  81. package/docs/examples/databases/update.md +2 -2
  82. package/docs/examples/functions/create-build.md +3 -3
  83. package/docs/examples/functions/create-deployment.md +1 -1
  84. package/docs/examples/functions/create-execution.md +1 -1
  85. package/docs/examples/functions/create-variable.md +3 -3
  86. package/docs/examples/functions/create.md +3 -3
  87. package/docs/examples/functions/delete-deployment.md +2 -2
  88. package/docs/examples/functions/delete-variable.md +2 -2
  89. package/docs/examples/functions/delete.md +1 -1
  90. package/docs/examples/functions/download-deployment.md +2 -2
  91. package/docs/examples/functions/get-deployment.md +2 -2
  92. package/docs/examples/functions/get-execution.md +2 -2
  93. package/docs/examples/functions/get-function-usage.md +1 -1
  94. package/docs/examples/functions/get-variable.md +2 -2
  95. package/docs/examples/functions/get.md +1 -1
  96. package/docs/examples/functions/list-deployments.md +1 -1
  97. package/docs/examples/functions/list-executions.md +1 -1
  98. package/docs/examples/functions/list-variables.md +1 -1
  99. package/docs/examples/functions/update-deployment.md +2 -2
  100. package/docs/examples/functions/update-variable.md +3 -3
  101. package/docs/examples/functions/update.md +2 -2
  102. package/docs/examples/health/get-certificate.md +2 -0
  103. package/docs/examples/health/get-failed-jobs.md +3 -0
  104. package/docs/examples/health/get-queue-usage-dump.md +2 -0
  105. package/docs/examples/health/get-queue-usage.md +2 -0
  106. package/docs/examples/health/get-storage.md +1 -0
  107. package/docs/examples/messaging/create-apns-provider.md +9 -0
  108. package/docs/examples/messaging/create-email.md +13 -0
  109. package/docs/examples/messaging/create-fcm-provider.md +5 -0
  110. package/docs/examples/messaging/create-mailgun-provider.md +11 -0
  111. package/docs/examples/messaging/create-msg91provider.md +7 -0
  112. package/docs/examples/messaging/create-push.md +17 -0
  113. package/docs/examples/messaging/create-sendgrid-provider.md +9 -0
  114. package/docs/examples/messaging/create-sms.md +8 -0
  115. package/docs/examples/messaging/create-smtp-provider.md +15 -0
  116. package/docs/examples/messaging/create-subscriber.md +4 -0
  117. package/docs/examples/messaging/create-telesign-provider.md +7 -0
  118. package/docs/examples/messaging/create-textmagic-provider.md +7 -0
  119. package/docs/examples/messaging/create-topic.md +4 -0
  120. package/docs/examples/messaging/create-twilio-provider.md +7 -0
  121. package/docs/examples/messaging/create-vonage-provider.md +7 -0
  122. package/docs/examples/messaging/delete-provider.md +2 -0
  123. package/docs/examples/messaging/delete-subscriber.md +3 -0
  124. package/docs/examples/messaging/delete-topic.md +2 -0
  125. package/docs/examples/messaging/delete.md +2 -0
  126. package/docs/examples/messaging/get-message.md +2 -0
  127. package/docs/examples/messaging/get-provider.md +2 -0
  128. package/docs/examples/messaging/get-subscriber.md +3 -0
  129. package/docs/examples/messaging/get-topic.md +2 -0
  130. package/docs/examples/messaging/list-message-logs.md +3 -0
  131. package/docs/examples/messaging/list-messages.md +3 -0
  132. package/docs/examples/messaging/list-provider-logs.md +3 -0
  133. package/docs/examples/messaging/list-providers.md +3 -0
  134. package/docs/examples/messaging/list-subscriber-logs.md +3 -0
  135. package/docs/examples/messaging/list-subscribers.md +4 -0
  136. package/docs/examples/messaging/list-targets.md +3 -0
  137. package/docs/examples/messaging/list-topic-logs.md +3 -0
  138. package/docs/examples/messaging/list-topics.md +3 -0
  139. package/docs/examples/messaging/update-apns-provider.md +9 -0
  140. package/docs/examples/messaging/update-email.md +12 -0
  141. package/docs/examples/messaging/update-fcm-provider.md +5 -0
  142. package/docs/examples/messaging/update-mailgun-provider.md +11 -0
  143. package/docs/examples/messaging/update-msg91provider.md +7 -0
  144. package/docs/examples/messaging/update-push.md +17 -0
  145. package/docs/examples/messaging/update-sendgrid-provider.md +9 -0
  146. package/docs/examples/messaging/update-sms.md +8 -0
  147. package/docs/examples/messaging/update-smtp-provider.md +15 -0
  148. package/docs/examples/messaging/update-telesign-provider.md +7 -0
  149. package/docs/examples/messaging/update-textmagic-provider.md +7 -0
  150. package/docs/examples/messaging/update-topic.md +4 -0
  151. package/docs/examples/messaging/update-twilio-provider.md +7 -0
  152. package/docs/examples/messaging/update-vonage-provider.md +7 -0
  153. package/docs/examples/migrations/create-appwrite-migration.md +2 -2
  154. package/docs/examples/migrations/create-firebase-migration.md +1 -1
  155. package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
  156. package/docs/examples/migrations/create-n-host-migration.md +6 -6
  157. package/docs/examples/migrations/create-supabase-migration.md +4 -4
  158. package/docs/examples/migrations/delete.md +1 -1
  159. package/docs/examples/migrations/get-appwrite-report.md +2 -2
  160. package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
  161. package/docs/examples/migrations/get-firebase-report.md +1 -1
  162. package/docs/examples/migrations/get-n-host-report.md +6 -6
  163. package/docs/examples/migrations/get-supabase-report.md +4 -4
  164. package/docs/examples/migrations/get.md +1 -1
  165. package/docs/examples/migrations/retry.md +1 -1
  166. package/docs/examples/project/create-variable.md +2 -2
  167. package/docs/examples/project/delete-variable.md +1 -1
  168. package/docs/examples/project/get-usage.md +2 -0
  169. package/docs/examples/project/get-variable.md +1 -1
  170. package/docs/examples/project/update-variable.md +2 -2
  171. package/docs/examples/projects/create-key.md +2 -2
  172. package/docs/examples/projects/create-platform.md +2 -2
  173. package/docs/examples/projects/create-smtp-test.md +11 -0
  174. package/docs/examples/projects/create-webhook.md +4 -3
  175. package/docs/examples/projects/create.md +2 -2
  176. package/docs/examples/projects/delete-email-template.md +1 -1
  177. package/docs/examples/projects/delete-key.md +2 -2
  178. package/docs/examples/projects/delete-platform.md +2 -2
  179. package/docs/examples/projects/delete-sms-template.md +1 -1
  180. package/docs/examples/projects/delete-webhook.md +2 -2
  181. package/docs/examples/projects/delete.md +1 -1
  182. package/docs/examples/projects/get-email-template.md +1 -1
  183. package/docs/examples/projects/get-key.md +2 -2
  184. package/docs/examples/projects/get-platform.md +2 -2
  185. package/docs/examples/projects/get-sms-template.md +1 -1
  186. package/docs/examples/projects/get-webhook.md +2 -2
  187. package/docs/examples/projects/get.md +1 -1
  188. package/docs/examples/projects/list-keys.md +1 -1
  189. package/docs/examples/projects/list-platforms.md +1 -1
  190. package/docs/examples/projects/list-webhooks.md +1 -1
  191. package/docs/examples/projects/update-api-status-all.md +3 -0
  192. package/docs/examples/projects/update-api-status.md +4 -0
  193. package/docs/examples/projects/update-auth-duration.md +1 -1
  194. package/docs/examples/projects/update-auth-limit.md +1 -1
  195. package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
  196. package/docs/examples/projects/update-auth-password-history.md +1 -1
  197. package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
  198. package/docs/examples/projects/update-auth-status.md +1 -1
  199. package/docs/examples/projects/update-email-template.md +3 -3
  200. package/docs/examples/projects/update-key.md +3 -3
  201. package/docs/examples/projects/update-o-auth2.md +1 -1
  202. package/docs/examples/projects/update-personal-data-check.md +1 -1
  203. package/docs/examples/projects/update-platform.md +3 -3
  204. package/docs/examples/projects/update-service-status-all.md +1 -1
  205. package/docs/examples/projects/update-service-status.md +1 -1
  206. package/docs/examples/projects/update-sms-template.md +2 -2
  207. package/docs/examples/projects/update-smtp.md +11 -0
  208. package/docs/examples/projects/update-team.md +2 -2
  209. package/docs/examples/projects/update-webhook-signature.md +2 -2
  210. package/docs/examples/projects/update-webhook.md +5 -4
  211. package/docs/examples/projects/update.md +2 -2
  212. package/docs/examples/proxy/delete-rule.md +1 -1
  213. package/docs/examples/proxy/get-rule.md +1 -1
  214. package/docs/examples/proxy/update-rule-verification.md +1 -1
  215. package/docs/examples/storage/create-bucket.md +2 -2
  216. package/docs/examples/storage/create-file.md +2 -2
  217. package/docs/examples/storage/delete-bucket.md +1 -1
  218. package/docs/examples/storage/delete-file.md +2 -2
  219. package/docs/examples/storage/get-bucket-usage.md +1 -1
  220. package/docs/examples/storage/get-bucket.md +1 -1
  221. package/docs/examples/storage/get-file-download.md +2 -2
  222. package/docs/examples/storage/get-file-preview.md +2 -2
  223. package/docs/examples/storage/get-file-view.md +2 -2
  224. package/docs/examples/storage/get-file.md +2 -2
  225. package/docs/examples/storage/list-files.md +1 -1
  226. package/docs/examples/storage/update-bucket.md +2 -2
  227. package/docs/examples/storage/update-file.md +2 -2
  228. package/docs/examples/teams/create-membership.md +1 -1
  229. package/docs/examples/teams/create.md +2 -2
  230. package/docs/examples/teams/delete-membership.md +2 -2
  231. package/docs/examples/teams/delete.md +1 -1
  232. package/docs/examples/teams/get-membership.md +2 -2
  233. package/docs/examples/teams/get-prefs.md +1 -1
  234. package/docs/examples/teams/get.md +1 -1
  235. package/docs/examples/teams/list-logs.md +1 -1
  236. package/docs/examples/teams/list-memberships.md +1 -1
  237. package/docs/examples/teams/update-membership-status.md +4 -4
  238. package/docs/examples/teams/update-membership.md +2 -2
  239. package/docs/examples/teams/update-name.md +2 -2
  240. package/docs/examples/teams/update-prefs.md +1 -1
  241. package/docs/examples/users/create-argon2user.md +1 -1
  242. package/docs/examples/users/create-bcrypt-user.md +1 -1
  243. package/docs/examples/users/create-m-d5user.md +1 -1
  244. package/docs/examples/users/create-mfa-recovery-codes.md +2 -0
  245. package/docs/examples/users/create-p-h-pass-user.md +1 -1
  246. package/docs/examples/users/create-s-h-a-user.md +1 -1
  247. package/docs/examples/users/create-scrypt-modified-user.md +4 -4
  248. package/docs/examples/users/create-scrypt-user.md +2 -2
  249. package/docs/examples/users/create-session.md +2 -0
  250. package/docs/examples/users/create-target.md +7 -0
  251. package/docs/examples/users/create-token.md +4 -0
  252. package/docs/examples/users/create.md +1 -1
  253. package/docs/examples/users/delete-identity.md +1 -1
  254. package/docs/examples/users/delete-mfa-authenticator.md +3 -0
  255. package/docs/examples/users/delete-session.md +2 -2
  256. package/docs/examples/users/delete-sessions.md +1 -1
  257. package/docs/examples/users/delete-target.md +3 -0
  258. package/docs/examples/users/delete.md +1 -1
  259. package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
  260. package/docs/examples/users/get-prefs.md +1 -1
  261. package/docs/examples/users/get-target.md +3 -0
  262. package/docs/examples/users/get-usage.md +0 -1
  263. package/docs/examples/users/get.md +1 -1
  264. package/docs/examples/users/list-logs.md +1 -1
  265. package/docs/examples/users/list-memberships.md +1 -1
  266. package/docs/examples/users/list-mfa-factors.md +2 -0
  267. package/docs/examples/users/list-sessions.md +1 -1
  268. package/docs/examples/users/list-targets.md +3 -0
  269. package/docs/examples/users/update-email-verification.md +1 -1
  270. package/docs/examples/users/update-email.md +1 -1
  271. package/docs/examples/users/update-labels.md +1 -1
  272. package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
  273. package/docs/examples/users/update-mfa.md +3 -0
  274. package/docs/examples/users/update-name.md +2 -2
  275. package/docs/examples/users/update-password.md +1 -1
  276. package/docs/examples/users/update-phone-verification.md +1 -1
  277. package/docs/examples/users/update-phone.md +1 -1
  278. package/docs/examples/users/update-prefs.md +1 -1
  279. package/docs/examples/users/update-status.md +1 -1
  280. package/docs/examples/users/update-target.md +6 -0
  281. package/docs/examples/vcs/create-repository-detection.md +2 -2
  282. package/docs/examples/vcs/create-repository.md +2 -2
  283. package/docs/examples/vcs/delete-installation.md +1 -1
  284. package/docs/examples/vcs/get-installation.md +1 -1
  285. package/docs/examples/vcs/get-repository.md +2 -2
  286. package/docs/examples/vcs/list-repositories.md +1 -1
  287. package/docs/examples/vcs/list-repository-branches.md +2 -2
  288. package/docs/examples/vcs/update-external-deployments.md +3 -3
  289. package/index.js +2 -0
  290. package/install.ps1 +2 -2
  291. package/install.sh +1 -1
  292. package/lib/client.js +9 -4
  293. package/lib/commands/account.js +966 -381
  294. package/lib/commands/assistant.js +3 -8
  295. package/lib/commands/avatars.js +32 -48
  296. package/lib/commands/console.js +3 -8
  297. package/lib/commands/databases.js +119 -265
  298. package/lib/commands/deploy.js +45 -6
  299. package/lib/commands/functions.js +59 -124
  300. package/lib/commands/generic.js +0 -1
  301. package/lib/commands/graphql.js +5 -13
  302. package/lib/commands/health.js +225 -89
  303. package/lib/commands/locale.js +17 -43
  304. package/lib/commands/messaging.js +2815 -0
  305. package/lib/commands/migrations.js +35 -85
  306. package/lib/commands/project.js +28 -38
  307. package/lib/commands/projects.js +286 -270
  308. package/lib/commands/proxy.js +12 -29
  309. package/lib/commands/storage.js +42 -87
  310. package/lib/commands/teams.js +31 -75
  311. package/lib/commands/users.js +677 -235
  312. package/lib/commands/vcs.js +19 -48
  313. package/lib/paginate.js +2 -2
  314. package/lib/parser.js +1 -0
  315. package/package.json +1 -1
  316. package/scoop/appwrite.json +3 -3
  317. package/docs/examples/account/create-magic-u-r-l-session.md +0 -4
  318. package/docs/examples/account/create-phone-session.md +0 -3
  319. package/docs/examples/projects/get-usage.md +0 -3
  320. package/docs/examples/projects/update-smtp-configuration.md +0 -11
@@ -37,11 +37,11 @@ function convertReadStreamToReadableStream(readStream) {
37
37
 
38
38
  const users = new Command("users").description(commandDescriptions['users']).configureHelp({
39
39
  helpWidth: process.stdout.columns || 80
40
- })
40
+ })
41
41
 
42
42
  /**
43
43
  * @typedef {Object} UsersListRequestParams
44
- * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification
44
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
45
45
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
46
46
  * @property {boolean} parseOutput
47
47
  * @property {libClient | undefined} sdk
@@ -52,7 +52,6 @@ const users = new Command("users").description(commandDescriptions['users']).con
52
52
  */
53
53
  const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
54
54
  let client = !sdk ? await sdkForProject() : sdk;
55
-
56
55
  let apiPath = '/users';
57
56
  let payload = {};
58
57
  if (typeof queries !== 'undefined') {
@@ -62,14 +61,12 @@ const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}
62
61
  payload['search'] = search;
63
62
  }
64
63
 
65
-
66
64
  let response = undefined;
67
-
65
+
68
66
  response = await client.call('get', apiPath, {
69
67
  'content-type': 'application/json',
70
68
  }, payload);
71
69
 
72
-
73
70
  if (parseOutput) {
74
71
  parse(response)
75
72
  success()
@@ -94,7 +91,6 @@ const usersList = async ({ queries, search, parseOutput = true, sdk = undefined}
94
91
  */
95
92
  const usersCreate = async ({ userId, email, phone, password, name, parseOutput = true, sdk = undefined}) => {
96
93
  let client = !sdk ? await sdkForProject() : sdk;
97
-
98
94
  let apiPath = '/users';
99
95
  let payload = {};
100
96
  if (typeof userId !== 'undefined') {
@@ -113,14 +109,12 @@ const usersCreate = async ({ userId, email, phone, password, name, parseOutput =
113
109
  payload['name'] = name;
114
110
  }
115
111
 
116
-
117
112
  let response = undefined;
118
-
113
+
119
114
  response = await client.call('post', apiPath, {
120
115
  'content-type': 'application/json',
121
116
  }, payload);
122
117
 
123
-
124
118
  if (parseOutput) {
125
119
  parse(response)
126
120
  success()
@@ -144,7 +138,6 @@ const usersCreate = async ({ userId, email, phone, password, name, parseOutput =
144
138
  */
145
139
  const usersCreateArgon2User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
146
140
  let client = !sdk ? await sdkForProject() : sdk;
147
-
148
141
  let apiPath = '/users/argon2';
149
142
  let payload = {};
150
143
  if (typeof userId !== 'undefined') {
@@ -160,14 +153,12 @@ const usersCreateArgon2User = async ({ userId, email, password, name, parseOutpu
160
153
  payload['name'] = name;
161
154
  }
162
155
 
163
-
164
156
  let response = undefined;
165
-
157
+
166
158
  response = await client.call('post', apiPath, {
167
159
  'content-type': 'application/json',
168
160
  }, payload);
169
161
 
170
-
171
162
  if (parseOutput) {
172
163
  parse(response)
173
164
  success()
@@ -191,7 +182,6 @@ const usersCreateArgon2User = async ({ userId, email, password, name, parseOutpu
191
182
  */
192
183
  const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
193
184
  let client = !sdk ? await sdkForProject() : sdk;
194
-
195
185
  let apiPath = '/users/bcrypt';
196
186
  let payload = {};
197
187
  if (typeof userId !== 'undefined') {
@@ -207,14 +197,12 @@ const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutpu
207
197
  payload['name'] = name;
208
198
  }
209
199
 
210
-
211
200
  let response = undefined;
212
-
201
+
213
202
  response = await client.call('post', apiPath, {
214
203
  'content-type': 'application/json',
215
204
  }, payload);
216
205
 
217
-
218
206
  if (parseOutput) {
219
207
  parse(response)
220
208
  success()
@@ -225,7 +213,7 @@ const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutpu
225
213
 
226
214
  /**
227
215
  * @typedef {Object} UsersListIdentitiesRequestParams
228
- * @property {string} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
216
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
229
217
  * @property {string} search Search term to filter your list results. Max length: 256 chars.
230
218
  * @property {boolean} parseOutput
231
219
  * @property {libClient | undefined} sdk
@@ -236,7 +224,6 @@ const usersCreateBcryptUser = async ({ userId, email, password, name, parseOutpu
236
224
  */
237
225
  const usersListIdentities = async ({ queries, search, parseOutput = true, sdk = undefined}) => {
238
226
  let client = !sdk ? await sdkForProject() : sdk;
239
-
240
227
  let apiPath = '/users/identities';
241
228
  let payload = {};
242
229
  if (typeof queries !== 'undefined') {
@@ -246,14 +233,12 @@ const usersListIdentities = async ({ queries, search, parseOutput = true, sdk =
246
233
  payload['search'] = search;
247
234
  }
248
235
 
249
-
250
236
  let response = undefined;
251
-
237
+
252
238
  response = await client.call('get', apiPath, {
253
239
  'content-type': 'application/json',
254
240
  }, payload);
255
241
 
256
-
257
242
  if (parseOutput) {
258
243
  parse(response)
259
244
  success()
@@ -274,18 +259,15 @@ const usersListIdentities = async ({ queries, search, parseOutput = true, sdk =
274
259
  */
275
260
  const usersDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undefined}) => {
276
261
  let client = !sdk ? await sdkForProject() : sdk;
277
-
278
262
  let apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId);
279
263
  let payload = {};
280
264
 
281
-
282
265
  let response = undefined;
283
-
266
+
284
267
  response = await client.call('delete', apiPath, {
285
268
  'content-type': 'application/json',
286
269
  }, payload);
287
270
 
288
-
289
271
  if (parseOutput) {
290
272
  parse(response)
291
273
  success()
@@ -309,7 +291,6 @@ const usersDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undef
309
291
  */
310
292
  const usersCreateMD5User = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
311
293
  let client = !sdk ? await sdkForProject() : sdk;
312
-
313
294
  let apiPath = '/users/md5';
314
295
  let payload = {};
315
296
  if (typeof userId !== 'undefined') {
@@ -325,14 +306,12 @@ const usersCreateMD5User = async ({ userId, email, password, name, parseOutput =
325
306
  payload['name'] = name;
326
307
  }
327
308
 
328
-
329
309
  let response = undefined;
330
-
310
+
331
311
  response = await client.call('post', apiPath, {
332
312
  'content-type': 'application/json',
333
313
  }, payload);
334
314
 
335
-
336
315
  if (parseOutput) {
337
316
  parse(response)
338
317
  success()
@@ -356,7 +335,6 @@ const usersCreateMD5User = async ({ userId, email, password, name, parseOutput =
356
335
  */
357
336
  const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
358
337
  let client = !sdk ? await sdkForProject() : sdk;
359
-
360
338
  let apiPath = '/users/phpass';
361
339
  let payload = {};
362
340
  if (typeof userId !== 'undefined') {
@@ -372,14 +350,12 @@ const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutpu
372
350
  payload['name'] = name;
373
351
  }
374
352
 
375
-
376
353
  let response = undefined;
377
-
354
+
378
355
  response = await client.call('post', apiPath, {
379
356
  'content-type': 'application/json',
380
357
  }, payload);
381
358
 
382
-
383
359
  if (parseOutput) {
384
360
  parse(response)
385
361
  success()
@@ -408,7 +384,6 @@ const usersCreatePHPassUser = async ({ userId, email, password, name, parseOutpu
408
384
  */
409
385
  const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name, parseOutput = true, sdk = undefined}) => {
410
386
  let client = !sdk ? await sdkForProject() : sdk;
411
-
412
387
  let apiPath = '/users/scrypt';
413
388
  let payload = {};
414
389
  if (typeof userId !== 'undefined') {
@@ -439,14 +414,12 @@ const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, pa
439
414
  payload['name'] = name;
440
415
  }
441
416
 
442
-
443
417
  let response = undefined;
444
-
418
+
445
419
  response = await client.call('post', apiPath, {
446
420
  'content-type': 'application/json',
447
421
  }, payload);
448
422
 
449
-
450
423
  if (parseOutput) {
451
424
  parse(response)
452
425
  success()
@@ -473,7 +446,6 @@ const usersCreateScryptUser = async ({ userId, email, password, passwordSalt, pa
473
446
  */
474
447
  const usersCreateScryptModifiedUser = async ({ userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name, parseOutput = true, sdk = undefined}) => {
475
448
  let client = !sdk ? await sdkForProject() : sdk;
476
-
477
449
  let apiPath = '/users/scrypt-modified';
478
450
  let payload = {};
479
451
  if (typeof userId !== 'undefined') {
@@ -498,14 +470,12 @@ const usersCreateScryptModifiedUser = async ({ userId, email, password, password
498
470
  payload['name'] = name;
499
471
  }
500
472
 
501
-
502
473
  let response = undefined;
503
-
474
+
504
475
  response = await client.call('post', apiPath, {
505
476
  'content-type': 'application/json',
506
477
  }, payload);
507
478
 
508
-
509
479
  if (parseOutput) {
510
480
  parse(response)
511
481
  success()
@@ -519,7 +489,7 @@ const usersCreateScryptModifiedUser = async ({ userId, email, password, password
519
489
  * @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
520
490
  * @property {string} email User email.
521
491
  * @property {string} password User password hashed using SHA.
522
- * @property {string} passwordVersion Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
492
+ * @property {PasswordHash} passwordVersion Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
523
493
  * @property {string} name User name. Max length: 128 chars.
524
494
  * @property {boolean} parseOutput
525
495
  * @property {libClient | undefined} sdk
@@ -530,7 +500,6 @@ const usersCreateScryptModifiedUser = async ({ userId, email, password, password
530
500
  */
531
501
  const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, name, parseOutput = true, sdk = undefined}) => {
532
502
  let client = !sdk ? await sdkForProject() : sdk;
533
-
534
503
  let apiPath = '/users/sha';
535
504
  let payload = {};
536
505
  if (typeof userId !== 'undefined') {
@@ -549,14 +518,12 @@ const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, na
549
518
  payload['name'] = name;
550
519
  }
551
520
 
552
-
553
521
  let response = undefined;
554
-
522
+
555
523
  response = await client.call('post', apiPath, {
556
524
  'content-type': 'application/json',
557
525
  }, payload);
558
526
 
559
-
560
527
  if (parseOutput) {
561
528
  parse(response)
562
529
  success()
@@ -567,8 +534,7 @@ const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, na
567
534
 
568
535
  /**
569
536
  * @typedef {Object} UsersGetUsageRequestParams
570
- * @property {string} range Date range.
571
- * @property {string} provider Provider Name.
537
+ * @property {UserUsageRange} range Date range.
572
538
  * @property {boolean} parseOutput
573
539
  * @property {libClient | undefined} sdk
574
540
  */
@@ -576,26 +542,20 @@ const usersCreateSHAUser = async ({ userId, email, password, passwordVersion, na
576
542
  /**
577
543
  * @param {UsersGetUsageRequestParams} params
578
544
  */
579
- const usersGetUsage = async ({ range, provider, parseOutput = true, sdk = undefined}) => {
545
+ const usersGetUsage = async ({ range, parseOutput = true, sdk = undefined}) => {
580
546
  let client = !sdk ? await sdkForProject() : sdk;
581
-
582
547
  let apiPath = '/users/usage';
583
548
  let payload = {};
584
549
  if (typeof range !== 'undefined') {
585
550
  payload['range'] = range;
586
551
  }
587
- if (typeof provider !== 'undefined') {
588
- payload['provider'] = provider;
589
- }
590
-
591
552
 
592
553
  let response = undefined;
593
-
554
+
594
555
  response = await client.call('get', apiPath, {
595
556
  'content-type': 'application/json',
596
557
  }, payload);
597
558
 
598
-
599
559
  if (parseOutput) {
600
560
  parse(response)
601
561
  success()
@@ -616,18 +576,15 @@ const usersGetUsage = async ({ range, provider, parseOutput = true, sdk = undefi
616
576
  */
617
577
  const usersGet = async ({ userId, parseOutput = true, sdk = undefined}) => {
618
578
  let client = !sdk ? await sdkForProject() : sdk;
619
-
620
579
  let apiPath = '/users/{userId}'.replace('{userId}', userId);
621
580
  let payload = {};
622
581
 
623
-
624
582
  let response = undefined;
625
-
583
+
626
584
  response = await client.call('get', apiPath, {
627
585
  'content-type': 'application/json',
628
586
  }, payload);
629
587
 
630
-
631
588
  if (parseOutput) {
632
589
  parse(response)
633
590
  success()
@@ -648,18 +605,15 @@ const usersGet = async ({ userId, parseOutput = true, sdk = undefined}) => {
648
605
  */
649
606
  const usersDelete = async ({ userId, parseOutput = true, sdk = undefined}) => {
650
607
  let client = !sdk ? await sdkForProject() : sdk;
651
-
652
608
  let apiPath = '/users/{userId}'.replace('{userId}', userId);
653
609
  let payload = {};
654
610
 
655
-
656
611
  let response = undefined;
657
-
612
+
658
613
  response = await client.call('delete', apiPath, {
659
614
  'content-type': 'application/json',
660
615
  }, payload);
661
616
 
662
-
663
617
  if (parseOutput) {
664
618
  parse(response)
665
619
  success()
@@ -681,21 +635,18 @@ const usersDelete = async ({ userId, parseOutput = true, sdk = undefined}) => {
681
635
  */
682
636
  const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undefined}) => {
683
637
  let client = !sdk ? await sdkForProject() : sdk;
684
-
685
638
  let apiPath = '/users/{userId}/email'.replace('{userId}', userId);
686
639
  let payload = {};
687
640
  if (typeof email !== 'undefined') {
688
641
  payload['email'] = email;
689
642
  }
690
643
 
691
-
692
644
  let response = undefined;
693
-
645
+
694
646
  response = await client.call('patch', apiPath, {
695
647
  'content-type': 'application/json',
696
648
  }, payload);
697
649
 
698
-
699
650
  if (parseOutput) {
700
651
  parse(response)
701
652
  success()
@@ -707,7 +658,7 @@ const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undef
707
658
  /**
708
659
  * @typedef {Object} UsersUpdateLabelsRequestParams
709
660
  * @property {string} userId User ID.
710
- * @property {string[]} labels Array of user labels. Replaces the previous labels. Maximum of 100 labels are allowed, each up to 36 alphanumeric characters long.
661
+ * @property {string[]} labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
711
662
  * @property {boolean} parseOutput
712
663
  * @property {libClient | undefined} sdk
713
664
  */
@@ -717,7 +668,6 @@ const usersUpdateEmail = async ({ userId, email, parseOutput = true, sdk = undef
717
668
  */
718
669
  const usersUpdateLabels = async ({ userId, labels, parseOutput = true, sdk = undefined}) => {
719
670
  let client = !sdk ? await sdkForProject() : sdk;
720
-
721
671
  let apiPath = '/users/{userId}/labels'.replace('{userId}', userId);
722
672
  let payload = {};
723
673
  labels = labels === true ? [] : labels;
@@ -725,14 +675,12 @@ const usersUpdateLabels = async ({ userId, labels, parseOutput = true, sdk = und
725
675
  payload['labels'] = labels;
726
676
  }
727
677
 
728
-
729
678
  let response = undefined;
730
-
679
+
731
680
  response = await client.call('put', apiPath, {
732
681
  'content-type': 'application/json',
733
682
  }, payload);
734
683
 
735
-
736
684
  if (parseOutput) {
737
685
  parse(response)
738
686
  success()
@@ -754,21 +702,18 @@ const usersUpdateLabels = async ({ userId, labels, parseOutput = true, sdk = und
754
702
  */
755
703
  const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
756
704
  let client = !sdk ? await sdkForProject() : sdk;
757
-
758
705
  let apiPath = '/users/{userId}/logs'.replace('{userId}', userId);
759
706
  let payload = {};
760
707
  if (typeof queries !== 'undefined') {
761
708
  payload['queries'] = queries;
762
709
  }
763
710
 
764
-
765
711
  let response = undefined;
766
-
712
+
767
713
  response = await client.call('get', apiPath, {
768
714
  'content-type': 'application/json',
769
715
  }, payload);
770
716
 
771
-
772
717
  if (parseOutput) {
773
718
  parse(response)
774
719
  success()
@@ -789,18 +734,15 @@ const usersListLogs = async ({ userId, queries, parseOutput = true, sdk = undefi
789
734
  */
790
735
  const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefined}) => {
791
736
  let client = !sdk ? await sdkForProject() : sdk;
792
-
793
737
  let apiPath = '/users/{userId}/memberships'.replace('{userId}', userId);
794
738
  let payload = {};
795
739
 
796
-
797
740
  let response = undefined;
798
-
741
+
799
742
  response = await client.call('get', apiPath, {
800
743
  'content-type': 'application/json',
801
744
  }, payload);
802
745
 
803
-
804
746
  if (parseOutput) {
805
747
  parse(response)
806
748
  success()
@@ -810,33 +752,30 @@ const usersListMemberships = async ({ userId, parseOutput = true, sdk = undefine
810
752
  }
811
753
 
812
754
  /**
813
- * @typedef {Object} UsersUpdateNameRequestParams
755
+ * @typedef {Object} UsersUpdateMfaRequestParams
814
756
  * @property {string} userId User ID.
815
- * @property {string} name User name. Max length: 128 chars.
757
+ * @property {boolean} mfa Enable or disable MFA.
816
758
  * @property {boolean} parseOutput
817
759
  * @property {libClient | undefined} sdk
818
760
  */
819
761
 
820
762
  /**
821
- * @param {UsersUpdateNameRequestParams} params
763
+ * @param {UsersUpdateMfaRequestParams} params
822
764
  */
823
- const usersUpdateName = async ({ userId, name, parseOutput = true, sdk = undefined}) => {
765
+ const usersUpdateMfa = async ({ userId, mfa, parseOutput = true, sdk = undefined}) => {
824
766
  let client = !sdk ? await sdkForProject() : sdk;
825
-
826
- let apiPath = '/users/{userId}/name'.replace('{userId}', userId);
767
+ let apiPath = '/users/{userId}/mfa'.replace('{userId}', userId);
827
768
  let payload = {};
828
- if (typeof name !== 'undefined') {
829
- payload['name'] = name;
769
+ if (typeof mfa !== 'undefined') {
770
+ payload['mfa'] = mfa;
830
771
  }
831
772
 
832
-
833
773
  let response = undefined;
834
-
774
+
835
775
  response = await client.call('patch', apiPath, {
836
776
  'content-type': 'application/json',
837
777
  }, payload);
838
778
 
839
-
840
779
  if (parseOutput) {
841
780
  parse(response)
842
781
  success()
@@ -846,33 +785,27 @@ const usersUpdateName = async ({ userId, name, parseOutput = true, sdk = undefin
846
785
  }
847
786
 
848
787
  /**
849
- * @typedef {Object} UsersUpdatePasswordRequestParams
788
+ * @typedef {Object} UsersDeleteMfaAuthenticatorRequestParams
850
789
  * @property {string} userId User ID.
851
- * @property {string} password New user password. Must be at least 8 chars.
790
+ * @property {AuthenticatorType} type Type of authenticator.
852
791
  * @property {boolean} parseOutput
853
792
  * @property {libClient | undefined} sdk
854
793
  */
855
794
 
856
795
  /**
857
- * @param {UsersUpdatePasswordRequestParams} params
796
+ * @param {UsersDeleteMfaAuthenticatorRequestParams} params
858
797
  */
859
- const usersUpdatePassword = async ({ userId, password, parseOutput = true, sdk = undefined}) => {
798
+ const usersDeleteMfaAuthenticator = async ({ userId, type, parseOutput = true, sdk = undefined}) => {
860
799
  let client = !sdk ? await sdkForProject() : sdk;
861
-
862
- let apiPath = '/users/{userId}/password'.replace('{userId}', userId);
800
+ let apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type);
863
801
  let payload = {};
864
- if (typeof password !== 'undefined') {
865
- payload['password'] = password;
866
- }
867
-
868
802
 
869
803
  let response = undefined;
870
-
871
- response = await client.call('patch', apiPath, {
804
+
805
+ response = await client.call('delete', apiPath, {
872
806
  'content-type': 'application/json',
873
807
  }, payload);
874
808
 
875
-
876
809
  if (parseOutput) {
877
810
  parse(response)
878
811
  success()
@@ -882,33 +815,26 @@ const usersUpdatePassword = async ({ userId, password, parseOutput = true, sdk =
882
815
  }
883
816
 
884
817
  /**
885
- * @typedef {Object} UsersUpdatePhoneRequestParams
818
+ * @typedef {Object} UsersListMfaFactorsRequestParams
886
819
  * @property {string} userId User ID.
887
- * @property {string} number User phone number.
888
820
  * @property {boolean} parseOutput
889
821
  * @property {libClient | undefined} sdk
890
822
  */
891
823
 
892
824
  /**
893
- * @param {UsersUpdatePhoneRequestParams} params
825
+ * @param {UsersListMfaFactorsRequestParams} params
894
826
  */
895
- const usersUpdatePhone = async ({ userId, number, parseOutput = true, sdk = undefined}) => {
827
+ const usersListMfaFactors = async ({ userId, parseOutput = true, sdk = undefined}) => {
896
828
  let client = !sdk ? await sdkForProject() : sdk;
897
-
898
- let apiPath = '/users/{userId}/phone'.replace('{userId}', userId);
829
+ let apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId);
899
830
  let payload = {};
900
- if (typeof number !== 'undefined') {
901
- payload['number'] = number;
902
- }
903
-
904
831
 
905
832
  let response = undefined;
906
-
907
- response = await client.call('patch', apiPath, {
833
+
834
+ response = await client.call('get', apiPath, {
908
835
  'content-type': 'application/json',
909
836
  }, payload);
910
837
 
911
-
912
838
  if (parseOutput) {
913
839
  parse(response)
914
840
  success()
@@ -918,29 +844,26 @@ const usersUpdatePhone = async ({ userId, number, parseOutput = true, sdk = unde
918
844
  }
919
845
 
920
846
  /**
921
- * @typedef {Object} UsersGetPrefsRequestParams
847
+ * @typedef {Object} UsersGetMfaRecoveryCodesRequestParams
922
848
  * @property {string} userId User ID.
923
849
  * @property {boolean} parseOutput
924
850
  * @property {libClient | undefined} sdk
925
851
  */
926
852
 
927
853
  /**
928
- * @param {UsersGetPrefsRequestParams} params
854
+ * @param {UsersGetMfaRecoveryCodesRequestParams} params
929
855
  */
930
- const usersGetPrefs = async ({ userId, parseOutput = true, sdk = undefined}) => {
856
+ const usersGetMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = undefined}) => {
931
857
  let client = !sdk ? await sdkForProject() : sdk;
932
-
933
- let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
858
+ let apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
934
859
  let payload = {};
935
860
 
936
-
937
861
  let response = undefined;
938
-
862
+
939
863
  response = await client.call('get', apiPath, {
940
864
  'content-type': 'application/json',
941
865
  }, payload);
942
866
 
943
-
944
867
  if (parseOutput) {
945
868
  parse(response)
946
869
  success()
@@ -950,33 +873,26 @@ const usersGetPrefs = async ({ userId, parseOutput = true, sdk = undefined}) =>
950
873
  }
951
874
 
952
875
  /**
953
- * @typedef {Object} UsersUpdatePrefsRequestParams
876
+ * @typedef {Object} UsersUpdateMfaRecoveryCodesRequestParams
954
877
  * @property {string} userId User ID.
955
- * @property {object} prefs Prefs key-value JSON object.
956
878
  * @property {boolean} parseOutput
957
879
  * @property {libClient | undefined} sdk
958
880
  */
959
881
 
960
882
  /**
961
- * @param {UsersUpdatePrefsRequestParams} params
883
+ * @param {UsersUpdateMfaRecoveryCodesRequestParams} params
962
884
  */
963
- const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undefined}) => {
885
+ const usersUpdateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = undefined}) => {
964
886
  let client = !sdk ? await sdkForProject() : sdk;
965
-
966
- let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
887
+ let apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
967
888
  let payload = {};
968
- if (typeof prefs !== 'undefined') {
969
- payload['prefs'] = JSON.parse(prefs);
970
- }
971
-
972
889
 
973
890
  let response = undefined;
974
-
975
- response = await client.call('patch', apiPath, {
891
+
892
+ response = await client.call('put', apiPath, {
976
893
  'content-type': 'application/json',
977
894
  }, payload);
978
895
 
979
-
980
896
  if (parseOutput) {
981
897
  parse(response)
982
898
  success()
@@ -986,29 +902,26 @@ const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undef
986
902
  }
987
903
 
988
904
  /**
989
- * @typedef {Object} UsersListSessionsRequestParams
905
+ * @typedef {Object} UsersCreateMfaRecoveryCodesRequestParams
990
906
  * @property {string} userId User ID.
991
907
  * @property {boolean} parseOutput
992
908
  * @property {libClient | undefined} sdk
993
909
  */
994
910
 
995
911
  /**
996
- * @param {UsersListSessionsRequestParams} params
912
+ * @param {UsersCreateMfaRecoveryCodesRequestParams} params
997
913
  */
998
- const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
914
+ const usersCreateMfaRecoveryCodes = async ({ userId, parseOutput = true, sdk = undefined}) => {
999
915
  let client = !sdk ? await sdkForProject() : sdk;
1000
-
1001
- let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
916
+ let apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
1002
917
  let payload = {};
1003
918
 
1004
-
1005
919
  let response = undefined;
1006
-
1007
- response = await client.call('get', apiPath, {
920
+
921
+ response = await client.call('patch', apiPath, {
1008
922
  'content-type': 'application/json',
1009
923
  }, payload);
1010
924
 
1011
-
1012
925
  if (parseOutput) {
1013
926
  parse(response)
1014
927
  success()
@@ -1018,29 +931,30 @@ const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined})
1018
931
  }
1019
932
 
1020
933
  /**
1021
- * @typedef {Object} UsersDeleteSessionsRequestParams
934
+ * @typedef {Object} UsersUpdateNameRequestParams
1022
935
  * @property {string} userId User ID.
936
+ * @property {string} name User name. Max length: 128 chars.
1023
937
  * @property {boolean} parseOutput
1024
938
  * @property {libClient | undefined} sdk
1025
939
  */
1026
940
 
1027
941
  /**
1028
- * @param {UsersDeleteSessionsRequestParams} params
942
+ * @param {UsersUpdateNameRequestParams} params
1029
943
  */
1030
- const usersDeleteSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
944
+ const usersUpdateName = async ({ userId, name, parseOutput = true, sdk = undefined}) => {
1031
945
  let client = !sdk ? await sdkForProject() : sdk;
1032
-
1033
- let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
946
+ let apiPath = '/users/{userId}/name'.replace('{userId}', userId);
1034
947
  let payload = {};
1035
-
948
+ if (typeof name !== 'undefined') {
949
+ payload['name'] = name;
950
+ }
1036
951
 
1037
952
  let response = undefined;
1038
-
1039
- response = await client.call('delete', apiPath, {
953
+
954
+ response = await client.call('patch', apiPath, {
1040
955
  'content-type': 'application/json',
1041
956
  }, payload);
1042
957
 
1043
-
1044
958
  if (parseOutput) {
1045
959
  parse(response)
1046
960
  success()
@@ -1050,30 +964,30 @@ const usersDeleteSessions = async ({ userId, parseOutput = true, sdk = undefined
1050
964
  }
1051
965
 
1052
966
  /**
1053
- * @typedef {Object} UsersDeleteSessionRequestParams
967
+ * @typedef {Object} UsersUpdatePasswordRequestParams
1054
968
  * @property {string} userId User ID.
1055
- * @property {string} sessionId Session ID.
969
+ * @property {string} password New user password. Must be at least 8 chars.
1056
970
  * @property {boolean} parseOutput
1057
971
  * @property {libClient | undefined} sdk
1058
972
  */
1059
973
 
1060
974
  /**
1061
- * @param {UsersDeleteSessionRequestParams} params
975
+ * @param {UsersUpdatePasswordRequestParams} params
1062
976
  */
1063
- const usersDeleteSession = async ({ userId, sessionId, parseOutput = true, sdk = undefined}) => {
977
+ const usersUpdatePassword = async ({ userId, password, parseOutput = true, sdk = undefined}) => {
1064
978
  let client = !sdk ? await sdkForProject() : sdk;
1065
-
1066
- let apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
979
+ let apiPath = '/users/{userId}/password'.replace('{userId}', userId);
1067
980
  let payload = {};
1068
-
981
+ if (typeof password !== 'undefined') {
982
+ payload['password'] = password;
983
+ }
1069
984
 
1070
985
  let response = undefined;
1071
-
1072
- response = await client.call('delete', apiPath, {
986
+
987
+ response = await client.call('patch', apiPath, {
1073
988
  'content-type': 'application/json',
1074
989
  }, payload);
1075
990
 
1076
-
1077
991
  if (parseOutput) {
1078
992
  parse(response)
1079
993
  success()
@@ -1083,33 +997,30 @@ const usersDeleteSession = async ({ userId, sessionId, parseOutput = true, sdk =
1083
997
  }
1084
998
 
1085
999
  /**
1086
- * @typedef {Object} UsersUpdateStatusRequestParams
1000
+ * @typedef {Object} UsersUpdatePhoneRequestParams
1087
1001
  * @property {string} userId User ID.
1088
- * @property {boolean} status User Status. To activate the user pass 'true' and to block the user pass 'false'.
1002
+ * @property {string} number User phone number.
1089
1003
  * @property {boolean} parseOutput
1090
1004
  * @property {libClient | undefined} sdk
1091
1005
  */
1092
1006
 
1093
1007
  /**
1094
- * @param {UsersUpdateStatusRequestParams} params
1008
+ * @param {UsersUpdatePhoneRequestParams} params
1095
1009
  */
1096
- const usersUpdateStatus = async ({ userId, status, parseOutput = true, sdk = undefined}) => {
1010
+ const usersUpdatePhone = async ({ userId, number, parseOutput = true, sdk = undefined}) => {
1097
1011
  let client = !sdk ? await sdkForProject() : sdk;
1098
-
1099
- let apiPath = '/users/{userId}/status'.replace('{userId}', userId);
1012
+ let apiPath = '/users/{userId}/phone'.replace('{userId}', userId);
1100
1013
  let payload = {};
1101
- if (typeof status !== 'undefined') {
1102
- payload['status'] = status;
1014
+ if (typeof number !== 'undefined') {
1015
+ payload['number'] = number;
1103
1016
  }
1104
1017
 
1105
-
1106
1018
  let response = undefined;
1107
-
1019
+
1108
1020
  response = await client.call('patch', apiPath, {
1109
1021
  'content-type': 'application/json',
1110
1022
  }, payload);
1111
1023
 
1112
-
1113
1024
  if (parseOutput) {
1114
1025
  parse(response)
1115
1026
  success()
@@ -1119,33 +1030,26 @@ const usersUpdateStatus = async ({ userId, status, parseOutput = true, sdk = und
1119
1030
  }
1120
1031
 
1121
1032
  /**
1122
- * @typedef {Object} UsersUpdateEmailVerificationRequestParams
1033
+ * @typedef {Object} UsersGetPrefsRequestParams
1123
1034
  * @property {string} userId User ID.
1124
- * @property {boolean} emailVerification User email verification status.
1125
1035
  * @property {boolean} parseOutput
1126
1036
  * @property {libClient | undefined} sdk
1127
1037
  */
1128
1038
 
1129
1039
  /**
1130
- * @param {UsersUpdateEmailVerificationRequestParams} params
1040
+ * @param {UsersGetPrefsRequestParams} params
1131
1041
  */
1132
- const usersUpdateEmailVerification = async ({ userId, emailVerification, parseOutput = true, sdk = undefined}) => {
1042
+ const usersGetPrefs = async ({ userId, parseOutput = true, sdk = undefined}) => {
1133
1043
  let client = !sdk ? await sdkForProject() : sdk;
1134
-
1135
- let apiPath = '/users/{userId}/verification'.replace('{userId}', userId);
1044
+ let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
1136
1045
  let payload = {};
1137
- if (typeof emailVerification !== 'undefined') {
1138
- payload['emailVerification'] = emailVerification;
1139
- }
1140
-
1141
1046
 
1142
1047
  let response = undefined;
1143
-
1144
- response = await client.call('patch', apiPath, {
1048
+
1049
+ response = await client.call('get', apiPath, {
1145
1050
  'content-type': 'application/json',
1146
1051
  }, payload);
1147
1052
 
1148
-
1149
1053
  if (parseOutput) {
1150
1054
  parse(response)
1151
1055
  success()
@@ -1155,33 +1059,213 @@ const usersUpdateEmailVerification = async ({ userId, emailVerification, parseOu
1155
1059
  }
1156
1060
 
1157
1061
  /**
1158
- * @typedef {Object} UsersUpdatePhoneVerificationRequestParams
1062
+ * @typedef {Object} UsersUpdatePrefsRequestParams
1159
1063
  * @property {string} userId User ID.
1160
- * @property {boolean} phoneVerification User phone verification status.
1064
+ * @property {object} prefs Prefs key-value JSON object.
1161
1065
  * @property {boolean} parseOutput
1162
1066
  * @property {libClient | undefined} sdk
1163
1067
  */
1164
1068
 
1165
1069
  /**
1166
- * @param {UsersUpdatePhoneVerificationRequestParams} params
1070
+ * @param {UsersUpdatePrefsRequestParams} params
1167
1071
  */
1168
- const usersUpdatePhoneVerification = async ({ userId, phoneVerification, parseOutput = true, sdk = undefined}) => {
1072
+ const usersUpdatePrefs = async ({ userId, prefs, parseOutput = true, sdk = undefined}) => {
1169
1073
  let client = !sdk ? await sdkForProject() : sdk;
1170
-
1171
- let apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId);
1074
+ let apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
1172
1075
  let payload = {};
1173
- if (typeof phoneVerification !== 'undefined') {
1174
- payload['phoneVerification'] = phoneVerification;
1076
+ if (typeof prefs !== 'undefined') {
1077
+ payload['prefs'] = JSON.parse(prefs);
1078
+ }
1079
+
1080
+ let response = undefined;
1081
+
1082
+ response = await client.call('patch', apiPath, {
1083
+ 'content-type': 'application/json',
1084
+ }, payload);
1085
+
1086
+ if (parseOutput) {
1087
+ parse(response)
1088
+ success()
1089
+ }
1090
+
1091
+ return response;
1092
+ }
1093
+
1094
+ /**
1095
+ * @typedef {Object} UsersListSessionsRequestParams
1096
+ * @property {string} userId User ID.
1097
+ * @property {boolean} parseOutput
1098
+ * @property {libClient | undefined} sdk
1099
+ */
1100
+
1101
+ /**
1102
+ * @param {UsersListSessionsRequestParams} params
1103
+ */
1104
+ const usersListSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
1105
+ let client = !sdk ? await sdkForProject() : sdk;
1106
+ let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
1107
+ let payload = {};
1108
+
1109
+ let response = undefined;
1110
+
1111
+ response = await client.call('get', apiPath, {
1112
+ 'content-type': 'application/json',
1113
+ }, payload);
1114
+
1115
+ if (parseOutput) {
1116
+ parse(response)
1117
+ success()
1118
+ }
1119
+
1120
+ return response;
1121
+ }
1122
+
1123
+ /**
1124
+ * @typedef {Object} UsersCreateSessionRequestParams
1125
+ * @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1126
+ * @property {boolean} parseOutput
1127
+ * @property {libClient | undefined} sdk
1128
+ */
1129
+
1130
+ /**
1131
+ * @param {UsersCreateSessionRequestParams} params
1132
+ */
1133
+ const usersCreateSession = async ({ userId, parseOutput = true, sdk = undefined}) => {
1134
+ let client = !sdk ? await sdkForProject() : sdk;
1135
+ let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
1136
+ let payload = {};
1137
+
1138
+ let response = undefined;
1139
+
1140
+ response = await client.call('post', apiPath, {
1141
+ 'content-type': 'application/json',
1142
+ }, payload);
1143
+
1144
+ if (parseOutput) {
1145
+ parse(response)
1146
+ success()
1175
1147
  }
1148
+
1149
+ return response;
1150
+ }
1176
1151
 
1152
+ /**
1153
+ * @typedef {Object} UsersDeleteSessionsRequestParams
1154
+ * @property {string} userId User ID.
1155
+ * @property {boolean} parseOutput
1156
+ * @property {libClient | undefined} sdk
1157
+ */
1158
+
1159
+ /**
1160
+ * @param {UsersDeleteSessionsRequestParams} params
1161
+ */
1162
+ const usersDeleteSessions = async ({ userId, parseOutput = true, sdk = undefined}) => {
1163
+ let client = !sdk ? await sdkForProject() : sdk;
1164
+ let apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
1165
+ let payload = {};
1177
1166
 
1178
1167
  let response = undefined;
1168
+
1169
+ response = await client.call('delete', apiPath, {
1170
+ 'content-type': 'application/json',
1171
+ }, payload);
1172
+
1173
+ if (parseOutput) {
1174
+ parse(response)
1175
+ success()
1176
+ }
1179
1177
 
1178
+ return response;
1179
+ }
1180
+
1181
+ /**
1182
+ * @typedef {Object} UsersDeleteSessionRequestParams
1183
+ * @property {string} userId User ID.
1184
+ * @property {string} sessionId Session ID.
1185
+ * @property {boolean} parseOutput
1186
+ * @property {libClient | undefined} sdk
1187
+ */
1188
+
1189
+ /**
1190
+ * @param {UsersDeleteSessionRequestParams} params
1191
+ */
1192
+ const usersDeleteSession = async ({ userId, sessionId, parseOutput = true, sdk = undefined}) => {
1193
+ let client = !sdk ? await sdkForProject() : sdk;
1194
+ let apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
1195
+ let payload = {};
1196
+
1197
+ let response = undefined;
1198
+
1199
+ response = await client.call('delete', apiPath, {
1200
+ 'content-type': 'application/json',
1201
+ }, payload);
1202
+
1203
+ if (parseOutput) {
1204
+ parse(response)
1205
+ success()
1206
+ }
1207
+
1208
+ return response;
1209
+ }
1210
+
1211
+ /**
1212
+ * @typedef {Object} UsersUpdateStatusRequestParams
1213
+ * @property {string} userId User ID.
1214
+ * @property {boolean} status User Status. To activate the user pass 'true' and to block the user pass 'false'.
1215
+ * @property {boolean} parseOutput
1216
+ * @property {libClient | undefined} sdk
1217
+ */
1218
+
1219
+ /**
1220
+ * @param {UsersUpdateStatusRequestParams} params
1221
+ */
1222
+ const usersUpdateStatus = async ({ userId, status, parseOutput = true, sdk = undefined}) => {
1223
+ let client = !sdk ? await sdkForProject() : sdk;
1224
+ let apiPath = '/users/{userId}/status'.replace('{userId}', userId);
1225
+ let payload = {};
1226
+ if (typeof status !== 'undefined') {
1227
+ payload['status'] = status;
1228
+ }
1229
+
1230
+ let response = undefined;
1231
+
1180
1232
  response = await client.call('patch', apiPath, {
1181
1233
  'content-type': 'application/json',
1182
1234
  }, payload);
1183
1235
 
1236
+ if (parseOutput) {
1237
+ parse(response)
1238
+ success()
1239
+ }
1184
1240
 
1241
+ return response;
1242
+ }
1243
+
1244
+ /**
1245
+ * @typedef {Object} UsersListTargetsRequestParams
1246
+ * @property {string} userId User ID.
1247
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels
1248
+ * @property {boolean} parseOutput
1249
+ * @property {libClient | undefined} sdk
1250
+ */
1251
+
1252
+ /**
1253
+ * @param {UsersListTargetsRequestParams} params
1254
+ */
1255
+ const usersListTargets = async ({ userId, queries, parseOutput = true, sdk = undefined}) => {
1256
+ let client = !sdk ? await sdkForProject() : sdk;
1257
+ let apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
1258
+ let payload = {};
1259
+ if (typeof queries !== 'undefined') {
1260
+ payload['queries'] = queries;
1261
+ }
1262
+
1263
+ let response = undefined;
1264
+
1265
+ response = await client.call('get', apiPath, {
1266
+ 'content-type': 'application/json',
1267
+ }, payload);
1268
+
1185
1269
  if (parseOutput) {
1186
1270
  parse(response)
1187
1271
  success()
@@ -1190,11 +1274,264 @@ const usersUpdatePhoneVerification = async ({ userId, phoneVerification, parseOu
1190
1274
  return response;
1191
1275
  }
1192
1276
 
1277
+ /**
1278
+ * @typedef {Object} UsersCreateTargetRequestParams
1279
+ * @property {string} userId User ID.
1280
+ * @property {string} targetId Target ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1281
+ * @property {MessagingProviderType} providerType The target provider type. Can be one of the following: 'email', 'sms' or 'push'.
1282
+ * @property {string} identifier The target identifier (token, email, phone etc.)
1283
+ * @property {string} providerId Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
1284
+ * @property {string} name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
1285
+ * @property {boolean} parseOutput
1286
+ * @property {libClient | undefined} sdk
1287
+ */
1288
+
1289
+ /**
1290
+ * @param {UsersCreateTargetRequestParams} params
1291
+ */
1292
+ const usersCreateTarget = async ({ userId, targetId, providerType, identifier, providerId, name, parseOutput = true, sdk = undefined}) => {
1293
+ let client = !sdk ? await sdkForProject() : sdk;
1294
+ let apiPath = '/users/{userId}/targets'.replace('{userId}', userId);
1295
+ let payload = {};
1296
+ if (typeof targetId !== 'undefined') {
1297
+ payload['targetId'] = targetId;
1298
+ }
1299
+ if (typeof providerType !== 'undefined') {
1300
+ payload['providerType'] = providerType;
1301
+ }
1302
+ if (typeof identifier !== 'undefined') {
1303
+ payload['identifier'] = identifier;
1304
+ }
1305
+ if (typeof providerId !== 'undefined') {
1306
+ payload['providerId'] = providerId;
1307
+ }
1308
+ if (typeof name !== 'undefined') {
1309
+ payload['name'] = name;
1310
+ }
1311
+
1312
+ let response = undefined;
1313
+
1314
+ response = await client.call('post', apiPath, {
1315
+ 'content-type': 'application/json',
1316
+ }, payload);
1317
+
1318
+ if (parseOutput) {
1319
+ parse(response)
1320
+ success()
1321
+ }
1322
+
1323
+ return response;
1324
+ }
1325
+
1326
+ /**
1327
+ * @typedef {Object} UsersGetTargetRequestParams
1328
+ * @property {string} userId User ID.
1329
+ * @property {string} targetId Target ID.
1330
+ * @property {boolean} parseOutput
1331
+ * @property {libClient | undefined} sdk
1332
+ */
1333
+
1334
+ /**
1335
+ * @param {UsersGetTargetRequestParams} params
1336
+ */
1337
+ const usersGetTarget = async ({ userId, targetId, parseOutput = true, sdk = undefined}) => {
1338
+ let client = !sdk ? await sdkForProject() : sdk;
1339
+ let apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1340
+ let payload = {};
1341
+
1342
+ let response = undefined;
1343
+
1344
+ response = await client.call('get', apiPath, {
1345
+ 'content-type': 'application/json',
1346
+ }, payload);
1347
+
1348
+ if (parseOutput) {
1349
+ parse(response)
1350
+ success()
1351
+ }
1352
+
1353
+ return response;
1354
+ }
1355
+
1356
+ /**
1357
+ * @typedef {Object} UsersUpdateTargetRequestParams
1358
+ * @property {string} userId User ID.
1359
+ * @property {string} targetId Target ID.
1360
+ * @property {string} identifier The target identifier (token, email, phone etc.)
1361
+ * @property {string} providerId Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
1362
+ * @property {string} name Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.
1363
+ * @property {boolean} parseOutput
1364
+ * @property {libClient | undefined} sdk
1365
+ */
1366
+
1367
+ /**
1368
+ * @param {UsersUpdateTargetRequestParams} params
1369
+ */
1370
+ const usersUpdateTarget = async ({ userId, targetId, identifier, providerId, name, parseOutput = true, sdk = undefined}) => {
1371
+ let client = !sdk ? await sdkForProject() : sdk;
1372
+ let apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1373
+ let payload = {};
1374
+ if (typeof identifier !== 'undefined') {
1375
+ payload['identifier'] = identifier;
1376
+ }
1377
+ if (typeof providerId !== 'undefined') {
1378
+ payload['providerId'] = providerId;
1379
+ }
1380
+ if (typeof name !== 'undefined') {
1381
+ payload['name'] = name;
1382
+ }
1383
+
1384
+ let response = undefined;
1385
+
1386
+ response = await client.call('patch', apiPath, {
1387
+ 'content-type': 'application/json',
1388
+ }, payload);
1389
+
1390
+ if (parseOutput) {
1391
+ parse(response)
1392
+ success()
1393
+ }
1394
+
1395
+ return response;
1396
+ }
1397
+
1398
+ /**
1399
+ * @typedef {Object} UsersDeleteTargetRequestParams
1400
+ * @property {string} userId User ID.
1401
+ * @property {string} targetId Target ID.
1402
+ * @property {boolean} parseOutput
1403
+ * @property {libClient | undefined} sdk
1404
+ */
1405
+
1406
+ /**
1407
+ * @param {UsersDeleteTargetRequestParams} params
1408
+ */
1409
+ const usersDeleteTarget = async ({ userId, targetId, parseOutput = true, sdk = undefined}) => {
1410
+ let client = !sdk ? await sdkForProject() : sdk;
1411
+ let apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId);
1412
+ let payload = {};
1413
+
1414
+ let response = undefined;
1415
+
1416
+ response = await client.call('delete', apiPath, {
1417
+ 'content-type': 'application/json',
1418
+ }, payload);
1419
+
1420
+ if (parseOutput) {
1421
+ parse(response)
1422
+ success()
1423
+ }
1424
+
1425
+ return response;
1426
+ }
1427
+
1428
+ /**
1429
+ * @typedef {Object} UsersCreateTokenRequestParams
1430
+ * @property {string} userId User ID.
1431
+ * @property {number} length Token length in characters. The default length is 6 characters
1432
+ * @property {number} expire Token expiration period in seconds. The default expiration is 15 minutes.
1433
+ * @property {boolean} parseOutput
1434
+ * @property {libClient | undefined} sdk
1435
+ */
1436
+
1437
+ /**
1438
+ * @param {UsersCreateTokenRequestParams} params
1439
+ */
1440
+ const usersCreateToken = async ({ userId, length, expire, parseOutput = true, sdk = undefined}) => {
1441
+ let client = !sdk ? await sdkForProject() : sdk;
1442
+ let apiPath = '/users/{userId}/tokens'.replace('{userId}', userId);
1443
+ let payload = {};
1444
+ if (typeof length !== 'undefined') {
1445
+ payload['length'] = length;
1446
+ }
1447
+ if (typeof expire !== 'undefined') {
1448
+ payload['expire'] = expire;
1449
+ }
1450
+
1451
+ let response = undefined;
1452
+
1453
+ response = await client.call('post', apiPath, {
1454
+ 'content-type': 'application/json',
1455
+ }, payload);
1456
+
1457
+ if (parseOutput) {
1458
+ parse(response)
1459
+ success()
1460
+ }
1461
+
1462
+ return response;
1463
+ }
1464
+
1465
+ /**
1466
+ * @typedef {Object} UsersUpdateEmailVerificationRequestParams
1467
+ * @property {string} userId User ID.
1468
+ * @property {boolean} emailVerification User email verification status.
1469
+ * @property {boolean} parseOutput
1470
+ * @property {libClient | undefined} sdk
1471
+ */
1472
+
1473
+ /**
1474
+ * @param {UsersUpdateEmailVerificationRequestParams} params
1475
+ */
1476
+ const usersUpdateEmailVerification = async ({ userId, emailVerification, parseOutput = true, sdk = undefined}) => {
1477
+ let client = !sdk ? await sdkForProject() : sdk;
1478
+ let apiPath = '/users/{userId}/verification'.replace('{userId}', userId);
1479
+ let payload = {};
1480
+ if (typeof emailVerification !== 'undefined') {
1481
+ payload['emailVerification'] = emailVerification;
1482
+ }
1483
+
1484
+ let response = undefined;
1485
+
1486
+ response = await client.call('patch', apiPath, {
1487
+ 'content-type': 'application/json',
1488
+ }, payload);
1489
+
1490
+ if (parseOutput) {
1491
+ parse(response)
1492
+ success()
1493
+ }
1494
+
1495
+ return response;
1496
+ }
1497
+
1498
+ /**
1499
+ * @typedef {Object} UsersUpdatePhoneVerificationRequestParams
1500
+ * @property {string} userId User ID.
1501
+ * @property {boolean} phoneVerification User phone verification status.
1502
+ * @property {boolean} parseOutput
1503
+ * @property {libClient | undefined} sdk
1504
+ */
1505
+
1506
+ /**
1507
+ * @param {UsersUpdatePhoneVerificationRequestParams} params
1508
+ */
1509
+ const usersUpdatePhoneVerification = async ({ userId, phoneVerification, parseOutput = true, sdk = undefined}) => {
1510
+ let client = !sdk ? await sdkForProject() : sdk;
1511
+ let apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId);
1512
+ let payload = {};
1513
+ if (typeof phoneVerification !== 'undefined') {
1514
+ payload['phoneVerification'] = phoneVerification;
1515
+ }
1516
+
1517
+ let response = undefined;
1518
+
1519
+ response = await client.call('patch', apiPath, {
1520
+ 'content-type': 'application/json',
1521
+ }, payload);
1522
+
1523
+ if (parseOutput) {
1524
+ parse(response)
1525
+ success()
1526
+ }
1527
+
1528
+ return response;
1529
+ }
1193
1530
 
1194
1531
  users
1195
1532
  .command(`list`)
1196
1533
  .description(`Get a list of all the project's users. You can use the query params to filter your results.`)
1197
- .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification`)
1534
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels`)
1198
1535
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1199
1536
  .action(actionRunner(usersList))
1200
1537
 
@@ -1229,7 +1566,7 @@ users
1229
1566
  users
1230
1567
  .command(`listIdentities`)
1231
1568
  .description(`Get identities for all users.`)
1232
- .option(`--queries <queries>`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry`)
1569
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry`)
1233
1570
  .option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
1234
1571
  .action(actionRunner(usersListIdentities))
1235
1572
 
@@ -1297,7 +1634,6 @@ users
1297
1634
  .command(`getUsage`)
1298
1635
  .description(``)
1299
1636
  .option(`--range <range>`, `Date range.`)
1300
- .option(`--provider <provider>`, `Provider Name.`)
1301
1637
  .action(actionRunner(usersGetUsage))
1302
1638
 
1303
1639
  users
@@ -1323,7 +1659,7 @@ users
1323
1659
  .command(`updateLabels`)
1324
1660
  .description(`Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user'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.`)
1325
1661
  .requiredOption(`--userId <userId>`, `User ID.`)
1326
- .requiredOption(`--labels [labels...]`, `Array of user labels. Replaces the previous labels. Maximum of 100 labels are allowed, each up to 36 alphanumeric characters long.`)
1662
+ .requiredOption(`--labels [labels...]`, `Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.`)
1327
1663
  .action(actionRunner(usersUpdateLabels))
1328
1664
 
1329
1665
  users
@@ -1339,6 +1675,44 @@ users
1339
1675
  .requiredOption(`--userId <userId>`, `User ID.`)
1340
1676
  .action(actionRunner(usersListMemberships))
1341
1677
 
1678
+ users
1679
+ .command(`updateMfa`)
1680
+ .description(`Enable or disable MFA on a user account.`)
1681
+ .requiredOption(`--userId <userId>`, `User ID.`)
1682
+ .requiredOption(`--mfa <mfa>`, `Enable or disable MFA.`, parseBool)
1683
+ .action(actionRunner(usersUpdateMfa))
1684
+
1685
+ users
1686
+ .command(`deleteMfaAuthenticator`)
1687
+ .description(`Delete an authenticator app.`)
1688
+ .requiredOption(`--userId <userId>`, `User ID.`)
1689
+ .requiredOption(`--type <type>`, `Type of authenticator.`)
1690
+ .action(actionRunner(usersDeleteMfaAuthenticator))
1691
+
1692
+ users
1693
+ .command(`listMfaFactors`)
1694
+ .description(`List the factors available on the account to be used as a MFA challange.`)
1695
+ .requiredOption(`--userId <userId>`, `User ID.`)
1696
+ .action(actionRunner(usersListMfaFactors))
1697
+
1698
+ users
1699
+ .command(`getMfaRecoveryCodes`)
1700
+ .description(`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.`)
1701
+ .requiredOption(`--userId <userId>`, `User ID.`)
1702
+ .action(actionRunner(usersGetMfaRecoveryCodes))
1703
+
1704
+ users
1705
+ .command(`updateMfaRecoveryCodes`)
1706
+ .description(`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.`)
1707
+ .requiredOption(`--userId <userId>`, `User ID.`)
1708
+ .action(actionRunner(usersUpdateMfaRecoveryCodes))
1709
+
1710
+ users
1711
+ .command(`createMfaRecoveryCodes`)
1712
+ .description(`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.`)
1713
+ .requiredOption(`--userId <userId>`, `User ID.`)
1714
+ .action(actionRunner(usersCreateMfaRecoveryCodes))
1715
+
1342
1716
  users
1343
1717
  .command(`updateName`)
1344
1718
  .description(`Update the user name by its unique ID.`)
@@ -1379,6 +1753,12 @@ users
1379
1753
  .requiredOption(`--userId <userId>`, `User ID.`)
1380
1754
  .action(actionRunner(usersListSessions))
1381
1755
 
1756
+ users
1757
+ .command(`createSession`)
1758
+ .description(`Creates a session for a user. Returns an immediately usable session object. 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.`)
1759
+ .requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1760
+ .action(actionRunner(usersCreateSession))
1761
+
1382
1762
  users
1383
1763
  .command(`deleteSessions`)
1384
1764
  .description(`Delete all user's sessions by using the user's unique ID.`)
@@ -1399,6 +1779,56 @@ users
1399
1779
  .requiredOption(`--status <status>`, `User Status. To activate the user pass 'true' and to block the user pass 'false'.`, parseBool)
1400
1780
  .action(actionRunner(usersUpdateStatus))
1401
1781
 
1782
+ users
1783
+ .command(`listTargets`)
1784
+ .description(`List the messaging targets that are associated with a user.`)
1785
+ .requiredOption(`--userId <userId>`, `User ID.`)
1786
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels`)
1787
+ .action(actionRunner(usersListTargets))
1788
+
1789
+ users
1790
+ .command(`createTarget`)
1791
+ .description(`Create a messaging target.`)
1792
+ .requiredOption(`--userId <userId>`, `User ID.`)
1793
+ .requiredOption(`--targetId <targetId>`, `Target ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1794
+ .requiredOption(`--providerType <providerType>`, `The target provider type. Can be one of the following: 'email', 'sms' or 'push'.`)
1795
+ .requiredOption(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`)
1796
+ .option(`--providerId <providerId>`, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`)
1797
+ .option(`--name <name>`, `Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.`)
1798
+ .action(actionRunner(usersCreateTarget))
1799
+
1800
+ users
1801
+ .command(`getTarget`)
1802
+ .description(`Get a user's push notification target by ID.`)
1803
+ .requiredOption(`--userId <userId>`, `User ID.`)
1804
+ .requiredOption(`--targetId <targetId>`, `Target ID.`)
1805
+ .action(actionRunner(usersGetTarget))
1806
+
1807
+ users
1808
+ .command(`updateTarget`)
1809
+ .description(`Update a messaging target.`)
1810
+ .requiredOption(`--userId <userId>`, `User ID.`)
1811
+ .requiredOption(`--targetId <targetId>`, `Target ID.`)
1812
+ .option(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`)
1813
+ .option(`--providerId <providerId>`, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`)
1814
+ .option(`--name <name>`, `Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23.`)
1815
+ .action(actionRunner(usersUpdateTarget))
1816
+
1817
+ users
1818
+ .command(`deleteTarget`)
1819
+ .description(`Delete a messaging target.`)
1820
+ .requiredOption(`--userId <userId>`, `User ID.`)
1821
+ .requiredOption(`--targetId <targetId>`, `Target ID.`)
1822
+ .action(actionRunner(usersDeleteTarget))
1823
+
1824
+ users
1825
+ .command(`createToken`)
1826
+ .description(`Returns a token with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession) endpoint to complete the login process.`)
1827
+ .requiredOption(`--userId <userId>`, `User ID.`)
1828
+ .option(`--length <length>`, `Token length in characters. The default length is 6 characters`, parseInteger)
1829
+ .option(`--expire <expire>`, `Token expiration period in seconds. The default expiration is 15 minutes.`, parseInteger)
1830
+ .action(actionRunner(usersCreateToken))
1831
+
1402
1832
  users
1403
1833
  .command(`updateEmailVerification`)
1404
1834
  .description(`Update the user email verification status by its unique ID.`)
@@ -1413,36 +1843,48 @@ users
1413
1843
  .requiredOption(`--phoneVerification <phoneVerification>`, `User phone verification status.`, parseBool)
1414
1844
  .action(actionRunner(usersUpdatePhoneVerification))
1415
1845
 
1416
-
1417
1846
  module.exports = {
1418
1847
  users,
1419
- usersList,
1420
- usersCreate,
1421
- usersCreateArgon2User,
1422
- usersCreateBcryptUser,
1423
- usersListIdentities,
1424
- usersDeleteIdentity,
1425
- usersCreateMD5User,
1426
- usersCreatePHPassUser,
1427
- usersCreateScryptUser,
1428
- usersCreateScryptModifiedUser,
1429
- usersCreateSHAUser,
1430
- usersGetUsage,
1431
- usersGet,
1432
- usersDelete,
1433
- usersUpdateEmail,
1434
- usersUpdateLabels,
1435
- usersListLogs,
1436
- usersListMemberships,
1437
- usersUpdateName,
1438
- usersUpdatePassword,
1439
- usersUpdatePhone,
1440
- usersGetPrefs,
1441
- usersUpdatePrefs,
1442
- usersListSessions,
1443
- usersDeleteSessions,
1444
- usersDeleteSession,
1445
- usersUpdateStatus,
1446
- usersUpdateEmailVerification,
1447
- usersUpdatePhoneVerification
1848
+ usersList,
1849
+ usersCreate,
1850
+ usersCreateArgon2User,
1851
+ usersCreateBcryptUser,
1852
+ usersListIdentities,
1853
+ usersDeleteIdentity,
1854
+ usersCreateMD5User,
1855
+ usersCreatePHPassUser,
1856
+ usersCreateScryptUser,
1857
+ usersCreateScryptModifiedUser,
1858
+ usersCreateSHAUser,
1859
+ usersGetUsage,
1860
+ usersGet,
1861
+ usersDelete,
1862
+ usersUpdateEmail,
1863
+ usersUpdateLabels,
1864
+ usersListLogs,
1865
+ usersListMemberships,
1866
+ usersUpdateMfa,
1867
+ usersDeleteMfaAuthenticator,
1868
+ usersListMfaFactors,
1869
+ usersGetMfaRecoveryCodes,
1870
+ usersUpdateMfaRecoveryCodes,
1871
+ usersCreateMfaRecoveryCodes,
1872
+ usersUpdateName,
1873
+ usersUpdatePassword,
1874
+ usersUpdatePhone,
1875
+ usersGetPrefs,
1876
+ usersUpdatePrefs,
1877
+ usersListSessions,
1878
+ usersCreateSession,
1879
+ usersDeleteSessions,
1880
+ usersDeleteSession,
1881
+ usersUpdateStatus,
1882
+ usersListTargets,
1883
+ usersCreateTarget,
1884
+ usersGetTarget,
1885
+ usersUpdateTarget,
1886
+ usersDeleteTarget,
1887
+ usersCreateToken,
1888
+ usersUpdateEmailVerification,
1889
+ usersUpdatePhoneVerification
1448
1890
  };