@appconda/nextjs 1.0.12

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 (597) hide show
  1. package/.github/workflows/autoclose.yml +11 -0
  2. package/.github/workflows/publish.yml +42 -0
  3. package/.travis.yml +32 -0
  4. package/CHANGELOG.md +1 -0
  5. package/LICENSE +12 -0
  6. package/README.md +0 -0
  7. package/dist/cjs/sdk.js +10608 -0
  8. package/dist/cjs/sdk.js.map +1 -0
  9. package/dist/esm/sdk.js +10589 -0
  10. package/dist/esm/sdk.js.map +1 -0
  11. package/dist/iife/sdk.js +10609 -0
  12. package/docs/examples/account/create-anonymous-session.md +11 -0
  13. package/docs/examples/account/create-email-password-session.md +14 -0
  14. package/docs/examples/account/create-email-token.md +15 -0
  15. package/docs/examples/account/create-j-w-t.md +11 -0
  16. package/docs/examples/account/create-magic-u-r-l-token.md +16 -0
  17. package/docs/examples/account/create-mfa-authenticator.md +13 -0
  18. package/docs/examples/account/create-mfa-challenge.md +13 -0
  19. package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
  20. package/docs/examples/account/create-o-auth2session.md +15 -0
  21. package/docs/examples/account/create-o-auth2token.md +15 -0
  22. package/docs/examples/account/create-phone-token.md +14 -0
  23. package/docs/examples/account/create-phone-verification.md +11 -0
  24. package/docs/examples/account/create-push-target.md +15 -0
  25. package/docs/examples/account/create-recovery.md +14 -0
  26. package/docs/examples/account/create-session.md +14 -0
  27. package/docs/examples/account/create-verification.md +13 -0
  28. package/docs/examples/account/create.md +16 -0
  29. package/docs/examples/account/delete-identity.md +13 -0
  30. package/docs/examples/account/delete-mfa-authenticator.md +13 -0
  31. package/docs/examples/account/delete-push-target.md +13 -0
  32. package/docs/examples/account/delete-session.md +13 -0
  33. package/docs/examples/account/delete-sessions.md +11 -0
  34. package/docs/examples/account/delete.md +11 -0
  35. package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
  36. package/docs/examples/account/get-prefs.md +11 -0
  37. package/docs/examples/account/get-session.md +13 -0
  38. package/docs/examples/account/get.md +11 -0
  39. package/docs/examples/account/list-identities.md +13 -0
  40. package/docs/examples/account/list-logs.md +13 -0
  41. package/docs/examples/account/list-mfa-factors.md +11 -0
  42. package/docs/examples/account/list-sessions.md +11 -0
  43. package/docs/examples/account/update-email.md +14 -0
  44. package/docs/examples/account/update-m-f-a.md +13 -0
  45. package/docs/examples/account/update-magic-u-r-l-session.md +14 -0
  46. package/docs/examples/account/update-mfa-authenticator.md +14 -0
  47. package/docs/examples/account/update-mfa-challenge.md +14 -0
  48. package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
  49. package/docs/examples/account/update-name.md +13 -0
  50. package/docs/examples/account/update-password.md +14 -0
  51. package/docs/examples/account/update-phone-session.md +14 -0
  52. package/docs/examples/account/update-phone-verification.md +14 -0
  53. package/docs/examples/account/update-phone.md +14 -0
  54. package/docs/examples/account/update-prefs.md +13 -0
  55. package/docs/examples/account/update-push-target.md +14 -0
  56. package/docs/examples/account/update-recovery.md +15 -0
  57. package/docs/examples/account/update-session.md +13 -0
  58. package/docs/examples/account/update-status.md +11 -0
  59. package/docs/examples/account/update-verification.md +14 -0
  60. package/docs/examples/assistant/chat.md +13 -0
  61. package/docs/examples/avatars/get-browser.md +16 -0
  62. package/docs/examples/avatars/get-credit-card.md +16 -0
  63. package/docs/examples/avatars/get-favicon.md +13 -0
  64. package/docs/examples/avatars/get-flag.md +16 -0
  65. package/docs/examples/avatars/get-image.md +15 -0
  66. package/docs/examples/avatars/get-initials.md +16 -0
  67. package/docs/examples/avatars/get-q-r.md +16 -0
  68. package/docs/examples/console/variables.md +11 -0
  69. package/docs/examples/databases/create-boolean-attribute.md +18 -0
  70. package/docs/examples/databases/create-collection.md +18 -0
  71. package/docs/examples/databases/create-datetime-attribute.md +18 -0
  72. package/docs/examples/databases/create-document.md +17 -0
  73. package/docs/examples/databases/create-email-attribute.md +18 -0
  74. package/docs/examples/databases/create-enum-attribute.md +19 -0
  75. package/docs/examples/databases/create-float-attribute.md +20 -0
  76. package/docs/examples/databases/create-index.md +18 -0
  77. package/docs/examples/databases/create-integer-attribute.md +20 -0
  78. package/docs/examples/databases/create-ip-attribute.md +18 -0
  79. package/docs/examples/databases/create-relationship-attribute.md +20 -0
  80. package/docs/examples/databases/create-string-attribute.md +20 -0
  81. package/docs/examples/databases/create-url-attribute.md +18 -0
  82. package/docs/examples/databases/create.md +15 -0
  83. package/docs/examples/databases/delete-attribute.md +15 -0
  84. package/docs/examples/databases/delete-collection.md +14 -0
  85. package/docs/examples/databases/delete-document.md +15 -0
  86. package/docs/examples/databases/delete-index.md +15 -0
  87. package/docs/examples/databases/delete.md +13 -0
  88. package/docs/examples/databases/get-attribute.md +15 -0
  89. package/docs/examples/databases/get-collection-usage.md +15 -0
  90. package/docs/examples/databases/get-collection.md +14 -0
  91. package/docs/examples/databases/get-database-usage.md +14 -0
  92. package/docs/examples/databases/get-document.md +16 -0
  93. package/docs/examples/databases/get-index.md +15 -0
  94. package/docs/examples/databases/get-usage.md +13 -0
  95. package/docs/examples/databases/get.md +13 -0
  96. package/docs/examples/databases/list-attributes.md +15 -0
  97. package/docs/examples/databases/list-collection-logs.md +15 -0
  98. package/docs/examples/databases/list-collections.md +15 -0
  99. package/docs/examples/databases/list-document-logs.md +16 -0
  100. package/docs/examples/databases/list-documents.md +15 -0
  101. package/docs/examples/databases/list-indexes.md +15 -0
  102. package/docs/examples/databases/list-logs.md +14 -0
  103. package/docs/examples/databases/list.md +14 -0
  104. package/docs/examples/databases/update-boolean-attribute.md +17 -0
  105. package/docs/examples/databases/update-collection.md +18 -0
  106. package/docs/examples/databases/update-datetime-attribute.md +17 -0
  107. package/docs/examples/databases/update-document.md +17 -0
  108. package/docs/examples/databases/update-email-attribute.md +17 -0
  109. package/docs/examples/databases/update-enum-attribute.md +18 -0
  110. package/docs/examples/databases/update-float-attribute.md +19 -0
  111. package/docs/examples/databases/update-integer-attribute.md +19 -0
  112. package/docs/examples/databases/update-ip-attribute.md +17 -0
  113. package/docs/examples/databases/update-relationship-attribute.md +16 -0
  114. package/docs/examples/databases/update-string-attribute.md +17 -0
  115. package/docs/examples/databases/update-url-attribute.md +17 -0
  116. package/docs/examples/databases/update.md +15 -0
  117. package/docs/examples/functions/create-build.md +15 -0
  118. package/docs/examples/functions/create-deployment.md +17 -0
  119. package/docs/examples/functions/create-execution.md +19 -0
  120. package/docs/examples/functions/create-variable.md +15 -0
  121. package/docs/examples/functions/create.md +34 -0
  122. package/docs/examples/functions/delete-deployment.md +14 -0
  123. package/docs/examples/functions/delete-execution.md +14 -0
  124. package/docs/examples/functions/delete-variable.md +14 -0
  125. package/docs/examples/functions/delete.md +13 -0
  126. package/docs/examples/functions/get-deployment-download.md +14 -0
  127. package/docs/examples/functions/get-deployment.md +14 -0
  128. package/docs/examples/functions/get-execution.md +14 -0
  129. package/docs/examples/functions/get-function-usage.md +14 -0
  130. package/docs/examples/functions/get-template.md +13 -0
  131. package/docs/examples/functions/get-usage.md +13 -0
  132. package/docs/examples/functions/get-variable.md +14 -0
  133. package/docs/examples/functions/get.md +13 -0
  134. package/docs/examples/functions/list-deployments.md +15 -0
  135. package/docs/examples/functions/list-executions.md +15 -0
  136. package/docs/examples/functions/list-runtimes.md +11 -0
  137. package/docs/examples/functions/list-specifications.md +11 -0
  138. package/docs/examples/functions/list-templates.md +16 -0
  139. package/docs/examples/functions/list-variables.md +13 -0
  140. package/docs/examples/functions/list.md +14 -0
  141. package/docs/examples/functions/update-deployment-build.md +14 -0
  142. package/docs/examples/functions/update-deployment.md +14 -0
  143. package/docs/examples/functions/update-variable.md +16 -0
  144. package/docs/examples/functions/update.md +30 -0
  145. package/docs/examples/graphql/mutation.md +13 -0
  146. package/docs/examples/graphql/query.md +13 -0
  147. package/docs/examples/health/get-antivirus.md +11 -0
  148. package/docs/examples/health/get-cache.md +11 -0
  149. package/docs/examples/health/get-certificate.md +13 -0
  150. package/docs/examples/health/get-d-b.md +11 -0
  151. package/docs/examples/health/get-failed-jobs.md +14 -0
  152. package/docs/examples/health/get-pub-sub.md +11 -0
  153. package/docs/examples/health/get-queue-builds.md +13 -0
  154. package/docs/examples/health/get-queue-certificates.md +13 -0
  155. package/docs/examples/health/get-queue-databases.md +14 -0
  156. package/docs/examples/health/get-queue-deletes.md +13 -0
  157. package/docs/examples/health/get-queue-functions.md +13 -0
  158. package/docs/examples/health/get-queue-logs.md +13 -0
  159. package/docs/examples/health/get-queue-mails.md +13 -0
  160. package/docs/examples/health/get-queue-messaging.md +13 -0
  161. package/docs/examples/health/get-queue-migrations.md +13 -0
  162. package/docs/examples/health/get-queue-usage-dump.md +13 -0
  163. package/docs/examples/health/get-queue-usage.md +13 -0
  164. package/docs/examples/health/get-queue-webhooks.md +13 -0
  165. package/docs/examples/health/get-queue.md +11 -0
  166. package/docs/examples/health/get-storage-local.md +11 -0
  167. package/docs/examples/health/get-storage.md +11 -0
  168. package/docs/examples/health/get-time.md +11 -0
  169. package/docs/examples/health/get.md +11 -0
  170. package/docs/examples/locale/get.md +11 -0
  171. package/docs/examples/locale/list-codes.md +11 -0
  172. package/docs/examples/locale/list-continents.md +11 -0
  173. package/docs/examples/locale/list-countries-e-u.md +11 -0
  174. package/docs/examples/locale/list-countries-phones.md +11 -0
  175. package/docs/examples/locale/list-countries.md +11 -0
  176. package/docs/examples/locale/list-currencies.md +11 -0
  177. package/docs/examples/locale/list-languages.md +11 -0
  178. package/docs/examples/messaging/create-apns-provider.md +20 -0
  179. package/docs/examples/messaging/create-email.md +24 -0
  180. package/docs/examples/messaging/create-fcm-provider.md +16 -0
  181. package/docs/examples/messaging/create-mailgun-provider.md +22 -0
  182. package/docs/examples/messaging/create-msg91provider.md +18 -0
  183. package/docs/examples/messaging/create-push.md +28 -0
  184. package/docs/examples/messaging/create-sendgrid-provider.md +20 -0
  185. package/docs/examples/messaging/create-sms.md +19 -0
  186. package/docs/examples/messaging/create-smtp-provider.md +26 -0
  187. package/docs/examples/messaging/create-subscriber.md +15 -0
  188. package/docs/examples/messaging/create-telesign-provider.md +18 -0
  189. package/docs/examples/messaging/create-textmagic-provider.md +18 -0
  190. package/docs/examples/messaging/create-topic.md +15 -0
  191. package/docs/examples/messaging/create-twilio-provider.md +18 -0
  192. package/docs/examples/messaging/create-vonage-provider.md +18 -0
  193. package/docs/examples/messaging/delete-provider.md +13 -0
  194. package/docs/examples/messaging/delete-subscriber.md +14 -0
  195. package/docs/examples/messaging/delete-topic.md +13 -0
  196. package/docs/examples/messaging/delete.md +13 -0
  197. package/docs/examples/messaging/get-message.md +13 -0
  198. package/docs/examples/messaging/get-provider.md +13 -0
  199. package/docs/examples/messaging/get-subscriber.md +14 -0
  200. package/docs/examples/messaging/get-topic.md +13 -0
  201. package/docs/examples/messaging/list-message-logs.md +14 -0
  202. package/docs/examples/messaging/list-messages.md +14 -0
  203. package/docs/examples/messaging/list-provider-logs.md +14 -0
  204. package/docs/examples/messaging/list-providers.md +14 -0
  205. package/docs/examples/messaging/list-subscriber-logs.md +14 -0
  206. package/docs/examples/messaging/list-subscribers.md +15 -0
  207. package/docs/examples/messaging/list-targets.md +14 -0
  208. package/docs/examples/messaging/list-topic-logs.md +14 -0
  209. package/docs/examples/messaging/list-topics.md +14 -0
  210. package/docs/examples/messaging/update-apns-provider.md +20 -0
  211. package/docs/examples/messaging/update-email.md +24 -0
  212. package/docs/examples/messaging/update-fcm-provider.md +16 -0
  213. package/docs/examples/messaging/update-mailgun-provider.md +22 -0
  214. package/docs/examples/messaging/update-msg91provider.md +18 -0
  215. package/docs/examples/messaging/update-push.md +28 -0
  216. package/docs/examples/messaging/update-sendgrid-provider.md +20 -0
  217. package/docs/examples/messaging/update-sms.md +19 -0
  218. package/docs/examples/messaging/update-smtp-provider.md +26 -0
  219. package/docs/examples/messaging/update-telesign-provider.md +18 -0
  220. package/docs/examples/messaging/update-textmagic-provider.md +18 -0
  221. package/docs/examples/messaging/update-topic.md +15 -0
  222. package/docs/examples/messaging/update-twilio-provider.md +18 -0
  223. package/docs/examples/messaging/update-vonage-provider.md +18 -0
  224. package/docs/examples/migrations/create-appwrite-migration.md +16 -0
  225. package/docs/examples/migrations/create-firebase-migration.md +14 -0
  226. package/docs/examples/migrations/create-firebase-o-auth-migration.md +14 -0
  227. package/docs/examples/migrations/create-n-host-migration.md +20 -0
  228. package/docs/examples/migrations/create-supabase-migration.md +19 -0
  229. package/docs/examples/migrations/delete-firebase-auth.md +11 -0
  230. package/docs/examples/migrations/delete.md +13 -0
  231. package/docs/examples/migrations/get-appwrite-report.md +16 -0
  232. package/docs/examples/migrations/get-firebase-report-o-auth.md +14 -0
  233. package/docs/examples/migrations/get-firebase-report.md +14 -0
  234. package/docs/examples/migrations/get-n-host-report.md +20 -0
  235. package/docs/examples/migrations/get-supabase-report.md +19 -0
  236. package/docs/examples/migrations/get.md +13 -0
  237. package/docs/examples/migrations/list-firebase-projects.md +11 -0
  238. package/docs/examples/migrations/list.md +14 -0
  239. package/docs/examples/migrations/retry.md +13 -0
  240. package/docs/examples/project/create-variable.md +14 -0
  241. package/docs/examples/project/delete-variable.md +13 -0
  242. package/docs/examples/project/get-usage.md +15 -0
  243. package/docs/examples/project/get-variable.md +13 -0
  244. package/docs/examples/project/list-variables.md +11 -0
  245. package/docs/examples/project/update-variable.md +15 -0
  246. package/docs/examples/projects/create-j-w-t.md +15 -0
  247. package/docs/examples/projects/create-key.md +16 -0
  248. package/docs/examples/projects/create-platform.md +18 -0
  249. package/docs/examples/projects/create-smtp-test.md +22 -0
  250. package/docs/examples/projects/create-webhook.md +20 -0
  251. package/docs/examples/projects/create.md +25 -0
  252. package/docs/examples/projects/delete-email-template.md +15 -0
  253. package/docs/examples/projects/delete-key.md +14 -0
  254. package/docs/examples/projects/delete-platform.md +14 -0
  255. package/docs/examples/projects/delete-sms-template.md +15 -0
  256. package/docs/examples/projects/delete-webhook.md +14 -0
  257. package/docs/examples/projects/delete.md +13 -0
  258. package/docs/examples/projects/get-email-template.md +15 -0
  259. package/docs/examples/projects/get-key.md +14 -0
  260. package/docs/examples/projects/get-platform.md +14 -0
  261. package/docs/examples/projects/get-sms-template.md +15 -0
  262. package/docs/examples/projects/get-webhook.md +14 -0
  263. package/docs/examples/projects/get.md +13 -0
  264. package/docs/examples/projects/list-keys.md +13 -0
  265. package/docs/examples/projects/list-platforms.md +13 -0
  266. package/docs/examples/projects/list-webhooks.md +13 -0
  267. package/docs/examples/projects/list.md +14 -0
  268. package/docs/examples/projects/update-api-status-all.md +14 -0
  269. package/docs/examples/projects/update-api-status.md +15 -0
  270. package/docs/examples/projects/update-auth-duration.md +14 -0
  271. package/docs/examples/projects/update-auth-limit.md +14 -0
  272. package/docs/examples/projects/update-auth-password-dictionary.md +14 -0
  273. package/docs/examples/projects/update-auth-password-history.md +14 -0
  274. package/docs/examples/projects/update-auth-sessions-limit.md +14 -0
  275. package/docs/examples/projects/update-auth-status.md +15 -0
  276. package/docs/examples/projects/update-email-template.md +20 -0
  277. package/docs/examples/projects/update-key.md +17 -0
  278. package/docs/examples/projects/update-mock-numbers.md +14 -0
  279. package/docs/examples/projects/update-o-auth2.md +17 -0
  280. package/docs/examples/projects/update-personal-data-check.md +14 -0
  281. package/docs/examples/projects/update-platform.md +18 -0
  282. package/docs/examples/projects/update-service-status-all.md +14 -0
  283. package/docs/examples/projects/update-service-status.md +15 -0
  284. package/docs/examples/projects/update-session-alerts.md +14 -0
  285. package/docs/examples/projects/update-sms-template.md +16 -0
  286. package/docs/examples/projects/update-smtp.md +22 -0
  287. package/docs/examples/projects/update-team.md +14 -0
  288. package/docs/examples/projects/update-webhook-signature.md +14 -0
  289. package/docs/examples/projects/update-webhook.md +21 -0
  290. package/docs/examples/projects/update.md +23 -0
  291. package/docs/examples/proxy/create-rule.md +15 -0
  292. package/docs/examples/proxy/delete-rule.md +13 -0
  293. package/docs/examples/proxy/get-rule.md +13 -0
  294. package/docs/examples/proxy/list-rules.md +14 -0
  295. package/docs/examples/proxy/update-rule-verification.md +13 -0
  296. package/docs/examples/storage/create-bucket.md +22 -0
  297. package/docs/examples/storage/create-file.md +16 -0
  298. package/docs/examples/storage/delete-bucket.md +13 -0
  299. package/docs/examples/storage/delete-file.md +14 -0
  300. package/docs/examples/storage/get-bucket-usage.md +14 -0
  301. package/docs/examples/storage/get-bucket.md +13 -0
  302. package/docs/examples/storage/get-file-download.md +14 -0
  303. package/docs/examples/storage/get-file-preview.md +25 -0
  304. package/docs/examples/storage/get-file-view.md +14 -0
  305. package/docs/examples/storage/get-file.md +14 -0
  306. package/docs/examples/storage/get-usage.md +13 -0
  307. package/docs/examples/storage/list-buckets.md +14 -0
  308. package/docs/examples/storage/list-files.md +15 -0
  309. package/docs/examples/storage/update-bucket.md +22 -0
  310. package/docs/examples/storage/update-file.md +16 -0
  311. package/docs/examples/teams/create-membership.md +19 -0
  312. package/docs/examples/teams/create.md +15 -0
  313. package/docs/examples/teams/delete-membership.md +14 -0
  314. package/docs/examples/teams/delete.md +13 -0
  315. package/docs/examples/teams/get-membership.md +14 -0
  316. package/docs/examples/teams/get-prefs.md +13 -0
  317. package/docs/examples/teams/get.md +13 -0
  318. package/docs/examples/teams/list-logs.md +14 -0
  319. package/docs/examples/teams/list-memberships.md +15 -0
  320. package/docs/examples/teams/list.md +14 -0
  321. package/docs/examples/teams/update-membership-status.md +16 -0
  322. package/docs/examples/teams/update-membership.md +15 -0
  323. package/docs/examples/teams/update-name.md +14 -0
  324. package/docs/examples/teams/update-prefs.md +14 -0
  325. package/docs/examples/users/create-argon2user.md +16 -0
  326. package/docs/examples/users/create-bcrypt-user.md +16 -0
  327. package/docs/examples/users/create-j-w-t.md +15 -0
  328. package/docs/examples/users/create-m-d5user.md +16 -0
  329. package/docs/examples/users/create-mfa-recovery-codes.md +13 -0
  330. package/docs/examples/users/create-p-h-pass-user.md +16 -0
  331. package/docs/examples/users/create-s-h-a-user.md +17 -0
  332. package/docs/examples/users/create-scrypt-modified-user.md +19 -0
  333. package/docs/examples/users/create-scrypt-user.md +21 -0
  334. package/docs/examples/users/create-session.md +13 -0
  335. package/docs/examples/users/create-target.md +18 -0
  336. package/docs/examples/users/create-token.md +15 -0
  337. package/docs/examples/users/create.md +17 -0
  338. package/docs/examples/users/delete-identity.md +13 -0
  339. package/docs/examples/users/delete-mfa-authenticator.md +14 -0
  340. package/docs/examples/users/delete-session.md +14 -0
  341. package/docs/examples/users/delete-sessions.md +13 -0
  342. package/docs/examples/users/delete-target.md +14 -0
  343. package/docs/examples/users/delete.md +13 -0
  344. package/docs/examples/users/get-mfa-recovery-codes.md +13 -0
  345. package/docs/examples/users/get-prefs.md +13 -0
  346. package/docs/examples/users/get-target.md +14 -0
  347. package/docs/examples/users/get-usage.md +13 -0
  348. package/docs/examples/users/get.md +13 -0
  349. package/docs/examples/users/list-identities.md +14 -0
  350. package/docs/examples/users/list-logs.md +14 -0
  351. package/docs/examples/users/list-memberships.md +13 -0
  352. package/docs/examples/users/list-mfa-factors.md +13 -0
  353. package/docs/examples/users/list-sessions.md +13 -0
  354. package/docs/examples/users/list-targets.md +14 -0
  355. package/docs/examples/users/list.md +14 -0
  356. package/docs/examples/users/update-email-verification.md +14 -0
  357. package/docs/examples/users/update-email.md +14 -0
  358. package/docs/examples/users/update-labels.md +14 -0
  359. package/docs/examples/users/update-mfa-recovery-codes.md +13 -0
  360. package/docs/examples/users/update-mfa.md +14 -0
  361. package/docs/examples/users/update-name.md +14 -0
  362. package/docs/examples/users/update-password.md +14 -0
  363. package/docs/examples/users/update-phone-verification.md +14 -0
  364. package/docs/examples/users/update-phone.md +14 -0
  365. package/docs/examples/users/update-prefs.md +14 -0
  366. package/docs/examples/users/update-status.md +14 -0
  367. package/docs/examples/users/update-target.md +17 -0
  368. package/docs/examples/vcs/create-repository-detection.md +15 -0
  369. package/docs/examples/vcs/create-repository.md +15 -0
  370. package/docs/examples/vcs/delete-installation.md +13 -0
  371. package/docs/examples/vcs/get-installation.md +13 -0
  372. package/docs/examples/vcs/get-repository-contents.md +15 -0
  373. package/docs/examples/vcs/get-repository.md +14 -0
  374. package/docs/examples/vcs/list-installations.md +14 -0
  375. package/docs/examples/vcs/list-repositories.md +14 -0
  376. package/docs/examples/vcs/list-repository-branches.md +14 -0
  377. package/docs/examples/vcs/update-external-deployments.md +15 -0
  378. package/package.json +42 -0
  379. package/publish.sh +4 -0
  380. package/rollup.config.js +27 -0
  381. package/src/Cache/Adapter.ts +11 -0
  382. package/src/Cache/Adapters/Filesystem.ts +126 -0
  383. package/src/Cache/Adapters/Memory.ts +57 -0
  384. package/src/Cache/Adapters/None.ts +36 -0
  385. package/src/Cache/Adapters/Redis.ts +106 -0
  386. package/src/Cache/Adapters/Sharding.ts +87 -0
  387. package/src/Cache/Cache.ts +75 -0
  388. package/src/Cache/index.ts +5 -0
  389. package/src/Cache/test.ts +0 -0
  390. package/src/Services.ts +41 -0
  391. package/src/client.ts +397 -0
  392. package/src/decorators/Cache.ts +102 -0
  393. package/src/decorators/CacheKey.ts +9 -0
  394. package/src/decorators/Invalidate.ts +68 -0
  395. package/src/enums/api-service.ts +13 -0
  396. package/src/enums/api.ts +5 -0
  397. package/src/enums/auth-method.ts +9 -0
  398. package/src/enums/authentication-factor.ts +6 -0
  399. package/src/enums/authenticator-type.ts +3 -0
  400. package/src/enums/browser.ts +16 -0
  401. package/src/enums/compression.ts +5 -0
  402. package/src/enums/credit-card.ts +18 -0
  403. package/src/enums/database-usage-range.ts +5 -0
  404. package/src/enums/email-template-locale.ts +133 -0
  405. package/src/enums/email-template-type.ts +9 -0
  406. package/src/enums/entities/EntityLimitType.ts +4 -0
  407. package/src/enums/entities/PropertyAttributeName.ts +27 -0
  408. package/src/enums/entities/PropertyCondition.ts +8 -0
  409. package/src/enums/entities/PropertyType.ts +16 -0
  410. package/src/enums/entities/PropertyValueType.ts +6 -0
  411. package/src/enums/entities/RowAccess.ts +2 -0
  412. package/src/enums/entities/ViewFilterCondition.ts +12 -0
  413. package/src/enums/execution-method.ts +8 -0
  414. package/src/enums/flag.ts +197 -0
  415. package/src/enums/function-usage-range.ts +5 -0
  416. package/src/enums/image-format.ts +7 -0
  417. package/src/enums/image-gravity.ts +11 -0
  418. package/src/enums/index-type.ts +5 -0
  419. package/src/enums/messaging-provider-type.ts +5 -0
  420. package/src/enums/name.ts +14 -0
  421. package/src/enums/o-auth-provider copy.ts +41 -0
  422. package/src/enums/o-auth-provider.ts +41 -0
  423. package/src/enums/password-hash.ts +13 -0
  424. package/src/enums/platform-type.ts +17 -0
  425. package/src/enums/project-usage-range.ts +4 -0
  426. package/src/enums/region.ts +4 -0
  427. package/src/enums/relation-mutate.ts +5 -0
  428. package/src/enums/relationship-type.ts +6 -0
  429. package/src/enums/resource-type.ts +4 -0
  430. package/src/enums/runtime.ts +48 -0
  431. package/src/enums/s-m-t-p-secure.ts +3 -0
  432. package/src/enums/shared/ApplicationLayout.ts +4 -0
  433. package/src/enums/shared/Colors.ts +24 -0
  434. package/src/enums/shared/InputType.ts +6 -0
  435. package/src/enums/shared/Periodicity.ts +7 -0
  436. package/src/enums/shared/SvgIcon.ts +37 -0
  437. package/src/enums/shared/Theme.ts +4 -0
  438. package/src/enums/sms-template-locale.ts +133 -0
  439. package/src/enums/sms-template-type.ts +6 -0
  440. package/src/enums/smtp-encryption.ts +5 -0
  441. package/src/enums/storage-usage-range.ts +5 -0
  442. package/src/enums/subscriptions/PricingModel.ts +14 -0
  443. package/src/enums/subscriptions/SubscriptionBillingPeriod.ts +15 -0
  444. package/src/enums/subscriptions/SubscriptionFeatureLimitType.ts +16 -0
  445. package/src/enums/subscriptions/SubscriptionPriceType.ts +10 -0
  446. package/src/enums/tenants/LinkedAccountStatus.ts +5 -0
  447. package/src/enums/tenants/TenantUserJoined.ts +6 -0
  448. package/src/enums/tenants/TenantUserStatus.ts +6 -0
  449. package/src/enums/tenants/TenantUserType.ts +5 -0
  450. package/src/enums/user-usage-range.ts +5 -0
  451. package/src/id.ts +47 -0
  452. package/src/index.ts +36 -0
  453. package/src/inputFile.ts +23 -0
  454. package/src/lib/Registry/Registry.ts +66 -0
  455. package/src/lib/Registry/index.ts +1 -0
  456. package/src/models.ts +3339 -0
  457. package/src/permission.ts +57 -0
  458. package/src/query.ts +261 -0
  459. package/src/role.ts +100 -0
  460. package/src/service-client.ts +29 -0
  461. package/src/service.ts +30 -0
  462. package/src/services/account.ts +1643 -0
  463. package/src/services/applets.ts +75 -0
  464. package/src/services/avatars.ts +314 -0
  465. package/src/services/community.ts +102 -0
  466. package/src/services/configuration.ts +15 -0
  467. package/src/services/databases.ts +2037 -0
  468. package/src/services/functions.ts +986 -0
  469. package/src/services/graphql.ts +75 -0
  470. package/src/services/health.ts +629 -0
  471. package/src/services/locale.ts +205 -0
  472. package/src/services/messaging.ts +2247 -0
  473. package/src/services/node.ts +15 -0
  474. package/src/services/permissions.ts +131 -0
  475. package/src/services/pricing.ts +30 -0
  476. package/src/services/projects.ts +1901 -0
  477. package/src/services/roles.ts +101 -0
  478. package/src/services/schema.ts +65 -0
  479. package/src/services/storage.ts +576 -0
  480. package/src/services/subscription.ts +40 -0
  481. package/src/services/teams.ts +490 -0
  482. package/src/services/tenant-subscription.ts +93 -0
  483. package/src/services/tenant.ts +194 -0
  484. package/src/services/users.ts +1584 -0
  485. package/tsconfig.json +29 -0
  486. package/types/Cache/Adapter.d.ts +10 -0
  487. package/types/Cache/Adapters/Filesystem.d.ts +16 -0
  488. package/types/Cache/Adapters/Memory.d.ts +18 -0
  489. package/types/Cache/Adapters/None.d.ts +12 -0
  490. package/types/Cache/Adapters/Redis.d.ts +14 -0
  491. package/types/Cache/Adapters/Sharding.d.ts +17 -0
  492. package/types/Cache/Cache.d.ts +16 -0
  493. package/types/Cache/index.d.ts +5 -0
  494. package/types/Cache/test.d.ts +0 -0
  495. package/types/Services.d.ts +6 -0
  496. package/types/client.d.ts +141 -0
  497. package/types/decorators/Cache.d.ts +1 -0
  498. package/types/decorators/CacheKey.d.ts +1 -0
  499. package/types/decorators/Invalidate.d.ts +1 -0
  500. package/types/enums/api-service.d.ts +13 -0
  501. package/types/enums/api.d.ts +5 -0
  502. package/types/enums/auth-method.d.ts +9 -0
  503. package/types/enums/authentication-factor.d.ts +6 -0
  504. package/types/enums/authenticator-type.d.ts +3 -0
  505. package/types/enums/browser.d.ts +16 -0
  506. package/types/enums/compression.d.ts +5 -0
  507. package/types/enums/credit-card.d.ts +18 -0
  508. package/types/enums/database-usage-range.d.ts +5 -0
  509. package/types/enums/email-template-locale.d.ts +133 -0
  510. package/types/enums/email-template-type.d.ts +9 -0
  511. package/types/enums/entities/EntityLimitType.d.ts +4 -0
  512. package/types/enums/entities/PropertyAttributeName.d.ts +27 -0
  513. package/types/enums/entities/PropertyCondition.d.ts +7 -0
  514. package/types/enums/entities/PropertyType.d.ts +12 -0
  515. package/types/enums/entities/PropertyValueType.d.ts +6 -0
  516. package/types/enums/entities/RowAccess.d.ts +2 -0
  517. package/types/enums/entities/ViewFilterCondition.d.ts +12 -0
  518. package/types/enums/execution-method.d.ts +8 -0
  519. package/types/enums/flag.d.ts +197 -0
  520. package/types/enums/function-usage-range.d.ts +5 -0
  521. package/types/enums/image-format.d.ts +7 -0
  522. package/types/enums/image-gravity.d.ts +11 -0
  523. package/types/enums/index-type.d.ts +5 -0
  524. package/types/enums/messaging-provider-type.d.ts +5 -0
  525. package/types/enums/name.d.ts +14 -0
  526. package/types/enums/o-auth-provider copy.d.ts +41 -0
  527. package/types/enums/o-auth-provider.d.ts +41 -0
  528. package/types/enums/password-hash.d.ts +13 -0
  529. package/types/enums/platform-type.d.ts +17 -0
  530. package/types/enums/project-usage-range.d.ts +4 -0
  531. package/types/enums/region.d.ts +4 -0
  532. package/types/enums/relation-mutate.d.ts +5 -0
  533. package/types/enums/relationship-type.d.ts +6 -0
  534. package/types/enums/resource-type.d.ts +4 -0
  535. package/types/enums/runtime.d.ts +48 -0
  536. package/types/enums/s-m-t-p-secure.d.ts +3 -0
  537. package/types/enums/shared/ApplicationLayout.d.ts +4 -0
  538. package/types/enums/shared/Colors.d.ts +24 -0
  539. package/types/enums/shared/InputType.d.ts +6 -0
  540. package/types/enums/shared/Periodicity.d.ts +7 -0
  541. package/types/enums/shared/SvgIcon.d.ts +37 -0
  542. package/types/enums/shared/Theme.d.ts +4 -0
  543. package/types/enums/sms-template-locale.d.ts +133 -0
  544. package/types/enums/sms-template-type.d.ts +6 -0
  545. package/types/enums/smtp-encryption.d.ts +5 -0
  546. package/types/enums/storage-usage-range.d.ts +5 -0
  547. package/types/enums/subscriptions/PricingModel.d.ts +11 -0
  548. package/types/enums/subscriptions/SubscriptionBillingPeriod.d.ts +10 -0
  549. package/types/enums/subscriptions/SubscriptionFeatureLimitType.d.ts +10 -0
  550. package/types/enums/subscriptions/SubscriptionPriceType.d.ts +7 -0
  551. package/types/enums/tenants/LinkedAccountStatus.d.ts +5 -0
  552. package/types/enums/tenants/TenantUserJoined.d.ts +6 -0
  553. package/types/enums/tenants/TenantUserStatus.d.ts +6 -0
  554. package/types/enums/tenants/TenantUserType.d.ts +5 -0
  555. package/types/enums/user-usage-range.d.ts +5 -0
  556. package/types/id.d.ts +20 -0
  557. package/types/index.d.ts +36 -0
  558. package/types/inputFile.d.ts +6 -0
  559. package/types/lib/Registry/Registry.d.ts +38 -0
  560. package/types/lib/Registry/index.d.ts +1 -0
  561. package/types/models.d.ts +3272 -0
  562. package/types/permission.d.ts +43 -0
  563. package/types/query.d.ts +194 -0
  564. package/types/role.d.ts +70 -0
  565. package/types/service-client.d.ts +7 -0
  566. package/types/service.d.ts +11 -0
  567. package/types/services/account.d.ts +530 -0
  568. package/types/services/acl.d.ts +28 -0
  569. package/types/services/applets.d.ts +9 -0
  570. package/types/services/assistant.d.ts +14 -0
  571. package/types/services/avatars.d.ts +115 -0
  572. package/types/services/community.d.ts +19 -0
  573. package/types/services/configuration.d.ts +5 -0
  574. package/types/services/console.d.ts +15 -0
  575. package/types/services/databases.d.ts +613 -0
  576. package/types/services/functions.d.ts +319 -0
  577. package/types/services/graphql.d.ts +25 -0
  578. package/types/services/health.d.ts +231 -0
  579. package/types/services/locale.d.ts +80 -0
  580. package/types/services/messaging.d.ts +685 -0
  581. package/types/services/migrations.d.ts +185 -0
  582. package/types/services/node.d.ts +5 -0
  583. package/types/services/permissions.d.ts +20 -0
  584. package/types/services/pricing.d.ts +15 -0
  585. package/types/services/project.d.ts +70 -0
  586. package/types/services/projects.d.ts +542 -0
  587. package/types/services/proxy.d.ts +59 -0
  588. package/types/services/roles.d.ts +19 -0
  589. package/types/services/schema.d.ts +17 -0
  590. package/types/services/storage.d.ts +189 -0
  591. package/types/services/subscription-product.d.ts +77 -0
  592. package/types/services/subscription.d.ts +15 -0
  593. package/types/services/teams.d.ts +167 -0
  594. package/types/services/tenant-subscription.d.ts +12 -0
  595. package/types/services/tenant.d.ts +32 -0
  596. package/types/services/users.d.ts +499 -0
  597. package/types/services/vcs.d.ts +108 -0
