appwrite-cli 4.2.2 → 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 (314) 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 +4 -4
  293. package/lib/commands/account.js +906 -226
  294. package/lib/commands/avatars.js +3 -3
  295. package/lib/commands/databases.js +22 -22
  296. package/lib/commands/deploy.js +45 -6
  297. package/lib/commands/functions.js +5 -5
  298. package/lib/commands/health.js +193 -1
  299. package/lib/commands/messaging.js +2815 -0
  300. package/lib/commands/migrations.js +2 -2
  301. package/lib/commands/project.js +15 -5
  302. package/lib/commands/projects.js +210 -72
  303. package/lib/commands/proxy.js +1 -1
  304. package/lib/commands/storage.js +6 -6
  305. package/lib/commands/teams.js +2 -2
  306. package/lib/commands/users.js +545 -14
  307. package/lib/paginate.js +2 -2
  308. package/lib/parser.js +1 -0
  309. package/package.json +1 -1
  310. package/scoop/appwrite.json +3 -3
  311. package/docs/examples/account/create-magic-u-r-l-session.md +0 -4
  312. package/docs/examples/account/create-phone-session.md +0 -3
  313. package/docs/examples/projects/get-usage.md +0 -3
  314. package/docs/examples/projects/update-smtp-configuration.md +0 -11
@@ -69,9 +69,9 @@ const accountGet = async ({ parseOutput = true, sdk = undefined}) => {
69
69
 
70
70
  /**
71
71
  * @typedef {Object} AccountCreateRequestParams
72
- * @property {string} userId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
72
+ * @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.
73
73
  * @property {string} email User email.
74
- * @property {string} password New user password. Must be at least 8 chars.
74
+ * @property {string} password New user password. Must be between 8 and 256 chars.
75
75
  * @property {string} name User name. Max length: 128 chars.
76
76
  * @property {boolean} parseOutput
77
77
  * @property {libClient | undefined} sdk
@@ -111,6 +111,34 @@ const accountCreate = async ({ userId, email, password, name, parseOutput = true
111
111
  return response;
112
112
  }
113
113
 
114
+ /**
115
+ * @typedef {Object} AccountDeleteRequestParams
116
+ * @property {boolean} parseOutput
117
+ * @property {libClient | undefined} sdk
118
+ */
119
+
120
+ /**
121
+ * @param {AccountDeleteRequestParams} params
122
+ */
123
+ const accountDelete = async ({ parseOutput = true, sdk = undefined}) => {
124
+ let client = !sdk ? await sdkForProject() : sdk;
125
+ let apiPath = '/account';
126
+ let payload = {};
127
+
128
+ let response = undefined;
129
+
130
+ response = await client.call('delete', apiPath, {
131
+ 'content-type': 'application/json',
132
+ }, payload);
133
+
134
+ if (parseOutput) {
135
+ parse(response)
136
+ success()
137
+ }
138
+
139
+ return response;
140
+ }
141
+
114
142
  /**
115
143
  * @typedef {Object} AccountUpdateEmailRequestParams
116
144
  * @property {string} email User email.
@@ -149,7 +177,7 @@ const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = u
149
177
 
150
178
  /**
151
179
  * @typedef {Object} AccountListIdentitiesRequestParams
152
- * @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
180
+ * @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
153
181
  * @property {boolean} parseOutput
154
182
  * @property {libClient | undefined} sdk
155
183
  */
@@ -269,21 +297,21 @@ const accountListLogs = async ({ queries, parseOutput = true, sdk = undefined})
269
297
  }
270
298
 
271
299
  /**
272
- * @typedef {Object} AccountUpdateNameRequestParams
273
- * @property {string} name User name. Max length: 128 chars.
300
+ * @typedef {Object} AccountUpdateMFARequestParams
301
+ * @property {boolean} mfa Enable or disable MFA.
274
302
  * @property {boolean} parseOutput
275
303
  * @property {libClient | undefined} sdk
276
304
  */
277
305
 
278
306
  /**
279
- * @param {AccountUpdateNameRequestParams} params
307
+ * @param {AccountUpdateMFARequestParams} params
280
308
  */
