appwrite-console 0.1.0__py3-none-any.whl

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 (552) hide show
  1. appwrite_console/__init__.py +1 -0
  2. appwrite_console/client.py +371 -0
  3. appwrite_console/encoders/__init__.py +1 -0
  4. appwrite_console/encoders/value_class_encoder.py +373 -0
  5. appwrite_console/enums/__init__.py +1 -0
  6. appwrite_console/enums/account_key_scopes.py +6 -0
  7. appwrite_console/enums/adapter.py +5 -0
  8. appwrite_console/enums/addon.py +7 -0
  9. appwrite_console/enums/appwrite_migration_resource.py +42 -0
  10. appwrite_console/enums/attribute_status.py +8 -0
  11. appwrite_console/enums/authentication_factor.py +7 -0
  12. appwrite_console/enums/authenticator_type.py +4 -0
  13. appwrite_console/enums/backup_services.py +10 -0
  14. appwrite_console/enums/billing_plan_group.py +6 -0
  15. appwrite_console/enums/block_mode.py +5 -0
  16. appwrite_console/enums/block_resource_type.py +12 -0
  17. appwrite_console/enums/browser.py +17 -0
  18. appwrite_console/enums/browser_permission.py +23 -0
  19. appwrite_console/enums/browser_theme.py +5 -0
  20. appwrite_console/enums/build_runtime.py +95 -0
  21. appwrite_console/enums/cache_database.py +6 -0
  22. appwrite_console/enums/cache_target.py +9 -0
  23. appwrite_console/enums/column_status.py +8 -0
  24. appwrite_console/enums/compression.py +6 -0
  25. appwrite_console/enums/console_resource_type.py +4 -0
  26. appwrite_console/enums/credit_card.py +20 -0
  27. appwrite_console/enums/database_status.py +17 -0
  28. appwrite_console/enums/database_type.py +10 -0
  29. appwrite_console/enums/databases_index_type.py +7 -0
  30. appwrite_console/enums/deployment_download_type.py +5 -0
  31. appwrite_console/enums/deployment_status.py +9 -0
  32. appwrite_console/enums/detection_framework_type.py +4 -0
  33. appwrite_console/enums/detection_runtime_type.py +4 -0
  34. appwrite_console/enums/documents_db_index_type.py +6 -0
  35. appwrite_console/enums/domain_purchase_status.py +7 -0
  36. appwrite_console/enums/domain_registration_type.py +7 -0
  37. appwrite_console/enums/domain_suggestion_type.py +5 -0
  38. appwrite_console/enums/domain_transfer_status_enum.py +11 -0
  39. appwrite_console/enums/embedding_model.py +7 -0
  40. appwrite_console/enums/execution_method.py +10 -0
  41. appwrite_console/enums/execution_status.py +8 -0
  42. appwrite_console/enums/execution_trigger.py +6 -0
  43. appwrite_console/enums/firebase_migration_resource.py +13 -0
  44. appwrite_console/enums/flag.py +198 -0
  45. appwrite_console/enums/framework.py +18 -0
  46. appwrite_console/enums/function_template_use_case.py +10 -0
  47. appwrite_console/enums/image_format.py +10 -0
  48. appwrite_console/enums/image_gravity.py +12 -0
  49. appwrite_console/enums/index_status.py +8 -0
  50. appwrite_console/enums/message_priority.py +5 -0
  51. appwrite_console/enums/message_status.py +8 -0
  52. appwrite_console/enums/messaging_provider_type.py +6 -0
  53. appwrite_console/enums/n_host_migration_resource.py +14 -0
  54. appwrite_console/enums/o_auth2_google_prompt.py +6 -0
  55. appwrite_console/enums/o_auth2_oidc_prompt.py +7 -0
  56. appwrite_console/enums/o_auth_provider.py +47 -0
  57. appwrite_console/enums/on_duplicate.py +6 -0
  58. appwrite_console/enums/order_by.py +5 -0
  59. appwrite_console/enums/organization_key_scopes.py +19 -0
  60. appwrite_console/enums/password_hash.py +14 -0
  61. appwrite_console/enums/platform.py +5 -0
  62. appwrite_console/enums/platform_type.py +8 -0
  63. appwrite_console/enums/project_auth_method_id.py +10 -0
  64. appwrite_console/enums/project_email_template_id.py +10 -0
  65. appwrite_console/enums/project_email_template_locale.py +134 -0
  66. appwrite_console/enums/project_key_scopes.py +107 -0
  67. appwrite_console/enums/project_o_auth2_google_prompt.py +6 -0
  68. appwrite_console/enums/project_o_auth2_oidc_prompt.py +7 -0
  69. appwrite_console/enums/project_o_auth_provider_id.py +47 -0
  70. appwrite_console/enums/project_policy_id.py +17 -0
  71. appwrite_console/enums/project_protocol_id.py +6 -0
  72. appwrite_console/enums/project_service_id.py +22 -0
  73. appwrite_console/enums/project_smtp_secure.py +5 -0
  74. appwrite_console/enums/project_usage_range.py +5 -0
  75. appwrite_console/enums/proxy_resource_type.py +5 -0
  76. appwrite_console/enums/proxy_rule_deployment_resource_type.py +5 -0
  77. appwrite_console/enums/proxy_rule_status.py +6 -0
  78. appwrite_console/enums/query_suggestion_resource.py +97 -0
  79. appwrite_console/enums/region.py +9 -0
  80. appwrite_console/enums/relation_mutate.py +6 -0
  81. appwrite_console/enums/relationship_type.py +7 -0
  82. appwrite_console/enums/runtime.py +95 -0
  83. appwrite_console/enums/schedule_resource_type.py +7 -0
  84. appwrite_console/enums/site_template_use_case.py +12 -0
  85. appwrite_console/enums/smtp_encryption.py +6 -0
  86. appwrite_console/enums/status.py +4 -0
  87. appwrite_console/enums/status_code.py +7 -0
  88. appwrite_console/enums/supabase_migration_resource.py +14 -0
  89. appwrite_console/enums/tables_db_index_type.py +7 -0
  90. appwrite_console/enums/template_reference_type.py +6 -0
  91. appwrite_console/enums/timezone.py +422 -0
  92. appwrite_console/enums/usage_range.py +6 -0
  93. appwrite_console/enums/vcs_detection_type.py +5 -0
  94. appwrite_console/enums/vcs_reference_type.py +6 -0
  95. appwrite_console/enums/vectors_db_index_type.py +9 -0
  96. appwrite_console/enums/waf_rule_action.py +8 -0
  97. appwrite_console/exception.py +7 -0
  98. appwrite_console/id.py +26 -0
  99. appwrite_console/input_file.py +21 -0
  100. appwrite_console/models/__init__.py +803 -0
  101. appwrite_console/models/activity_event.py +99 -0
  102. appwrite_console/models/activity_event_list.py +19 -0
  103. appwrite_console/models/additional_resource.py +30 -0
  104. appwrite_console/models/addon.py +42 -0
  105. appwrite_console/models/addon_list.py +19 -0
  106. appwrite_console/models/addon_price.py +36 -0
  107. appwrite_console/models/aggregation_breakdown.py +28 -0
  108. appwrite_console/models/aggregation_team.py +101 -0
  109. appwrite_console/models/aggregation_team_list.py +19 -0
  110. appwrite_console/models/algo_argon2.py +24 -0
  111. appwrite_console/models/algo_bcrypt.py +15 -0
  112. appwrite_console/models/algo_md5.py +15 -0
  113. appwrite_console/models/algo_phpass.py +15 -0
  114. appwrite_console/models/algo_scrypt.py +27 -0
  115. appwrite_console/models/algo_scrypt_modified.py +24 -0
  116. appwrite_console/models/algo_sha.py +15 -0
  117. appwrite_console/models/app.py +91 -0
  118. appwrite_console/models/app_installation.py +42 -0
  119. appwrite_console/models/app_installation_list.py +19 -0
  120. appwrite_console/models/app_key.py +39 -0
  121. appwrite_console/models/app_key_list.py +19 -0
  122. appwrite_console/models/app_scope.py +27 -0
  123. appwrite_console/models/app_scope_list.py +19 -0
  124. appwrite_console/models/app_secret.py +39 -0
  125. appwrite_console/models/app_secret_list.py +19 -0
  126. appwrite_console/models/app_secret_plaintext.py +39 -0
  127. appwrite_console/models/apps_list.py +19 -0
  128. appwrite_console/models/attribute_bigint.py +46 -0
  129. appwrite_console/models/attribute_boolean.py +40 -0
  130. appwrite_console/models/attribute_datetime.py +43 -0
  131. appwrite_console/models/attribute_email.py +43 -0
  132. appwrite_console/models/attribute_enum.py +46 -0
  133. appwrite_console/models/attribute_float.py +46 -0
  134. appwrite_console/models/attribute_integer.py +46 -0
  135. appwrite_console/models/attribute_ip.py +43 -0
  136. appwrite_console/models/attribute_line.py +40 -0
  137. appwrite_console/models/attribute_list.py +36 -0
  138. appwrite_console/models/attribute_longtext.py +43 -0
  139. appwrite_console/models/attribute_mediumtext.py +43 -0
  140. appwrite_console/models/attribute_object.py +37 -0
  141. appwrite_console/models/attribute_point.py +40 -0
  142. appwrite_console/models/attribute_polygon.py +40 -0
  143. appwrite_console/models/attribute_relationship.py +55 -0
  144. appwrite_console/models/attribute_string.py +46 -0
  145. appwrite_console/models/attribute_text.py +43 -0
  146. appwrite_console/models/attribute_url.py +43 -0
  147. appwrite_console/models/attribute_varchar.py +46 -0
  148. appwrite_console/models/attribute_vector.py +40 -0
  149. appwrite_console/models/backup_archive.py +48 -0
  150. appwrite_console/models/backup_archive_list.py +19 -0
  151. appwrite_console/models/backup_policy.py +48 -0
  152. appwrite_console/models/backup_policy_list.py +19 -0
  153. appwrite_console/models/backup_restoration.py +45 -0
  154. appwrite_console/models/backup_restoration_list.py +19 -0
  155. appwrite_console/models/base_model.py +27 -0
  156. appwrite_console/models/billing_address.py +36 -0
  157. appwrite_console/models/billing_address_list.py +19 -0
  158. appwrite_console/models/billing_limits.py +36 -0
  159. appwrite_console/models/billing_plan.py +226 -0
  160. appwrite_console/models/billing_plan_addon.py +19 -0
  161. appwrite_console/models/billing_plan_addon_details.py +36 -0
  162. appwrite_console/models/billing_plan_dedicated_database_limits.py +69 -0
  163. appwrite_console/models/billing_plan_limits.py +18 -0
  164. appwrite_console/models/billing_plan_list.py +19 -0
  165. appwrite_console/models/billing_plan_supported_addons.py +21 -0
  166. appwrite_console/models/block.py +45 -0
  167. appwrite_console/models/block_delete.py +19 -0
  168. appwrite_console/models/block_list.py +19 -0
  169. appwrite_console/models/branch.py +15 -0
  170. appwrite_console/models/branch_list.py +19 -0
  171. appwrite_console/models/bucket.py +54 -0
  172. appwrite_console/models/bucket_list.py +19 -0
  173. appwrite_console/models/campaign.py +49 -0
  174. appwrite_console/models/collection.py +67 -0
  175. appwrite_console/models/collection_list.py +19 -0
  176. appwrite_console/models/column_bigint.py +46 -0
  177. appwrite_console/models/column_boolean.py +40 -0
  178. appwrite_console/models/column_datetime.py +43 -0
  179. appwrite_console/models/column_email.py +43 -0
  180. appwrite_console/models/column_enum.py +46 -0
  181. appwrite_console/models/column_float.py +46 -0
  182. appwrite_console/models/column_index.py +42 -0
  183. appwrite_console/models/column_index_list.py +19 -0
  184. appwrite_console/models/column_integer.py +46 -0
  185. appwrite_console/models/column_ip.py +43 -0
  186. appwrite_console/models/column_line.py +40 -0
  187. appwrite_console/models/column_list.py +36 -0
  188. appwrite_console/models/column_longtext.py +43 -0
  189. appwrite_console/models/column_mediumtext.py +43 -0
  190. appwrite_console/models/column_point.py +40 -0
  191. appwrite_console/models/column_polygon.py +40 -0
  192. appwrite_console/models/column_relationship.py +55 -0
  193. appwrite_console/models/column_string.py +46 -0
  194. appwrite_console/models/column_text.py +43 -0
  195. appwrite_console/models/column_url.py +43 -0
  196. appwrite_console/models/column_varchar.py +46 -0
  197. appwrite_console/models/console_key_scope.py +24 -0
  198. appwrite_console/models/console_key_scope_list.py +19 -0
  199. appwrite_console/models/console_o_auth2_provider.py +19 -0
  200. appwrite_console/models/console_o_auth2_provider_list.py +19 -0
  201. appwrite_console/models/console_o_auth2_provider_parameter.py +24 -0
  202. appwrite_console/models/console_region.py +30 -0
  203. appwrite_console/models/console_region_list.py +19 -0
  204. appwrite_console/models/console_variables.py +96 -0
  205. appwrite_console/models/continent.py +18 -0
  206. appwrite_console/models/continent_list.py +19 -0
  207. appwrite_console/models/country.py +18 -0
  208. appwrite_console/models/country_list.py +19 -0
  209. appwrite_console/models/coupon.py +36 -0
  210. appwrite_console/models/credit.py +45 -0
  211. appwrite_console/models/credit_available.py +15 -0
  212. appwrite_console/models/credit_list.py +22 -0
  213. appwrite_console/models/currency.py +33 -0
  214. appwrite_console/models/currency_list.py +19 -0
  215. appwrite_console/models/database.py +52 -0
  216. appwrite_console/models/database_list.py +19 -0
  217. appwrite_console/models/database_migration.py +57 -0
  218. appwrite_console/models/database_migration_list.py +19 -0
  219. appwrite_console/models/database_status.py +57 -0
  220. appwrite_console/models/database_status_connections.py +18 -0
  221. appwrite_console/models/database_status_replica.py +24 -0
  222. appwrite_console/models/database_status_volume.py +24 -0
  223. appwrite_console/models/dedicated_database.py +159 -0
  224. appwrite_console/models/dedicated_database_backup.py +63 -0
  225. appwrite_console/models/dedicated_database_backup_list.py +19 -0
  226. appwrite_console/models/dedicated_database_backup_storage.py +27 -0
  227. appwrite_console/models/dedicated_database_branch.py +48 -0
  228. appwrite_console/models/dedicated_database_branch_list.py +16 -0
  229. appwrite_console/models/dedicated_database_execution.py +31 -0
  230. appwrite_console/models/dedicated_database_execution_column.py +18 -0
  231. appwrite_console/models/dedicated_database_extensions.py +22 -0
  232. appwrite_console/models/dedicated_database_list.py +19 -0
  233. appwrite_console/models/dedicated_database_member.py +24 -0
  234. appwrite_console/models/dedicated_database_operation.py +45 -0
  235. appwrite_console/models/dedicated_database_operation_list.py +19 -0
  236. appwrite_console/models/dedicated_database_pitr_windows.py +18 -0
  237. appwrite_console/models/dedicated_database_pooler.py +42 -0
  238. appwrite_console/models/dedicated_database_replicas.py +37 -0
  239. appwrite_console/models/dedicated_database_restoration.py +45 -0
  240. appwrite_console/models/dedicated_database_restoration_list.py +19 -0
  241. appwrite_console/models/dedicated_database_specification.py +39 -0
  242. appwrite_console/models/dedicated_database_specification_list.py +23 -0
  243. appwrite_console/models/dedicated_database_specification_pricing.py +27 -0
  244. appwrite_console/models/deployment.py +94 -0
  245. appwrite_console/models/deployment_list.py +19 -0
  246. appwrite_console/models/detection_framework.py +32 -0
  247. appwrite_console/models/detection_runtime.py +29 -0
  248. appwrite_console/models/detection_variable.py +18 -0
  249. appwrite_console/models/dev_key.py +36 -0
  250. appwrite_console/models/dev_key_list.py +19 -0
  251. appwrite_console/models/dns_record.py +48 -0
  252. appwrite_console/models/dns_records_list.py +19 -0
  253. appwrite_console/models/document.py +80 -0
  254. appwrite_console/models/document_list.py +32 -0
  255. appwrite_console/models/domain.py +53 -0
  256. appwrite_console/models/domain_price.py +30 -0
  257. appwrite_console/models/domain_purchase.py +43 -0
  258. appwrite_console/models/domain_suggestion.py +24 -0
  259. appwrite_console/models/domain_suggestions_list.py +19 -0
  260. appwrite_console/models/domain_transfer_out.py +15 -0
  261. appwrite_console/models/domain_transfer_status.py +22 -0
  262. appwrite_console/models/domains_list.py +19 -0
  263. appwrite_console/models/downgrade_feedback.py +42 -0
  264. appwrite_console/models/email_template.py +36 -0
  265. appwrite_console/models/email_template_list.py +19 -0
  266. appwrite_console/models/embedding.py +24 -0
  267. appwrite_console/models/embedding_list.py +19 -0
  268. appwrite_console/models/ephemeral_key.py +39 -0
  269. appwrite_console/models/estimation.py +37 -0
  270. appwrite_console/models/estimation_delete_organization.py +16 -0
  271. appwrite_console/models/estimation_item.py +18 -0
  272. appwrite_console/models/estimation_plan_change.py +29 -0
  273. appwrite_console/models/estimation_update_plan.py +40 -0
  274. appwrite_console/models/execution.py +69 -0
  275. appwrite_console/models/execution_list.py +19 -0
  276. appwrite_console/models/file.py +60 -0
  277. appwrite_console/models/file_list.py +19 -0
  278. appwrite_console/models/framework.py +28 -0
  279. appwrite_console/models/framework_adapter.py +27 -0
  280. appwrite_console/models/framework_list.py +19 -0
  281. appwrite_console/models/function.py +109 -0
  282. appwrite_console/models/function_list.py +19 -0
  283. appwrite_console/models/headers.py +18 -0
  284. appwrite_console/models/identity.py +42 -0
  285. appwrite_console/models/identity_list.py +19 -0
  286. appwrite_console/models/index.py +43 -0
  287. appwrite_console/models/index_list.py +19 -0
  288. appwrite_console/models/insight.py +64 -0
  289. appwrite_console/models/insight_cta.py +24 -0
  290. appwrite_console/models/insight_list.py +19 -0
  291. appwrite_console/models/installation.py +30 -0
  292. appwrite_console/models/installation_list.py +19 -0
  293. appwrite_console/models/invoice.py +82 -0
  294. appwrite_console/models/invoice_list.py +19 -0
  295. appwrite_console/models/jwt.py +15 -0
  296. appwrite_console/models/key.py +39 -0
  297. appwrite_console/models/key_list.py +19 -0
  298. appwrite_console/models/language.py +21 -0
  299. appwrite_console/models/language_list.py +19 -0
  300. appwrite_console/models/locale.py +66 -0
  301. appwrite_console/models/locale_code.py +18 -0
  302. appwrite_console/models/locale_code_list.py +19 -0
  303. appwrite_console/models/log.py +78 -0
  304. appwrite_console/models/log_list.py +19 -0
  305. appwrite_console/models/membership.py +57 -0
  306. appwrite_console/models/membership_list.py +19 -0
  307. appwrite_console/models/message.py +52 -0
  308. appwrite_console/models/message_list.py +19 -0
  309. appwrite_console/models/metric.py +18 -0
  310. appwrite_console/models/metric_breakdown.py +24 -0
  311. appwrite_console/models/mfa_challenge.py +24 -0
  312. appwrite_console/models/mfa_factors.py +24 -0
  313. appwrite_console/models/mfa_recovery_codes.py +15 -0
  314. appwrite_console/models/mfa_type.py +18 -0
  315. appwrite_console/models/migration.py +75 -0
  316. appwrite_console/models/migration_list.py +19 -0
  317. appwrite_console/models/migration_report.py +96 -0
  318. appwrite_console/models/mock_number.py +24 -0
  319. appwrite_console/models/mock_number_list.py +19 -0
  320. appwrite_console/models/notification.py +60 -0
  321. appwrite_console/models/notification_list.py +19 -0
  322. appwrite_console/models/o_auth2_amazon.py +24 -0
  323. appwrite_console/models/o_auth2_apple.py +30 -0
  324. appwrite_console/models/o_auth2_appwrite.py +24 -0
  325. appwrite_console/models/o_auth2_auth0.py +27 -0
  326. appwrite_console/models/o_auth2_authentik.py +27 -0
  327. appwrite_console/models/o_auth2_autodesk.py +24 -0
  328. appwrite_console/models/o_auth2_bitbucket.py +24 -0
  329. appwrite_console/models/o_auth2_bitly.py +24 -0
  330. appwrite_console/models/o_auth2_box.py +24 -0
  331. appwrite_console/models/o_auth2_dailymotion.py +24 -0
  332. appwrite_console/models/o_auth2_discord.py +24 -0
  333. appwrite_console/models/o_auth2_disqus.py +24 -0
  334. appwrite_console/models/o_auth2_dropbox.py +24 -0
  335. appwrite_console/models/o_auth2_etsy.py +24 -0
  336. appwrite_console/models/o_auth2_facebook.py +24 -0
  337. appwrite_console/models/o_auth2_figma.py +24 -0
  338. appwrite_console/models/o_auth2_fusion_auth.py +27 -0
  339. appwrite_console/models/o_auth2_github.py +24 -0
  340. appwrite_console/models/o_auth2_gitlab.py +27 -0
  341. appwrite_console/models/o_auth2_google.py +28 -0
  342. appwrite_console/models/o_auth2_keycloak.py +30 -0
  343. appwrite_console/models/o_auth2_kick.py +24 -0
  344. appwrite_console/models/o_auth2_linkedin.py +24 -0
  345. appwrite_console/models/o_auth2_microsoft.py +27 -0
  346. appwrite_console/models/o_auth2_notion.py +24 -0
  347. appwrite_console/models/o_auth2_oidc.py +43 -0
  348. appwrite_console/models/o_auth2_okta.py +30 -0
  349. appwrite_console/models/o_auth2_paypal.py +24 -0
  350. appwrite_console/models/o_auth2_podio.py +24 -0
  351. appwrite_console/models/o_auth2_provider_list.py +59 -0
  352. appwrite_console/models/o_auth2_salesforce.py +24 -0
  353. appwrite_console/models/o_auth2_slack.py +24 -0
  354. appwrite_console/models/o_auth2_spotify.py +24 -0
  355. appwrite_console/models/o_auth2_stripe.py +24 -0
  356. appwrite_console/models/o_auth2_tradeshift.py +24 -0
  357. appwrite_console/models/o_auth2_twitch.py +24 -0
  358. appwrite_console/models/o_auth2_word_press.py +24 -0
  359. appwrite_console/models/o_auth2_x.py +24 -0
  360. appwrite_console/models/o_auth2_yahoo.py +24 -0
  361. appwrite_console/models/o_auth2_yandex.py +24 -0
  362. appwrite_console/models/o_auth2_zoho.py +24 -0
  363. appwrite_console/models/o_auth2_zoom.py +24 -0
  364. appwrite_console/models/oauth2_approve.py +15 -0
  365. appwrite_console/models/oauth2_authorize.py +18 -0
  366. appwrite_console/models/oauth2_consent.py +42 -0
  367. appwrite_console/models/oauth2_consent_list.py +19 -0
  368. appwrite_console/models/oauth2_consent_token.py +45 -0
  369. appwrite_console/models/oauth2_consent_token_list.py +19 -0
  370. appwrite_console/models/oauth2_device_authorization.py +30 -0
  371. appwrite_console/models/oauth2_grant.py +48 -0
  372. appwrite_console/models/oauth2_organization.py +15 -0
  373. appwrite_console/models/oauth2_organization_list.py +19 -0
  374. appwrite_console/models/oauth2_par.py +18 -0
  375. appwrite_console/models/oauth2_project.py +21 -0
  376. appwrite_console/models/oauth2_project_list.py +19 -0
  377. appwrite_console/models/oauth2_reject.py +15 -0
  378. appwrite_console/models/oauth2_token.py +33 -0
  379. appwrite_console/models/organization.py +132 -0
  380. appwrite_console/models/organization_list.py +32 -0
  381. appwrite_console/models/payment_authentication.py +30 -0
  382. appwrite_console/models/payment_method.py +72 -0
  383. appwrite_console/models/payment_method_list.py +19 -0
  384. appwrite_console/models/phone.py +21 -0
  385. appwrite_console/models/phone_list.py +19 -0
  386. appwrite_console/models/plan_change_estimation_details.py +39 -0
  387. appwrite_console/models/plan_change_limits.py +28 -0
  388. appwrite_console/models/plan_change_project_compliance.py +28 -0
  389. appwrite_console/models/plan_change_resource_compliance.py +30 -0
  390. appwrite_console/models/platform_android.py +31 -0
  391. appwrite_console/models/platform_apple.py +31 -0
  392. appwrite_console/models/platform_linux.py +31 -0
  393. appwrite_console/models/platform_list.py +23 -0
  394. appwrite_console/models/platform_web.py +31 -0
  395. appwrite_console/models/platform_windows.py +31 -0
  396. appwrite_console/models/policy_deny_aliased_email.py +18 -0
  397. appwrite_console/models/policy_deny_corporate_email.py +18 -0
  398. appwrite_console/models/policy_deny_disposable_email.py +18 -0
  399. appwrite_console/models/policy_deny_free_email.py +18 -0
  400. appwrite_console/models/policy_list.py +32 -0
  401. appwrite_console/models/policy_membership_privacy.py +33 -0
  402. appwrite_console/models/policy_password_dictionary.py +18 -0
  403. appwrite_console/models/policy_password_history.py +18 -0
  404. appwrite_console/models/policy_password_personal_data.py +18 -0
  405. appwrite_console/models/policy_password_strength.py +30 -0
  406. appwrite_console/models/policy_session_alert.py +18 -0
  407. appwrite_console/models/policy_session_duration.py +18 -0
  408. appwrite_console/models/policy_session_invalidation.py +18 -0
  409. appwrite_console/models/policy_session_limit.py +18 -0
  410. appwrite_console/models/policy_user_limit.py +18 -0
  411. appwrite_console/models/postgres_extension.py +24 -0
  412. appwrite_console/models/postgres_extension_list.py +19 -0
  413. appwrite_console/models/preferences.py +52 -0
  414. appwrite_console/models/presence.py +39 -0
  415. appwrite_console/models/presence_list.py +19 -0
  416. appwrite_console/models/program.py +39 -0
  417. appwrite_console/models/project.py +153 -0
  418. appwrite_console/models/project_auth_method.py +19 -0
  419. appwrite_console/models/project_list.py +19 -0
  420. appwrite_console/models/project_protocol.py +19 -0
  421. appwrite_console/models/project_service.py +19 -0
  422. appwrite_console/models/provider.py +39 -0
  423. appwrite_console/models/provider_list.py +19 -0
  424. appwrite_console/models/provider_repository.py +42 -0
  425. appwrite_console/models/provider_repository_framework.py +45 -0
  426. appwrite_console/models/provider_repository_framework_list.py +22 -0
  427. appwrite_console/models/provider_repository_runtime.py +45 -0
  428. appwrite_console/models/provider_repository_runtime_list.py +22 -0
  429. appwrite_console/models/proxy_rule.py +59 -0
  430. appwrite_console/models/proxy_rule_list.py +19 -0
  431. appwrite_console/models/report.py +49 -0
  432. appwrite_console/models/report_list.py +19 -0
  433. appwrite_console/models/resource_token.py +33 -0
  434. appwrite_console/models/resource_token_list.py +19 -0
  435. appwrite_console/models/review.py +24 -0
  436. appwrite_console/models/roles.py +18 -0
  437. appwrite_console/models/row.py +80 -0
  438. appwrite_console/models/row_list.py +32 -0
  439. appwrite_console/models/runtime.py +36 -0
  440. appwrite_console/models/runtime_list.py +19 -0
  441. appwrite_console/models/schedule.py +45 -0
  442. appwrite_console/models/schedule_list.py +19 -0
  443. appwrite_console/models/session.py +99 -0
  444. appwrite_console/models/session_list.py +19 -0
  445. appwrite_console/models/site.py +115 -0
  446. appwrite_console/models/site_list.py +19 -0
  447. appwrite_console/models/specification.py +24 -0
  448. appwrite_console/models/specification_list.py +19 -0
  449. appwrite_console/models/stage.py +27 -0
  450. appwrite_console/models/stage_list.py +16 -0
  451. appwrite_console/models/subscriber.py +40 -0
  452. appwrite_console/models/subscriber_list.py +19 -0
  453. appwrite_console/models/table.py +67 -0
  454. appwrite_console/models/table_list.py +19 -0
  455. appwrite_console/models/target.py +39 -0
  456. appwrite_console/models/target_list.py +19 -0
  457. appwrite_console/models/team.py +43 -0
  458. appwrite_console/models/team_list.py +32 -0
  459. appwrite_console/models/template_framework.py +39 -0
  460. appwrite_console/models/template_function.py +65 -0
  461. appwrite_console/models/template_function_list.py +19 -0
  462. appwrite_console/models/template_runtime.py +24 -0
  463. appwrite_console/models/template_site.py +53 -0
  464. appwrite_console/models/template_site_list.py +19 -0
  465. appwrite_console/models/template_variable.py +33 -0
  466. appwrite_console/models/token.py +30 -0
  467. appwrite_console/models/topic.py +36 -0
  468. appwrite_console/models/topic_list.py +19 -0
  469. appwrite_console/models/transaction.py +30 -0
  470. appwrite_console/models/transaction_list.py +19 -0
  471. appwrite_console/models/usage_billing_plan.py +46 -0
  472. appwrite_console/models/usage_data_point.py +99 -0
  473. appwrite_console/models/usage_event_list.py +19 -0
  474. appwrite_console/models/usage_gauge_list.py +19 -0
  475. appwrite_console/models/usage_metric.py +19 -0
  476. appwrite_console/models/usage_organization.py +104 -0
  477. appwrite_console/models/usage_organization_project.py +73 -0
  478. appwrite_console/models/usage_presence.py +22 -0
  479. appwrite_console/models/usage_project.py +218 -0
  480. appwrite_console/models/usage_resources.py +36 -0
  481. appwrite_console/models/usage_users.py +28 -0
  482. appwrite_console/models/user.py +111 -0
  483. appwrite_console/models/user_list.py +32 -0
  484. appwrite_console/models/variable.py +36 -0
  485. appwrite_console/models/variable_list.py +19 -0
  486. appwrite_console/models/vcs_content.py +21 -0
  487. appwrite_console/models/vcs_content_list.py +19 -0
  488. appwrite_console/models/vcs_namespace.py +27 -0
  489. appwrite_console/models/vcs_namespace_list.py +19 -0
  490. appwrite_console/models/vectorsdb_collection.py +54 -0
  491. appwrite_console/models/vectorsdb_collection_list.py +19 -0
  492. appwrite_console/models/waf_rule.py +55 -0
  493. appwrite_console/models/waf_rule_bypass.py +55 -0
  494. appwrite_console/models/waf_rule_challenge.py +64 -0
  495. appwrite_console/models/waf_rule_deny.py +55 -0
  496. appwrite_console/models/waf_rule_list.py +19 -0
  497. appwrite_console/models/waf_rule_rate_limit.py +64 -0
  498. appwrite_console/models/waf_rule_redirect.py +61 -0
  499. appwrite_console/models/webhook.py +51 -0
  500. appwrite_console/models/webhook_list.py +19 -0
  501. appwrite_console/operator.py +150 -0
  502. appwrite_console/permission.py +21 -0
  503. appwrite_console/query.py +293 -0
  504. appwrite_console/role.py +111 -0
  505. appwrite_console/service.py +50 -0
  506. appwrite_console/services/__init__.py +1 -0
  507. appwrite_console/services/account.py +3328 -0
  508. appwrite_console/services/activities.py +89 -0
  509. appwrite_console/services/advisor.py +234 -0
  510. appwrite_console/services/apps.py +1156 -0
  511. appwrite_console/services/assistant.py +50 -0
  512. appwrite_console/services/avatars.py +531 -0
  513. appwrite_console/services/backups.py +572 -0
  514. appwrite_console/services/console.py +807 -0
  515. appwrite_console/services/databases.py +4976 -0
  516. appwrite_console/services/documents_db.py +2052 -0
  517. appwrite_console/services/domains.py +3047 -0
  518. appwrite_console/services/functions.py +1659 -0
  519. appwrite_console/services/graphql.py +92 -0
  520. appwrite_console/services/locale.py +243 -0
  521. appwrite_console/services/manager.py +301 -0
  522. appwrite_console/services/messaging.py +3137 -0
  523. appwrite_console/services/migrations.py +1036 -0
  524. appwrite_console/services/mongo.py +1683 -0
  525. appwrite_console/services/mysql.py +1861 -0
  526. appwrite_console/services/notifications.py +98 -0
  527. appwrite_console/services/oauth2.py +914 -0
  528. appwrite_console/services/organization.py +1039 -0
  529. appwrite_console/services/organizations.py +2245 -0
  530. appwrite_console/services/postgresql.py +1995 -0
  531. appwrite_console/services/presences.py +309 -0
  532. appwrite_console/services/project.py +5271 -0
  533. appwrite_console/services/projects.py +885 -0
  534. appwrite_console/services/proxy.py +394 -0
  535. appwrite_console/services/sites.py +1593 -0
  536. appwrite_console/services/storage.py +818 -0
  537. appwrite_console/services/tables_db.py +5189 -0
  538. appwrite_console/services/teams.py +993 -0
  539. appwrite_console/services/tokens.py +243 -0
  540. appwrite_console/services/usage.py +194 -0
  541. appwrite_console/services/users.py +2314 -0
  542. appwrite_console/services/vcs.py +599 -0
  543. appwrite_console/services/vectors_db.py +2054 -0
  544. appwrite_console/services/waf.py +1014 -0
  545. appwrite_console/services/webhooks.py +344 -0
  546. appwrite_console/utils/__init__.py +1 -0
  547. appwrite_console/utils/deprecated.py +51 -0
  548. appwrite_console-0.1.0.dist-info/METADATA +189 -0
  549. appwrite_console-0.1.0.dist-info/RECORD +552 -0
  550. appwrite_console-0.1.0.dist-info/WHEEL +5 -0
  551. appwrite_console-0.1.0.dist-info/licenses/LICENSE +12 -0
  552. appwrite_console-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3328 @@