@@ -0,0 +1,1643 @@
1
+
2
+ import { AppcondaException, Client, type Payload, UploadProgress } from '../client';
3
+ import type { Models } from '../models';
4
+ import { AuthenticatorType } from '../enums/authenticator-type';
5
+ import { AuthenticationFactor } from '../enums/authentication-factor';
6
+ import { OAuthProvider } from '../enums/o-auth-provider';
7
+ import { Service } from '../service';
8
+
9
+ export class Account {
10
+ client: Client;
11
+
12
+ constructor(client: Client) {
13
+ this.client = client;
14
+ }
15
+
16
+ /**
17
+ * Get account
18
+ *
19
+ * Get the currently logged in user.
20
+ *
21
+ * @throws {AppcondaException}
22
+ * @returns {Promise<Models.User<Preferences>>}
23
+ */
24
+ async get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
25
+ const apiPath = '/account';
26
+ const payload: Payload = {};
27
+ const uri = new URL(this.client.config.endpoint + apiPath);
28
+
29
+ const apiHeaders: { [header: string]: string } = {
30
+ 'content-type': 'application/json',
31
+ }
32
+
33
+
34
+ return await this.client.call(
35
+ 'get',
36
+ uri,
37
+ apiHeaders,
38
+ payload
39
+ );
40
+ }
41
+ /**
42
+ * Create account
43
+ *
44
+ * 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://appconda.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://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
45
+ *
46
+ * @param {string} userId
47
+ * @param {string} email
48
+ * @param {string} password
49
+ * @param {string} name
50
+ * @throws {AppcondaException}
51
+ * @returns {Promise<Models.User<Preferences>>}
52
+ */
53
+ async create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
54
+ if (typeof userId === 'undefined') {
55
+ throw new AppcondaException('Missing required parameter: "userId"');
56
+ }
57
+ if (typeof email === 'undefined') {
58
+ throw new AppcondaException('Missing required parameter: "email"');
59
+ }
60
+ if (typeof password === 'undefined') {
61
+ throw new AppcondaException('Missing required parameter: "password"');
62
+ }
63
+ const apiPath = '/account';
64
+ const payload: Payload = {};
65
+ if (typeof userId !== 'undefined') {
66
+ payload['userId'] = userId;
67
+ }
68
+ if (typeof email !== 'undefined') {
69
+ payload['email'] = email;
70
+ }
71
+ if (typeof password !== 'undefined') {
72
+ payload['password'] = password;
73
+ }
74
+ if (typeof name !== 'undefined') {
75
+ payload['name'] = name;
76
+ }
77
+ const uri = new URL(this.client.config.endpoint + apiPath);
78
+
79
+ const apiHeaders: { [header: string]: string } = {
80
+ 'content-type': 'application/json',
81
+ }
82
+
83
+
84
+ return await this.client.call(
85
+ 'post',
86
+ uri,
87
+ apiHeaders,
88
+ payload
89
+ );
90
+ }
91
+ /**
92
+ * Delete account
93
+ *
94
+ * Delete the currently logged in user.
95
+ *
96
+ * @throws {AppcondaException}
97
+ * @returns {Promise<{}>}
98
+ */
99
+ async delete(): Promise<{}> {
100
+ const apiPath = '/account';
101
+ const payload: Payload = {};
102
+ const uri = new URL(this.client.config.endpoint + apiPath);
103
+
104
+ const apiHeaders: { [header: string]: string } = {
105
+ 'content-type': 'application/json',
106
+ }
107
+
108
+
109
+ return await this.client.call(
110
+ 'delete',
111
+ uri,
112
+ apiHeaders,
113
+ payload
114
+ );
115
+ }
116
+
117
+ /**
118
+ * Update email
119
+ *
120
+ * 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.
121
+ This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
122
+
123
+ *
124
+ * @param {string} email
125
+ * @param {string} password
126
+ * @throws {AppcondaException}
127
+ * @returns {Promise<Models.User<Preferences>>}
128
+ */
129
+ async updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>> {
130
+ if (typeof email === 'undefined') {
131
+ throw new AppcondaException('Missing required parameter: "email"');
132
+ }
133
+ if (typeof password === 'undefined') {
134
+ throw new AppcondaException('Missing required parameter: "password"');
135
+ }
136
+ const apiPath = '/account/email';
137
+ const payload: Payload = {};
138
+ if (typeof email !== 'undefined') {
139
+ payload['email'] = email;
140
+ }
141
+ if (typeof password !== 'undefined') {
142
+ payload['password'] = password;
143
+ }
144
+ const uri = new URL(this.client.config.endpoint + apiPath);
145
+
146
+ const apiHeaders: { [header: string]: string } = {
147
+ 'content-type': 'application/json',
148
+ }
149
+
150
+
151
+ return await this.client.call(
152
+ 'patch',
153
+ uri,
154
+ apiHeaders,
155
+ payload
156
+ );
157
+ }
158
+ /**
159
+ * List Identities
160
+ *
161
+ * Get the list of identities for the currently logged in user.
162
+ *
163
+ * @param {string[]} queries
164
+ * @throws {AppcondaException}
165
+ * @returns {Promise<Models.IdentityList>}
166
+ */
167
+ async listIdentities(queries?: string[]): Promise<Models.IdentityList> {
168
+ const apiPath = '/account/identities';
169
+ const payload: Payload = {};
170
+ if (typeof queries !== 'undefined') {
171
+ payload['queries'] = queries;
172
+ }
173
+ const uri = new URL(this.client.config.endpoint + apiPath);
174
+
175
+ const apiHeaders: { [header: string]: string } = {
176
+ 'content-type': 'application/json',
177
+ }
178
+
179
+
180
+ return await this.client.call(
181
+ 'get',
182
+ uri,
183
+ apiHeaders,
184
+ payload
185
+ );
186
+ }
187
+ /**
188
+ * Delete identity
189
+ *
190
+ * Delete an identity by its unique ID.
191
+ *
192
+ * @param {string} identityId
193
+ * @throws {AppcondaException}
194
+ * @returns {Promise<{}>}
195
+ */
196
+ async deleteIdentity(identityId: string): Promise<{}> {
197
+ if (typeof identityId === 'undefined') {
198
+ throw new AppcondaException('Missing required parameter: "identityId"');
199
+ }
200
+ const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
201
+ const payload: Payload = {};
202
+ const uri = new URL(this.client.config.endpoint + apiPath);
203
+
204
+ const apiHeaders: { [header: string]: string } = {
205
+ 'content-type': 'application/json',
206
+ }
207
+
208
+
209
+ return await this.client.call(
210
+ 'delete',
211
+ uri,
212
+ apiHeaders,
213
+ payload
214
+ );
215
+ }
216
+ /**
217
+ * Create JWT
218
+ *
219
+ * Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appconda server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
220
+ *
221
+ * @throws {AppcondaException}
222
+ * @returns {Promise<Models.Jwt>}
223
+ */
224
+ async createJWT(): Promise<Models.Jwt> {
225
+ const apiPath = '/account/jwts';
226
+ const payload: Payload = {};
227
+ const uri = new URL(this.client.config.endpoint + apiPath);
228
+
229
+ const apiHeaders: { [header: string]: string } = {
230
+ 'content-type': 'application/json',
231
+ }
232
+
233
+
234
+ return await this.client.call(
235
+ 'post',
236
+ uri,
237
+ apiHeaders,
238
+ payload
239
+ );
240
+ }
241
+ /**
242
+ * List logs
243
+ *
244
+ * Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
245
+ *
246
+ * @param {string[]} queries
247
+ * @throws {AppcondaException}
248
+ * @returns {Promise<Models.LogList>}
249
+ */
250
+ async listLogs(queries?: string[]): Promise<Models.LogList> {
251
+ const apiPath = '/account/logs';
252
+ const payload: Payload = {};
253
+ if (typeof queries !== 'undefined') {
254
+ payload['queries'] = queries;
255
+ }
256
+ const uri = new URL(this.client.config.endpoint + apiPath);
257
+
258
+ const apiHeaders: { [header: string]: string } = {
259
+ 'content-type': 'application/json',
260
+ }
261
+
262
+
263
+ return await this.client.call(
264
+ 'get',
265
+ uri,
266
+ apiHeaders,
267
+ payload
268
+ );
269
+ }
270
+ /**
271
+ * Update MFA
272
+ *
273
+ * Enable or disable MFA on an account.
274
+ *
275
+ * @param {boolean} mfa
276
+ * @throws {AppcondaException}
277
+ * @returns {Promise<Models.User<Preferences>>}
278
+ */
279
+ async updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences>> {
280
+ if (typeof mfa === 'undefined') {
281
+ throw new AppcondaException('Missing required parameter: "mfa"');
282
+ }
283
+ const apiPath = '/account/mfa';
284
+ const payload: Payload = {};
285
+ if (typeof mfa !== 'undefined') {
286
+ payload['mfa'] = mfa;
287
+ }
288
+ const uri = new URL(this.client.config.endpoint + apiPath);
289
+
290
+ const apiHeaders: { [header: string]: string } = {
291
+ 'content-type': 'application/json',
292
+ }
293
+
294
+
295
+ return await this.client.call(
296
+ 'patch',
297
+ uri,
298
+ apiHeaders,
299
+ payload
300
+ );
301
+ }
302
+ /**
303
+ * Create Authenticator
304
+ *
305
+ * Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
306
+ *
307
+ * @param {AuthenticatorType} type
308
+ * @throws {AppcondaException}
309
+ * @returns {Promise<Models.MfaType>}
310
+ */
311
+ async createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType> {
312
+ if (typeof type === 'undefined') {
313
+ throw new AppcondaException('Missing required parameter: "type"');
314
+ }
315
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
316
+ const payload: Payload = {};
317
+ const uri = new URL(this.client.config.endpoint + apiPath);
318
+
319
+ const apiHeaders: { [header: string]: string } = {
320
+ 'content-type': 'application/json',
321
+ }
322
+
323
+
324
+ return await this.client.call(
325
+ 'post',
326
+ uri,
327
+ apiHeaders,
328
+ payload
329
+ );
330
+ }
331
+ /**
332
+ * Verify Authenticator
333
+ *
334
+ * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
335
+ *
336
+ * @param {AuthenticatorType} type
337
+ * @param {string} otp
338
+ * @throws {AppcondaException}
339
+ * @returns {Promise<Models.User<Preferences>>}
340
+ */
341
+ async updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
342
+ if (typeof type === 'undefined') {
343
+ throw new AppcondaException('Missing required parameter: "type"');
344
+ }
345
+ if (typeof otp === 'undefined') {
346
+ throw new AppcondaException('Missing required parameter: "otp"');
347
+ }
348
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
349
+ const payload: Payload = {};
350
+ if (typeof otp !== 'undefined') {
351
+ payload['otp'] = otp;
352
+ }
353
+ const uri = new URL(this.client.config.endpoint + apiPath);
354
+
355
+ const apiHeaders: { [header: string]: string } = {
356
+ 'content-type': 'application/json',
357
+ }
358
+
359
+
360
+ return await this.client.call(
361
+ 'put',
362
+ uri,
363
+ apiHeaders,
364
+ payload
365
+ );
366
+ }
367
+ /**
368
+ * Delete Authenticator
369
+ *
370
+ * Delete an authenticator for a user by ID.
371
+ *
372
+ * @param {AuthenticatorType} type
373
+ * @throws {AppcondaException}
374
+ * @returns {Promise<{}>}
375
+ */
376
+ async deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> {
377
+ if (typeof type === 'undefined') {
378
+ throw new AppcondaException('Missing required parameter: "type"');
379
+ }
380
+ const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
381
+ const payload: Payload = {};
382
+ const uri = new URL(this.client.config.endpoint + apiPath);
383
+
384
+ const apiHeaders: { [header: string]: string } = {
385
+ 'content-type': 'application/json',
386
+ }
387
+
388
+
389
+ return await this.client.call(
390
+ 'delete',
391
+ uri,
392
+ apiHeaders,
393
+ payload
394
+ );
395
+ }
396
+ /**
397
+ * Create MFA Challenge
398
+ *
399
+ * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
400
+ *
401
+ * @param {AuthenticationFactor} factor
402
+ * @throws {AppcondaException}
403
+ * @returns {Promise<Models.MfaChallenge>}
404
+ */
405
+ async createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge> {
406
+ if (typeof factor === 'undefined') {
407
+ throw new AppcondaException('Missing required parameter: "factor"');
408
+ }
409
+ const apiPath = '/account/mfa/challenge';
410
+ const payload: Payload = {};
411
+ if (typeof factor !== 'undefined') {
412
+ payload['factor'] = factor;
413
+ }
414
+ const uri = new URL(this.client.config.endpoint + apiPath);
415
+
416
+ const apiHeaders: { [header: string]: string } = {
417
+ 'content-type': 'application/json',
418
+ }
419
+
420
+
421
+ return await this.client.call(
422
+ 'post',
423
+ uri,
424
+ apiHeaders,
425
+ payload
426
+ );
427
+ }
428
+ /**
429
+ * Create MFA Challenge (confirmation)
430
+ *
431
+ * 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.
432
+ *
433
+ * @param {string} challengeId
434
+ * @param {string} otp
435
+ * @throws {AppcondaException}
436
+ * @returns {Promise<{}>}
437
+ */
438
+ async updateMfaChallenge(challengeId: string, otp: string): Promise<{}> {
439
+ if (typeof challengeId === 'undefined') {
440
+ throw new AppcondaException('Missing required parameter: "challengeId"');
441
+ }
442
+ if (typeof otp === 'undefined') {
443
+ throw new AppcondaException('Missing required parameter: "otp"');
444
+ }
445
+ const apiPath = '/account/mfa/challenge';
446
+ const payload: Payload = {};
447
+ if (typeof challengeId !== 'undefined') {
448
+ payload['challengeId'] = challengeId;
449
+ }
450
+ if (typeof otp !== 'undefined') {
451
+ payload['otp'] = otp;
452
+ }
453
+ const uri = new URL(this.client.config.endpoint + apiPath);
454
+
455
+ const apiHeaders: { [header: string]: string } = {
456
+ 'content-type': 'application/json',
457
+ }
458
+
459
+
460
+ return await this.client.call(
461
+ 'put',
462
+ uri,
463
+ apiHeaders,
464
+ payload
465
+ );
466
+ }
467
+ /**
468
+ * List Factors
469
+ *
470
+ * List the factors available on the account to be used as a MFA challange.
471
+ *
472
+ * @throws {AppcondaException}
473
+ * @returns {Promise<Models.MfaFactors>}
474
+ */
475
+ async listMfaFactors(): Promise<Models.MfaFactors> {
476
+ const apiPath = '/account/mfa/factors';
477
+ const payload: Payload = {};
478
+ const uri = new URL(this.client.config.endpoint + apiPath);
479
+
480
+ const apiHeaders: { [header: string]: string } = {
481
+ 'content-type': 'application/json',
482
+ }
483
+
484
+
485
+ return await this.client.call(
486
+ 'get',
487
+ uri,
488
+ apiHeaders,
489
+ payload
490
+ );
491
+ }
492
+ /**
493
+ * Get MFA Recovery Codes
494
+ *
495
+ * 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.
496
+ *
497
+ * @throws {AppcondaException}
498
+ * @returns {Promise<Models.MfaRecoveryCodes>}
499
+ */
500
+ async getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
501
+ const apiPath = '/account/mfa/recovery-codes';
502
+ const payload: Payload = {};
503
+ const uri = new URL(this.client.config.endpoint + apiPath);
504
+
505
+ const apiHeaders: { [header: string]: string } = {
506
+ 'content-type': 'application/json',
507
+ }
508
+
509
+
510
+ return await this.client.call(
511
+ 'get',
512
+ uri,
513
+ apiHeaders,
514
+ payload
515
+ );
516
+ }
517
+ /**
518
+ * Create MFA Recovery Codes
519
+ *
520
+ * Generate recovery codes as backup for MFA flow. It&#039;s recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
521
+ *
522
+ * @throws {AppcondaException}
523
+ * @returns {Promise<Models.MfaRecoveryCodes>}
524
+ */
525
+ async createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
526
+ const apiPath = '/account/mfa/recovery-codes';
527
+ const payload: Payload = {};
528
+ const uri = new URL(this.client.config.endpoint + apiPath);
529
+
530
+ const apiHeaders: { [header: string]: string } = {
531
+ 'content-type': 'application/json',
532
+ }
533
+
534
+
535
+ return await this.client.call(
536
+ 'post',
537
+ uri,
538
+ apiHeaders,
539
+ payload
540
+ );
541
+ }
542
+
543
+ /**
544
+ * Regenerate MFA Recovery Codes
545
+ *
546
+ * 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.
547
+ *
548
+ * @throws {AppcondaException}
549
+ * @returns {Promise<Models.MfaRecoveryCodes>}
550
+ */
551
+ async updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
552
+ const apiPath = '/account/mfa/recovery-codes';
553
+ const payload: Payload = {};
554
+ const uri = new URL(this.client.config.endpoint + apiPath);
555
+
556
+ const apiHeaders: { [header: string]: string } = {
557
+ 'content-type': 'application/json',
558
+ }
559
+
560
+
561
+ return await this.client.call(
562
+ 'patch',
563
+ uri,
564
+ apiHeaders,
565
+ payload
566
+ );
567
+ }
568
+ /**
569
+ * Update name
570
+ *
571
+ * Update currently logged in user account name.
572
+ *
573
+ * @param {string} name
574
+ * @throws {AppcondaException}
575
+ * @returns {Promise<Models.User<Preferences>>}
576
+ */
577
+ async updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>> {
578
+ if (typeof name === 'undefined') {
579
+ throw new AppcondaException('Missing required parameter: "name"');
580
+ }
581
+ const apiPath = '/account/name';
582
+ const payload: Payload = {};
583
+ if (typeof name !== 'undefined') {
584
+ payload['name'] = name;
585
+ }
586
+ const uri = new URL(this.client.config.endpoint + apiPath);
587
+
588
+ const apiHeaders: { [header: string]: string } = {
589
+ 'content-type': 'application/json',
590
+ }
591
+
592
+
593
+ return await this.client.call(
594
+ 'patch',
595
+ uri,
596
+ apiHeaders,
597
+ payload
598
+ );
599
+ }
600
+ /**
601
+ * Update password
602
+ *
603
+ * Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
604
+ *
605
+ * @param {string} password
606
+ * @param {string} oldPassword
607
+ * @throws {AppcondaException}
608
+ * @returns {Promise<Models.User<Preferences>>}
609
+ */
610
+ async updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>> {
611
+ if (typeof password === 'undefined') {
612
+ throw new AppcondaException('Missing required parameter: "password"');
613
+ }
614
+ const apiPath = '/account/password';
615
+ const payload: Payload = {};
616
+ if (typeof password !== 'undefined') {
617
+ payload['password'] = password;
618
+ }
619
+ if (typeof oldPassword !== 'undefined') {
620
+ payload['oldPassword'] = oldPassword;
621
+ }
622
+ const uri = new URL(this.client.config.endpoint + apiPath);
623
+
624
+ const apiHeaders: { [header: string]: string } = {
625
+ 'content-type': 'application/json',
626
+ }
627
+
628
+
629
+ return await this.client.call(
630
+ 'patch',
631
+ uri,
632
+ apiHeaders,
633
+ payload
634
+ );
635
+ }
636
+ /**
637
+ * Update phone
638
+ *
639
+ * Update the currently logged in user&#039;s phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appconda.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
640
+ *
641
+ * @param {string} phone
642
+ * @param {string} password
643
+ * @throws {AppcondaException}
644
+ * @returns {Promise<Models.User<Preferences>>}
645
+ */
646
+ async updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>> {
647
+ if (typeof phone === 'undefined') {
648
+ throw new AppcondaException('Missing required parameter: "phone"');
649
+ }
650
+ if (typeof password === 'undefined') {
651
+ throw new AppcondaException('Missing required parameter: "password"');
652
+ }
653
+ const apiPath = '/account/phone';
654
+ const payload: Payload = {};
655
+ if (typeof phone !== 'undefined') {
656
+ payload['phone'] = phone;
657
+ }
658
+ if (typeof password !== 'undefined') {
659
+ payload['password'] = password;
660
+ }
661
+ const uri = new URL(this.client.config.endpoint + apiPath);
662
+
663
+ const apiHeaders: { [header: string]: string } = {
664
+ 'content-type': 'application/json',
665
+ }
666
+
667
+
668
+ return await this.client.call(
669
+ 'patch',
670
+ uri,
671
+ apiHeaders,
672
+ payload
673
+ );
674
+ }
675
+ /**
676
+ * Get account preferences
677
+ *
678
+ * Get the preferences as a key-value object for the currently logged in user.
679
+ *
680
+ * @throws {AppcondaException}
681
+ * @returns {Promise<Preferences>}
682
+ */
683
+ async getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
684
+ const apiPath = '/account/prefs';
685
+ const payload: Payload = {};
686
+ const uri = new URL(this.client.config.endpoint + apiPath);
687
+
688
+ const apiHeaders: { [header: string]: string } = {
689
+ 'content-type': 'application/json',
690
+ }
691
+
692
+
693
+ return await this.client.call(
694
+ 'get',
695
+ uri,
696
+ apiHeaders,
697
+ payload
698
+ );
699
+ }
700
+ /**
701
+ * Update preferences
702
+ *
703
+ * Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
704
+ *
705
+ * @param {Partial<Preferences>} prefs
706
+ * @throws {AppcondaException}
707
+ * @returns {Promise<Models.User<Preferences>>}
708
+ */
709
+ async updatePrefs<Preferences extends Models.Preferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>> {
710
+ if (typeof prefs === 'undefined') {
711
+ throw new AppcondaException('Missing required parameter: "prefs"');
712
+ }
713
+ const apiPath = '/account/prefs';
714
+ const payload: Payload = {};
715
+ if (typeof prefs !== 'undefined') {
716
+ payload['prefs'] = prefs;
717
+ }
718
+ const uri = new URL(this.client.config.endpoint + apiPath);
719
+
720
+ const apiHeaders: { [header: string]: string } = {
721
+ 'content-type': 'application/json',
722
+ }
723
+
724
+
725
+ return await this.client.call(
726
+ 'patch',
727
+ uri,
728
+ apiHeaders,
729
+ payload
730
+ );
731
+ }
732
+ /**
733
+ * Create password recovery
734
+ *
735
+ * Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appconda.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user&#039;s email address is valid for 1 hour.
736
+ *
737
+ * @param {string} email
738
+ * @param {string} url
739
+ * @throws {AppcondaException}
740
+ * @returns {Promise<Models.Token>}
741
+ */
742
+ async createRecovery(email: string, url: string): Promise<Models.Token> {
743
+ if (typeof email === 'undefined') {
744
+ throw new AppcondaException('Missing required parameter: "email"');
745
+ }
746
+ if (typeof url === 'undefined') {
747
+ throw new AppcondaException('Missing required parameter: "url"');
748
+ }
749
+ const apiPath = '/account/recovery';
750
+ const payload: Payload = {};
751
+ if (typeof email !== 'undefined') {
752
+ payload['email'] = email;
753
+ }
754
+ if (typeof url !== 'undefined') {
755
+ payload['url'] = url;
756
+ }
757
+ const uri = new URL(this.client.config.endpoint + apiPath);
758
+
759
+ const apiHeaders: { [header: string]: string } = {
760
+ 'content-type': 'application/json',
761
+ }
762
+
763
+
764
+ return await this.client.call(
765
+ 'post',
766
+ uri,
767
+ apiHeaders,
768
+ payload
769
+ );
770
+ }
771
+ /**
772
+ * Create password recovery (confirmation)
773
+ *
774
+ * 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://appconda.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
775
+
776
+ 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.
777
+ *
778
+ * @param {string} userId
779
+ * @param {string} secret
780
+ * @param {string} password
781
+ * @throws {AppcondaException}
782
+ * @returns {Promise<Models.Token>}
783
+ */
784
+ async updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token> {
785
+ if (typeof userId === 'undefined') {
786
+ throw new AppcondaException('Missing required parameter: "userId"');
787
+ }
788
+ if (typeof secret === 'undefined') {
789
+ throw new AppcondaException('Missing required parameter: "secret"');
790
+ }
791
+ if (typeof password === 'undefined') {
792
+ throw new AppcondaException('Missing required parameter: "password"');
793
+ }
794
+ const apiPath = '/account/recovery';
795
+ const payload: Payload = {};
796
+ if (typeof userId !== 'undefined') {
797
+ payload['userId'] = userId;
798
+ }
799
+ if (typeof secret !== 'undefined') {
800
+ payload['secret'] = secret;
801
+ }
802
+ if (typeof password !== 'undefined') {
803
+ payload['password'] = password;
804
+ }
805
+ const uri = new URL(this.client.config.endpoint + apiPath);
806
+
807
+ const apiHeaders: { [header: string]: string } = {
808
+ 'content-type': 'application/json',
809
+ }
810
+
811
+
812
+ return await this.client.call(
813
+ 'put',
814
+ uri,
815
+ apiHeaders,
816
+ payload
817
+ );
818
+ }
819
+ /**
820
+ * List sessions
821
+ *
822
+ * Get the list of active sessions across different devices for the currently logged in user.
823
+ *
824
+ * @throws {AppcondaException}
825
+ * @returns {Promise<Models.SessionList>}
826
+ */
827
+ async listSessions(): Promise<Models.SessionList> {
828
+ const apiPath = '/account/sessions';
829
+ const payload: Payload = {};
830
+ const uri = new URL(this.client.config.endpoint + apiPath);
831
+
832
+ const apiHeaders: { [header: string]: string } = {
833
+ 'content-type': 'application/json',
834
+ }
835
+
836
+
837
+ return await this.client.call(
838
+ 'get',
839
+ uri,
840
+ apiHeaders,
841
+ payload
842
+ );
843
+ }
844
+ /**
845
+ * Delete sessions
846
+ *
847
+ * Delete all sessions from the user account and remove any sessions cookies from the end client.
848
+ *
849
+ * @throws {AppcondaException}
850
+ * @returns {Promise<{}>}
851
+ */
852
+ async deleteSessions(): Promise<{}> {
853
+ const apiPath = '/account/sessions';
854
+ const payload: Payload = {};
855
+ const uri = new URL(this.client.config.endpoint + apiPath);
856
+
857
+ const apiHeaders: { [header: string]: string } = {
858
+ 'content-type': 'application/json',
859
+ }
860
+
861
+
862
+ return await this.client.call(
863
+ 'delete',
864
+ uri,
865
+ apiHeaders,
866
+ payload
867
+ );
868
+ }
869
+ /**
870
+ * Create anonymous session
871
+ *
872
+ * Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appconda.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appconda.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
873
+ *
874
+ * @throws {AppcondaException}
875
+ * @returns {Promise<Models.Session>}
876
+ */
877
+ async createAnonymousSession(): Promise<Models.Session> {
878
+ const apiPath = '/account/sessions/anonymous';
879
+ const payload: Payload = {};
880
+ const uri = new URL(this.client.config.endpoint + apiPath);
881
+
882
+ const apiHeaders: { [header: string]: string } = {
883
+ 'content-type': 'application/json',
884
+ }
885
+
886
+
887
+ return await this.client.call(
888
+ 'post',
889
+ uri,
890
+ apiHeaders,
891
+ payload
892
+ );
893
+ }
894
+ /**
895
+ * Create email password session
896
+ *
897
+ * 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.
898
+
899
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
900
+ *
901
+ * @param {string} email
902
+ * @param {string} password
903
+ * @throws {AppcondaException}
904
+ * @returns {Promise<Models.Session>}
905
+ */
906
+ async createEmailPasswordSession(email: string, password: string): Promise<Models.Session> {
907
+ if (typeof email === 'undefined') {
908
+ throw new AppcondaException('Missing required parameter: "email"');
909
+ }
910
+ if (typeof password === 'undefined') {
911
+ throw new AppcondaException('Missing required parameter: "password"');
912
+ }
913
+ const apiPath = '/account/sessions/email';
914
+ const payload: Payload = {};
915
+ if (typeof email !== 'undefined') {
916
+ payload['email'] = email;
917
+ }
918
+ if (typeof password !== 'undefined') {
919
+ payload['password'] = password;
920
+ }
921
+ const uri = new URL(this.client.config.endpoint + apiPath);
922
+
923
+ const apiHeaders: { [header: string]: string } = {
924
+ 'content-type': 'application/json',
925
+ }
926
+
927
+
928
+ return await this.client.call(
929
+ 'post',
930
+ uri,
931
+ apiHeaders,
932
+ payload
933
+ );
934
+ }
935
+ /**
936
+ * Update magic URL session
937
+ *
938
+ * 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.
939
+ *
940
+ * @param {string} userId
941
+ * @param {string} secret
942
+ * @throws {AppcondaException}
943
+ * @returns {Promise<Models.Session>}
944
+ */
945
+ async updateMagicURLSession(userId: string, secret: string): Promise<Models.Session> {
946
+ if (typeof userId === 'undefined') {
947
+ throw new AppcondaException('Missing required parameter: "userId"');
948
+ }
949
+ if (typeof secret === 'undefined') {
950
+ throw new AppcondaException('Missing required parameter: "secret"');
951
+ }
952
+ const apiPath = '/account/sessions/magic-url';
953
+ const payload: Payload = {};
954
+ if (typeof userId !== 'undefined') {
955
+ payload['userId'] = userId;
956
+ }
957
+ if (typeof secret !== 'undefined') {
958
+ payload['secret'] = secret;
959
+ }
960
+ const uri = new URL(this.client.config.endpoint + apiPath);
961
+
962
+ const apiHeaders: { [header: string]: string } = {
963
+ 'content-type': 'application/json',
964
+ }
965
+
966
+
967
+ return await this.client.call(
968
+ 'put',
969
+ uri,
970
+ apiHeaders,
971
+ payload
972
+ );
973
+ }
974
+ /**
975
+ * Create OAuth2 session
976
+ *
977
+ * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appconda console first. Use the success and failure arguments to provide a redirect URL&#039;s back to your app when login is completed.
978
+
979
+ 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.
980
+
981
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
982
+
983
+ *
984
+ * @param {OAuthProvider} provider
985
+ * @param {string} success
986
+ * @param {string} failure
987
+ * @param {string[]} scopes
988
+ * @throws {AppcondaException}
989
+ * @returns {Promise<void | string>}
990
+ */
991
+ async createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<void | string> {
992
+
993
+ if (typeof provider === 'undefined') {
994
+ throw new AppcondaException('Missing required parameter: "provider"');
995
+ }
996
+ const apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
997
+ const payload: Payload = {};
998
+ if (typeof success !== 'undefined') {
999
+ payload['success'] = success;
1000
+ }
1001
+ if (typeof failure !== 'undefined') {
1002
+ payload['failure'] = failure;
1003
+ }
1004
+ if (typeof scopes !== 'undefined') {
1005
+ payload['scopes'] = scopes;
1006
+ }
1007
+ const uri = new URL(this.client.config.endpoint + apiPath);
1008
+
1009
+ const apiHeaders: { [header: string]: string } = {
1010
+ 'content-type': 'application/json',
1011
+ }
1012
+
1013
+ payload['project'] = this.client.config.project;
1014
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1015
+ uri.searchParams.append(key, value);
1016
+ }
1017
+
1018
+ if (typeof window !== 'undefined' && window?.location) {
1019
+ window.location.href = uri.toString();
1020
+ return;
1021
+ } else {
1022
+ return uri.toString();
1023
+ }
1024
+ }
1025
+ /**
1026
+ * Update phone session
1027
+ *
1028
+ * 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.
1029
+ *
1030
+ * @param {string} userId
1031
+ * @param {string} secret
1032
+ * @throws {AppcondaException}
1033
+ * @returns {Promise<Models.Session>}
1034
+ */
1035
+ async updatePhoneSession(userId: string, secret: string): Promise<Models.Session> {
1036
+ if (typeof userId === 'undefined') {
1037
+ throw new AppcondaException('Missing required parameter: "userId"');
1038
+ }
1039
+ if (typeof secret === 'undefined') {
1040
+ throw new AppcondaException('Missing required parameter: "secret"');
1041
+ }
1042
+ const apiPath = '/account/sessions/phone';
1043
+ const payload: Payload = {};
1044
+ if (typeof userId !== 'undefined') {
1045
+ payload['userId'] = userId;
1046
+ }
1047
+ if (typeof secret !== 'undefined') {
1048
+ payload['secret'] = secret;
1049
+ }
1050
+ const uri = new URL(this.client.config.endpoint + apiPath);
1051
+
1052
+ const apiHeaders: { [header: string]: string } = {
1053
+ 'content-type': 'application/json',
1054
+ }
1055
+
1056
+
1057
+ return await this.client.call(
1058
+ 'put',
1059
+ uri,
1060
+ apiHeaders,
1061
+ payload
1062
+ );
1063
+ }
1064
+ /**
1065
+ * Create session
1066
+ *
1067
+ * 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.
1068
+ *
1069
+ * @param {string} userId
1070
+ * @param {string} secret
1071
+ * @throws {AppcondaException}
1072
+ * @returns {Promise<Models.Session>}
1073
+ */
1074
+ async createSession(userId: string, secret: string): Promise<Models.Session> {
1075
+ if (typeof userId === 'undefined') {
1076
+ throw new AppcondaException('Missing required parameter: "userId"');
1077
+ }
1078
+ if (typeof secret === 'undefined') {
1079
+ throw new AppcondaException('Missing required parameter: "secret"');
1080
+ }
1081
+ const apiPath = '/account/sessions/token';
1082
+ const payload: Payload = {};
1083
+ if (typeof userId !== 'undefined') {
1084
+ payload['userId'] = userId;
1085
+ }
1086
+ if (typeof secret !== 'undefined') {
1087
+ payload['secret'] = secret;
1088
+ }
1089
+ const uri = new URL(this.client.config.endpoint + apiPath);
1090
+
1091
+ const apiHeaders: { [header: string]: string } = {
1092
+ 'content-type': 'application/json',
1093
+ }
1094
+
1095
+
1096
+ return await this.client.call(
1097
+ 'post',
1098
+ uri,
1099
+ apiHeaders,
1100
+ payload
1101
+ );
1102
+ }
1103
+ /**
1104
+ * Get session
1105
+ *
1106
+ * Use this endpoint to get a logged in user&#039;s session using a Session ID. Inputting &#039;current&#039; will return the current session being used.
1107
+ *
1108
+ * @param {string} sessionId
1109
+ * @throws {AppcondaException}
1110
+ * @returns {Promise<Models.Session>}
1111
+ */
1112
+ async getSession(sessionId: string): Promise<Models.Session> {
1113
+ if (typeof sessionId === 'undefined') {
1114
+ throw new AppcondaException('Missing required parameter: "sessionId"');
1115
+ }
1116
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1117
+ const payload: Payload = {};
1118
+ const uri = new URL(this.client.config.endpoint + apiPath);
1119
+
1120
+ const apiHeaders: { [header: string]: string } = {
1121
+ 'content-type': 'application/json',
1122
+ }
1123
+
1124
+
1125
+ return await this.client.call(
1126
+ 'get',
1127
+ uri,
1128
+ apiHeaders,
1129
+ payload
1130
+ );
1131
+ }
1132
+ /**
1133
+ * Update session
1134
+ *
1135
+ * Use this endpoint to extend a session&#039;s length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
1136
+ *
1137
+ * @param {string} sessionId
1138
+ * @throws {AppcondaException}
1139
+ * @returns {Promise<Models.Session>}
1140
+ */
1141
+ async updateSession(sessionId: string): Promise<Models.Session> {
1142
+ if (typeof sessionId === 'undefined') {
1143
+ throw new AppcondaException('Missing required parameter: "sessionId"');
1144
+ }
1145
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1146
+ const payload: Payload = {};
1147
+ const uri = new URL(this.client.config.endpoint + apiPath);
1148
+
1149
+ const apiHeaders: { [header: string]: string } = {
1150
+ 'content-type': 'application/json',
1151
+ }
1152
+
1153
+
1154
+ return await this.client.call(
1155
+ 'patch',
1156
+ uri,
1157
+ apiHeaders,
1158
+ payload
1159
+ );
1160
+ }
1161
+ /**
1162
+ * Delete session
1163
+ *
1164
+ * Logout the user. Use &#039;current&#039; as the session ID to logout on this device, use a session ID to logout on another device. If you&#039;re looking to logout the user on all devices, use [Delete Sessions](https://appconda.io/docs/references/cloud/client-web/account#deleteSessions) instead.
1165
+ *
1166
+ * @param {string} sessionId
1167
+ * @throws {AppcondaException}
1168
+ * @returns {Promise<{}>}
1169
+ */
1170
+ async deleteSession(sessionId: string): Promise<{}> {
1171
+ if (typeof sessionId === 'undefined') {
1172
+ throw new AppcondaException('Missing required parameter: "sessionId"');
1173
+ }
1174
+ const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
1175
+ const payload: Payload = {};
1176
+ const uri = new URL(this.client.config.endpoint + apiPath);
1177
+
1178
+ const apiHeaders: { [header: string]: string } = {
1179
+ 'content-type': 'application/json',
1180
+ }
1181
+
1182
+
1183
+ return await this.client.call(
1184
+ 'delete',
1185
+ uri,
1186
+ apiHeaders,
1187
+ payload
1188
+ );
1189
+ }
1190
+ /**
1191
+ * Update status
1192
+ *
1193
+ * 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.
1194
+ *
1195
+ * @throws {AppcondaException}
1196
+ * @returns {Promise<Models.User<Preferences>>}
1197
+ */
1198
+ async updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
1199
+ const apiPath = '/account/status';
1200
+ const payload: Payload = {};
1201
+ const uri = new URL(this.client.config.endpoint + apiPath);
1202
+
1203
+ const apiHeaders: { [header: string]: string } = {
1204
+ 'content-type': 'application/json',
1205
+ }
1206
+
1207
+
1208
+ return await this.client.call(
1209
+ 'patch',
1210
+ uri,
1211
+ apiHeaders,
1212
+ payload
1213
+ );
1214
+ }
1215
+ /**
1216
+ * Create push target
1217
+ *
1218
+ *
1219
+ * @param {string} targetId
1220
+ * @param {string} identifier
1221
+ * @param {string} providerId
1222
+ * @throws {AppcondaException}
1223
+ * @returns {Promise<Models.Target>}
1224
+ */
1225
+ async createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target> {
1226
+ if (typeof targetId === 'undefined') {
1227
+ throw new AppcondaException('Missing required parameter: "targetId"');
1228
+ }
1229
+ if (typeof identifier === 'undefined') {
1230
+ throw new AppcondaException('Missing required parameter: "identifier"');
1231
+ }
1232
+ const apiPath = '/account/targets/push';
1233
+ const payload: Payload = {};
1234
+ if (typeof targetId !== 'undefined') {
1235
+ payload['targetId'] = targetId;
1236
+ }
1237
+ if (typeof identifier !== 'undefined') {
1238
+ payload['identifier'] = identifier;
1239
+ }
1240
+ if (typeof providerId !== 'undefined') {
1241
+ payload['providerId'] = providerId;
1242
+ }
1243
+ const uri = new URL(this.client.config.endpoint + apiPath);
1244
+
1245
+ const apiHeaders: { [header: string]: string } = {
1246
+ 'content-type': 'application/json',
1247
+ }
1248
+
1249
+
1250
+ return await this.client.call(
1251
+ 'post',
1252
+ uri,
1253
+ apiHeaders,
1254
+ payload
1255
+ );
1256
+ }
1257
+ /**
1258
+ * Update push target
1259
+ *
1260
+ *
1261
+ * @param {string} targetId
1262
+ * @param {string} identifier
1263
+ * @throws {AppcondaException}
1264
+ * @returns {Promise<Models.Target>}
1265
+ */
1266
+ async updatePushTarget(targetId: string, identifier: string): Promise<Models.Target> {
1267
+ if (typeof targetId === 'undefined') {
1268
+ throw new AppcondaException('Missing required parameter: "targetId"');
1269
+ }
1270
+ if (typeof identifier === 'undefined') {
1271
+ throw new AppcondaException('Missing required parameter: "identifier"');
1272
+ }
1273
+ const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
1274
+ const payload: Payload = {};
1275
+ if (typeof identifier !== 'undefined') {
1276
+ payload['identifier'] = identifier;
1277
+ }
1278
+ const uri = new URL(this.client.config.endpoint + apiPath);
1279
+
1280
+ const apiHeaders: { [header: string]: string } = {
1281
+ 'content-type': 'application/json',
1282
+ }
1283
+
1284
+
1285
+ return await this.client.call(
1286
+ 'put',
1287
+ uri,
1288
+ apiHeaders,
1289
+ payload
1290
+ );
1291
+ }
1292
+ /**
1293
+ * Delete push target
1294
+ *
1295
+ *
1296
+ * @param {string} targetId
1297
+ * @throws {AppcondaException}
1298
+ * @returns {Promise<{}>}
1299
+ */
1300
+ async deletePushTarget(targetId: string): Promise<{}> {
1301
+ if (typeof targetId === 'undefined') {
1302
+ throw new AppcondaException('Missing required parameter: "targetId"');
1303
+ }
1304
+ const apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
1305
+ const payload: Payload = {};
1306
+ const uri = new URL(this.client.config.endpoint + apiPath);
1307
+
1308
+ const apiHeaders: { [header: string]: string } = {
1309
+ 'content-type': 'application/json',
1310
+ }
1311
+
1312
+
1313
+ return await this.client.call(
1314
+ 'delete',
1315
+ uri,
1316
+ apiHeaders,
1317
+ payload
1318
+ );
1319
+ }
1320
+ /**
1321
+ * Create email token (OTP)
1322
+ *
1323
+ * 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://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user&#039;s email is valid for 15 minutes.
1324
+
1325
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
1326
+ *
1327
+ * @param {string} userId
1328
+ * @param {string} email
1329
+ * @param {boolean} phrase
1330
+ * @throws {AppcondaException}
1331
+ * @returns {Promise<Models.Token>}
1332
+ */
1333
+ async createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token> {
1334
+ if (typeof userId === 'undefined') {
1335
+ throw new AppcondaException('Missing required parameter: "userId"');
1336
+ }
1337
+ if (typeof email === 'undefined') {
1338
+ throw new AppcondaException('Missing required parameter: "email"');
1339
+ }
1340
+ const apiPath = '/account/tokens/email';
1341
+ const payload: Payload = {};
1342
+ if (typeof userId !== 'undefined') {
1343
+ payload['userId'] = userId;
1344
+ }
1345
+ if (typeof email !== 'undefined') {
1346
+ payload['email'] = email;
1347
+ }
1348
+ if (typeof phrase !== 'undefined') {
1349
+ payload['phrase'] = phrase;
1350
+ }
1351
+ const uri = new URL(this.client.config.endpoint + apiPath);
1352
+
1353
+ const apiHeaders: { [header: string]: string } = {
1354
+ 'content-type': 'application/json',
1355
+ }
1356
+
1357
+
1358
+ return await this.client.call(
1359
+ 'post',
1360
+ uri,
1361
+ apiHeaders,
1362
+ payload
1363
+ );
1364
+ }
1365
+ /**
1366
+ * Create magic URL token
1367
+ *
1368
+ * 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://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user&#039;s email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appconda instance by default.
1369
+
1370
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
1371
+
1372
+ *
1373
+ * @param {string} userId
1374
+ * @param {string} email
1375
+ * @param {string} url
1376
+ * @param {boolean} phrase
1377
+ * @throws {AppcondaException}
1378
+ * @returns {Promise<Models.Token>}
1379
+ */
1380
+ async createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token> {
1381
+ if (typeof userId === 'undefined') {
1382
+ throw new AppcondaException('Missing required parameter: "userId"');
1383
+ }
1384
+ if (typeof email === 'undefined') {
1385
+ throw new AppcondaException('Missing required parameter: "email"');
1386
+ }
1387
+ const apiPath = '/account/tokens/magic-url';
1388
+ const payload: 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
+ const uri = new URL(this.client.config.endpoint + apiPath);
1402
+
1403
+ const apiHeaders: { [header: string]: string } = {
1404
+ 'content-type': 'application/json',
1405
+ }
1406
+
1407
+
1408
+ return await this.client.call(
1409
+ 'post',
1410
+ uri,
1411
+ apiHeaders,
1412
+ payload
1413
+ );
1414
+ }
1415
+ /**
1416
+ * Create OAuth2 token
1417
+ *
1418
+ * Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appconda console first. Use the success and failure arguments to provide a redirect URL&#039;s back to your app when login is completed.
1419
+
1420
+ 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://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint.
1421
+
1422
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
1423
+ *
1424
+ * @param {OAuthProvider} provider
1425
+ * @param {string} success
1426
+ * @param {string} failure
1427
+ * @param {string[]} scopes
1428
+ * @throws {AppcondaException}
1429
+ * @returns {Promise<void | string>}
1430
+ */
1431
+ async createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<void | string> {
1432
+ if (typeof provider === 'undefined') {
1433
+ throw new AppcondaException('Missing required parameter: "provider"');
1434
+ }
1435
+ const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
1436
+ const payload: Payload = {};
1437
+ if (typeof success !== 'undefined') {
1438
+ payload['success'] = success;
1439
+ }
1440
+ if (typeof failure !== 'undefined') {
1441
+ payload['failure'] = failure;
1442
+ }
1443
+ if (typeof scopes !== 'undefined') {
1444
+ payload['scopes'] = scopes;
1445
+ }
1446
+ const uri = new URL(this.client.config.endpoint + apiPath);
1447
+
1448
+ const apiHeaders: { [header: string]: string } = {
1449
+ 'content-type': 'application/json',
1450
+ }
1451
+
1452
+ payload['project'] = this.client.config.project;
1453
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1454
+ uri.searchParams.append(key, value);
1455
+ }
1456
+
1457
+ if (typeof window !== 'undefined' && window?.location) {
1458
+ window.location.href = uri.toString();
1459
+ return;
1460
+ } else {
1461
+ return uri.toString();
1462
+ }
1463
+ }
1464
+ /**
1465
+ * Create phone token
1466
+ *
1467
+ * 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://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user&#039;s phone is valid for 15 minutes.
1468
+
1469
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
1470
+ *
1471
+ * @param {string} userId
1472
+ * @param {string} phone
1473
+ * @throws {AppcondaException}
1474
+ * @returns {Promise<Models.Token>}
1475
+ */
1476
+ async createPhoneToken(userId: string, phone: string): Promise<Models.Token> {
1477
+ if (typeof userId === 'undefined') {
1478
+ throw new AppcondaException('Missing required parameter: "userId"');
1479
+ }
1480
+ if (typeof phone === 'undefined') {
1481
+ throw new AppcondaException('Missing required parameter: "phone"');
1482
+ }
1483
+ const apiPath = '/account/tokens/phone';
1484
+ const payload: Payload = {};
1485
+ if (typeof userId !== 'undefined') {
1486
+ payload['userId'] = userId;
1487
+ }
1488
+ if (typeof phone !== 'undefined') {
1489
+ payload['phone'] = phone;
1490
+ }
1491
+ const uri = new URL(this.client.config.endpoint + apiPath);
1492
+
1493
+ const apiHeaders: { [header: string]: string } = {
1494
+ 'content-type': 'application/json',
1495
+ }
1496
+
1497
+
1498
+ return await this.client.call(
1499
+ 'post',
1500
+ uri,
1501
+ apiHeaders,
1502
+ payload
1503
+ );
1504
+ }
1505
+ /**
1506
+ * Create email verification
1507
+ *
1508
+ * 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://appconda.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user&#039;s email address is valid for 7 days.
1509
+
1510
+ 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.
1511
+
1512
+ *
1513
+ * @param {string} url
1514
+ * @throws {AppcondaException}
1515
+ * @returns {Promise<Models.Token>}
1516
+ */
1517
+ async createVerification(url: string): Promise<Models.Token> {
1518
+ if (typeof url === 'undefined') {
1519
+ throw new AppcondaException('Missing required parameter: "url"');
1520
+ }
1521
+ const apiPath = '/account/verification';
1522
+ const payload: Payload = {};
1523
+ if (typeof url !== 'undefined') {
1524
+ payload['url'] = url;
1525
+ }
1526
+ const uri = new URL(this.client.config.endpoint + apiPath);
1527
+
1528
+ const apiHeaders: { [header: string]: string } = {
1529
+ 'content-type': 'application/json',
1530
+ }
1531
+
1532
+
1533
+ return await this.client.call(
1534
+ 'post',
1535
+ uri,
1536
+ apiHeaders,
1537
+ payload
1538
+ );
1539
+ }
1540
+ /**
1541
+ * Create email verification (confirmation)
1542
+ *
1543
+ * Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
1544
+ *
1545
+ * @param {string} userId
1546
+ * @param {string} secret
1547
+ * @throws {AppcondaException}
1548
+ * @returns {Promise<Models.Token>}
1549
+ */
1550
+ async updateVerification(userId: string, secret: string): Promise<Models.Token> {
1551
+ if (typeof userId === 'undefined') {
1552
+ throw new AppcondaException('Missing required parameter: "userId"');
1553
+ }
1554
+ if (typeof secret === 'undefined') {
1555
+ throw new AppcondaException('Missing required parameter: "secret"');
1556
+ }
1557
+ const apiPath = '/account/verification';
1558
+ const payload: Payload = {};
1559
+ if (typeof userId !== 'undefined') {
1560
+ payload['userId'] = userId;
1561
+ }
1562
+ if (typeof secret !== 'undefined') {
1563
+ payload['secret'] = secret;
1564
+ }
1565
+ const uri = new URL(this.client.config.endpoint + apiPath);
1566
+
1567
+ const apiHeaders: { [header: string]: string } = {
1568
+ 'content-type': 'application/json',
1569
+ }
1570
+
1571
+
1572
+ return await this.client.call(
1573
+ 'put',
1574
+ uri,
1575
+ apiHeaders,
1576
+ payload
1577
+ );
1578
+ }
1579
+ /**
1580
+ * Create phone verification
1581
+ *
1582
+ * Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user&#039;s phone number using the [accountUpdatePhone](https://appconda.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appconda.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user&#039;s phone number is valid for 15 minutes.
1583
+ *
1584
+ * @throws {AppcondaException}
1585
+ * @returns {Promise<Models.Token>}
1586
+ */
1587
+ async createPhoneVerification(): Promise<Models.Token> {
1588
+ const apiPath = '/account/verification/phone';
1589
+ const payload: Payload = {};
1590
+ const uri = new URL(this.client.config.endpoint + apiPath);
1591
+
1592
+ const apiHeaders: { [header: string]: string } = {
1593
+ 'content-type': 'application/json',
1594
+ }
1595
+
1596
+
1597
+ return await this.client.call(
1598
+ 'post',
1599
+ uri,
1600
+ apiHeaders,
1601
+ payload
1602
+ );
1603
+ }
1604
+ /**
1605
+ * Update phone verification (confirmation)
1606
+ *
1607
+ * Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user&#039;s phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
1608
+ *
1609
+ * @param {string} userId
1610
+ * @param {string} secret
1611
+ * @throws {AppcondaException}
1612
+ * @returns {Promise<Models.Token>}
1613
+ */
1614
+ async updatePhoneVerification(userId: string, secret: string): Promise<Models.Token> {
1615
+ if (typeof userId === 'undefined') {
1616
+ throw new AppcondaException('Missing required parameter: "userId"');
1617
+ }
1618
+ if (typeof secret === 'undefined') {
1619
+ throw new AppcondaException('Missing required parameter: "secret"');
1620
+ }
1621
+ const apiPath = '/account/verification/phone';
1622
+ const payload: Payload = {};
1623
+ if (typeof userId !== 'undefined') {
1624
+ payload['userId'] = userId;
1625
+ }
1626
+ if (typeof secret !== 'undefined') {
1627
+ payload['secret'] = secret;
1628
+ }
1629
+ const uri = new URL(this.client.config.endpoint + apiPath);
1630
+
1631
+ const apiHeaders: { [header: string]: string } = {
1632
+ 'content-type': 'application/json',
1633
+ }
1634
+
1635
+
1636
+ return await this.client.call(
1637
+ 'put',
1638
+ uri,
1639
+ apiHeaders,
1640
+ payload
1641
+ );
1642
+ }
1643
+ }