281
- const accountUpdateName = async ({ name, parseOutput = true, sdk = undefined}) => {
309
+ const accountUpdateMFA = async ({ mfa, parseOutput = true, sdk = undefined}) => {
282
310
  let client = !sdk ? await sdkForProject() : sdk;
283
- let apiPath = '/account/name';
311
+ let apiPath = '/account/mfa';
284
312
  let payload = {};
285
- if (typeof name !== 'undefined') {
286
- payload['name'] = name;
313
+ if (typeof mfa !== 'undefined') {
314
+ payload['mfa'] = mfa;
287
315
  }
288
316
 
289
317
  let response = undefined;
@@ -301,30 +329,23 @@ const accountUpdateName = async ({ name, parseOutput = true, sdk = undefined}) =
301
329
  }
302
330
 
303
331
  /**
304
- * @typedef {Object} AccountUpdatePasswordRequestParams
305
- * @property {string} password New user password. Must be at least 8 chars.
306
- * @property {string} oldPassword Current user password. Must be at least 8 chars.
332
+ * @typedef {Object} AccountCreateMfaAuthenticatorRequestParams
333
+ * @property {AuthenticatorType} type Type of authenticator. Must be 'totp'
307
334
  * @property {boolean} parseOutput
308
335
  * @property {libClient | undefined} sdk
309
336
  */
310
337
 
311
338
  /**
312
- * @param {AccountUpdatePasswordRequestParams} params
339
+ * @param {AccountCreateMfaAuthenticatorRequestParams} params
313
340
  */
314
- const accountUpdatePassword = async ({ password, oldPassword, parseOutput = true, sdk = undefined}) => {
341
+ const accountCreateMfaAuthenticator = async ({ type, parseOutput = true, sdk = undefined}) => {
315
342
  let client = !sdk ? await sdkForProject() : sdk;
316
- let apiPath = '/account/password';
343
+ let apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
317
344
  let payload = {};
318
- if (typeof password !== 'undefined') {
319
- payload['password'] = password;
320
- }
321
- if (typeof oldPassword !== 'undefined') {
322
- payload['oldPassword'] = oldPassword;
323
- }
324
345
 
325
346
  let response = undefined;
326
347
 
327
- response = await client.call('patch', apiPath, {
348
+ response = await client.call('post', apiPath, {
328
349
  'content-type': 'application/json',
329
350
  }, payload);
330
351
 
@@ -337,30 +358,27 @@ const accountUpdatePassword = async ({ password, oldPassword, parseOutput = true
337
358
  }
338
359
 
339
360
  /**
340
- * @typedef {Object} AccountUpdatePhoneRequestParams
341
- * @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
342
- * @property {string} password User password. Must be at least 8 chars.
361
+ * @typedef {Object} AccountUpdateMfaAuthenticatorRequestParams
362
+ * @property {AuthenticatorType} type Type of authenticator.
363
+ * @property {string} otp Valid verification token.
343
364
  * @property {boolean} parseOutput
344
365
  * @property {libClient | undefined} sdk
345
366
  */
346
367
 
347
368
  /**
348
- * @param {AccountUpdatePhoneRequestParams} params
369
+ * @param {AccountUpdateMfaAuthenticatorRequestParams} params
349
370
  */
350
- const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = undefined}) => {
371
+ const accountUpdateMfaAuthenticator = async ({ type, otp, parseOutput = true, sdk = undefined}) => {
351
372
  let client = !sdk ? await sdkForProject() : sdk;
352
- let apiPath = '/account/phone';
373
+ let apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
353
374
  let payload = {};
354
- if (typeof phone !== 'undefined') {
355
- payload['phone'] = phone;
356
- }
357
- if (typeof password !== 'undefined') {
358
- payload['password'] = password;
375
+ if (typeof otp !== 'undefined') {
376
+ payload['otp'] = otp;
359
377
  }
360
378
 
361
379
  let response = undefined;
362
380
 
363
- response = await client.call('patch', apiPath, {
381
+ response = await client.call('put', apiPath, {
364
382
  'content-type': 'application/json',
365
383
  }, payload);
366
384
 
@@ -373,22 +391,27 @@ const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = u
373
391
  }
374
392
 
375
393
  /**
376
- * @typedef {Object} AccountGetPrefsRequestParams
394
+ * @typedef {Object} AccountDeleteMfaAuthenticatorRequestParams
395
+ * @property {AuthenticatorType} type Type of authenticator.
396
+ * @property {string} otp Valid verification token.
377
397
  * @property {boolean} parseOutput
378
398
  * @property {libClient | undefined} sdk
379
399
  */
380
400
 
381
401
  /**
382
- * @param {AccountGetPrefsRequestParams} params
402
+ * @param {AccountDeleteMfaAuthenticatorRequestParams} params
383
403
  */
384
- const accountGetPrefs = async ({ parseOutput = true, sdk = undefined}) => {
404
+ const accountDeleteMfaAuthenticator = async ({ type, otp, parseOutput = true, sdk = undefined}) => {
385
405
  let client = !sdk ? await sdkForProject() : sdk;
386
- let apiPath = '/account/prefs';
406
+ let apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
387
407
  let payload = {};
408
+ if (typeof otp !== 'undefined') {
409
+ payload['otp'] = otp;
410
+ }
388
411
 
389
412
  let response = undefined;
390
413
 
391
- response = await client.call('get', apiPath, {
414
+ response = await client.call('delete', apiPath, {
392
415
  'content-type': 'application/json',
393
416
  }, payload);
394
417
 
@@ -401,26 +424,26 @@ const accountGetPrefs = async ({ parseOutput = true, sdk = undefined}) => {
401
424
  }
402
425
 
403
426
  /**
404
- * @typedef {Object} AccountUpdatePrefsRequestParams
405
- * @property {object} prefs Prefs key-value JSON object.
427
+ * @typedef {Object} AccountCreateMfaChallengeRequestParams
428
+ * @property {AuthenticationFactor} factor Factor used for verification. Must be one of following: 'email', 'phone', 'totp', 'recoveryCode'.
406
429
  * @property {boolean} parseOutput
407
430
  * @property {libClient | undefined} sdk
408
431
  */
409
432
 
410
433
  /**
411
- * @param {AccountUpdatePrefsRequestParams} params
434
+ * @param {AccountCreateMfaChallengeRequestParams} params
412
435
  */
413
- const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined}) => {
436
+ const accountCreateMfaChallenge = async ({ factor, parseOutput = true, sdk = undefined}) => {
414
437
  let client = !sdk ? await sdkForProject() : sdk;
415
- let apiPath = '/account/prefs';
438
+ let apiPath = '/account/mfa/challenge';
416
439
  let payload = {};
417
- if (typeof prefs !== 'undefined') {
418
- payload['prefs'] = JSON.parse(prefs);
440
+ if (typeof factor !== 'undefined') {
441
+ payload['factor'] = factor;
419
442
  }
420
443
 
421
444
  let response = undefined;
422
445
 
423
- response = await client.call('patch', apiPath, {
446
+ response = await client.call('post', apiPath, {
424
447
  'content-type': 'application/json',
425
448
  }, payload);
426
449
 
@@ -433,30 +456,30 @@ const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined})
433
456
  }
434
457
 
435
458
  /**
436
- * @typedef {Object} AccountCreateRecoveryRequestParams
437
- * @property {string} email User email.
438
- * @property {string} url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
459
+ * @typedef {Object} AccountUpdateMfaChallengeRequestParams
460
+ * @property {string} challengeId ID of the challenge.
461
+ * @property {string} otp Valid verification token.
439
462
  * @property {boolean} parseOutput
440
463
  * @property {libClient | undefined} sdk
441
464
  */
442
465
 
443
466
  /**
444
- * @param {AccountCreateRecoveryRequestParams} params
467
+ * @param {AccountUpdateMfaChallengeRequestParams} params
445
468
  */
446
- const accountCreateRecovery = async ({ email, url, parseOutput = true, sdk = undefined}) => {
469
+ const accountUpdateMfaChallenge = async ({ challengeId, otp, parseOutput = true, sdk = undefined}) => {
447
470
  let client = !sdk ? await sdkForProject() : sdk;
448
- let apiPath = '/account/recovery';
471
+ let apiPath = '/account/mfa/challenge';
449
472
  let payload = {};
450
- if (typeof email !== 'undefined') {
451
- payload['email'] = email;
473
+ if (typeof challengeId !== 'undefined') {
474
+ payload['challengeId'] = challengeId;
452
475
  }
453
- if (typeof url !== 'undefined') {
454
- payload['url'] = url;
476
+ if (typeof otp !== 'undefined') {
477
+ payload['otp'] = otp;
455
478
  }
456
479
 
457
480
  let response = undefined;
458
481
 
459
- response = await client.call('post', apiPath, {
482
+ response = await client.call('put', apiPath, {
460
483
  'content-type': 'application/json',
461
484
  }, payload);
462
485
 
@@ -469,38 +492,22 @@ const accountCreateRecovery = async ({ email, url, parseOutput = true, sdk = und
469
492
  }
470
493
 
471
494
  /**
472
- * @typedef {Object} AccountUpdateRecoveryRequestParams
473
- * @property {string} userId User ID.
474
- * @property {string} secret Valid reset token.
475
- * @property {string} password New user password. Must be at least 8 chars.
476
- * @property {string} passwordAgain Repeat new user password. Must be at least 8 chars.
495
+ * @typedef {Object} AccountListMfaFactorsRequestParams
477
496
  * @property {boolean} parseOutput
478
497
  * @property {libClient | undefined} sdk
479
498
  */
480
499
 
481
500
  /**
482
- * @param {AccountUpdateRecoveryRequestParams} params
501
+ * @param {AccountListMfaFactorsRequestParams} params
483
502
  */
484
- const accountUpdateRecovery = async ({ userId, secret, password, passwordAgain, parseOutput = true, sdk = undefined}) => {
503
+ const accountListMfaFactors = async ({ parseOutput = true, sdk = undefined}) => {
485
504
  let client = !sdk ? await sdkForProject() : sdk;
486
- let apiPath = '/account/recovery';
505
+ let apiPath = '/account/mfa/factors';
487
506
  let payload = {};
488
- if (typeof userId !== 'undefined') {
489
- payload['userId'] = userId;
490
- }
491
- if (typeof secret !== 'undefined') {
492
- payload['secret'] = secret;
493
- }
494
- if (typeof password !== 'undefined') {
495
- payload['password'] = password;
496
- }
497
- if (typeof passwordAgain !== 'undefined') {
498
- payload['passwordAgain'] = passwordAgain;
499
- }
500
507
 
501
508
  let response = undefined;
502
509
 
503
- response = await client.call('put', apiPath, {
510
+ response = await client.call('get', apiPath, {
504
511
  'content-type': 'application/json',
505
512
  }, payload);
506
513
 
@@ -513,17 +520,17 @@ const accountUpdateRecovery = async ({ userId, secret, password, passwordAgain,
513
520
  }
514
521
 
515
522
  /**
516
- * @typedef {Object} AccountListSessionsRequestParams
523
+ * @typedef {Object} AccountGetMfaRecoveryCodesRequestParams
517
524
  * @property {boolean} parseOutput
518
525
  * @property {libClient | undefined} sdk
519
526
  */
520
527
 
521
528
  /**
522
- * @param {AccountListSessionsRequestParams} params
529
+ * @param {AccountGetMfaRecoveryCodesRequestParams} params
523
530
  */
524
- const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
531
+ const accountGetMfaRecoveryCodes = async ({ parseOutput = true, sdk = undefined}) => {
525
532
  let client = !sdk ? await sdkForProject() : sdk;
526
- let apiPath = '/account/sessions';
533
+ let apiPath = '/account/mfa/recovery-codes';
527
534
  let payload = {};
528
535
 
529
536
  let response = undefined;
@@ -541,22 +548,22 @@ const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
541
548
  }
542
549
 
543
550
  /**
544
- * @typedef {Object} AccountDeleteSessionsRequestParams
551
+ * @typedef {Object} AccountCreateMfaRecoveryCodesRequestParams
545
552
  * @property {boolean} parseOutput
546
553
  * @property {libClient | undefined} sdk
547
554
  */
548
555
 
549
556
  /**
550
- * @param {AccountDeleteSessionsRequestParams} params
557
+ * @param {AccountCreateMfaRecoveryCodesRequestParams} params
551
558
  */
552
- const accountDeleteSessions = async ({ parseOutput = true, sdk = undefined}) => {
559
+ const accountCreateMfaRecoveryCodes = async ({ parseOutput = true, sdk = undefined}) => {
553
560
  let client = !sdk ? await sdkForProject() : sdk;
554
- let apiPath = '/account/sessions';
561
+ let apiPath = '/account/mfa/recovery-codes';
555
562
  let payload = {};
556
563
 
557
564
  let response = undefined;
558
565
 
559
- response = await client.call('delete', apiPath, {
566
+ response = await client.call('post', apiPath, {
560
567
  'content-type': 'application/json',
561
568
  }, payload);
562
569
 
@@ -569,22 +576,22 @@ const accountDeleteSessions = async ({ parseOutput = true, sdk = undefined}) =>
569
576
  }
570
577
 
571
578
  /**
572
- * @typedef {Object} AccountCreateAnonymousSessionRequestParams
579
+ * @typedef {Object} AccountUpdateMfaRecoveryCodesRequestParams
573
580
  * @property {boolean} parseOutput
574
581
  * @property {libClient | undefined} sdk
575
582
  */
576
583
 
577
584
  /**
578
- * @param {AccountCreateAnonymousSessionRequestParams} params
585
+ * @param {AccountUpdateMfaRecoveryCodesRequestParams} params
579
586
  */
580
- const accountCreateAnonymousSession = async ({ parseOutput = true, sdk = undefined}) => {
587
+ const accountUpdateMfaRecoveryCodes = async ({ parseOutput = true, sdk = undefined}) => {
581
588
  let client = !sdk ? await sdkForProject() : sdk;
582
- let apiPath = '/account/sessions/anonymous';
589
+ let apiPath = '/account/mfa/recovery-codes';
583
590
  let payload = {};
584
591
 
585
592
  let response = undefined;
586
593
 
587
- response = await client.call('post', apiPath, {
594
+ response = await client.call('patch', apiPath, {
588
595
  'content-type': 'application/json',
589
596
  }, payload);
590
597
 
@@ -597,30 +604,26 @@ const accountCreateAnonymousSession = async ({ parseOutput = true, sdk = undefin
597
604
  }
598
605
 
599
606
  /**
600
- * @typedef {Object} AccountCreateEmailSessionRequestParams
601
- * @property {string} email User email.
602
- * @property {string} password User password. Must be at least 8 chars.
607
+ * @typedef {Object} AccountUpdateNameRequestParams
608
+ * @property {string} name User name. Max length: 128 chars.
603
609
  * @property {boolean} parseOutput
604
610
  * @property {libClient | undefined} sdk
605
611
  */
606
612
 
607
613
  /**
608
- * @param {AccountCreateEmailSessionRequestParams} params
614
+ * @param {AccountUpdateNameRequestParams} params
609
615
  */
610
- const accountCreateEmailSession = async ({ email, password, parseOutput = true, sdk = undefined}) => {
616
+ const accountUpdateName = async ({ name, parseOutput = true, sdk = undefined}) => {
611
617
  let client = !sdk ? await sdkForProject() : sdk;
612
- let apiPath = '/account/sessions/email';
618
+ let apiPath = '/account/name';
613
619
  let payload = {};
614
- if (typeof email !== 'undefined') {
615
- payload['email'] = email;
616
- }
617
- if (typeof password !== 'undefined') {
618
- payload['password'] = password;
620
+ if (typeof name !== 'undefined') {
621
+ payload['name'] = name;
619
622
  }
620
623
 
621
624
  let response = undefined;
622
625
 
623
- response = await client.call('post', apiPath, {
626
+ response = await client.call('patch', apiPath, {
624
627
  'content-type': 'application/json',
625
628
  }, payload);
626
629
 
@@ -633,34 +636,30 @@ const accountCreateEmailSession = async ({ email, password, parseOutput = true,
633
636
  }
634
637
 
635
638
  /**
636
- * @typedef {Object} AccountCreateMagicURLSessionRequestParams
637
- * @property {string} userId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
638
- * @property {string} email User email.
639
- * @property {string} url URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
639
+ * @typedef {Object} AccountUpdatePasswordRequestParams
640
+ * @property {string} password New user password. Must be at least 8 chars.
641
+ * @property {string} oldPassword Current user password. Must be at least 8 chars.
640
642
  * @property {boolean} parseOutput
641
643
  * @property {libClient | undefined} sdk
642
644
  */
643
645
 
644
646
  /**
645
- * @param {AccountCreateMagicURLSessionRequestParams} params
647
+ * @param {AccountUpdatePasswordRequestParams} params
646
648
  */
647
- const accountCreateMagicURLSession = async ({ userId, email, url, parseOutput = true, sdk = undefined}) => {
649
+ const accountUpdatePassword = async ({ password, oldPassword, parseOutput = true, sdk = undefined}) => {
648
650
  let client = !sdk ? await sdkForProject() : sdk;
649
- let apiPath = '/account/sessions/magic-url';
651
+ let apiPath = '/account/password';
650
652
  let payload = {};
651
- if (typeof userId !== 'undefined') {
652
- payload['userId'] = userId;
653
- }
654
- if (typeof email !== 'undefined') {
655
- payload['email'] = email;
653
+ if (typeof password !== 'undefined') {
654
+ payload['password'] = password;
656
655
  }
657
- if (typeof url !== 'undefined') {
658
- payload['url'] = url;
656
+ if (typeof oldPassword !== 'undefined') {
657
+ payload['oldPassword'] = oldPassword;
659
658
  }
660
659
 
661
660
  let response = undefined;
662
661
 
663
- response = await client.call('post', apiPath, {
662
+ response = await client.call('patch', apiPath, {
664
663
  'content-type': 'application/json',
665
664
  }, payload);
666
665
 
@@ -673,30 +672,30 @@ const accountCreateMagicURLSession = async ({ userId, email, url, parseOutput =
673
672
  }
674
673
 
675
674
  /**
676
- * @typedef {Object} AccountUpdateMagicURLSessionRequestParams
677
- * @property {string} userId User ID.
678
- * @property {string} secret Valid verification token.
675
+ * @typedef {Object} AccountUpdatePhoneRequestParams
676
+ * @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
677
+ * @property {string} password User password. Must be at least 8 chars.
679
678
  * @property {boolean} parseOutput
680
679
  * @property {libClient | undefined} sdk
681
680
  */
682
681
 
683
682
  /**
684
- * @param {AccountUpdateMagicURLSessionRequestParams} params
683
+ * @param {AccountUpdatePhoneRequestParams} params
685
684
  */
686
- const accountUpdateMagicURLSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
685
+ const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = undefined}) => {
687
686
  let client = !sdk ? await sdkForProject() : sdk;
688
- let apiPath = '/account/sessions/magic-url';
687
+ let apiPath = '/account/phone';
689
688
  let payload = {};
690
- if (typeof userId !== 'undefined') {
691
- payload['userId'] = userId;
689
+ if (typeof phone !== 'undefined') {
690
+ payload['phone'] = phone;
692
691
  }
693
- if (typeof secret !== 'undefined') {
694
- payload['secret'] = secret;
692
+ if (typeof password !== 'undefined') {
693
+ payload['password'] = password;
695
694
  }
696
695
 
697
696
  let response = undefined;
698
697
 
699
- response = await client.call('put', apiPath, {
698
+ response = await client.call('patch', apiPath, {
700
699
  'content-type': 'application/json',
701
700
  }, payload);
702
701
 
@@ -709,31 +708,18 @@ const accountUpdateMagicURLSession = async ({ userId, secret, parseOutput = true
709
708
  }
710
709
 
711
710
  /**
712
- * @typedef {Object} AccountCreateOAuth2SessionRequestParams
713
- * @property {string} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom.
714
- * @property {string} success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
715
- * @property {string} failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
716
- * @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
711
+ * @typedef {Object} AccountGetPrefsRequestParams
717
712
  * @property {boolean} parseOutput
718
713
  * @property {libClient | undefined} sdk
719
714
  */
720
715
 
721
716
  /**
722
- * @param {AccountCreateOAuth2SessionRequestParams} params
717
+ * @param {AccountGetPrefsRequestParams} params
723
718
  */
724
- const accountCreateOAuth2Session = async ({ provider, success, failure, scopes, parseOutput = true, sdk = undefined}) => {
719
+ const accountGetPrefs = async ({ parseOutput = true, sdk = undefined}) => {
725
720
  let client = !sdk ? await sdkForProject() : sdk;
726
- let apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
721
+ let apiPath = '/account/prefs';
727
722
  let payload = {};
728
- if (typeof success !== 'undefined') {
729
- payload['success'] = success;
730
- }
731
- if (typeof failure !== 'undefined') {
732
- payload['failure'] = failure;
733
- }
734
- if (typeof scopes !== 'undefined') {
735
- payload['scopes'] = scopes;
736
- }
737
723
 
738
724
  let response = undefined;
739
725
 
@@ -750,30 +736,26 @@ const accountCreateOAuth2Session = async ({ provider, success, failure, scopes,
750
736
  }
751
737
 
752
738
  /**
753
- * @typedef {Object} AccountCreatePhoneSessionRequestParams
754
- * @property {string} userId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
755
- * @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
739
+ * @typedef {Object} AccountUpdatePrefsRequestParams
740
+ * @property {object} prefs Prefs key-value JSON object.
756
741
  * @property {boolean} parseOutput
757
742
  * @property {libClient | undefined} sdk
758
743
  */
759
744
 
760
745
  /**
761
- * @param {AccountCreatePhoneSessionRequestParams} params
746
+ * @param {AccountUpdatePrefsRequestParams} params
762
747
  */
763
- const accountCreatePhoneSession = async ({ userId, phone, parseOutput = true, sdk = undefined}) => {
748
+ const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined}) => {
764
749
  let client = !sdk ? await sdkForProject() : sdk;
765
- let apiPath = '/account/sessions/phone';
750
+ let apiPath = '/account/prefs';
766
751
  let payload = {};
767
- if (typeof userId !== 'undefined') {
768
- payload['userId'] = userId;
769
- }
770
- if (typeof phone !== 'undefined') {
771
- payload['phone'] = phone;
752
+ if (typeof prefs !== 'undefined') {
753
+ payload['prefs'] = JSON.parse(prefs);
772
754
  }
773
755
 
774
756
  let response = undefined;
775
757
 
776
- response = await client.call('post', apiPath, {
758
+ response = await client.call('patch', apiPath, {
777
759
  'content-type': 'application/json',
778
760
  }, payload);
779
761
 
@@ -786,30 +768,30 @@ const accountCreatePhoneSession = async ({ userId, phone, parseOutput = true, sd
786
768
  }
787
769
 
788
770
  /**
789
- * @typedef {Object} AccountUpdatePhoneSessionRequestParams
790
- * @property {string} userId User ID.
791
- * @property {string} secret Valid verification token.
771
+ * @typedef {Object} AccountCreateRecoveryRequestParams
772
+ * @property {string} email User email.
773
+ * @property {string} url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
792
774
  * @property {boolean} parseOutput
793
775
  * @property {libClient | undefined} sdk
794
776
  */
795
777
 
796
778
  /**
797
- * @param {AccountUpdatePhoneSessionRequestParams} params
779
+ * @param {AccountCreateRecoveryRequestParams} params
798
780
  */
799
- const accountUpdatePhoneSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
781
+ const accountCreateRecovery = async ({ email, url, parseOutput = true, sdk = undefined}) => {
800
782
  let client = !sdk ? await sdkForProject() : sdk;
801
- let apiPath = '/account/sessions/phone';
783
+ let apiPath = '/account/recovery';
802
784
  let payload = {};
803
- if (typeof userId !== 'undefined') {
804
- payload['userId'] = userId;
785
+ if (typeof email !== 'undefined') {
786
+ payload['email'] = email;
805
787
  }
806
- if (typeof secret !== 'undefined') {
807
- payload['secret'] = secret;
788
+ if (typeof url !== 'undefined') {
789
+ payload['url'] = url;
808
790
  }
809
791
 
810
792
  let response = undefined;
811
793
 
812
- response = await client.call('put', apiPath, {
794
+ response = await client.call('post', apiPath, {
813
795
  'content-type': 'application/json',
814
796
  }, payload);
815
797
 
@@ -822,23 +804,390 @@ const accountUpdatePhoneSession = async ({ userId, secret, parseOutput = true, s
822
804
  }
823
805
 
824
806
  /**
825
- * @typedef {Object} AccountGetSessionRequestParams
826
- * @property {string} sessionId Session ID. Use the string 'current' to get the current device session.
807
+ * @typedef {Object} AccountUpdateRecoveryRequestParams
808
+ * @property {string} userId User ID.
809
+ * @property {string} secret Valid reset token.
810
+ * @property {string} password New user password. Must be between 8 and 256 chars.
827
811
  * @property {boolean} parseOutput
828
812
  * @property {libClient | undefined} sdk
829
813
  */
830
814
 
831
815
  /**
832
- * @param {AccountGetSessionRequestParams} params
816
+ * @param {AccountUpdateRecoveryRequestParams} params
833
817
  */
834
- const accountGetSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
818
+ const accountUpdateRecovery = async ({ userId, secret, password, parseOutput = true, sdk = undefined}) => {
835
819
  let client = !sdk ? await sdkForProject() : sdk;
836
- let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
820
+ let apiPath = '/account/recovery';
821
+ let payload = {};
822
+ if (typeof userId !== 'undefined') {
823
+ payload['userId'] = userId;
824
+ }
825
+ if (typeof secret !== 'undefined') {
826
+ payload['secret'] = secret;
827
+ }
828
+ if (typeof password !== 'undefined') {
829
+ payload['password'] = password;
830
+ }
831
+
832
+ let response = undefined;
833
+
834
+ response = await client.call('put', apiPath, {
835
+ 'content-type': 'application/json',
836
+ }, payload);
837
+
838
+ if (parseOutput) {
839
+ parse(response)
840
+ success()
841
+ }
842
+
843
+ return response;
844
+ }
845
+
846
+ /**
847
+ * @typedef {Object} AccountListSessionsRequestParams
848
+ * @property {boolean} parseOutput
849
+ * @property {libClient | undefined} sdk
850
+ */
851
+
852
+ /**
853
+ * @param {AccountListSessionsRequestParams} params
854
+ */
855
+ const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
856
+ let client = !sdk ? await sdkForProject() : sdk;
857
+ let apiPath = '/account/sessions';
858
+ let payload = {};
859
+
860
+ let response = undefined;
861
+
862
+ response = await client.call('get', apiPath, {
863
+ 'content-type': 'application/json',
864
+ }, payload);
865
+
866
+ if (parseOutput) {
867
+ parse(response)
868
+ success()
869
+ }
870
+
871
+ return response;
872
+ }
873
+
874
+ /**
875
+ * @typedef {Object} AccountDeleteSessionsRequestParams
876
+ * @property {boolean} parseOutput
877
+ * @property {libClient | undefined} sdk
878
+ */
879
+
880
+ /**
881
+ * @param {AccountDeleteSessionsRequestParams} params
882
+ */
883
+ const accountDeleteSessions = async ({ parseOutput = true, sdk = undefined}) => {
884
+ let client = !sdk ? await sdkForProject() : sdk;
885
+ let apiPath = '/account/sessions';
886
+ let payload = {};
887
+
888
+ let response = undefined;
889
+
890
+ response = await client.call('delete', apiPath, {
891
+ 'content-type': 'application/json',
892
+ }, payload);
893
+
894
+ if (parseOutput) {
895
+ parse(response)
896
+ success()
897
+ }
898
+
899
+ return response;
900
+ }
901
+
902
+ /**
903
+ * @typedef {Object} AccountCreateAnonymousSessionRequestParams
904
+ * @property {boolean} parseOutput
905
+ * @property {libClient | undefined} sdk
906
+ */
907
+
908
+ /**
909
+ * @param {AccountCreateAnonymousSessionRequestParams} params
910
+ */
911
+ const accountCreateAnonymousSession = async ({ parseOutput = true, sdk = undefined}) => {
912
+ let client = !sdk ? await sdkForProject() : sdk;
913
+ let apiPath = '/account/sessions/anonymous';
914
+ let payload = {};
915
+
916
+ let response = undefined;
917
+
918
+ response = await client.call('post', apiPath, {
919
+ 'content-type': 'application/json',
920
+ }, payload);
921
+
922
+ if (parseOutput) {
923
+ parse(response)
924
+ success()
925
+ }
926
+
927
+ return response;
928
+ }
929
+
930
+ /**
931
+ * @typedef {Object} AccountCreateEmailPasswordSessionRequestParams
932
+ * @property {string} email User email.
933
+ * @property {string} password User password. Must be at least 8 chars.
934
+ * @property {boolean} parseOutput
935
+ * @property {libClient | undefined} sdk
936
+ */
937
+
938
+ /**
939
+ * @param {AccountCreateEmailPasswordSessionRequestParams} params
940
+ */
941
+ const accountCreateEmailPasswordSession = async ({ email, password, parseOutput = true, sdk = undefined}) => {
942
+ let client = !sdk ? await sdkForProject() : sdk;
943
+ let apiPath = '/account/sessions/email';
944
+ let payload = {};
945
+ if (typeof email !== 'undefined') {
946
+ payload['email'] = email;
947
+ }
948
+ if (typeof password !== 'undefined') {
949
+ payload['password'] = password;
950
+ }
951
+
952
+ let response = undefined;
953
+
954
+ response = await client.call('post', apiPath, {
955
+ 'content-type': 'application/json',
956
+ }, payload);
957
+
958
+ if (parseOutput) {
959
+ parse(response)
960
+ success()
961
+ }
962
+
963
+ return response;
964
+ }
965
+
966
+ /**
967
+ * @typedef {Object} AccountUpdateMagicURLSessionRequestParams
968
+ * @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.
969
+ * @property {string} secret Valid verification token.
970
+ * @property {boolean} parseOutput
971
+ * @property {libClient | undefined} sdk
972
+ */
973
+
974
+ /**
975
+ * @param {AccountUpdateMagicURLSessionRequestParams} params
976
+ */
977
+ const accountUpdateMagicURLSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
978
+ let client = !sdk ? await sdkForProject() : sdk;
979
+ let apiPath = '/account/sessions/magic-url';
980
+ let payload = {};
981
+ if (typeof userId !== 'undefined') {
982
+ payload['userId'] = userId;
983
+ }
984
+ if (typeof secret !== 'undefined') {
985
+ payload['secret'] = secret;
986
+ }
987
+
988
+ let response = undefined;
989
+
990
+ response = await client.call('put', apiPath, {
991
+ 'content-type': 'application/json',
992
+ }, payload);
993
+
994
+ if (parseOutput) {
995
+ parse(response)
996
+ success()
997
+ }
998
+
999
+ return response;
1000
+ }
1001
+
1002
+ /**
1003
+ * @typedef {Object} AccountCreateOAuth2SessionRequestParams
1004
+ * @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
1005
+ * @property {string} success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1006
+ * @property {string} failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1007
+ * @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
1008
+ * @property {boolean} parseOutput
1009
+ * @property {libClient | undefined} sdk
1010
+ */
1011
+
1012
+ /**
1013
+ * @param {AccountCreateOAuth2SessionRequestParams} params
1014
+ */
1015
+ const accountCreateOAuth2Session = async ({ provider, success, failure, scopes, parseOutput = true, sdk = undefined}) => {
1016
+ let client = !sdk ? await sdkForProject() : sdk;
1017
+ let apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
1018
+ let payload = {};
1019
+ if (typeof success !== 'undefined') {
1020
+ payload['success'] = success;
1021
+ }
1022
+ if (typeof failure !== 'undefined') {
1023
+ payload['failure'] = failure;
1024
+ }
1025
+ if (typeof scopes !== 'undefined') {
1026
+ payload['scopes'] = scopes;
1027
+ }
1028
+
1029
+ let response = undefined;
1030
+
1031
+ response = await client.call('get', apiPath, {
1032
+ 'content-type': 'application/json',
1033
+ }, payload);
1034
+
1035
+ if (parseOutput) {
1036
+ parse(response)
1037
+ success()
1038
+ }
1039
+
1040
+ return response;
1041
+ }
1042
+
1043
+ /**
1044
+ * @typedef {Object} AccountUpdatePhoneSessionRequestParams
1045
+ * @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.
1046
+ * @property {string} secret Valid verification token.
1047
+ * @property {boolean} parseOutput
1048
+ * @property {libClient | undefined} sdk
1049
+ */
1050
+
1051
+ /**
1052
+ * @param {AccountUpdatePhoneSessionRequestParams} params
1053
+ */
1054
+ const accountUpdatePhoneSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
1055
+ let client = !sdk ? await sdkForProject() : sdk;
1056
+ let apiPath = '/account/sessions/phone';
1057
+ let payload = {};
1058
+ if (typeof userId !== 'undefined') {
1059
+ payload['userId'] = userId;
1060
+ }
1061
+ if (typeof secret !== 'undefined') {
1062
+ payload['secret'] = secret;
1063
+ }
1064
+
1065
+ let response = undefined;
1066
+
1067
+ response = await client.call('put', apiPath, {
1068
+ 'content-type': 'application/json',
1069
+ }, payload);
1070
+
1071
+ if (parseOutput) {
1072
+ parse(response)
1073
+ success()
1074
+ }
1075
+
1076
+ return response;
1077
+ }
1078
+
1079
+ /**
1080
+ * @typedef {Object} AccountCreateSessionRequestParams
1081
+ * @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.
1082
+ * @property {string} secret Secret of a token generated by login methods. For example, the 'createMagicURLToken' or 'createPhoneToken' methods.
1083
+ * @property {boolean} parseOutput
1084
+ * @property {libClient | undefined} sdk
1085
+ */
1086
+
1087
+ /**
1088
+ * @param {AccountCreateSessionRequestParams} params
1089
+ */
1090
+ const accountCreateSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
1091
+ let client = !sdk ? await sdkForProject() : sdk;
1092
+ let apiPath = '/account/sessions/token';
1093
+ let payload = {};
1094
+ if (typeof userId !== 'undefined') {
1095
+ payload['userId'] = userId;
1096
+ }
1097
+ if (typeof secret !== 'undefined') {
1098
+ payload['secret'] = secret;
1099
+ }
1100
+
1101
+ let response = undefined;
1102
+
1103
+ response = await client.call('post', apiPath, {
1104
+ 'content-type': 'application/json',
1105
+ }, payload);
1106
+
1107
+ if (parseOutput) {
1108
+ parse(response)
1109
+ success()
1110
+ }
1111
+
1112
+ return response;
1113
+ }
1114
+
1115
+ /**
1116
+ * @typedef {Object} AccountGetSessionRequestParams
1117
+ * @property {string} sessionId Session ID. Use the string 'current' to get the current device session.
1118
+ * @property {boolean} parseOutput
1119
+ * @property {libClient | undefined} sdk
1120
+ */
1121
+
1122
+ /**
1123
+ * @param {AccountGetSessionRequestParams} params
1124
+ */
1125
+ const accountGetSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
1126
+ let client = !sdk ? await sdkForProject() : sdk;
1127
+ let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1128
+ let payload = {};
1129
+
1130
+ let response = undefined;
1131
+
1132
+ response = await client.call('get', apiPath, {
1133
+ 'content-type': 'application/json',
1134
+ }, payload);
1135
+
1136
+ if (parseOutput) {
1137
+ parse(response)
1138
+ success()
1139
+ }
1140
+
1141
+ return response;
1142
+ }
1143
+
1144
+ /**
1145
+ * @typedef {Object} AccountUpdateSessionRequestParams
1146
+ * @property {string} sessionId Session ID. Use the string 'current' to update the current device session.
1147
+ * @property {boolean} parseOutput
1148
+ * @property {libClient | undefined} sdk
1149
+ */
1150
+
1151
+ /**
1152
+ * @param {AccountUpdateSessionRequestParams} params
1153
+ */
1154
+ const accountUpdateSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
1155
+ let client = !sdk ? await sdkForProject() : sdk;
1156
+ let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1157
+ let payload = {};
1158
+
1159
+ let response = undefined;
1160
+
1161
+ response = await client.call('patch', apiPath, {
1162
+ 'content-type': 'application/json',
1163
+ }, payload);
1164
+
1165
+ if (parseOutput) {
1166
+ parse(response)
1167
+ success()
1168
+ }
1169
+
1170
+ return response;
1171
+ }
1172
+
1173
+ /**
1174
+ * @typedef {Object} AccountDeleteSessionRequestParams
1175
+ * @property {string} sessionId Session ID. Use the string 'current' to delete the current device session.
1176
+ * @property {boolean} parseOutput
1177
+ * @property {libClient | undefined} sdk
1178
+ */
1179
+
1180
+ /**
1181
+ * @param {AccountDeleteSessionRequestParams} params
1182
+ */
1183
+ const accountDeleteSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
1184
+ let client = !sdk ? await sdkForProject() : sdk;
1185
+ let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
837
1186
  let payload = {};
838
1187
 
839
- let response = undefined;
840
-
841
- response = await client.call('get', apiPath, {
1188
+ let response = undefined;
1189
+
1190
+ response = await client.call('delete', apiPath, {
842
1191
  'content-type': 'application/json',
843
1192
  }, payload);
844
1193
 
@@ -851,18 +1200,17 @@ const accountGetSession = async ({ sessionId, parseOutput = true, sdk = undefine
851
1200
  }
852
1201
 
853
1202
  /**
854
- * @typedef {Object} AccountUpdateSessionRequestParams
855
- * @property {string} sessionId Session ID. Use the string 'current' to update the current device session.
1203
+ * @typedef {Object} AccountUpdateStatusRequestParams
856
1204
  * @property {boolean} parseOutput
857
1205
  * @property {libClient | undefined} sdk
858
1206
  */
859
1207
 
860
1208
  /**
861
- * @param {AccountUpdateSessionRequestParams} params
1209
+ * @param {AccountUpdateStatusRequestParams} params
862
1210
  */
863
- const accountUpdateSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
1211
+ const accountUpdateStatus = async ({ parseOutput = true, sdk = undefined}) => {
864
1212
  let client = !sdk ? await sdkForProject() : sdk;
865
- let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1213
+ let apiPath = '/account/status';
866
1214
  let payload = {};
867
1215
 
868
1216
  let response = undefined;
@@ -880,18 +1228,91 @@ const accountUpdateSession = async ({ sessionId, parseOutput = true, sdk = undef
880
1228
  }
881
1229
 
882
1230
  /**
883
- * @typedef {Object} AccountDeleteSessionRequestParams
884
- * @property {string} sessionId Session ID. Use the string 'current' to delete the current device session.
1231
+ * @typedef {Object} AccountCreatePushTargetRequestParams
1232
+ * @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.
1233
+ * @property {string} identifier The target identifier (token, email, phone etc.)
1234
+ * @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.
885
1235
  * @property {boolean} parseOutput
886
1236
  * @property {libClient | undefined} sdk
887
1237
  */
888
1238
 
889
1239
  /**
890
- * @param {AccountDeleteSessionRequestParams} params
1240
+ * @param {AccountCreatePushTargetRequestParams} params
891
1241
  */
892
- const accountDeleteSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
1242
+ const accountCreatePushTarget = async ({ targetId, identifier, providerId, parseOutput = true, sdk = undefined}) => {
893
1243
  let client = !sdk ? await sdkForProject() : sdk;
894
- let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1244
+ let apiPath = '/account/targets/push';
1245
+ let payload = {};
1246
+ if (typeof targetId !== 'undefined') {
1247
+ payload['targetId'] = targetId;
1248
+ }
1249
+ if (typeof identifier !== 'undefined') {
1250
+ payload['identifier'] = identifier;
1251
+ }
1252
+ if (typeof providerId !== 'undefined') {
1253
+ payload['providerId'] = providerId;
1254
+ }
1255
+
1256
+ let response = undefined;
1257
+
1258
+ response = await client.call('post', apiPath, {
1259
+ 'content-type': 'application/json',
1260
+ }, payload);
1261
+
1262
+ if (parseOutput) {
1263
+ parse(response)
1264
+ success()
1265
+ }
1266
+
1267
+ return response;
1268
+ }
1269
+
1270
+ /**
1271
+ * @typedef {Object} AccountUpdatePushTargetRequestParams
1272
+ * @property {string} targetId Target ID.
1273
+ * @property {string} identifier The target identifier (token, email, phone etc.)
1274
+ * @property {boolean} parseOutput
1275
+ * @property {libClient | undefined} sdk
1276
+ */
1277
+
1278
+ /**
1279
+ * @param {AccountUpdatePushTargetRequestParams} params
1280
+ */
1281
+ const accountUpdatePushTarget = async ({ targetId, identifier, parseOutput = true, sdk = undefined}) => {
1282
+ let client = !sdk ? await sdkForProject() : sdk;
1283
+ let apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
1284
+ let payload = {};
1285
+ if (typeof identifier !== 'undefined') {
1286
+ payload['identifier'] = identifier;
1287
+ }
1288
+
1289
+ let response = undefined;
1290
+
1291
+ response = await client.call('put', apiPath, {
1292
+ 'content-type': 'application/json',
1293
+ }, payload);
1294
+
1295
+ if (parseOutput) {
1296
+ parse(response)
1297
+ success()
1298
+ }
1299
+
1300
+ return response;
1301
+ }
1302
+
1303
+ /**
1304
+ * @typedef {Object} AccountDeletePushTargetRequestParams
1305
+ * @property {string} targetId Target ID.
1306
+ * @property {boolean} parseOutput
1307
+ * @property {libClient | undefined} sdk
1308
+ */
1309
+
1310
+ /**
1311
+ * @param {AccountDeletePushTargetRequestParams} params
1312
+ */
1313
+ const accountDeletePushTarget = async ({ targetId, parseOutput = true, sdk = undefined}) => {
1314
+ let client = !sdk ? await sdkForProject() : sdk;
1315
+ let apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
895
1316
  let payload = {};
896
1317
 
897
1318
  let response = undefined;
@@ -909,22 +1330,155 @@ const accountDeleteSession = async ({ sessionId, parseOutput = true, sdk = undef
909
1330
  }
910
1331
 
911
1332
  /**
912
- * @typedef {Object} AccountUpdateStatusRequestParams
1333
+ * @typedef {Object} AccountCreateEmailTokenRequestParams
1334
+ * @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.
1335
+ * @property {string} email User email.
1336
+ * @property {boolean} phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
913
1337
  * @property {boolean} parseOutput
914
1338
  * @property {libClient | undefined} sdk
915
1339
  */
916
1340
 
917
1341
  /**
918
- * @param {AccountUpdateStatusRequestParams} params
1342
+ * @param {AccountCreateEmailTokenRequestParams} params
919
1343
  */
920
- const accountUpdateStatus = async ({ parseOutput = true, sdk = undefined}) => {
1344
+ const accountCreateEmailToken = async ({ userId, email, phrase, parseOutput = true, sdk = undefined}) => {
921
1345
  let client = !sdk ? await sdkForProject() : sdk;
922
- let apiPath = '/account/status';
1346
+ let apiPath = '/account/tokens/email';
923
1347
  let payload = {};
1348
+ if (typeof userId !== 'undefined') {
1349
+ payload['userId'] = userId;
1350
+ }
1351
+ if (typeof email !== 'undefined') {
1352
+ payload['email'] = email;
1353
+ }
1354
+ if (typeof phrase !== 'undefined') {
1355
+ payload['phrase'] = phrase;
1356
+ }
924
1357
 
925
1358
  let response = undefined;
926
1359
 
927
- response = await client.call('patch', apiPath, {
1360
+ response = await client.call('post', apiPath, {
1361
+ 'content-type': 'application/json',
1362
+ }, payload);
1363
+
1364
+ if (parseOutput) {
1365
+ parse(response)
1366
+ success()
1367
+ }
1368
+
1369
+ return response;
1370
+ }
1371
+
1372
+ /**
1373
+ * @typedef {Object} AccountCreateMagicURLTokenRequestParams
1374
+ * @property {string} userId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1375
+ * @property {string} email User email.
1376
+ * @property {string} url URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1377
+ * @property {boolean} phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
1378
+ * @property {boolean} parseOutput
1379
+ * @property {libClient | undefined} sdk
1380
+ */
1381
+
1382
+ /**
1383
+ * @param {AccountCreateMagicURLTokenRequestParams} params
1384
+ */
1385
+ const accountCreateMagicURLToken = async ({ userId, email, url, phrase, parseOutput = true, sdk = undefined}) => {
1386
+ let client = !sdk ? await sdkForProject() : sdk;
1387
+ let apiPath = '/account/tokens/magic-url';
1388
+ let payload = {};
1389
+ if (typeof userId !== 'undefined') {
1390
+ payload['userId'] = userId;
1391
+ }
1392
+ if (typeof email !== 'undefined') {
1393
+ payload['email'] = email;
1394
+ }
1395
+ if (typeof url !== 'undefined') {
1396
+ payload['url'] = url;
1397
+ }
1398
+ if (typeof phrase !== 'undefined') {
1399
+ payload['phrase'] = phrase;
1400
+ }
1401
+
1402
+ let response = undefined;
1403
+
1404
+ response = await client.call('post', apiPath, {
1405
+ 'content-type': 'application/json',
1406
+ }, payload);
1407
+
1408
+ if (parseOutput) {
1409
+ parse(response)
1410
+ success()
1411
+ }
1412
+
1413
+ return response;
1414
+ }
1415
+
1416
+ /**
1417
+ * @typedef {Object} AccountCreateOAuth2TokenRequestParams
1418
+ * @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
1419
+ * @property {string} success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1420
+ * @property {string} failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1421
+ * @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
1422
+ * @property {boolean} parseOutput
1423
+ * @property {libClient | undefined} sdk
1424
+ */
1425
+
1426
+ /**
1427
+ * @param {AccountCreateOAuth2TokenRequestParams} params
1428
+ */
1429
+ const accountCreateOAuth2Token = async ({ provider, success, failure, scopes, parseOutput = true, sdk = undefined}) => {
1430
+ let client = !sdk ? await sdkForProject() : sdk;
1431
+ let apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
1432
+ let payload = {};
1433
+ if (typeof success !== 'undefined') {
1434
+ payload['success'] = success;
1435
+ }
1436
+ if (typeof failure !== 'undefined') {
1437
+ payload['failure'] = failure;
1438
+ }
1439
+ if (typeof scopes !== 'undefined') {
1440
+ payload['scopes'] = scopes;
1441
+ }
1442
+
1443
+ let response = undefined;
1444
+
1445
+ response = await client.call('get', apiPath, {
1446
+ 'content-type': 'application/json',
1447
+ }, payload);
1448
+
1449
+ if (parseOutput) {
1450
+ parse(response)
1451
+ success()
1452
+ }
1453
+
1454
+ return response;
1455
+ }
1456
+
1457
+ /**
1458
+ * @typedef {Object} AccountCreatePhoneTokenRequestParams
1459
+ * @property {string} userId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
1460
+ * @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
1461
+ * @property {boolean} parseOutput
1462
+ * @property {libClient | undefined} sdk
1463
+ */
1464
+
1465
+ /**
1466
+ * @param {AccountCreatePhoneTokenRequestParams} params
1467
+ */
1468
+ const accountCreatePhoneToken = async ({ userId, phone, parseOutput = true, sdk = undefined}) => {
1469
+ let client = !sdk ? await sdkForProject() : sdk;
1470
+ let apiPath = '/account/tokens/phone';
1471
+ let payload = {};
1472
+ if (typeof userId !== 'undefined') {
1473
+ payload['userId'] = userId;
1474
+ }
1475
+ if (typeof phone !== 'undefined') {
1476
+ payload['phone'] = phone;
1477
+ }
1478
+
1479
+ let response = undefined;
1480
+
1481
+ response = await client.call('post', apiPath, {
928
1482
  'content-type': 'application/json',
929
1483
  }, payload);
930
1484
 
@@ -1076,12 +1630,17 @@ account
1076
1630
  account
1077
1631
  .command(`create`)
1078
1632
  .description(`Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).`)
1079
- .requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1633
+ .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.`)
1080
1634
  .requiredOption(`--email <email>`, `User email.`)
1081
- .requiredOption(`--password <password>`, `New user password. Must be at least 8 chars.`)
1635
+ .requiredOption(`--password <password>`, `New user password. Must be between 8 and 256 chars.`)
1082
1636
  .option(`--name <name>`, `User name. Max length: 128 chars.`)
1083
1637
  .action(actionRunner(accountCreate))
1084
1638
 
1639
+ account
1640
+ .command(`delete`)
1641
+ .description(`Delete the currently logged in user.`)
1642
+ .action(actionRunner(accountDelete))
1643
+
1085
1644
  account
1086
1645
  .command(`updateEmail`)
1087
1646
  .description(`Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. `)
@@ -1092,7 +1651,7 @@ account
1092
1651
  account
1093
1652
  .command(`listIdentities`)
1094
1653
  .description(`Get the list of identities for the currently logged in user.`)
1095
- .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`)
1654
+ .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`)
1096
1655
  .action(actionRunner(accountListIdentities))
1097
1656
 
1098
1657
  account
@@ -1112,6 +1671,65 @@ account
1112
1671
  .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). Only supported methods are limit and offset`)
1113
1672
  .action(actionRunner(accountListLogs))
1114
1673
 
1674
+ account
1675
+ .command(`updateMFA`)
1676
+ .description(`Enable or disable MFA on an account.`)
1677
+ .requiredOption(`--mfa <mfa>`, `Enable or disable MFA.`, parseBool)
1678
+ .action(actionRunner(accountUpdateMFA))
1679
+
1680
+ account
1681
+ .command(`createMfaAuthenticator`)
1682
+ .description(`Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) method.`)
1683
+ .requiredOption(`--type <type>`, `Type of authenticator. Must be 'totp'`)
1684
+ .action(actionRunner(accountCreateMfaAuthenticator))
1685
+
1686
+ account
1687
+ .command(`updateMfaAuthenticator`)
1688
+ .description(`Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method.`)
1689
+ .requiredOption(`--type <type>`, `Type of authenticator.`)
1690
+ .requiredOption(`--otp <otp>`, `Valid verification token.`)
1691
+ .action(actionRunner(accountUpdateMfaAuthenticator))
1692
+
1693
+ account
1694
+ .command(`deleteMfaAuthenticator`)
1695
+ .description(`Delete an authenticator for a user by ID.`)
1696
+ .requiredOption(`--type <type>`, `Type of authenticator.`)
1697
+ .requiredOption(`--otp <otp>`, `Valid verification token.`)
1698
+ .action(actionRunner(accountDeleteMfaAuthenticator))
1699
+
1700
+ account
1701
+ .command(`createMfaChallenge`)
1702
+ .description(`Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.`)
1703
+ .requiredOption(`--factor <factor>`, `Factor used for verification. Must be one of following: 'email', 'phone', 'totp', 'recoveryCode'.`)
1704
+ .action(actionRunner(accountCreateMfaChallenge))
1705
+
1706
+ account
1707
+ .command(`updateMfaChallenge`)
1708
+ .description(`Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.`)
1709
+ .requiredOption(`--challengeId <challengeId>`, `ID of the challenge.`)
1710
+ .requiredOption(`--otp <otp>`, `Valid verification token.`)
1711
+ .action(actionRunner(accountUpdateMfaChallenge))
1712
+
1713
+ account
1714
+ .command(`listMfaFactors`)
1715
+ .description(`List the factors available on the account to be used as a MFA challange.`)
1716
+ .action(actionRunner(accountListMfaFactors))
1717
+
1718
+ account
1719
+ .command(`getMfaRecoveryCodes`)
1720
+ .description(`Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.`)
1721
+ .action(actionRunner(accountGetMfaRecoveryCodes))
1722
+
1723
+ account
1724
+ .command(`createMfaRecoveryCodes`)
1725
+ .description(`Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.`)
1726
+ .action(actionRunner(accountCreateMfaRecoveryCodes))
1727
+
1728
+ account
1729
+ .command(`updateMfaRecoveryCodes`)
1730
+ .description(`Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.`)
1731
+ .action(actionRunner(accountUpdateMfaRecoveryCodes))
1732
+
1115
1733
  account
1116
1734
  .command(`updateName`)
1117
1735
  .description(`Update currently logged in user account name.`)
@@ -1155,8 +1773,7 @@ account
1155
1773
  .description(`Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.`)
1156
1774
  .requiredOption(`--userId <userId>`, `User ID.`)
1157
1775
  .requiredOption(`--secret <secret>`, `Valid reset token.`)
1158
- .requiredOption(`--password <password>`, `New user password. Must be at least 8 chars.`)
1159
- .requiredOption(`--passwordAgain <passwordAgain>`, `Repeat new user password. Must be at least 8 chars.`)
1776
+ .requiredOption(`--password <password>`, `New user password. Must be between 8 and 256 chars.`)
1160
1777
  .action(actionRunner(accountUpdateRecovery))
1161
1778
 
1162
1779
  account
@@ -1175,50 +1792,42 @@ account
1175
1792
  .action(actionRunner(accountCreateAnonymousSession))
1176
1793
 
1177
1794
  account
1178
- .command(`createEmailSession`)
1795
+ .command(`createEmailPasswordSession`)
1179
1796
  .description(`Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
1180
1797
  .requiredOption(`--email <email>`, `User email.`)
1181
1798
  .requiredOption(`--password <password>`, `User password. Must be at least 8 chars.`)
1182
- .action(actionRunner(accountCreateEmailSession))
1183
-
1184
- account
1185
- .command(`createMagicURLSession`)
1186
- .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#updateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `)
1187
- .requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1188
- .requiredOption(`--email <email>`, `User email.`)
1189
- .option(`--url <url>`, `URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1190
- .action(actionRunner(accountCreateMagicURLSession))
1799
+ .action(actionRunner(accountCreateEmailPasswordSession))
1191
1800
 
1192
1801
  account
1193
1802
  .command(`updateMagicURLSession`)
1194
- .description(`Use this endpoint to complete creating the session with the Magic URL. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#createMagicURLSession) endpoint. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.`)
1195
- .requiredOption(`--userId <userId>`, `User ID.`)
1803
+ .description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
1804
+ .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.`)
1196
1805
  .requiredOption(`--secret <secret>`, `Valid verification token.`)
1197
1806
  .action(actionRunner(accountUpdateMagicURLSession))
1198
1807
 
1199
1808
  account
1200
1809
  .command(`createOAuth2Session`)
1201
1810
  .description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `)
1202
- .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom.`)
1811
+ .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
1203
1812
  .option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1204
1813
  .option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1205
1814
  .option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`)
1206
1815
  .action(actionRunner(accountCreateOAuth2Session))
1207
1816
 
1208
- account
1209
- .command(`createPhoneSession`)
1210
- .description(`Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/phone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
1211
- .requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1212
- .requiredOption(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
1213
- .action(actionRunner(accountCreatePhoneSession))
1214
-
1215
1817
  account
1216
1818
  .command(`updatePhoneSession`)
1217
- .description(`Use this endpoint to complete creating a session with SMS. Use the **userId** from the [createPhoneSession](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneSession) endpoint and the **secret** received via SMS to successfully update and confirm the phone session.`)
1218
- .requiredOption(`--userId <userId>`, `User ID.`)
1819
+ .description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
1820
+ .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.`)
1219
1821
  .requiredOption(`--secret <secret>`, `Valid verification token.`)
1220
1822
  .action(actionRunner(accountUpdatePhoneSession))
1221
1823
 
1824
+ account
1825
+ .command(`createSession`)
1826
+ .description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
1827
+ .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.`)
1828
+ .requiredOption(`--secret <secret>`, `Secret of a token generated by login methods. For example, the 'createMagicURLToken' or 'createPhoneToken' methods.`)
1829
+ .action(actionRunner(accountCreateSession))
1830
+
1222
1831
  account
1223
1832
  .command(`getSession`)
1224
1833
  .description(`Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.`)
@@ -1227,7 +1836,7 @@ account
1227
1836
 
1228
1837
  account
1229
1838
  .command(`updateSession`)
1230
- .description(`Access tokens have limited lifespan and expire to mitigate security risks. If session was created using an OAuth provider, this route can be used to "refresh" the access token.`)
1839
+ .description(`Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.`)
1231
1840
  .requiredOption(`--sessionId <sessionId>`, `Session ID. Use the string 'current' to update the current device session.`)
1232
1841
  .action(actionRunner(accountUpdateSession))
1233
1842
 
@@ -1242,6 +1851,60 @@ account
1242
1851
  .description(`Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.`)
1243
1852
  .action(actionRunner(accountUpdateStatus))
1244
1853
 
1854
+ account
1855
+ .command(`createPushTarget`)
1856
+ .description(``)
1857
+ .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.`)
1858
+ .requiredOption(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`)
1859
+ .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.`)
1860
+ .action(actionRunner(accountCreatePushTarget))
1861
+
1862
+ account
1863
+ .command(`updatePushTarget`)
1864
+ .description(``)
1865
+ .requiredOption(`--targetId <targetId>`, `Target ID.`)
1866
+ .requiredOption(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`)
1867
+ .action(actionRunner(accountUpdatePushTarget))
1868
+
1869
+ account
1870
+ .command(`deletePushTarget`)
1871
+ .description(``)
1872
+ .requiredOption(`--targetId <targetId>`, `Target ID.`)
1873
+ .action(actionRunner(accountDeletePushTarget))
1874
+
1875
+ account
1876
+ .command(`createEmailToken`)
1877
+ .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
1878
+ .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.`)
1879
+ .requiredOption(`--email <email>`, `User email.`)
1880
+ .option(`--phrase <phrase>`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool)
1881
+ .action(actionRunner(accountCreateEmailToken))
1882
+
1883
+ account
1884
+ .command(`createMagicURLToken`)
1885
+ .description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `)
1886
+ .requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1887
+ .requiredOption(`--email <email>`, `User email.`)
1888
+ .option(`--url <url>`, `URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1889
+ .option(`--phrase <phrase>`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool)
1890
+ .action(actionRunner(accountCreateMagicURLToken))
1891
+
1892
+ account
1893
+ .command(`createOAuth2Token`)
1894
+ .description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If authentication succeeds, 'userId' and 'secret' of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
1895
+ .requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
1896
+ .option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1897
+ .option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
1898
+ .option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`)
1899
+ .action(actionRunner(accountCreateOAuth2Token))
1900
+
1901
+ account
1902
+ .command(`createPhoneToken`)
1903
+ .description(`Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
1904
+ .requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
1905
+ .requiredOption(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
1906
+ .action(actionRunner(accountCreatePhoneToken))
1907
+
1245
1908
  account
1246
1909
  .command(`createVerification`)
1247
1910
  .description(`Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. `)
@@ -1271,11 +1934,22 @@ module.exports = {
1271
1934
  account,
1272
1935
  accountGet,
1273
1936
  accountCreate,
1937
+ accountDelete,
1274
1938
  accountUpdateEmail,
1275
1939
  accountListIdentities,
1276
1940
  accountDeleteIdentity,
1277
1941
  accountCreateJWT,
1278
1942
  accountListLogs,
1943
+ accountUpdateMFA,
1944
+ accountCreateMfaAuthenticator,
1945
+ accountUpdateMfaAuthenticator,
1946
+ accountDeleteMfaAuthenticator,
1947
+ accountCreateMfaChallenge,
1948
+ accountUpdateMfaChallenge,
1949
+ accountListMfaFactors,
1950
+ accountGetMfaRecoveryCodes,
1951
+ accountCreateMfaRecoveryCodes,
1952
+ accountUpdateMfaRecoveryCodes,
1279
1953
  accountUpdateName,
1280
1954
  accountUpdatePassword,
1281
1955
  accountUpdatePhone,
@@ -1286,16 +1960,22 @@ module.exports = {
1286
1960
  accountListSessions,
1287
1961
  accountDeleteSessions,
1288
1962
  accountCreateAnonymousSession,
1289
- accountCreateEmailSession,
1290
- accountCreateMagicURLSession,
1963
+ accountCreateEmailPasswordSession,
1291
1964
  accountUpdateMagicURLSession,
1292
1965
  accountCreateOAuth2Session,
1293
- accountCreatePhoneSession,
1294
1966
  accountUpdatePhoneSession,
1967
+ accountCreateSession,
1295
1968
  accountGetSession,
1296
1969
  accountUpdateSession,
1297
1970
  accountDeleteSession,
1298
1971
  accountUpdateStatus,
1972
+ accountCreatePushTarget,
1973
+ accountUpdatePushTarget,
1974
+ accountDeletePushTarget,
1975
+ accountCreateEmailToken,
1976
+ accountCreateMagicURLToken,
1977
+ accountCreateOAuth2Token,
1978
+ accountCreatePhoneToken,
1299
1979
  accountCreateVerification,
1300
1980
  accountUpdateVerification,
1301
1981
  accountCreatePhoneVerification,