1
+ from ..service import Service
2
+ from urllib.parse import quote
3
+ from typing import Any, Dict, List, Optional, Union, Type, TypeVar
4
+ from ..exception import AppwriteException
5
+ from appwrite_console.utils.deprecated import deprecated
6
+ from ..models.user import User
7
+ from ..models.billing_address_list import BillingAddressList
8
+ from ..models.billing_address import BillingAddress
9
+ from ..models.oauth2_consent_list import Oauth2ConsentList
10
+ from ..models.oauth2_consent import Oauth2Consent
11
+ from ..models.oauth2_consent_token_list import Oauth2ConsentTokenList
12
+ from ..models.oauth2_consent_token import Oauth2ConsentToken
13
+ from ..models.coupon import Coupon
14
+ from ..models.identity_list import IdentityList
15
+ from ..models.invoice_list import InvoiceList
16
+ from ..models.jwt import Jwt
17
+ from ..models.key_list import KeyList
18
+ from ..enums.account_key_scopes import AccountKeyScopes
19
+ from ..models.key import Key
20
+ from ..models.log_list import LogList
21
+ from ..enums.authenticator_type import AuthenticatorType
22
+ from ..models.mfa_type import MfaType
23
+ from ..enums.authentication_factor import AuthenticationFactor
24
+ from ..models.mfa_challenge import MfaChallenge
25
+ from ..models.session import Session
26
+ from ..models.mfa_factors import MfaFactors
27
+ from ..models.mfa_recovery_codes import MfaRecoveryCodes
28
+ from ..models.payment_method_list import PaymentMethodList
29
+ from ..models.payment_method import PaymentMethod
30
+ from ..models.preferences import Preferences
31
+ from ..models.token import Token
32
+ from ..models.session_list import SessionList
33
+ from ..enums.o_auth_provider import OAuthProvider
34
+ from ..models.target import Target
35
+
36
+ T = TypeVar('T')
37
+
38
+ class Account(Service):
39
+
40
+ def __init__(self, client) -> None:
41
+ super(Account, self).__init__(client)
42
+
43
+ def get(
44
+ self,
45
+ model_type: Type[T] = dict
46
+ ) -> User[T]:
47
+ """
48
+ Get the currently logged in user.
49
+
50
+ Parameters
51
+ ----------
52
+
53
+ model_type : Type[T], optional
54
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
55
+
56
+ Returns
57
+ -------
58
+ User[T]
59
+ API response as a typed Pydantic model
60
+
61
+ Raises
62
+ ------
63
+ AppwriteException
64
+ If API request fails
65
+ """
66
+
67
+ api_path = '/account'
68
+ api_params = {}
69
+
70
+ response = self.client.call('get', api_path, {
71
+ 'X-Appwrite-Project': self.client.get_config('project'),
72
+ 'accept': 'application/json',
73
+ }, api_params)
74
+
75
+ return User.with_data(response, model_type)
76
+
77
+
78
+ def create(
79
+ self,
80
+ user_id: str,
81
+ email: str,
82
+ password: str,
83
+ name: Optional[str] = None,
84
+ model_type: Type[T] = dict
85
+ ) -> User[T]:
86
+ """
87
+ Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
88
+
89
+ Parameters
90
+ ----------
91
+ user_id : str
92
+ User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
93
+ email : str
94
+ User email.
95
+ password : str
96
+ New user password. Must be between 8 and 256 chars.
97
+ name : Optional[str]
98
+ User name. Max length: 128 chars.
99
+
100
+ model_type : Type[T], optional
101
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
102
+
103
+ Returns
104
+ -------
105
+ User[T]
106
+ API response as a typed Pydantic model
107
+
108
+ Raises
109
+ ------
110
+ AppwriteException
111
+ If API request fails
112
+ """
113
+
114
+ api_path = '/account'
115
+ api_params = {}
116
+ if user_id is None:
117
+ raise AppwriteException('Missing required parameter: "user_id"')
118
+
119
+ if email is None:
120
+ raise AppwriteException('Missing required parameter: "email"')
121
+
122
+ if password is None:
123
+ raise AppwriteException('Missing required parameter: "password"')
124
+
125
+
126
+ api_params['userId'] = self._normalize_value(user_id)
127
+ api_params['email'] = self._normalize_value(email)
128
+ api_params['password'] = self._normalize_value(password)
129
+ if name is not None:
130
+ api_params['name'] = self._normalize_value(name)
131
+
132
+ response = self.client.call('post', api_path, {
133
+ 'X-Appwrite-Project': self.client.get_config('project'),
134
+ 'content-type': 'application/json',
135
+ 'accept': 'application/json',
136
+ }, api_params)
137
+
138
+ return User.with_data(response, model_type)
139
+
140
+
141
+ def delete(
142
+ self
143
+ ) -> Dict[str, Any]:
144
+ """
145
+ Delete the currently logged in user.
146
+
147
+ Returns
148
+ -------
149
+ Dict[str, Any]
150
+ API response as a dictionary
151
+
152
+ Raises
153
+ ------
154
+ AppwriteException
155
+ If API request fails
156
+ """
157
+
158
+ api_path = '/account'
159
+ api_params = {}
160
+
161
+ response = self.client.call('delete', api_path, {
162
+ 'X-Appwrite-Project': self.client.get_config('project'),
163
+ 'content-type': 'application/json',
164
+ }, api_params)
165
+
166
+ return response
167
+
168
+
169
+ def list_billing_addresses(
170
+ self,
171
+ queries: Optional[List[str]] = None
172
+ ) -> BillingAddressList:
173
+ """
174
+ List all billing addresses for a user.
175
+
176
+ Parameters
177
+ ----------
178
+ queries : Optional[List[str]]
179
+ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
180
+
181
+ Returns
182
+ -------
183
+ BillingAddressList
184
+ API response as a typed Pydantic model
185
+
186
+ Raises
187
+ ------
188
+ AppwriteException
189
+ If API request fails
190
+ """
191
+
192
+ api_path = '/account/billing-addresses'
193
+ api_params = {}
194
+
195
+ if queries is not None:
196
+ api_params['queries'] = self._normalize_value(queries)
197
+
198
+ response = self.client.call('get', api_path, {
199
+ 'X-Appwrite-Project': self.client.get_config('project'),
200
+ 'accept': 'application/json',
201
+ }, api_params)
202
+
203
+ return self._parse_response(response, model=BillingAddressList)
204
+
205
+
206
+ def create_billing_address(
207
+ self,
208
+ country: str,
209
+ city: str,
210
+ street_address: str,
211
+ address_line2: Optional[str] = None,
212
+ state: Optional[str] = None,
213
+ postal_code: Optional[str] = None
214
+ ) -> BillingAddress:
215
+ """
216
+ Add a new billing address to a user's account.
217
+
218
+ Parameters
219
+ ----------
220
+ country : str
221
+ Country
222
+ city : str
223
+ City
224
+ street_address : str
225
+ Street address
226
+ address_line2 : Optional[str]
227
+ Address line 2
228
+ state : Optional[str]
229
+ State or province
230
+ postal_code : Optional[str]
231
+ Postal code
232
+
233
+ Returns
234
+ -------
235
+ BillingAddress
236
+ API response as a typed Pydantic model
237
+
238
+ Raises
239
+ ------
240
+ AppwriteException
241
+ If API request fails
242
+ """
243
+
244
+ api_path = '/account/billing-addresses'
245
+ api_params = {}
246
+ if country is None:
247
+ raise AppwriteException('Missing required parameter: "country"')
248
+
249
+ if city is None:
250
+ raise AppwriteException('Missing required parameter: "city"')
251
+
252
+ if street_address is None:
253
+ raise AppwriteException('Missing required parameter: "street_address"')
254
+
255
+
256
+ api_params['country'] = self._normalize_value(country)
257
+ api_params['city'] = self._normalize_value(city)
258
+ api_params['streetAddress'] = self._normalize_value(street_address)
259
+ if address_line2 is not None:
260
+ api_params['addressLine2'] = self._normalize_value(address_line2)
261
+ if state is not None:
262
+ api_params['state'] = self._normalize_value(state)
263
+ if postal_code is not None:
264
+ api_params['postalCode'] = self._normalize_value(postal_code)
265
+
266
+ response = self.client.call('post', api_path, {
267
+ 'X-Appwrite-Project': self.client.get_config('project'),
268
+ 'content-type': 'application/json',
269
+ 'accept': 'application/json',
270
+ }, api_params)
271
+
272
+ return self._parse_response(response, model=BillingAddress)
273
+
274
+
275
+ def get_billing_address(
276
+ self,
277
+ billing_address_id: str
278
+ ) -> BillingAddress:
279
+ """
280
+ Get a specific billing address for a user using it's ID.
281
+
282
+ Parameters
283
+ ----------
284
+ billing_address_id : str
285
+ Unique ID of billing address
286
+
287
+ Returns
288
+ -------
289
+ BillingAddress
290
+ API response as a typed Pydantic model
291
+
292
+ Raises
293
+ ------
294
+ AppwriteException
295
+ If API request fails
296
+ """
297
+
298
+ api_path = '/account/billing-addresses/{billingAddressId}'
299
+ api_params = {}
300
+ if billing_address_id is None:
301
+ raise AppwriteException('Missing required parameter: "billing_address_id"')
302
+
303
+ api_path = api_path.replace('{billingAddressId}', str(self._normalize_value(billing_address_id)))
304
+
305
+
306
+ response = self.client.call('get', api_path, {
307
+ 'X-Appwrite-Project': self.client.get_config('project'),
308
+ 'accept': 'application/json',
309
+ }, api_params)
310
+
311
+ return self._parse_response(response, model=BillingAddress)
312
+
313
+
314
+ def update_billing_address(
315
+ self,
316
+ billing_address_id: str,
317
+ country: str,
318
+ city: str,
319
+ street_address: str,
320
+ address_line2: Optional[str] = None,
321
+ state: Optional[str] = None,
322
+ postal_code: Optional[str] = None
323
+ ) -> BillingAddress:
324
+ """
325
+ Update a specific billing address using it's ID.
326
+
327
+ Parameters
328
+ ----------
329
+ billing_address_id : str
330
+ Unique ID of billing address
331
+ country : str
332
+ Country
333
+ city : str
334
+ City
335
+ street_address : str
336
+ Street address
337
+ address_line2 : Optional[str]
338
+ Address line 2
339
+ state : Optional[str]
340
+ State or province
341
+ postal_code : Optional[str]
342
+ Postal code
343
+
344
+ Returns
345
+ -------
346
+ BillingAddress
347
+ API response as a typed Pydantic model
348
+
349
+ Raises
350
+ ------
351
+ AppwriteException
352
+ If API request fails
353
+ """
354
+
355
+ api_path = '/account/billing-addresses/{billingAddressId}'
356
+ api_params = {}
357
+ if billing_address_id is None:
358
+ raise AppwriteException('Missing required parameter: "billing_address_id"')
359
+
360
+ if country is None:
361
+ raise AppwriteException('Missing required parameter: "country"')
362
+
363
+ if city is None:
364
+ raise AppwriteException('Missing required parameter: "city"')
365
+
366
+ if street_address is None:
367
+ raise AppwriteException('Missing required parameter: "street_address"')
368
+
369
+ api_path = api_path.replace('{billingAddressId}', str(self._normalize_value(billing_address_id)))
370
+
371
+ api_params['country'] = self._normalize_value(country)
372
+ api_params['city'] = self._normalize_value(city)
373
+ api_params['streetAddress'] = self._normalize_value(street_address)
374
+ if address_line2 is not None:
375
+ api_params['addressLine2'] = self._normalize_value(address_line2)
376
+ if state is not None:
377
+ api_params['state'] = self._normalize_value(state)
378
+ if postal_code is not None:
379
+ api_params['postalCode'] = self._normalize_value(postal_code)
380
+
381
+ response = self.client.call('put', api_path, {
382
+ 'X-Appwrite-Project': self.client.get_config('project'),
383
+ 'content-type': 'application/json',
384
+ 'accept': 'application/json',
385
+ }, api_params)
386
+
387
+ return self._parse_response(response, model=BillingAddress)
388
+
389
+
390
+ def delete_billing_address(
391
+ self,
392
+ billing_address_id: str
393
+ ) -> Dict[str, Any]:
394
+ """
395
+ Delete a specific billing address using it's ID.
396
+
397
+ Parameters
398
+ ----------
399
+ billing_address_id : str
400
+ Billing address unique ID
401
+
402
+ Returns
403
+ -------
404
+ Dict[str, Any]
405
+ API response as a dictionary
406
+
407
+ Raises
408
+ ------
409
+ AppwriteException
410
+ If API request fails
411
+ """
412
+
413
+ api_path = '/account/billing-addresses/{billingAddressId}'
414
+ api_params = {}
415
+ if billing_address_id is None:
416
+ raise AppwriteException('Missing required parameter: "billing_address_id"')
417
+
418
+ api_path = api_path.replace('{billingAddressId}', str(self._normalize_value(billing_address_id)))
419
+
420
+
421
+ response = self.client.call('delete', api_path, {
422
+ 'X-Appwrite-Project': self.client.get_config('project'),
423
+ 'content-type': 'application/json',
424
+ 'accept': 'application/json',
425
+ }, api_params)
426
+
427
+ return response
428
+
429
+
430
+ def list_consents(
431
+ self,
432
+ queries: Optional[List[str]] = None,
433
+ total: Optional[bool] = None
434
+ ) -> Oauth2ConsentList:
435
+ """
436
+ Get a list of the OAuth2 consents the current user has given to third-party apps.
437
+
438
+ Parameters
439
+ ----------
440
+ queries : Optional[List[str]]
441
+ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
442
+ total : Optional[bool]
443
+ When set to false, the total count returned will be 0 and will not be calculated.
444
+
445
+ Returns
446
+ -------
447
+ Oauth2ConsentList
448
+ API response as a typed Pydantic model
449
+
450
+ Raises
451
+ ------
452
+ AppwriteException
453
+ If API request fails
454
+ """
455
+
456
+ api_path = '/account/consents'
457
+ api_params = {}
458
+
459
+ if queries is not None:
460
+ api_params['queries'] = self._normalize_value(queries)
461
+ if total is not None:
462
+ api_params['total'] = self._normalize_value(total)
463
+
464
+ response = self.client.call('get', api_path, {
465
+ 'X-Appwrite-Project': self.client.get_config('project'),
466
+ 'accept': 'application/json',
467
+ }, api_params)
468
+
469
+ return self._parse_response(response, model=Oauth2ConsentList)
470
+
471
+
472
+ def get_consent(
473
+ self,
474
+ consent_id: str
475
+ ) -> Oauth2Consent:
476
+ """
477
+ Get an OAuth2 consent the current user has given to a third-party app by its unique ID.
478
+
479
+ Parameters
480
+ ----------
481
+ consent_id : str
482
+ Consent unique ID.
483
+
484
+ Returns
485
+ -------
486
+ Oauth2Consent
487
+ API response as a typed Pydantic model
488
+
489
+ Raises
490
+ ------
491
+ AppwriteException
492
+ If API request fails
493
+ """
494
+
495
+ api_path = '/account/consents/{consentId}'
496
+ api_params = {}
497
+ if consent_id is None:
498
+ raise AppwriteException('Missing required parameter: "consent_id"')
499
+
500
+ api_path = api_path.replace('{consentId}', str(self._normalize_value(consent_id)))
501
+
502
+
503
+ response = self.client.call('get', api_path, {
504
+ 'X-Appwrite-Project': self.client.get_config('project'),
505
+ 'accept': 'application/json',
506
+ }, api_params)
507
+
508
+ return self._parse_response(response, model=Oauth2Consent)
509
+
510
+
511
+ def delete_consent(
512
+ self,
513
+ consent_id: str
514
+ ) -> Dict[str, Any]:
515
+ """
516
+ Delete an OAuth2 consent by its unique ID. All token families issued under the consent are revoked, and the app must ask for consent again to regain access.
517
+
518
+ Parameters
519
+ ----------
520
+ consent_id : str
521
+ Consent unique ID.
522
+
523
+ Returns
524
+ -------
525
+ Dict[str, Any]
526
+ API response as a dictionary
527
+
528
+ Raises
529
+ ------
530
+ AppwriteException
531
+ If API request fails
532
+ """
533
+
534
+ api_path = '/account/consents/{consentId}'
535
+ api_params = {}
536
+ if consent_id is None:
537
+ raise AppwriteException('Missing required parameter: "consent_id"')
538
+
539
+ api_path = api_path.replace('{consentId}', str(self._normalize_value(consent_id)))
540
+
541
+
542
+ response = self.client.call('delete', api_path, {
543
+ 'X-Appwrite-Project': self.client.get_config('project'),
544
+ 'content-type': 'application/json',
545
+ 'accept': 'application/json',
546
+ }, api_params)
547
+
548
+ return response
549
+
550
+
551
+ def list_consent_tokens(
552
+ self,
553
+ consent_id: str,
554
+ queries: Optional[List[str]] = None,
555
+ total: Optional[bool] = None
556
+ ) -> Oauth2ConsentTokenList:
557
+ """
558
+ Get a list of the token families issued under an OAuth2 consent. Each entry represents one authorized device or session; the token secrets themselves are never returned.
559
+
560
+ Parameters
561
+ ----------
562
+ consent_id : str
563
+ Consent unique ID.
564
+ queries : Optional[List[str]]
565
+ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
566
+ total : Optional[bool]
567
+ When set to false, the total count returned will be 0 and will not be calculated.
568
+
569
+ Returns
570
+ -------
571
+ Oauth2ConsentTokenList
572
+ API response as a typed Pydantic model
573
+
574
+ Raises
575
+ ------
576
+ AppwriteException
577
+ If API request fails
578
+ """
579
+
580
+ api_path = '/account/consents/{consentId}/tokens'
581
+ api_params = {}
582
+ if consent_id is None:
583
+ raise AppwriteException('Missing required parameter: "consent_id"')
584
+
585
+ api_path = api_path.replace('{consentId}', str(self._normalize_value(consent_id)))
586
+
587
+ if queries is not None:
588
+ api_params['queries'] = self._normalize_value(queries)
589
+ if total is not None:
590
+ api_params['total'] = self._normalize_value(total)
591
+
592
+ response = self.client.call('get', api_path, {
593
+ 'X-Appwrite-Project': self.client.get_config('project'),
594
+ 'accept': 'application/json',
595
+ }, api_params)
596
+
597
+ return self._parse_response(response, model=Oauth2ConsentTokenList)
598
+
599
+
600
+ def get_consent_token(
601
+ self,
602
+ consent_id: str,
603
+ token_id: str
604
+ ) -> Oauth2ConsentToken:
605
+ """
606
+ Get a token family issued under an OAuth2 consent by its unique ID. The token secrets themselves are never returned.
607
+
608
+ Parameters
609
+ ----------
610
+ consent_id : str
611
+ Consent unique ID.
612
+ token_id : str
613
+ Token unique ID.
614
+
615
+ Returns
616
+ -------
617
+ Oauth2ConsentToken
618
+ API response as a typed Pydantic model
619
+
620
+ Raises
621
+ ------
622
+ AppwriteException
623
+ If API request fails
624
+ """
625
+
626
+ api_path = '/account/consents/{consentId}/tokens/{tokenId}'
627
+ api_params = {}
628
+ if consent_id is None:
629
+ raise AppwriteException('Missing required parameter: "consent_id"')
630
+
631
+ if token_id is None:
632
+ raise AppwriteException('Missing required parameter: "token_id"')
633
+
634
+ api_path = api_path.replace('{consentId}', str(self._normalize_value(consent_id)))
635
+ api_path = api_path.replace('{tokenId}', str(self._normalize_value(token_id)))
636
+
637
+
638
+ response = self.client.call('get', api_path, {
639
+ 'X-Appwrite-Project': self.client.get_config('project'),
640
+ 'accept': 'application/json',
641
+ }, api_params)
642
+
643
+ return self._parse_response(response, model=Oauth2ConsentToken)
644
+
645
+
646
+ def delete_consent_token(
647
+ self,
648
+ consent_id: str,
649
+ token_id: str
650
+ ) -> Dict[str, Any]:
651
+ """
652
+ Delete a token family issued under an OAuth2 consent by its unique ID. The access and refresh tokens of the family stop working immediately; other token families and the consent itself are unaffected.
653
+
654
+ Parameters
655
+ ----------
656
+ consent_id : str
657
+ Consent unique ID.
658
+ token_id : str
659
+ Token unique ID.
660
+
661
+ Returns
662
+ -------
663
+ Dict[str, Any]
664
+ API response as a dictionary
665
+
666
+ Raises
667
+ ------
668
+ AppwriteException
669
+ If API request fails
670
+ """
671
+
672
+ api_path = '/account/consents/{consentId}/tokens/{tokenId}'
673
+ api_params = {}
674
+ if consent_id is None:
675
+ raise AppwriteException('Missing required parameter: "consent_id"')
676
+
677
+ if token_id is None:
678
+ raise AppwriteException('Missing required parameter: "token_id"')
679
+
680
+ api_path = api_path.replace('{consentId}', str(self._normalize_value(consent_id)))
681
+ api_path = api_path.replace('{tokenId}', str(self._normalize_value(token_id)))
682
+
683
+
684
+ response = self.client.call('delete', api_path, {
685
+ 'X-Appwrite-Project': self.client.get_config('project'),
686
+ 'content-type': 'application/json',
687
+ 'accept': 'application/json',
688
+ }, api_params)
689
+
690
+ return response
691
+
692
+
693
+ def get_coupon(
694
+ self,
695
+ coupon_id: str
696
+ ) -> Coupon:
697
+ """
698
+ Get coupon details for an account.
699
+
700
+ Parameters
701
+ ----------
702
+ coupon_id : str
703
+ ID of the coupon
704
+
705
+ Returns
706
+ -------
707
+ Coupon
708
+ API response as a typed Pydantic model
709
+
710
+ Raises
711
+ ------
712
+ AppwriteException
713
+ If API request fails
714
+ """
715
+
716
+ api_path = '/account/coupons/{couponId}'
717
+ api_params = {}
718
+ if coupon_id is None:
719
+ raise AppwriteException('Missing required parameter: "coupon_id"')
720
+
721
+ api_path = api_path.replace('{couponId}', str(self._normalize_value(coupon_id)))
722
+
723
+
724
+ response = self.client.call('get', api_path, {
725
+ 'X-Appwrite-Project': self.client.get_config('project'),
726
+ 'accept': 'application/json',
727
+ }, api_params)
728
+
729
+ return self._parse_response(response, model=Coupon)
730
+
731
+
732
+ def update_email(
733
+ self,
734
+ email: str,
735
+ password: str,
736
+ model_type: Type[T] = dict
737
+ ) -> User[T]:
738
+ """
739
+ 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.
740
+ This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
741
+
742
+
743
+ Parameters
744
+ ----------
745
+ email : str
746
+ User email.
747
+ password : str
748
+ User password. Must be at least 8 chars.
749
+
750
+ model_type : Type[T], optional
751
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
752
+
753
+ Returns
754
+ -------
755
+ User[T]
756
+ API response as a typed Pydantic model
757
+
758
+ Raises
759
+ ------
760
+ AppwriteException
761
+ If API request fails
762
+ """
763
+
764
+ api_path = '/account/email'
765
+ api_params = {}
766
+ if email is None:
767
+ raise AppwriteException('Missing required parameter: "email"')
768
+
769
+ if password is None:
770
+ raise AppwriteException('Missing required parameter: "password"')
771
+
772
+
773
+ api_params['email'] = self._normalize_value(email)
774
+ api_params['password'] = self._normalize_value(password)
775
+
776
+ response = self.client.call('patch', api_path, {
777
+ 'X-Appwrite-Project': self.client.get_config('project'),
778
+ 'content-type': 'application/json',
779
+ 'accept': 'application/json',
780
+ }, api_params)
781
+
782
+ return User.with_data(response, model_type)
783
+
784
+
785
+ def list_identities(
786
+ self,
787
+ queries: Optional[List[str]] = None,
788
+ total: Optional[bool] = None
789
+ ) -> IdentityList:
790
+ """
791
+ Get the list of identities for the currently logged in user.
792
+
793
+ Parameters
794
+ ----------
795
+ queries : Optional[List[str]]
796
+ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
797
+ total : Optional[bool]
798
+ When set to false, the total count returned will be 0 and will not be calculated.
799
+
800
+ Returns
801
+ -------
802
+ IdentityList
803
+ API response as a typed Pydantic model
804
+
805
+ Raises
806
+ ------
807
+ AppwriteException
808
+ If API request fails
809
+ """
810
+
811
+ api_path = '/account/identities'
812
+ api_params = {}
813
+
814
+ if queries is not None:
815
+ api_params['queries'] = self._normalize_value(queries)
816
+ if total is not None:
817
+ api_params['total'] = self._normalize_value(total)
818
+
819
+ response = self.client.call('get', api_path, {
820
+ 'X-Appwrite-Project': self.client.get_config('project'),
821
+ 'accept': 'application/json',
822
+ }, api_params)
823
+
824
+ return self._parse_response(response, model=IdentityList)
825
+
826
+
827
+ def delete_identity(
828
+ self,
829
+ identity_id: str
830
+ ) -> Dict[str, Any]:
831
+ """
832
+ Delete an identity by its unique ID.
833
+
834
+ Parameters
835
+ ----------
836
+ identity_id : str
837
+ Identity ID.
838
+
839
+ Returns
840
+ -------
841
+ Dict[str, Any]
842
+ API response as a dictionary
843
+
844
+ Raises
845
+ ------
846
+ AppwriteException
847
+ If API request fails
848
+ """
849
+
850
+ api_path = '/account/identities/{identityId}'
851
+ api_params = {}
852
+ if identity_id is None:
853
+ raise AppwriteException('Missing required parameter: "identity_id"')
854
+
855
+ api_path = api_path.replace('{identityId}', str(self._normalize_value(identity_id)))
856
+
857
+
858
+ response = self.client.call('delete', api_path, {
859
+ 'X-Appwrite-Project': self.client.get_config('project'),
860
+ 'content-type': 'application/json',
861
+ }, api_params)
862
+
863
+ return response
864
+
865
+
866
+ def list_invoices(
867
+ self,
868
+ queries: Optional[List[str]] = None
869
+ ) -> InvoiceList:
870
+ """
871
+ List all invoices tied to an account.
872
+
873
+ Parameters
874
+ ----------
875
+ queries : Optional[List[str]]
876
+ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: teamId, aggregationId, type, amount, currency, from, to, dueAt, attempts, status, grossAmount
877
+
878
+ Returns
879
+ -------
880
+ InvoiceList
881
+ API response as a typed Pydantic model
882
+
883
+ Raises
884
+ ------
885
+ AppwriteException
886
+ If API request fails
887
+ """
888
+
889
+ api_path = '/account/invoices'
890
+ api_params = {}
891
+
892
+ if queries is not None:
893
+ api_params['queries'] = self._normalize_value(queries)
894
+
895
+ response = self.client.call('get', api_path, {
896
+ 'X-Appwrite-Project': self.client.get_config('project'),
897
+ 'accept': 'application/json',
898
+ }, api_params)
899
+
900
+ return self._parse_response(response, model=InvoiceList)
901
+
902
+
903
+ def create_jwt(
904
+ self,
905
+ duration: Optional[float] = None
906
+ ) -> Jwt:
907
+ """
908
+ 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 Appwrite 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.
909
+
910
+ Parameters
911
+ ----------
912
+ duration : Optional[float]
913
+ Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds.
914
+
915
+ Returns
916
+ -------
917
+ Jwt
918
+ API response as a typed Pydantic model
919
+
920
+ Raises
921
+ ------
922
+ AppwriteException
923
+ If API request fails
924
+ """
925
+
926
+ api_path = '/account/jwts'
927
+ api_params = {}
928
+
929
+ if duration is not None:
930
+ api_params['duration'] = self._normalize_value(duration)
931
+
932
+ response = self.client.call('post', api_path, {
933
+ 'X-Appwrite-Project': self.client.get_config('project'),
934
+ 'content-type': 'application/json',
935
+ 'accept': 'application/json',
936
+ }, api_params)
937
+
938
+ return self._parse_response(response, model=Jwt)
939
+
940
+
941
+ def list_keys(
942
+ self,
943
+ total: Optional[bool] = None
944
+ ) -> KeyList:
945
+ """
946
+ Get a list of all API keys from the current account.
947
+
948
+ Parameters
949
+ ----------
950
+ total : Optional[bool]
951
+ When set to false, the total count returned will be 0 and will not be calculated.
952
+
953
+ Returns
954
+ -------
955
+ KeyList
956
+ API response as a typed Pydantic model
957
+
958
+ Raises
959
+ ------
960
+ AppwriteException
961
+ If API request fails
962
+ """
963
+
964
+ api_path = '/account/keys'
965
+ api_params = {}
966
+
967
+ if total is not None:
968
+ api_params['total'] = self._normalize_value(total)
969
+
970
+ response = self.client.call('get', api_path, {
971
+ 'X-Appwrite-Project': self.client.get_config('project'),
972
+ 'accept': 'application/json',
973
+ }, api_params)
974
+
975
+ return self._parse_response(response, model=KeyList)
976
+
977
+
978
+ def create_key(
979
+ self,
980
+ name: str,
981
+ scopes: List[AccountKeyScopes],
982
+ expire: Optional[str] = None
983
+ ) -> Key:
984
+ """
985
+ Create a new account API key.
986
+
987
+ Parameters
988
+ ----------
989
+ name : str
990
+ Key name. Max length: 128 chars.
991
+ scopes : List[AccountKeyScopes]
992
+ Key scopes list. Maximum of 200 scopes are allowed.
993
+ expire : Optional[str]
994
+ Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
995
+
996
+ Returns
997
+ -------
998
+ Key
999
+ API response as a typed Pydantic model
1000
+
1001
+ Raises
1002
+ ------
1003
+ AppwriteException
1004
+ If API request fails
1005
+ """
1006
+
1007
+ api_path = '/account/keys'
1008
+ api_params = {}
1009
+ if name is None:
1010
+ raise AppwriteException('Missing required parameter: "name"')
1011
+
1012
+ if scopes is None:
1013
+ raise AppwriteException('Missing required parameter: "scopes"')
1014
+
1015
+
1016
+ api_params['name'] = self._normalize_value(name)
1017
+ api_params['scopes'] = self._normalize_value(scopes)
1018
+ if expire is not None:
1019
+ api_params['expire'] = self._normalize_value(expire)
1020
+
1021
+ response = self.client.call('post', api_path, {
1022
+ 'X-Appwrite-Project': self.client.get_config('project'),
1023
+ 'content-type': 'application/json',
1024
+ 'accept': 'application/json',
1025
+ }, api_params)
1026
+
1027
+ return self._parse_response(response, model=Key)
1028
+
1029
+
1030
+ def get_key(
1031
+ self,
1032
+ key_id: str
1033
+ ) -> Key:
1034
+ """
1035
+ Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes.
1036
+
1037
+ Parameters
1038
+ ----------
1039
+ key_id : str
1040
+ Key unique ID.
1041
+
1042
+ Returns
1043
+ -------
1044
+ Key
1045
+ API response as a typed Pydantic model
1046
+
1047
+ Raises
1048
+ ------
1049
+ AppwriteException
1050
+ If API request fails
1051
+ """
1052
+
1053
+ api_path = '/account/keys/{keyId}'
1054
+ api_params = {}
1055
+ if key_id is None:
1056
+ raise AppwriteException('Missing required parameter: "key_id"')
1057
+
1058
+ api_path = api_path.replace('{keyId}', str(self._normalize_value(key_id)))
1059
+
1060
+
1061
+ response = self.client.call('get', api_path, {
1062
+ 'X-Appwrite-Project': self.client.get_config('project'),
1063
+ 'accept': 'application/json',
1064
+ }, api_params)
1065
+
1066
+ return self._parse_response(response, model=Key)
1067
+
1068
+
1069
+ def update_key(
1070
+ self,
1071
+ key_id: str,
1072
+ name: str,
1073
+ scopes: List[AccountKeyScopes],
1074
+ expire: Optional[str] = None
1075
+ ) -> Key:
1076
+ """
1077
+ Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.
1078
+
1079
+ Parameters
1080
+ ----------
1081
+ key_id : str
1082
+ Key unique ID.
1083
+ name : str
1084
+ Key name. Max length: 128 chars.
1085
+ scopes : List[AccountKeyScopes]
1086
+ Key scopes list. Maximum of 200 scopes are allowed.
1087
+ expire : Optional[str]
1088
+ Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
1089
+
1090
+ Returns
1091
+ -------
1092
+ Key
1093
+ API response as a typed Pydantic model
1094
+
1095
+ Raises
1096
+ ------
1097
+ AppwriteException
1098
+ If API request fails
1099
+ """
1100
+
1101
+ api_path = '/account/keys/{keyId}'
1102
+ api_params = {}
1103
+ if key_id is None:
1104
+ raise AppwriteException('Missing required parameter: "key_id"')
1105
+
1106
+ if name is None:
1107
+ raise AppwriteException('Missing required parameter: "name"')
1108
+
1109
+ if scopes is None:
1110
+ raise AppwriteException('Missing required parameter: "scopes"')
1111
+
1112
+ api_path = api_path.replace('{keyId}', str(self._normalize_value(key_id)))
1113
+
1114
+ api_params['name'] = self._normalize_value(name)
1115
+ api_params['scopes'] = self._normalize_value(scopes)
1116
+ if expire is not None:
1117
+ api_params['expire'] = self._normalize_value(expire)
1118
+
1119
+ response = self.client.call('put', api_path, {
1120
+ 'X-Appwrite-Project': self.client.get_config('project'),
1121
+ 'content-type': 'application/json',
1122
+ 'accept': 'application/json',
1123
+ }, api_params)
1124
+
1125
+ return self._parse_response(response, model=Key)
1126
+
1127
+
1128
+ def delete_key(
1129
+ self,
1130
+ key_id: str
1131
+ ) -> Dict[str, Any]:
1132
+ """
1133
+ Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.
1134
+
1135
+ Parameters
1136
+ ----------
1137
+ key_id : str
1138
+ Key unique ID.
1139
+
1140
+ Returns
1141
+ -------
1142
+ Dict[str, Any]
1143
+ API response as a dictionary
1144
+
1145
+ Raises
1146
+ ------
1147
+ AppwriteException
1148
+ If API request fails
1149
+ """
1150
+
1151
+ api_path = '/account/keys/{keyId}'
1152
+ api_params = {}
1153
+ if key_id is None:
1154
+ raise AppwriteException('Missing required parameter: "key_id"')
1155
+
1156
+ api_path = api_path.replace('{keyId}', str(self._normalize_value(key_id)))
1157
+
1158
+
1159
+ response = self.client.call('delete', api_path, {
1160
+ 'X-Appwrite-Project': self.client.get_config('project'),
1161
+ 'content-type': 'application/json',
1162
+ 'accept': 'application/json',
1163
+ }, api_params)
1164
+
1165
+ return response
1166
+
1167
+
1168
+ def list_logs(
1169
+ self,
1170
+ queries: Optional[List[str]] = None,
1171
+ total: Optional[bool] = None
1172
+ ) -> LogList:
1173
+ """
1174
+ 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.
1175
+
1176
+ Parameters
1177
+ ----------
1178
+ queries : Optional[List[str]]
1179
+ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
1180
+ total : Optional[bool]
1181
+ When set to false, the total count returned will be 0 and will not be calculated.
1182
+
1183
+ Returns
1184
+ -------
1185
+ LogList
1186
+ API response as a typed Pydantic model
1187
+
1188
+ Raises
1189
+ ------
1190
+ AppwriteException
1191
+ If API request fails
1192
+ """
1193
+
1194
+ api_path = '/account/logs'
1195
+ api_params = {}
1196
+
1197
+ if queries is not None:
1198
+ api_params['queries'] = self._normalize_value(queries)
1199
+ if total is not None:
1200
+ api_params['total'] = self._normalize_value(total)
1201
+
1202
+ response = self.client.call('get', api_path, {
1203
+ 'X-Appwrite-Project': self.client.get_config('project'),
1204
+ 'accept': 'application/json',
1205
+ }, api_params)
1206
+
1207
+ return self._parse_response(response, model=LogList)
1208
+
1209
+
1210
+ def update_mfa(
1211
+ self,
1212
+ mfa: bool,
1213
+ model_type: Type[T] = dict
1214
+ ) -> User[T]:
1215
+ """
1216
+ Enable or disable MFA on an account.
1217
+
1218
+ Parameters
1219
+ ----------
1220
+ mfa : bool
1221
+ Enable or disable MFA.
1222
+
1223
+ model_type : Type[T], optional
1224
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
1225
+
1226
+ Returns
1227
+ -------
1228
+ User[T]
1229
+ API response as a typed Pydantic model
1230
+
1231
+ Raises
1232
+ ------
1233
+ AppwriteException
1234
+ If API request fails
1235
+ """
1236
+
1237
+ api_path = '/account/mfa'
1238
+ api_params = {}
1239
+ if mfa is None:
1240
+ raise AppwriteException('Missing required parameter: "mfa"')
1241
+
1242
+
1243
+ api_params['mfa'] = self._normalize_value(mfa)
1244
+
1245
+ response = self.client.call('patch', api_path, {
1246
+ 'X-Appwrite-Project': self.client.get_config('project'),
1247
+ 'content-type': 'application/json',
1248
+ 'accept': 'application/json',
1249
+ }, api_params)
1250
+
1251
+ return User.with_data(response, model_type)
1252
+
1253
+
1254
+ def create_mfa_authenticator(
1255
+ self,
1256
+ type: AuthenticatorType
1257
+ ) -> MfaType:
1258
+ """
1259
+ 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.
1260
+
1261
+ Parameters
1262
+ ----------
1263
+ type : AuthenticatorType
1264
+ Type of authenticator. Must be `totp`
1265
+
1266
+ Returns
1267
+ -------
1268
+ MfaType
1269
+ API response as a typed Pydantic model
1270
+
1271
+ Raises
1272
+ ------
1273
+ AppwriteException
1274
+ If API request fails
1275
+ """
1276
+
1277
+ api_path = '/account/mfa/authenticators/{type}'
1278
+ api_params = {}
1279
+ if type is None:
1280
+ raise AppwriteException('Missing required parameter: "type"')
1281
+
1282
+ api_path = api_path.replace('{type}', str(self._normalize_value(type)))
1283
+
1284
+
1285
+ response = self.client.call('post', api_path, {
1286
+ 'X-Appwrite-Project': self.client.get_config('project'),
1287
+ 'content-type': 'application/json',
1288
+ 'accept': 'application/json',
1289
+ }, api_params)
1290
+
1291
+ return self._parse_response(response, model=MfaType)
1292
+
1293
+
1294
+ def update_mfa_authenticator(
1295
+ self,
1296
+ type: AuthenticatorType,
1297
+ otp: str,
1298
+ model_type: Type[T] = dict
1299
+ ) -> User[T]:
1300
+ """
1301
+ Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
1302
+
1303
+ Parameters
1304
+ ----------
1305
+ type : AuthenticatorType
1306
+ Type of authenticator.
1307
+ otp : str
1308
+ Valid verification token.
1309
+
1310
+ model_type : Type[T], optional
1311
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
1312
+
1313
+ Returns
1314
+ -------
1315
+ User[T]
1316
+ API response as a typed Pydantic model
1317
+
1318
+ Raises
1319
+ ------
1320
+ AppwriteException
1321
+ If API request fails
1322
+ """
1323
+
1324
+ api_path = '/account/mfa/authenticators/{type}'
1325
+ api_params = {}
1326
+ if type is None:
1327
+ raise AppwriteException('Missing required parameter: "type"')
1328
+
1329
+ if otp is None:
1330
+ raise AppwriteException('Missing required parameter: "otp"')
1331
+
1332
+ api_path = api_path.replace('{type}', str(self._normalize_value(type)))
1333
+
1334
+ api_params['otp'] = self._normalize_value(otp)
1335
+
1336
+ response = self.client.call('put', api_path, {
1337
+ 'X-Appwrite-Project': self.client.get_config('project'),
1338
+ 'content-type': 'application/json',
1339
+ 'accept': 'application/json',
1340
+ }, api_params)
1341
+
1342
+ return User.with_data(response, model_type)
1343
+
1344
+
1345
+ def delete_mfa_authenticator(
1346
+ self,
1347
+ type: AuthenticatorType
1348
+ ) -> Dict[str, Any]:
1349
+ """
1350
+ Delete an authenticator for a user by ID.
1351
+
1352
+ Parameters
1353
+ ----------
1354
+ type : AuthenticatorType
1355
+ Type of authenticator.
1356
+
1357
+ Returns
1358
+ -------
1359
+ Dict[str, Any]
1360
+ API response as a dictionary
1361
+
1362
+ Raises
1363
+ ------
1364
+ AppwriteException
1365
+ If API request fails
1366
+ """
1367
+
1368
+ api_path = '/account/mfa/authenticators/{type}'
1369
+ api_params = {}
1370
+ if type is None:
1371
+ raise AppwriteException('Missing required parameter: "type"')
1372
+
1373
+ api_path = api_path.replace('{type}', str(self._normalize_value(type)))
1374
+
1375
+
1376
+ response = self.client.call('delete', api_path, {
1377
+ 'X-Appwrite-Project': self.client.get_config('project'),
1378
+ 'content-type': 'application/json',
1379
+ }, api_params)
1380
+
1381
+ return response
1382
+
1383
+
1384
+ def create_mfa_challenge(
1385
+ self,
1386
+ factor: AuthenticationFactor
1387
+ ) -> MfaChallenge:
1388
+ """
1389
+ Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
1390
+
1391
+ Parameters
1392
+ ----------
1393
+ factor : AuthenticationFactor
1394
+ Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
1395
+
1396
+ Returns
1397
+ -------
1398
+ MfaChallenge
1399
+ API response as a typed Pydantic model
1400
+
1401
+ Raises
1402
+ ------
1403
+ AppwriteException
1404
+ If API request fails
1405
+ """
1406
+
1407
+ api_path = '/account/mfa/challenges'
1408
+ api_params = {}
1409
+ if factor is None:
1410
+ raise AppwriteException('Missing required parameter: "factor"')
1411
+
1412
+
1413
+ api_params['factor'] = self._normalize_value(factor)
1414
+
1415
+ response = self.client.call('post', api_path, {
1416
+ 'X-Appwrite-Project': self.client.get_config('project'),
1417
+ 'content-type': 'application/json',
1418
+ 'accept': 'application/json',
1419
+ }, api_params)
1420
+
1421
+ return self._parse_response(response, model=MfaChallenge)
1422
+
1423
+
1424
+ def update_mfa_challenge(
1425
+ self,
1426
+ challenge_id: str,
1427
+ otp: str
1428
+ ) -> Session:
1429
+ """
1430
+ 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.
1431
+
1432
+ Parameters
1433
+ ----------
1434
+ challenge_id : str
1435
+ ID of the challenge.
1436
+ otp : str
1437
+ Valid verification token.
1438
+
1439
+ Returns
1440
+ -------
1441
+ Session
1442
+ API response as a typed Pydantic model
1443
+
1444
+ Raises
1445
+ ------
1446
+ AppwriteException
1447
+ If API request fails
1448
+ """
1449
+
1450
+ api_path = '/account/mfa/challenges'
1451
+ api_params = {}
1452
+ if challenge_id is None:
1453
+ raise AppwriteException('Missing required parameter: "challenge_id"')
1454
+
1455
+ if otp is None:
1456
+ raise AppwriteException('Missing required parameter: "otp"')
1457
+
1458
+
1459
+ api_params['challengeId'] = self._normalize_value(challenge_id)
1460
+ api_params['otp'] = self._normalize_value(otp)
1461
+
1462
+ response = self.client.call('put', api_path, {
1463
+ 'X-Appwrite-Project': self.client.get_config('project'),
1464
+ 'content-type': 'application/json',
1465
+ 'accept': 'application/json',
1466
+ }, api_params)
1467
+
1468
+ return self._parse_response(response, model=Session)
1469
+
1470
+
1471
+ def list_mfa_factors(
1472
+ self
1473
+ ) -> MfaFactors:
1474
+ """
1475
+ List the factors available on the account to be used as a MFA challange.
1476
+
1477
+ Returns
1478
+ -------
1479
+ MfaFactors
1480
+ API response as a typed Pydantic model
1481
+
1482
+ Raises
1483
+ ------
1484
+ AppwriteException
1485
+ If API request fails
1486
+ """
1487
+
1488
+ api_path = '/account/mfa/factors'
1489
+ api_params = {}
1490
+
1491
+ response = self.client.call('get', api_path, {
1492
+ 'X-Appwrite-Project': self.client.get_config('project'),
1493
+ 'accept': 'application/json',
1494
+ }, api_params)
1495
+
1496
+ return self._parse_response(response, model=MfaFactors)
1497
+
1498
+
1499
+ def get_mfa_recovery_codes(
1500
+ self
1501
+ ) -> MfaRecoveryCodes:
1502
+ """
1503
+ 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.
1504
+
1505
+ Returns
1506
+ -------
1507
+ MfaRecoveryCodes
1508
+ API response as a typed Pydantic model
1509
+
1510
+ Raises
1511
+ ------
1512
+ AppwriteException
1513
+ If API request fails
1514
+ """
1515
+
1516
+ api_path = '/account/mfa/recovery-codes'
1517
+ api_params = {}
1518
+
1519
+ response = self.client.call('get', api_path, {
1520
+ 'X-Appwrite-Project': self.client.get_config('project'),
1521
+ 'accept': 'application/json',
1522
+ }, api_params)
1523
+
1524
+ return self._parse_response(response, model=MfaRecoveryCodes)
1525
+
1526
+
1527
+ def create_mfa_recovery_codes(
1528
+ self
1529
+ ) -> MfaRecoveryCodes:
1530
+ """
1531
+ Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
1532
+
1533
+ Returns
1534
+ -------
1535
+ MfaRecoveryCodes
1536
+ API response as a typed Pydantic model
1537
+
1538
+ Raises
1539
+ ------
1540
+ AppwriteException
1541
+ If API request fails
1542
+ """
1543
+
1544
+ api_path = '/account/mfa/recovery-codes'
1545
+ api_params = {}
1546
+
1547
+ response = self.client.call('post', api_path, {
1548
+ 'X-Appwrite-Project': self.client.get_config('project'),
1549
+ 'content-type': 'application/json',
1550
+ 'accept': 'application/json',
1551
+ }, api_params)
1552
+
1553
+ return self._parse_response(response, model=MfaRecoveryCodes)
1554
+
1555
+
1556
+ def update_mfa_recovery_codes(
1557
+ self
1558
+ ) -> MfaRecoveryCodes:
1559
+ """
1560
+ 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.
1561
+
1562
+ Returns
1563
+ -------
1564
+ MfaRecoveryCodes
1565
+ API response as a typed Pydantic model
1566
+
1567
+ Raises
1568
+ ------
1569
+ AppwriteException
1570
+ If API request fails
1571
+ """
1572
+
1573
+ api_path = '/account/mfa/recovery-codes'
1574
+ api_params = {}
1575
+
1576
+ response = self.client.call('patch', api_path, {
1577
+ 'X-Appwrite-Project': self.client.get_config('project'),
1578
+ 'content-type': 'application/json',
1579
+ 'accept': 'application/json',
1580
+ }, api_params)
1581
+
1582
+ return self._parse_response(response, model=MfaRecoveryCodes)
1583
+
1584
+
1585
+ def update_name(
1586
+ self,
1587
+ name: str,
1588
+ model_type: Type[T] = dict
1589
+ ) -> User[T]:
1590
+ """
1591
+ Update currently logged in user account name.
1592
+
1593
+ Parameters
1594
+ ----------
1595
+ name : str
1596
+ User name. Max length: 128 chars.
1597
+
1598
+ model_type : Type[T], optional
1599
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
1600
+
1601
+ Returns
1602
+ -------
1603
+ User[T]
1604
+ API response as a typed Pydantic model
1605
+
1606
+ Raises
1607
+ ------
1608
+ AppwriteException
1609
+ If API request fails
1610
+ """
1611
+
1612
+ api_path = '/account/name'
1613
+ api_params = {}
1614
+ if name is None:
1615
+ raise AppwriteException('Missing required parameter: "name"')
1616
+
1617
+
1618
+ api_params['name'] = self._normalize_value(name)
1619
+
1620
+ response = self.client.call('patch', api_path, {
1621
+ 'X-Appwrite-Project': self.client.get_config('project'),
1622
+ 'content-type': 'application/json',
1623
+ 'accept': 'application/json',
1624
+ }, api_params)
1625
+
1626
+ return User.with_data(response, model_type)
1627
+
1628
+
1629
+ def update_password(
1630
+ self,
1631
+ password: str,
1632
+ old_password: Optional[str] = None,
1633
+ model_type: Type[T] = dict
1634
+ ) -> User[T]:
1635
+ """
1636
+ 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.
1637
+
1638
+ Parameters
1639
+ ----------
1640
+ password : str
1641
+ New user password. Must be at least 8 chars.
1642
+ old_password : Optional[str]
1643
+ Current user password. Max length: 256 chars.
1644
+
1645
+ model_type : Type[T], optional
1646
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
1647
+
1648
+ Returns
1649
+ -------
1650
+ User[T]
1651
+ API response as a typed Pydantic model
1652
+
1653
+ Raises
1654
+ ------
1655
+ AppwriteException
1656
+ If API request fails
1657
+ """
1658
+
1659
+ api_path = '/account/password'
1660
+ api_params = {}
1661
+ if password is None:
1662
+ raise AppwriteException('Missing required parameter: "password"')
1663
+
1664
+
1665
+ api_params['password'] = self._normalize_value(password)
1666
+ if old_password is not None:
1667
+ api_params['oldPassword'] = self._normalize_value(old_password)
1668
+
1669
+ response = self.client.call('patch', api_path, {
1670
+ 'X-Appwrite-Project': self.client.get_config('project'),
1671
+ 'content-type': 'application/json',
1672
+ 'accept': 'application/json',
1673
+ }, api_params)
1674
+
1675
+ return User.with_data(response, model_type)
1676
+
1677
+
1678
+ def list_payment_methods(
1679
+ self,
1680
+ queries: Optional[List[str]] = None
1681
+ ) -> PaymentMethodList:
1682
+ """
1683
+ List payment methods for this account.
1684
+
1685
+ Parameters
1686
+ ----------
1687
+ queries : Optional[List[str]]
1688
+ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, expired, failed
1689
+
1690
+ Returns
1691
+ -------
1692
+ PaymentMethodList
1693
+ API response as a typed Pydantic model
1694
+
1695
+ Raises
1696
+ ------
1697
+ AppwriteException
1698
+ If API request fails
1699
+ """
1700
+
1701
+ api_path = '/account/payment-methods'
1702
+ api_params = {}
1703
+
1704
+ if queries is not None:
1705
+ api_params['queries'] = self._normalize_value(queries)
1706
+
1707
+ response = self.client.call('get', api_path, {
1708
+ 'X-Appwrite-Project': self.client.get_config('project'),
1709
+ 'accept': 'application/json',
1710
+ }, api_params)
1711
+
1712
+ return self._parse_response(response, model=PaymentMethodList)
1713
+
1714
+
1715
+ def create_payment_method(
1716
+ self
1717
+ ) -> PaymentMethod:
1718
+ """
1719
+ Create a new payment method for the current user account.
1720
+
1721
+ Returns
1722
+ -------
1723
+ PaymentMethod
1724
+ API response as a typed Pydantic model
1725
+
1726
+ Raises
1727
+ ------
1728
+ AppwriteException
1729
+ If API request fails
1730
+ """
1731
+
1732
+ api_path = '/account/payment-methods'
1733
+ api_params = {}
1734
+
1735
+ response = self.client.call('post', api_path, {
1736
+ 'X-Appwrite-Project': self.client.get_config('project'),
1737
+ 'content-type': 'application/json',
1738
+ 'accept': 'application/json',
1739
+ }, api_params)
1740
+
1741
+ return self._parse_response(response, model=PaymentMethod)
1742
+
1743
+
1744
+ def get_payment_method(
1745
+ self,
1746
+ payment_method_id: str
1747
+ ) -> PaymentMethod:
1748
+ """
1749
+ Get a specific payment method for the user.
1750
+
1751
+ Parameters
1752
+ ----------
1753
+ payment_method_id : str
1754
+ Unique ID of payment method
1755
+
1756
+ Returns
1757
+ -------
1758
+ PaymentMethod
1759
+ API response as a typed Pydantic model
1760
+
1761
+ Raises
1762
+ ------
1763
+ AppwriteException
1764
+ If API request fails
1765
+ """
1766
+
1767
+ api_path = '/account/payment-methods/{paymentMethodId}'
1768
+ api_params = {}
1769
+ if payment_method_id is None:
1770
+ raise AppwriteException('Missing required parameter: "payment_method_id"')
1771
+
1772
+ api_path = api_path.replace('{paymentMethodId}', str(self._normalize_value(payment_method_id)))
1773
+
1774
+
1775
+ response = self.client.call('get', api_path, {
1776
+ 'X-Appwrite-Project': self.client.get_config('project'),
1777
+ 'accept': 'application/json',
1778
+ }, api_params)
1779
+
1780
+ return self._parse_response(response, model=PaymentMethod)
1781
+
1782
+
1783
+ def update_payment_method(
1784
+ self,
1785
+ payment_method_id: str,
1786
+ expiry_month: float,
1787
+ expiry_year: float,
1788
+ state: Optional[str] = None
1789
+ ) -> PaymentMethod:
1790
+ """
1791
+ Update a new payment method for the current user account.
1792
+
1793
+ Parameters
1794
+ ----------
1795
+ payment_method_id : str
1796
+ Unique ID of payment method
1797
+ expiry_month : float
1798
+ Payment expiry month
1799
+ expiry_year : float
1800
+ Expiry year
1801
+ state : Optional[str]
1802
+ State of the payment method country
1803
+
1804
+ Returns
1805
+ -------
1806
+ PaymentMethod
1807
+ API response as a typed Pydantic model
1808
+
1809
+ Raises
1810
+ ------
1811
+ AppwriteException
1812
+ If API request fails
1813
+ """
1814
+
1815
+ api_path = '/account/payment-methods/{paymentMethodId}'
1816
+ api_params = {}
1817
+ if payment_method_id is None:
1818
+ raise AppwriteException('Missing required parameter: "payment_method_id"')
1819
+
1820
+ if expiry_month is None:
1821
+ raise AppwriteException('Missing required parameter: "expiry_month"')
1822
+
1823
+ if expiry_year is None:
1824
+ raise AppwriteException('Missing required parameter: "expiry_year"')
1825
+
1826
+ api_path = api_path.replace('{paymentMethodId}', str(self._normalize_value(payment_method_id)))
1827
+
1828
+ api_params['expiryMonth'] = self._normalize_value(expiry_month)
1829
+ api_params['expiryYear'] = self._normalize_value(expiry_year)
1830
+ if state is not None:
1831
+ api_params['state'] = self._normalize_value(state)
1832
+
1833
+ response = self.client.call('patch', api_path, {
1834
+ 'X-Appwrite-Project': self.client.get_config('project'),
1835
+ 'content-type': 'application/json',
1836
+ 'accept': 'application/json',
1837
+ }, api_params)
1838
+
1839
+ return self._parse_response(response, model=PaymentMethod)
1840
+
1841
+
1842
+ def delete_payment_method(
1843
+ self,
1844
+ payment_method_id: str
1845
+ ) -> Dict[str, Any]:
1846
+ """
1847
+ Delete a specific payment method from a user's account.
1848
+
1849
+ Parameters
1850
+ ----------
1851
+ payment_method_id : str
1852
+ Unique ID of payment method
1853
+
1854
+ Returns
1855
+ -------
1856
+ Dict[str, Any]
1857
+ API response as a dictionary
1858
+
1859
+ Raises
1860
+ ------
1861
+ AppwriteException
1862
+ If API request fails
1863
+ """
1864
+
1865
+ api_path = '/account/payment-methods/{paymentMethodId}'
1866
+ api_params = {}
1867
+ if payment_method_id is None:
1868
+ raise AppwriteException('Missing required parameter: "payment_method_id"')
1869
+
1870
+ api_path = api_path.replace('{paymentMethodId}', str(self._normalize_value(payment_method_id)))
1871
+
1872
+
1873
+ response = self.client.call('delete', api_path, {
1874
+ 'X-Appwrite-Project': self.client.get_config('project'),
1875
+ 'content-type': 'application/json',
1876
+ 'accept': 'application/json',
1877
+ }, api_params)
1878
+
1879
+ return response
1880
+
1881
+
1882
+ def update_payment_method_provider(
1883
+ self,
1884
+ payment_method_id: str,
1885
+ provider_method_id: str,
1886
+ name: str,
1887
+ state: Optional[str] = None
1888
+ ) -> PaymentMethod:
1889
+ """
1890
+ Update payment method provider.
1891
+
1892
+ Parameters
1893
+ ----------
1894
+ payment_method_id : str
1895
+ Unique ID of payment method
1896
+ provider_method_id : str
1897
+ Payment method ID from the payment provider
1898
+ name : str
1899
+ Name in the payment method
1900
+ state : Optional[str]
1901
+ State of the payment method country
1902
+
1903
+ Returns
1904
+ -------
1905
+ PaymentMethod
1906
+ API response as a typed Pydantic model
1907
+
1908
+ Raises
1909
+ ------
1910
+ AppwriteException
1911
+ If API request fails
1912
+ """
1913
+
1914
+ api_path = '/account/payment-methods/{paymentMethodId}/provider'
1915
+ api_params = {}
1916
+ if payment_method_id is None:
1917
+ raise AppwriteException('Missing required parameter: "payment_method_id"')
1918
+
1919
+ if provider_method_id is None:
1920
+ raise AppwriteException('Missing required parameter: "provider_method_id"')
1921
+
1922
+ if name is None:
1923
+ raise AppwriteException('Missing required parameter: "name"')
1924
+
1925
+ api_path = api_path.replace('{paymentMethodId}', str(self._normalize_value(payment_method_id)))
1926
+
1927
+ api_params['providerMethodId'] = self._normalize_value(provider_method_id)
1928
+ api_params['name'] = self._normalize_value(name)
1929
+ if state is not None:
1930
+ api_params['state'] = self._normalize_value(state)
1931
+
1932
+ response = self.client.call('patch', api_path, {
1933
+ 'X-Appwrite-Project': self.client.get_config('project'),
1934
+ 'content-type': 'application/json',
1935
+ 'accept': 'application/json',
1936
+ }, api_params)
1937
+
1938
+ return self._parse_response(response, model=PaymentMethod)
1939
+
1940
+
1941
+ def update_payment_method_mandate_options(
1942
+ self,
1943
+ payment_method_id: str
1944
+ ) -> PaymentMethod:
1945
+ """
1946
+ Update payment method mandate options.
1947
+
1948
+ Parameters
1949
+ ----------
1950
+ payment_method_id : str
1951
+ Unique ID of payment method
1952
+
1953
+ Returns
1954
+ -------
1955
+ PaymentMethod
1956
+ API response as a typed Pydantic model
1957
+
1958
+ Raises
1959
+ ------
1960
+ AppwriteException
1961
+ If API request fails
1962
+ """
1963
+
1964
+ api_path = '/account/payment-methods/{paymentMethodId}/setup'
1965
+ api_params = {}
1966
+ if payment_method_id is None:
1967
+ raise AppwriteException('Missing required parameter: "payment_method_id"')
1968
+
1969
+ api_path = api_path.replace('{paymentMethodId}', str(self._normalize_value(payment_method_id)))
1970
+
1971
+
1972
+ response = self.client.call('patch', api_path, {
1973
+ 'X-Appwrite-Project': self.client.get_config('project'),
1974
+ 'content-type': 'application/json',
1975
+ 'accept': 'application/json',
1976
+ }, api_params)
1977
+
1978
+ return self._parse_response(response, model=PaymentMethod)
1979
+
1980
+
1981
+ def update_phone(
1982
+ self,
1983
+ phone: str,
1984
+ password: str,
1985
+ model_type: Type[T] = dict
1986
+ ) -> User[T]:
1987
+ """
1988
+ Update the currently logged in user'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://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
1989
+
1990
+ Parameters
1991
+ ----------
1992
+ phone : str
1993
+ Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
1994
+ password : str
1995
+ User password. Must be at least 8 chars.
1996
+
1997
+ model_type : Type[T], optional
1998
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
1999
+
2000
+ Returns
2001
+ -------
2002
+ User[T]
2003
+ API response as a typed Pydantic model
2004
+
2005
+ Raises
2006
+ ------
2007
+ AppwriteException
2008
+ If API request fails
2009
+ """
2010
+
2011
+ api_path = '/account/phone'
2012
+ api_params = {}
2013
+ if phone is None:
2014
+ raise AppwriteException('Missing required parameter: "phone"')
2015
+
2016
+ if password is None:
2017
+ raise AppwriteException('Missing required parameter: "password"')
2018
+
2019
+
2020
+ api_params['phone'] = self._normalize_value(phone)
2021
+ api_params['password'] = self._normalize_value(password)
2022
+
2023
+ response = self.client.call('patch', api_path, {
2024
+ 'X-Appwrite-Project': self.client.get_config('project'),
2025
+ 'content-type': 'application/json',
2026
+ 'accept': 'application/json',
2027
+ }, api_params)
2028
+
2029
+ return User.with_data(response, model_type)
2030
+
2031
+
2032
+ def get_prefs(
2033
+ self,
2034
+ model_type: Type[T] = dict
2035
+ ) -> Preferences[T]:
2036
+ """
2037
+ Get the preferences as a key-value object for the currently logged in user.
2038
+
2039
+ Parameters
2040
+ ----------
2041
+
2042
+ model_type : Type[T], optional
2043
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
2044
+
2045
+ Returns
2046
+ -------
2047
+ Preferences[T]
2048
+ API response as a typed Pydantic model
2049
+
2050
+ Raises
2051
+ ------
2052
+ AppwriteException
2053
+ If API request fails
2054
+ """
2055
+
2056
+ api_path = '/account/prefs'
2057
+ api_params = {}
2058
+
2059
+ response = self.client.call('get', api_path, {
2060
+ 'X-Appwrite-Project': self.client.get_config('project'),
2061
+ 'accept': 'application/json',
2062
+ }, api_params)
2063
+
2064
+ return Preferences.with_data(response, model_type)
2065
+
2066
+
2067
+ def update_prefs(
2068
+ self,
2069
+ prefs: Dict[str, Any],
2070
+ model_type: Type[T] = dict
2071
+ ) -> User[T]:
2072
+ """
2073
+ 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.
2074
+
2075
+ Parameters
2076
+ ----------
2077
+ prefs : Dict[str, Any]
2078
+ Prefs key-value JSON object.
2079
+
2080
+ model_type : Type[T], optional
2081
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
2082
+
2083
+ Returns
2084
+ -------
2085
+ User[T]
2086
+ API response as a typed Pydantic model
2087
+
2088
+ Raises
2089
+ ------
2090
+ AppwriteException
2091
+ If API request fails
2092
+ """
2093
+
2094
+ api_path = '/account/prefs'
2095
+ api_params = {}
2096
+ if prefs is None:
2097
+ raise AppwriteException('Missing required parameter: "prefs"')
2098
+
2099
+
2100
+ api_params['prefs'] = self._normalize_value(prefs)
2101
+
2102
+ response = self.client.call('patch', api_path, {
2103
+ 'X-Appwrite-Project': self.client.get_config('project'),
2104
+ 'content-type': 'application/json',
2105
+ 'accept': 'application/json',
2106
+ }, api_params)
2107
+
2108
+ return User.with_data(response, model_type)
2109
+
2110
+
2111
+ def create_recovery(
2112
+ self,
2113
+ email: str,
2114
+ url: str
2115
+ ) -> Token:
2116
+ """
2117
+ 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://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
2118
+
2119
+ Parameters
2120
+ ----------
2121
+ email : str
2122
+ User email.
2123
+ url : str
2124
+ URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2125
+
2126
+ Returns
2127
+ -------
2128
+ Token
2129
+ API response as a typed Pydantic model
2130
+
2131
+ Raises
2132
+ ------
2133
+ AppwriteException
2134
+ If API request fails
2135
+ """
2136
+
2137
+ api_path = '/account/recovery'
2138
+ api_params = {}
2139
+ if email is None:
2140
+ raise AppwriteException('Missing required parameter: "email"')
2141
+
2142
+ if url is None:
2143
+ raise AppwriteException('Missing required parameter: "url"')
2144
+
2145
+
2146
+ api_params['email'] = self._normalize_value(email)
2147
+ api_params['url'] = self._normalize_value(url)
2148
+
2149
+ response = self.client.call('post', api_path, {
2150
+ 'X-Appwrite-Project': self.client.get_config('project'),
2151
+ 'content-type': 'application/json',
2152
+ 'accept': 'application/json',
2153
+ }, api_params)
2154
+
2155
+ return self._parse_response(response, model=Token)
2156
+
2157
+
2158
+ def update_recovery(
2159
+ self,
2160
+ user_id: str,
2161
+ secret: str,
2162
+ password: str
2163
+ ) -> Token:
2164
+ """
2165
+ Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
2166
+
2167
+ 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.
2168
+
2169
+ Parameters
2170
+ ----------
2171
+ user_id : str
2172
+ User ID.
2173
+ secret : str
2174
+ Valid reset token.
2175
+ password : str
2176
+ New user password. Must be between 8 and 256 chars.
2177
+
2178
+ Returns
2179
+ -------
2180
+ Token
2181
+ API response as a typed Pydantic model
2182
+
2183
+ Raises
2184
+ ------
2185
+ AppwriteException
2186
+ If API request fails
2187
+ """
2188
+
2189
+ api_path = '/account/recovery'
2190
+ api_params = {}
2191
+ if user_id is None:
2192
+ raise AppwriteException('Missing required parameter: "user_id"')
2193
+
2194
+ if secret is None:
2195
+ raise AppwriteException('Missing required parameter: "secret"')
2196
+
2197
+ if password is None:
2198
+ raise AppwriteException('Missing required parameter: "password"')
2199
+
2200
+
2201
+ api_params['userId'] = self._normalize_value(user_id)
2202
+ api_params['secret'] = self._normalize_value(secret)
2203
+ api_params['password'] = self._normalize_value(password)
2204
+
2205
+ response = self.client.call('put', api_path, {
2206
+ 'X-Appwrite-Project': self.client.get_config('project'),
2207
+ 'content-type': 'application/json',
2208
+ 'accept': 'application/json',
2209
+ }, api_params)
2210
+
2211
+ return self._parse_response(response, model=Token)
2212
+
2213
+
2214
+ def list_sessions(
2215
+ self
2216
+ ) -> SessionList:
2217
+ """
2218
+ Get the list of active sessions across different devices for the currently logged in user.
2219
+
2220
+ Returns
2221
+ -------
2222
+ SessionList
2223
+ API response as a typed Pydantic model
2224
+
2225
+ Raises
2226
+ ------
2227
+ AppwriteException
2228
+ If API request fails
2229
+ """
2230
+
2231
+ api_path = '/account/sessions'
2232
+ api_params = {}
2233
+
2234
+ response = self.client.call('get', api_path, {
2235
+ 'X-Appwrite-Project': self.client.get_config('project'),
2236
+ 'accept': 'application/json',
2237
+ }, api_params)
2238
+
2239
+ return self._parse_response(response, model=SessionList)
2240
+
2241
+
2242
+ def delete_sessions(
2243
+ self
2244
+ ) -> Dict[str, Any]:
2245
+ """
2246
+ Delete all sessions from the user account and remove any sessions cookies from the end client.
2247
+
2248
+ Returns
2249
+ -------
2250
+ Dict[str, Any]
2251
+ API response as a dictionary
2252
+
2253
+ Raises
2254
+ ------
2255
+ AppwriteException
2256
+ If API request fails
2257
+ """
2258
+
2259
+ api_path = '/account/sessions'
2260
+ api_params = {}
2261
+
2262
+ response = self.client.call('delete', api_path, {
2263
+ 'X-Appwrite-Project': self.client.get_config('project'),
2264
+ 'content-type': 'application/json',
2265
+ }, api_params)
2266
+
2267
+ return response
2268
+
2269
+
2270
+ def create_anonymous_session(
2271
+ self
2272
+ ) -> Session:
2273
+ """
2274
+ 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://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
2275
+
2276
+ Returns
2277
+ -------
2278
+ Session
2279
+ API response as a typed Pydantic model
2280
+
2281
+ Raises
2282
+ ------
2283
+ AppwriteException
2284
+ If API request fails
2285
+ """
2286
+
2287
+ api_path = '/account/sessions/anonymous'
2288
+ api_params = {}
2289
+
2290
+ response = self.client.call('post', api_path, {
2291
+ 'X-Appwrite-Project': self.client.get_config('project'),
2292
+ 'content-type': 'application/json',
2293
+ 'accept': 'application/json',
2294
+ }, api_params)
2295
+
2296
+ return self._parse_response(response, model=Session)
2297
+
2298
+
2299
+ def create_email_password_session(
2300
+ self,
2301
+ email: str,
2302
+ password: str
2303
+ ) -> Session:
2304
+ """
2305
+ 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.
2306
+
2307
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
2308
+
2309
+ Parameters
2310
+ ----------
2311
+ email : str
2312
+ User email.
2313
+ password : str
2314
+ User password. Must be at least 8 chars.
2315
+
2316
+ Returns
2317
+ -------
2318
+ Session
2319
+ API response as a typed Pydantic model
2320
+
2321
+ Raises
2322
+ ------
2323
+ AppwriteException
2324
+ If API request fails
2325
+ """
2326
+
2327
+ api_path = '/account/sessions/email'
2328
+ api_params = {}
2329
+ if email is None:
2330
+ raise AppwriteException('Missing required parameter: "email"')
2331
+
2332
+ if password is None:
2333
+ raise AppwriteException('Missing required parameter: "password"')
2334
+
2335
+
2336
+ api_params['email'] = self._normalize_value(email)
2337
+ api_params['password'] = self._normalize_value(password)
2338
+
2339
+ response = self.client.call('post', api_path, {
2340
+ 'X-Appwrite-Project': self.client.get_config('project'),
2341
+ 'content-type': 'application/json',
2342
+ 'accept': 'application/json',
2343
+ }, api_params)
2344
+
2345
+ return self._parse_response(response, model=Session)
2346
+
2347
+
2348
+ @deprecated("This API has been deprecated since 1.6.0. Please use `account.create_session` instead.")
2349
+ def update_magic_url_session(
2350
+ self,
2351
+ user_id: str,
2352
+ secret: str
2353
+ ) -> Session:
2354
+ """
2355
+ 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.
2356
+
2357
+ .. deprecated::1.6.0
2358
+ This API has been deprecated since 1.6.0. Please use `account.create_session` instead.
2359
+ Parameters
2360
+ ----------
2361
+ user_id : str
2362
+ User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2363
+ secret : str
2364
+ Valid verification token.
2365
+
2366
+ Returns
2367
+ -------
2368
+ Session
2369
+ API response as a typed Pydantic model
2370
+
2371
+ Raises
2372
+ ------
2373
+ AppwriteException
2374
+ If API request fails
2375
+ """
2376
+
2377
+ api_path = '/account/sessions/magic-url'
2378
+ api_params = {}
2379
+ if user_id is None:
2380
+ raise AppwriteException('Missing required parameter: "user_id"')
2381
+
2382
+ if secret is None:
2383
+ raise AppwriteException('Missing required parameter: "secret"')
2384
+
2385
+
2386
+ api_params['userId'] = self._normalize_value(user_id)
2387
+ api_params['secret'] = self._normalize_value(secret)
2388
+
2389
+ response = self.client.call('put', api_path, {
2390
+ 'X-Appwrite-Project': self.client.get_config('project'),
2391
+ 'content-type': 'application/json',
2392
+ 'accept': 'application/json',
2393
+ }, api_params)
2394
+
2395
+ return self._parse_response(response, model=Session)
2396
+
2397
+
2398
+ def create_o_auth2_session(
2399
+ self,
2400
+ provider: OAuthProvider,
2401
+ success: Optional[str] = None,
2402
+ failure: Optional[str] = None,
2403
+ scopes: Optional[List[str]] = None
2404
+ ) -> str:
2405
+ """
2406
+ Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
2407
+
2408
+ 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.
2409
+
2410
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
2411
+
2412
+
2413
+ Parameters
2414
+ ----------
2415
+ provider : OAuthProvider
2416
+ OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
2417
+ success : Optional[str]
2418
+ URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2419
+ failure : Optional[str]
2420
+ URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2421
+ scopes : Optional[List[str]]
2422
+ A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
2423
+
2424
+ Returns
2425
+ -------
2426
+ str
2427
+ Authentication response as a string
2428
+
2429
+ Raises
2430
+ ------
2431
+ AppwriteException
2432
+ If API request fails
2433
+ """
2434
+
2435
+ api_path = '/account/sessions/oauth2/{provider}'
2436
+ api_params = {}
2437
+ if provider is None:
2438
+ raise AppwriteException('Missing required parameter: "provider"')
2439
+
2440
+ api_path = api_path.replace('{provider}', str(self._normalize_value(provider)))
2441
+
2442
+ if success is not None:
2443
+ api_params['success'] = self._normalize_value(success)
2444
+ if failure is not None:
2445
+ api_params['failure'] = self._normalize_value(failure)
2446
+ if scopes is not None:
2447
+ api_params['scopes'] = self._normalize_value(scopes)
2448
+
2449
+ response = self.client.call('get', api_path, {
2450
+ 'X-Appwrite-Project': self.client.get_config('project'),
2451
+ 'accept': 'text/html',
2452
+ }, api_params, response_type='location')
2453
+
2454
+ return response
2455
+
2456
+
2457
+ @deprecated("This API has been deprecated since 1.6.0. Please use `account.create_session` instead.")
2458
+ def update_phone_session(
2459
+ self,
2460
+ user_id: str,
2461
+ secret: str
2462
+ ) -> Session:
2463
+ """
2464
+ 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.
2465
+
2466
+ .. deprecated::1.6.0
2467
+ This API has been deprecated since 1.6.0. Please use `account.create_session` instead.
2468
+ Parameters
2469
+ ----------
2470
+ user_id : str
2471
+ User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2472
+ secret : str
2473
+ Valid verification token.
2474
+
2475
+ Returns
2476
+ -------
2477
+ Session
2478
+ API response as a typed Pydantic model
2479
+
2480
+ Raises
2481
+ ------
2482
+ AppwriteException
2483
+ If API request fails
2484
+ """
2485
+
2486
+ api_path = '/account/sessions/phone'
2487
+ api_params = {}
2488
+ if user_id is None:
2489
+ raise AppwriteException('Missing required parameter: "user_id"')
2490
+
2491
+ if secret is None:
2492
+ raise AppwriteException('Missing required parameter: "secret"')
2493
+
2494
+
2495
+ api_params['userId'] = self._normalize_value(user_id)
2496
+ api_params['secret'] = self._normalize_value(secret)
2497
+
2498
+ response = self.client.call('put', api_path, {
2499
+ 'X-Appwrite-Project': self.client.get_config('project'),
2500
+ 'content-type': 'application/json',
2501
+ 'accept': 'application/json',
2502
+ }, api_params)
2503
+
2504
+ return self._parse_response(response, model=Session)
2505
+
2506
+
2507
+ def create_session(
2508
+ self,
2509
+ user_id: str,
2510
+ secret: str
2511
+ ) -> Session:
2512
+ """
2513
+ 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.
2514
+
2515
+ Parameters
2516
+ ----------
2517
+ user_id : str
2518
+ User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2519
+ secret : str
2520
+ Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
2521
+
2522
+ Returns
2523
+ -------
2524
+ Session
2525
+ API response as a typed Pydantic model
2526
+
2527
+ Raises
2528
+ ------
2529
+ AppwriteException
2530
+ If API request fails
2531
+ """
2532
+
2533
+ api_path = '/account/sessions/token'
2534
+ api_params = {}
2535
+ if user_id is None:
2536
+ raise AppwriteException('Missing required parameter: "user_id"')
2537
+
2538
+ if secret is None:
2539
+ raise AppwriteException('Missing required parameter: "secret"')
2540
+
2541
+
2542
+ api_params['userId'] = self._normalize_value(user_id)
2543
+ api_params['secret'] = self._normalize_value(secret)
2544
+
2545
+ response = self.client.call('post', api_path, {
2546
+ 'X-Appwrite-Project': self.client.get_config('project'),
2547
+ 'content-type': 'application/json',
2548
+ 'accept': 'application/json',
2549
+ }, api_params)
2550
+
2551
+ return self._parse_response(response, model=Session)
2552
+
2553
+
2554
+ def get_session(
2555
+ self,
2556
+ session_id: str
2557
+ ) -> Session:
2558
+ """
2559
+ Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
2560
+
2561
+ Parameters
2562
+ ----------
2563
+ session_id : str
2564
+ Session ID. Use the string 'current' to get the current device session.
2565
+
2566
+ Returns
2567
+ -------
2568
+ Session
2569
+ API response as a typed Pydantic model
2570
+
2571
+ Raises
2572
+ ------
2573
+ AppwriteException
2574
+ If API request fails
2575
+ """
2576
+
2577
+ api_path = '/account/sessions/{sessionId}'
2578
+ api_params = {}
2579
+ if session_id is None:
2580
+ raise AppwriteException('Missing required parameter: "session_id"')
2581
+
2582
+ api_path = api_path.replace('{sessionId}', str(self._normalize_value(session_id)))
2583
+
2584
+
2585
+ response = self.client.call('get', api_path, {
2586
+ 'X-Appwrite-Project': self.client.get_config('project'),
2587
+ 'accept': 'application/json',
2588
+ }, api_params)
2589
+
2590
+ return self._parse_response(response, model=Session)
2591
+
2592
+
2593
+ def update_session(
2594
+ self,
2595
+ session_id: str
2596
+ ) -> Session:
2597
+ """
2598
+ Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
2599
+
2600
+ Parameters
2601
+ ----------
2602
+ session_id : str
2603
+ Session ID. Use the string 'current' to update the current device session.
2604
+
2605
+ Returns
2606
+ -------
2607
+ Session
2608
+ API response as a typed Pydantic model
2609
+
2610
+ Raises
2611
+ ------
2612
+ AppwriteException
2613
+ If API request fails
2614
+ """
2615
+
2616
+ api_path = '/account/sessions/{sessionId}'
2617
+ api_params = {}
2618
+ if session_id is None:
2619
+ raise AppwriteException('Missing required parameter: "session_id"')
2620
+
2621
+ api_path = api_path.replace('{sessionId}', str(self._normalize_value(session_id)))
2622
+
2623
+
2624
+ response = self.client.call('patch', api_path, {
2625
+ 'X-Appwrite-Project': self.client.get_config('project'),
2626
+ 'content-type': 'application/json',
2627
+ 'accept': 'application/json',
2628
+ }, api_params)
2629
+
2630
+ return self._parse_response(response, model=Session)
2631
+
2632
+
2633
+ def delete_session(
2634
+ self,
2635
+ session_id: str
2636
+ ) -> Dict[str, Any]:
2637
+ """
2638
+ Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
2639
+
2640
+ Parameters
2641
+ ----------
2642
+ session_id : str
2643
+ Session ID. Use the string 'current' to delete the current device session.
2644
+
2645
+ Returns
2646
+ -------
2647
+ Dict[str, Any]
2648
+ API response as a dictionary
2649
+
2650
+ Raises
2651
+ ------
2652
+ AppwriteException
2653
+ If API request fails
2654
+ """
2655
+
2656
+ api_path = '/account/sessions/{sessionId}'
2657
+ api_params = {}
2658
+ if session_id is None:
2659
+ raise AppwriteException('Missing required parameter: "session_id"')
2660
+
2661
+ api_path = api_path.replace('{sessionId}', str(self._normalize_value(session_id)))
2662
+
2663
+
2664
+ response = self.client.call('delete', api_path, {
2665
+ 'X-Appwrite-Project': self.client.get_config('project'),
2666
+ 'content-type': 'application/json',
2667
+ }, api_params)
2668
+
2669
+ return response
2670
+
2671
+
2672
+ def update_status(
2673
+ self,
2674
+ model_type: Type[T] = dict
2675
+ ) -> User[T]:
2676
+ """
2677
+ 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.
2678
+
2679
+ Parameters
2680
+ ----------
2681
+
2682
+ model_type : Type[T], optional
2683
+ Pydantic model class for the user-defined data. Defaults to dict for backward compatibility.
2684
+
2685
+ Returns
2686
+ -------
2687
+ User[T]
2688
+ API response as a typed Pydantic model
2689
+
2690
+ Raises
2691
+ ------
2692
+ AppwriteException
2693
+ If API request fails
2694
+ """
2695
+
2696
+ api_path = '/account/status'
2697
+ api_params = {}
2698
+
2699
+ response = self.client.call('patch', api_path, {
2700
+ 'X-Appwrite-Project': self.client.get_config('project'),
2701
+ 'content-type': 'application/json',
2702
+ 'accept': 'application/json',
2703
+ }, api_params)
2704
+
2705
+ return User.with_data(response, model_type)
2706
+
2707
+
2708
+ def create_push_target(
2709
+ self,
2710
+ target_id: str,
2711
+ identifier: str,
2712
+ provider_id: Optional[str] = None
2713
+ ) -> Target:
2714
+ """
2715
+ Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
2716
+
2717
+ Parameters
2718
+ ----------
2719
+ target_id : str
2720
+ Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2721
+ identifier : str
2722
+ The target identifier (token, email, phone etc.)
2723
+ provider_id : Optional[str]
2724
+ Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
2725
+
2726
+ Returns
2727
+ -------
2728
+ Target
2729
+ API response as a typed Pydantic model
2730
+
2731
+ Raises
2732
+ ------
2733
+ AppwriteException
2734
+ If API request fails
2735
+ """
2736
+
2737
+ api_path = '/account/targets/push'
2738
+ api_params = {}
2739
+ if target_id is None:
2740
+ raise AppwriteException('Missing required parameter: "target_id"')
2741
+
2742
+ if identifier is None:
2743
+ raise AppwriteException('Missing required parameter: "identifier"')
2744
+
2745
+
2746
+ api_params['targetId'] = self._normalize_value(target_id)
2747
+ api_params['identifier'] = self._normalize_value(identifier)
2748
+ if provider_id is not None:
2749
+ api_params['providerId'] = self._normalize_value(provider_id)
2750
+
2751
+ response = self.client.call('post', api_path, {
2752
+ 'X-Appwrite-Project': self.client.get_config('project'),
2753
+ 'content-type': 'application/json',
2754
+ 'accept': 'application/json',
2755
+ }, api_params)
2756
+
2757
+ return self._parse_response(response, model=Target)
2758
+
2759
+
2760
+ def update_push_target(
2761
+ self,
2762
+ target_id: str,
2763
+ identifier: str
2764
+ ) -> Target:
2765
+ """
2766
+ Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
2767
+
2768
+ Parameters
2769
+ ----------
2770
+ target_id : str
2771
+ Target ID.
2772
+ identifier : str
2773
+ The target identifier (token, email, phone etc.)
2774
+
2775
+ Returns
2776
+ -------
2777
+ Target
2778
+ API response as a typed Pydantic model
2779
+
2780
+ Raises
2781
+ ------
2782
+ AppwriteException
2783
+ If API request fails
2784
+ """
2785
+
2786
+ api_path = '/account/targets/{targetId}/push'
2787
+ api_params = {}
2788
+ if target_id is None:
2789
+ raise AppwriteException('Missing required parameter: "target_id"')
2790
+
2791
+ if identifier is None:
2792
+ raise AppwriteException('Missing required parameter: "identifier"')
2793
+
2794
+ api_path = api_path.replace('{targetId}', str(self._normalize_value(target_id)))
2795
+
2796
+ api_params['identifier'] = self._normalize_value(identifier)
2797
+
2798
+ response = self.client.call('put', api_path, {
2799
+ 'X-Appwrite-Project': self.client.get_config('project'),
2800
+ 'content-type': 'application/json',
2801
+ 'accept': 'application/json',
2802
+ }, api_params)
2803
+
2804
+ return self._parse_response(response, model=Target)
2805
+
2806
+
2807
+ def delete_push_target(
2808
+ self,
2809
+ target_id: str
2810
+ ) -> Dict[str, Any]:
2811
+ """
2812
+ Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
2813
+
2814
+ Parameters
2815
+ ----------
2816
+ target_id : str
2817
+ Target ID.
2818
+
2819
+ Returns
2820
+ -------
2821
+ Dict[str, Any]
2822
+ API response as a dictionary
2823
+
2824
+ Raises
2825
+ ------
2826
+ AppwriteException
2827
+ If API request fails
2828
+ """
2829
+
2830
+ api_path = '/account/targets/{targetId}/push'
2831
+ api_params = {}
2832
+ if target_id is None:
2833
+ raise AppwriteException('Missing required parameter: "target_id"')
2834
+
2835
+ api_path = api_path.replace('{targetId}', str(self._normalize_value(target_id)))
2836
+
2837
+
2838
+ response = self.client.call('delete', api_path, {
2839
+ 'X-Appwrite-Project': self.client.get_config('project'),
2840
+ 'content-type': 'application/json',
2841
+ }, api_params)
2842
+
2843
+ return response
2844
+
2845
+
2846
+ def create_email_token(
2847
+ self,
2848
+ user_id: str,
2849
+ email: str,
2850
+ phrase: Optional[bool] = None
2851
+ ) -> Token:
2852
+ """
2853
+ Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
2854
+
2855
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
2856
+
2857
+
2858
+ Parameters
2859
+ ----------
2860
+ user_id : str
2861
+ User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
2862
+ email : str
2863
+ User email.
2864
+ phrase : Optional[bool]
2865
+ Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
2866
+
2867
+ Returns
2868
+ -------
2869
+ Token
2870
+ API response as a typed Pydantic model
2871
+
2872
+ Raises
2873
+ ------
2874
+ AppwriteException
2875
+ If API request fails
2876
+ """
2877
+
2878
+ api_path = '/account/tokens/email'
2879
+ api_params = {}
2880
+ if user_id is None:
2881
+ raise AppwriteException('Missing required parameter: "user_id"')
2882
+
2883
+ if email is None:
2884
+ raise AppwriteException('Missing required parameter: "email"')
2885
+
2886
+
2887
+ api_params['userId'] = self._normalize_value(user_id)
2888
+ api_params['email'] = self._normalize_value(email)
2889
+ if phrase is not None:
2890
+ api_params['phrase'] = self._normalize_value(phrase)
2891
+
2892
+ response = self.client.call('post', api_path, {
2893
+ 'X-Appwrite-Project': self.client.get_config('project'),
2894
+ 'content-type': 'application/json',
2895
+ 'accept': 'application/json',
2896
+ }, api_params)
2897
+
2898
+ return self._parse_response(response, model=Token)
2899
+
2900
+
2901
+ def create_magic_url_token(
2902
+ self,
2903
+ user_id: str,
2904
+ email: str,
2905
+ url: Optional[str] = None,
2906
+ phrase: Optional[bool] = None
2907
+ ) -> Token:
2908
+ """
2909
+ Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
2910
+
2911
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
2912
+
2913
+
2914
+ Parameters
2915
+ ----------
2916
+ user_id : str
2917
+ Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
2918
+ email : str
2919
+ User email.
2920
+ url : Optional[str]
2921
+ URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2922
+ phrase : Optional[bool]
2923
+ Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
2924
+
2925
+ Returns
2926
+ -------
2927
+ Token
2928
+ API response as a typed Pydantic model
2929
+
2930
+ Raises
2931
+ ------
2932
+ AppwriteException
2933
+ If API request fails
2934
+ """
2935
+
2936
+ api_path = '/account/tokens/magic-url'
2937
+ api_params = {}
2938
+ if user_id is None:
2939
+ raise AppwriteException('Missing required parameter: "user_id"')
2940
+
2941
+ if email is None:
2942
+ raise AppwriteException('Missing required parameter: "email"')
2943
+
2944
+
2945
+ api_params['userId'] = self._normalize_value(user_id)
2946
+ api_params['email'] = self._normalize_value(email)
2947
+ if url is not None:
2948
+ api_params['url'] = self._normalize_value(url)
2949
+ if phrase is not None:
2950
+ api_params['phrase'] = self._normalize_value(phrase)
2951
+
2952
+ response = self.client.call('post', api_path, {
2953
+ 'X-Appwrite-Project': self.client.get_config('project'),
2954
+ 'content-type': 'application/json',
2955
+ 'accept': 'application/json',
2956
+ }, api_params)
2957
+
2958
+ return self._parse_response(response, model=Token)
2959
+
2960
+
2961
+ def create_o_auth2_token(
2962
+ self,
2963
+ provider: OAuthProvider,
2964
+ success: Optional[str] = None,
2965
+ failure: Optional[str] = None,
2966
+ scopes: Optional[List[str]] = None
2967
+ ) -> str:
2968
+ """
2969
+ Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
2970
+
2971
+ If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
2972
+
2973
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
2974
+
2975
+ Parameters
2976
+ ----------
2977
+ provider : OAuthProvider
2978
+ OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
2979
+ success : Optional[str]
2980
+ URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2981
+ failure : Optional[str]
2982
+ URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
2983
+ scopes : Optional[List[str]]
2984
+ A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
2985
+
2986
+ Returns
2987
+ -------
2988
+ str
2989
+ Authentication response as a string
2990
+
2991
+ Raises
2992
+ ------
2993
+ AppwriteException
2994
+ If API request fails
2995
+ """
2996
+
2997
+ api_path = '/account/tokens/oauth2/{provider}'
2998
+ api_params = {}
2999
+ if provider is None:
3000
+ raise AppwriteException('Missing required parameter: "provider"')
3001
+
3002
+ api_path = api_path.replace('{provider}', str(self._normalize_value(provider)))
3003
+
3004
+ if success is not None:
3005
+ api_params['success'] = self._normalize_value(success)
3006
+ if failure is not None:
3007
+ api_params['failure'] = self._normalize_value(failure)
3008
+ if scopes is not None:
3009
+ api_params['scopes'] = self._normalize_value(scopes)
3010
+
3011
+ response = self.client.call('get', api_path, {
3012
+ 'X-Appwrite-Project': self.client.get_config('project'),
3013
+ 'accept': 'text/html',
3014
+ }, api_params, response_type='location')
3015
+
3016
+ return response
3017
+
3018
+
3019
+ def create_phone_token(
3020
+ self,
3021
+ user_id: str,
3022
+ phone: str
3023
+ ) -> Token:
3024
+ """
3025
+ Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
3026
+
3027
+ A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
3028
+
3029
+ Parameters
3030
+ ----------
3031
+ user_id : str
3032
+ Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
3033
+ phone : str
3034
+ Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
3035
+
3036
+ Returns
3037
+ -------
3038
+ Token
3039
+ API response as a typed Pydantic model
3040
+
3041
+ Raises
3042
+ ------
3043
+ AppwriteException
3044
+ If API request fails
3045
+ """
3046
+
3047
+ api_path = '/account/tokens/phone'
3048
+ api_params = {}
3049
+ if user_id is None:
3050
+ raise AppwriteException('Missing required parameter: "user_id"')
3051
+
3052
+ if phone is None:
3053
+ raise AppwriteException('Missing required parameter: "phone"')
3054
+
3055
+
3056
+ api_params['userId'] = self._normalize_value(user_id)
3057
+ api_params['phone'] = self._normalize_value(phone)
3058
+
3059
+ response = self.client.call('post', api_path, {
3060
+ 'X-Appwrite-Project': self.client.get_config('project'),
3061
+ 'content-type': 'application/json',
3062
+ 'accept': 'application/json',
3063
+ }, api_params)
3064
+
3065
+ return self._parse_response(response, model=Token)
3066
+
3067
+
3068
+ def create_email_verification(
3069
+ self,
3070
+ url: str
3071
+ ) -> Token:
3072
+ """
3073
+ Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
3074
+
3075
+ 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.
3076
+
3077
+
3078
+ Parameters
3079
+ ----------
3080
+ url : str
3081
+ URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3082
+
3083
+ Returns
3084
+ -------
3085
+ Token
3086
+ API response as a typed Pydantic model
3087
+
3088
+ Raises
3089
+ ------
3090
+ AppwriteException
3091
+ If API request fails
3092
+ """
3093
+
3094
+ api_path = '/account/verifications/email'
3095
+ api_params = {}
3096
+ if url is None:
3097
+ raise AppwriteException('Missing required parameter: "url"')
3098
+
3099
+
3100
+ api_params['url'] = self._normalize_value(url)
3101
+
3102
+ response = self.client.call('post', api_path, {
3103
+ 'X-Appwrite-Project': self.client.get_config('project'),
3104
+ 'content-type': 'application/json',
3105
+ 'accept': 'application/json',
3106
+ }, api_params)
3107
+
3108
+ return self._parse_response(response, model=Token)
3109
+
3110
+
3111
+ @deprecated("This API has been deprecated since 1.8.0. Please use `account.create_email_verification` instead.")
3112
+ def create_verification(
3113
+ self,
3114
+ url: str
3115
+ ) -> Token:
3116
+ """
3117
+ Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
3118
+
3119
+ 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.
3120
+
3121
+
3122
+ .. deprecated::1.8.0
3123
+ This API has been deprecated since 1.8.0. Please use `account.create_email_verification` instead.
3124
+ Parameters
3125
+ ----------
3126
+ url : str
3127
+ URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
3128
+
3129
+ Returns
3130
+ -------
3131
+ Token
3132
+ API response as a typed Pydantic model
3133
+
3134
+ Raises
3135
+ ------
3136
+ AppwriteException
3137
+ If API request fails
3138
+ """
3139
+
3140
+ api_path = '/account/verifications/email'
3141
+ api_params = {}
3142
+ if url is None:
3143
+ raise AppwriteException('Missing required parameter: "url"')
3144
+
3145
+
3146
+ api_params['url'] = self._normalize_value(url)
3147
+
3148
+ response = self.client.call('post', api_path, {
3149
+ 'X-Appwrite-Project': self.client.get_config('project'),
3150
+ 'content-type': 'application/json',
3151
+ 'accept': 'application/json',
3152
+ }, api_params)
3153
+
3154
+ return self._parse_response(response, model=Token)
3155
+
3156
+
3157
+ def update_email_verification(
3158
+ self,
3159
+ user_id: str,
3160
+ secret: str
3161
+ ) -> Token:
3162
+ """
3163
+ 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.
3164
+
3165
+ Parameters
3166
+ ----------
3167
+ user_id : str
3168
+ User ID.
3169
+ secret : str
3170
+ Valid verification token.
3171
+
3172
+ Returns
3173
+ -------
3174
+ Token
3175
+ API response as a typed Pydantic model
3176
+
3177
+ Raises
3178
+ ------
3179
+ AppwriteException
3180
+ If API request fails
3181
+ """
3182
+
3183
+ api_path = '/account/verifications/email'
3184
+ api_params = {}
3185
+ if user_id is None:
3186
+ raise AppwriteException('Missing required parameter: "user_id"')
3187
+
3188
+ if secret is None:
3189
+ raise AppwriteException('Missing required parameter: "secret"')
3190
+
3191
+
3192
+ api_params['userId'] = self._normalize_value(user_id)
3193
+ api_params['secret'] = self._normalize_value(secret)
3194
+
3195
+ response = self.client.call('put', api_path, {
3196
+ 'X-Appwrite-Project': self.client.get_config('project'),
3197
+ 'content-type': 'application/json',
3198
+ 'accept': 'application/json',
3199
+ }, api_params)
3200
+
3201
+ return self._parse_response(response, model=Token)
3202
+
3203
+
3204
+ @deprecated("This API has been deprecated since 1.8.0. Please use `account.update_email_verification` instead.")
3205
+ def update_verification(
3206
+ self,
3207
+ user_id: str,
3208
+ secret: str
3209
+ ) -> Token:
3210
+ """
3211
+ 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.
3212
+
3213
+ .. deprecated::1.8.0
3214
+ This API has been deprecated since 1.8.0. Please use `account.update_email_verification` instead.
3215
+ Parameters
3216
+ ----------
3217
+ user_id : str
3218
+ User ID.
3219
+ secret : str
3220
+ Valid verification token.
3221
+
3222
+ Returns
3223
+ -------
3224
+ Token
3225
+ API response as a typed Pydantic model
3226
+
3227
+ Raises
3228
+ ------
3229
+ AppwriteException
3230
+ If API request fails
3231
+ """
3232
+
3233
+ api_path = '/account/verifications/email'
3234
+ api_params = {}
3235
+ if user_id is None:
3236
+ raise AppwriteException('Missing required parameter: "user_id"')
3237
+
3238
+ if secret is None:
3239
+ raise AppwriteException('Missing required parameter: "secret"')
3240
+
3241
+
3242
+ api_params['userId'] = self._normalize_value(user_id)
3243
+ api_params['secret'] = self._normalize_value(secret)
3244
+
3245
+ response = self.client.call('put', api_path, {
3246
+ 'X-Appwrite-Project': self.client.get_config('project'),
3247
+ 'content-type': 'application/json',
3248
+ 'accept': 'application/json',
3249
+ }, api_params)
3250
+
3251
+ return self._parse_response(response, model=Token)
3252
+
3253
+
3254
+ def create_phone_verification(
3255
+ self
3256
+ ) -> Token:
3257
+ """
3258
+ Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
3259
+
3260
+ Returns
3261
+ -------
3262
+ Token
3263
+ API response as a typed Pydantic model
3264
+
3265
+ Raises
3266
+ ------
3267
+ AppwriteException
3268
+ If API request fails
3269
+ """
3270
+
3271
+ api_path = '/account/verifications/phone'
3272
+ api_params = {}
3273
+
3274
+ response = self.client.call('post', api_path, {
3275
+ 'X-Appwrite-Project': self.client.get_config('project'),
3276
+ 'content-type': 'application/json',
3277
+ 'accept': 'application/json',
3278
+ }, api_params)
3279
+
3280
+ return self._parse_response(response, model=Token)
3281
+
3282
+
3283
+ def update_phone_verification(
3284
+ self,
3285
+ user_id: str,
3286
+ secret: str
3287
+ ) -> Token:
3288
+ """
3289
+ Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
3290
+
3291
+ Parameters
3292
+ ----------
3293
+ user_id : str
3294
+ User ID.
3295
+ secret : str
3296
+ Valid verification token.
3297
+
3298
+ Returns
3299
+ -------
3300
+ Token
3301
+ API response as a typed Pydantic model
3302
+
3303
+ Raises
3304
+ ------
3305
+ AppwriteException
3306
+ If API request fails
3307
+ """
3308
+
3309
+ api_path = '/account/verifications/phone'
3310
+ api_params = {}
3311
+ if user_id is None:
3312
+ raise AppwriteException('Missing required parameter: "user_id"')
3313
+
3314
+ if secret is None:
3315
+ raise AppwriteException('Missing required parameter: "secret"')
3316
+
3317
+
3318
+ api_params['userId'] = self._normalize_value(user_id)
3319
+ api_params['secret'] = self._normalize_value(secret)
3320
+
3321
+ response = self.client.call('put', api_path, {
3322
+ 'X-Appwrite-Project': self.client.get_config('project'),
3323
+ 'content-type': 'application/json',
3324
+ 'accept': 'application/json',
3325
+ }, api_params)
3326
+
3327
+ return self._parse_response(response, model=Token)
3328
+