appwrite 27.0.0 → 28.0.0.rc1

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 (404) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +27 -24
  3. data/lib/appwrite/enums/adapter.rb +1 -1
  4. data/lib/appwrite/enums/attribute_status.rb +1 -1
  5. data/lib/appwrite/enums/authentication_factor.rb +1 -1
  6. data/lib/appwrite/enums/authenticator_type.rb +1 -1
  7. data/lib/appwrite/enums/backup_services.rb +1 -1
  8. data/lib/appwrite/enums/billing_plan_group.rb +1 -1
  9. data/lib/appwrite/enums/browser.rb +1 -1
  10. data/lib/appwrite/enums/browser_permission.rb +1 -1
  11. data/lib/appwrite/enums/browser_theme.rb +1 -1
  12. data/lib/appwrite/enums/build_runtime.rb +2 -1
  13. data/lib/appwrite/enums/column_status.rb +1 -1
  14. data/lib/appwrite/enums/compression.rb +1 -1
  15. data/lib/appwrite/enums/credit_card.rb +1 -1
  16. data/lib/appwrite/enums/database_status.rb +1 -1
  17. data/lib/appwrite/enums/database_type.rb +1 -1
  18. data/lib/appwrite/enums/databases_index_type.rb +1 -1
  19. data/lib/appwrite/enums/deployment_download_type.rb +1 -1
  20. data/lib/appwrite/enums/deployment_status.rb +1 -1
  21. data/lib/appwrite/enums/documents_db_index_type.rb +9 -0
  22. data/lib/appwrite/enums/embedding_model.rb +1 -3
  23. data/lib/appwrite/enums/execution_method.rb +1 -1
  24. data/lib/appwrite/enums/execution_resource_type.rb +8 -0
  25. data/lib/appwrite/enums/execution_status.rb +1 -1
  26. data/lib/appwrite/enums/execution_trigger.rb +1 -1
  27. data/lib/appwrite/enums/flag.rb +1 -1
  28. data/lib/appwrite/enums/framework.rb +1 -1
  29. data/lib/appwrite/enums/image_format.rb +1 -1
  30. data/lib/appwrite/enums/image_gravity.rb +1 -1
  31. data/lib/appwrite/enums/index_status.rb +1 -1
  32. data/lib/appwrite/enums/invalidation_type.rb +1 -1
  33. data/lib/appwrite/enums/message_priority.rb +1 -1
  34. data/lib/appwrite/enums/message_status.rb +1 -1
  35. data/lib/appwrite/enums/messaging_provider_type.rb +1 -1
  36. data/lib/appwrite/enums/o_auth2_google_prompt.rb +1 -1
  37. data/lib/appwrite/enums/o_auth2_oidc_prompt.rb +1 -1
  38. data/lib/appwrite/enums/o_auth_provider.rb +2 -1
  39. data/lib/appwrite/enums/order_by.rb +1 -1
  40. data/lib/appwrite/enums/organization_key_scopes.rb +1 -1
  41. data/lib/appwrite/enums/password_hash.rb +1 -1
  42. data/lib/appwrite/enums/platform_type.rb +1 -1
  43. data/lib/appwrite/enums/project_auth_method_id.rb +1 -1
  44. data/lib/appwrite/enums/project_email_template_id.rb +1 -1
  45. data/lib/appwrite/enums/project_email_template_locale.rb +1 -1
  46. data/lib/appwrite/enums/project_key_scopes.rb +14 -3
  47. data/lib/appwrite/enums/project_o_auth2_google_prompt.rb +1 -1
  48. data/lib/appwrite/enums/project_o_auth2_oidc_prompt.rb +1 -1
  49. data/lib/appwrite/enums/project_o_auth_provider_id.rb +2 -1
  50. data/lib/appwrite/enums/project_policy_id.rb +1 -1
  51. data/lib/appwrite/enums/project_protocol_id.rb +1 -1
  52. data/lib/appwrite/enums/project_service_id.rb +1 -1
  53. data/lib/appwrite/enums/project_smtp_secure.rb +1 -1
  54. data/lib/appwrite/enums/proxy_resource_type.rb +1 -1
  55. data/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb +1 -1
  56. data/lib/appwrite/enums/proxy_rule_status.rb +1 -1
  57. data/lib/appwrite/enums/region.rb +1 -1
  58. data/lib/appwrite/enums/relation_mutate.rb +1 -1
  59. data/lib/appwrite/enums/relationship_type.rb +1 -1
  60. data/lib/appwrite/enums/runtime.rb +2 -1
  61. data/lib/appwrite/enums/smtp_encryption.rb +1 -1
  62. data/lib/appwrite/enums/status_code.rb +1 -1
  63. data/lib/appwrite/enums/tables_db_index_type.rb +1 -1
  64. data/lib/appwrite/enums/template_reference_type.rb +1 -1
  65. data/lib/appwrite/enums/timezone.rb +1 -1
  66. data/lib/appwrite/enums/vcs_reference_type.rb +1 -1
  67. data/lib/appwrite/enums/vectors_db_index_type.rb +12 -0
  68. data/lib/appwrite/exception.rb +1 -1
  69. data/lib/appwrite/id.rb +3 -3
  70. data/lib/appwrite/input_file.rb +1 -1
  71. data/lib/appwrite/models/activity_event.rb +1 -1
  72. data/lib/appwrite/models/activity_event_list.rb +1 -1
  73. data/lib/appwrite/models/additional_resource.rb +1 -1
  74. data/lib/appwrite/models/algo_argon2.rb +1 -1
  75. data/lib/appwrite/models/algo_bcrypt.rb +1 -1
  76. data/lib/appwrite/models/algo_md5.rb +1 -1
  77. data/lib/appwrite/models/algo_phpass.rb +1 -1
  78. data/lib/appwrite/models/algo_scrypt.rb +1 -1
  79. data/lib/appwrite/models/algo_scrypt_modified.rb +1 -1
  80. data/lib/appwrite/models/algo_sha.rb +1 -1
  81. data/lib/appwrite/models/app.rb +1 -1
  82. data/lib/appwrite/models/app_installation.rb +2 -2
  83. data/lib/appwrite/models/app_installation_list.rb +1 -1
  84. data/lib/appwrite/models/app_key.rb +2 -2
  85. data/lib/appwrite/models/app_key_list.rb +1 -1
  86. data/lib/appwrite/models/app_scope.rb +1 -1
  87. data/lib/appwrite/models/app_scope_list.rb +1 -1
  88. data/lib/appwrite/models/app_secret.rb +2 -2
  89. data/lib/appwrite/models/app_secret_list.rb +1 -1
  90. data/lib/appwrite/models/app_secret_plaintext.rb +2 -2
  91. data/lib/appwrite/models/apps_list.rb +1 -1
  92. data/lib/appwrite/models/attribute_bigint.rb +5 -6
  93. data/lib/appwrite/models/attribute_boolean.rb +3 -4
  94. data/lib/appwrite/models/attribute_datetime.rb +3 -4
  95. data/lib/appwrite/models/attribute_email.rb +3 -4
  96. data/lib/appwrite/models/attribute_enum.rb +3 -4
  97. data/lib/appwrite/models/attribute_float.rb +5 -6
  98. data/lib/appwrite/models/attribute_integer.rb +5 -6
  99. data/lib/appwrite/models/attribute_ip.rb +3 -4
  100. data/lib/appwrite/models/attribute_line.rb +3 -4
  101. data/lib/appwrite/models/attribute_list.rb +1 -1
  102. data/lib/appwrite/models/attribute_longtext.rb +4 -5
  103. data/lib/appwrite/models/attribute_mediumtext.rb +4 -5
  104. data/lib/appwrite/models/attribute_object.rb +80 -0
  105. data/lib/appwrite/models/attribute_point.rb +3 -4
  106. data/lib/appwrite/models/attribute_polygon.rb +3 -4
  107. data/lib/appwrite/models/attribute_relationship.rb +2 -3
  108. data/lib/appwrite/models/attribute_string.rb +4 -5
  109. data/lib/appwrite/models/attribute_text.rb +4 -5
  110. data/lib/appwrite/models/attribute_url.rb +3 -4
  111. data/lib/appwrite/models/attribute_varchar.rb +4 -5
  112. data/lib/appwrite/models/attribute_vector.rb +85 -0
  113. data/lib/appwrite/models/backup_archive.rb +3 -3
  114. data/lib/appwrite/models/backup_archive_list.rb +1 -1
  115. data/lib/appwrite/models/backup_policy.rb +3 -3
  116. data/lib/appwrite/models/backup_policy_list.rb +1 -1
  117. data/lib/appwrite/models/backup_restoration.rb +1 -1
  118. data/lib/appwrite/models/backup_restoration_list.rb +1 -1
  119. data/lib/appwrite/models/billing_limits.rb +9 -9
  120. data/lib/appwrite/models/billing_plan.rb +19 -10
  121. data/lib/appwrite/models/billing_plan_addon.rb +3 -3
  122. data/lib/appwrite/models/billing_plan_addon_details.rb +2 -2
  123. data/lib/appwrite/models/billing_plan_dedicated_database_limits.rb +20 -20
  124. data/lib/appwrite/models/billing_plan_limits.rb +3 -3
  125. data/lib/appwrite/models/billing_plan_supported_addons.rb +1 -1
  126. data/lib/appwrite/models/block.rb +3 -3
  127. data/lib/appwrite/models/bucket.rb +1 -1
  128. data/lib/appwrite/models/bucket_list.rb +1 -1
  129. data/lib/appwrite/models/collection.rb +1 -1
  130. data/lib/appwrite/models/collection_list.rb +1 -1
  131. data/lib/appwrite/models/column_bigint.rb +5 -6
  132. data/lib/appwrite/models/column_boolean.rb +3 -4
  133. data/lib/appwrite/models/column_datetime.rb +3 -4
  134. data/lib/appwrite/models/column_email.rb +3 -4
  135. data/lib/appwrite/models/column_enum.rb +3 -4
  136. data/lib/appwrite/models/column_float.rb +5 -6
  137. data/lib/appwrite/models/column_index.rb +2 -2
  138. data/lib/appwrite/models/column_index_list.rb +1 -1
  139. data/lib/appwrite/models/column_integer.rb +5 -6
  140. data/lib/appwrite/models/column_ip.rb +3 -4
  141. data/lib/appwrite/models/column_line.rb +3 -4
  142. data/lib/appwrite/models/column_list.rb +1 -1
  143. data/lib/appwrite/models/column_longtext.rb +4 -5
  144. data/lib/appwrite/models/column_mediumtext.rb +4 -5
  145. data/lib/appwrite/models/column_point.rb +3 -4
  146. data/lib/appwrite/models/column_polygon.rb +3 -4
  147. data/lib/appwrite/models/column_relationship.rb +2 -3
  148. data/lib/appwrite/models/column_string.rb +4 -5
  149. data/lib/appwrite/models/column_text.rb +4 -5
  150. data/lib/appwrite/models/column_url.rb +3 -4
  151. data/lib/appwrite/models/column_varchar.rb +4 -5
  152. data/lib/appwrite/models/continent.rb +1 -1
  153. data/lib/appwrite/models/continent_list.rb +1 -1
  154. data/lib/appwrite/models/country.rb +1 -1
  155. data/lib/appwrite/models/country_list.rb +1 -1
  156. data/lib/appwrite/models/currency.rb +1 -1
  157. data/lib/appwrite/models/currency_list.rb +1 -1
  158. data/lib/appwrite/models/database.rb +22 -8
  159. data/lib/appwrite/models/database_list.rb +1 -1
  160. data/lib/appwrite/models/database_migration.rb +6 -1
  161. data/lib/appwrite/models/database_migration_list.rb +1 -1
  162. data/lib/appwrite/models/database_status.rb +3 -3
  163. data/lib/appwrite/models/database_status_connections.rb +1 -1
  164. data/lib/appwrite/models/database_status_replica.rb +7 -2
  165. data/lib/appwrite/models/database_status_volume.rb +1 -1
  166. data/lib/appwrite/models/dedicated_database.rb +3 -3
  167. data/lib/appwrite/models/dedicated_database_backup.rb +107 -0
  168. data/lib/appwrite/models/dedicated_database_backup_list.rb +32 -0
  169. data/lib/appwrite/models/dedicated_database_backup_storage.rb +47 -0
  170. data/lib/appwrite/models/dedicated_database_branch.rb +82 -0
  171. data/lib/appwrite/models/dedicated_database_branch_list.rb +32 -0
  172. data/lib/appwrite/models/dedicated_database_execution.rb +52 -0
  173. data/lib/appwrite/models/dedicated_database_execution_column.rb +32 -0
  174. data/lib/appwrite/models/dedicated_database_extensions.rb +37 -0
  175. data/lib/appwrite/models/dedicated_database_list.rb +32 -0
  176. data/lib/appwrite/models/dedicated_database_member.rb +7 -2
  177. data/lib/appwrite/models/dedicated_database_operation.rb +4 -4
  178. data/lib/appwrite/models/dedicated_database_operation_list.rb +1 -1
  179. data/lib/appwrite/models/dedicated_database_pitr_windows.rb +32 -0
  180. data/lib/appwrite/models/dedicated_database_pooler.rb +72 -0
  181. data/lib/appwrite/models/dedicated_database_replicas.rb +3 -3
  182. data/lib/appwrite/models/dedicated_database_restoration.rb +82 -0
  183. data/lib/appwrite/models/dedicated_database_restoration_list.rb +32 -0
  184. data/lib/appwrite/models/dedicated_database_specification.rb +1 -1
  185. data/lib/appwrite/models/dedicated_database_specification_list.rb +1 -1
  186. data/lib/appwrite/models/dedicated_database_specification_pricing.rb +1 -1
  187. data/lib/appwrite/models/deployment.rb +1 -2
  188. data/lib/appwrite/models/deployment_list.rb +1 -1
  189. data/lib/appwrite/models/dev_key.rb +1 -1
  190. data/lib/appwrite/models/document.rb +1 -1
  191. data/lib/appwrite/models/document_list.rb +1 -1
  192. data/lib/appwrite/models/email_template.rb +1 -1
  193. data/lib/appwrite/models/email_template_list.rb +1 -1
  194. data/lib/appwrite/models/embedding.rb +1 -1
  195. data/lib/appwrite/models/embedding_list.rb +1 -1
  196. data/lib/appwrite/models/ephemeral_key.rb +1 -1
  197. data/lib/appwrite/models/execution.rb +25 -8
  198. data/lib/appwrite/models/execution_list.rb +1 -1
  199. data/lib/appwrite/models/file.rb +1 -1
  200. data/lib/appwrite/models/file_list.rb +1 -1
  201. data/lib/appwrite/models/framework.rb +1 -1
  202. data/lib/appwrite/models/framework_adapter.rb +1 -1
  203. data/lib/appwrite/models/framework_list.rb +1 -1
  204. data/lib/appwrite/models/function.rb +1 -1
  205. data/lib/appwrite/models/function_list.rb +1 -1
  206. data/lib/appwrite/models/headers.rb +1 -1
  207. data/lib/appwrite/models/identity.rb +1 -1
  208. data/lib/appwrite/models/identity_list.rb +1 -1
  209. data/lib/appwrite/models/index.rb +2 -3
  210. data/lib/appwrite/models/index_list.rb +1 -1
  211. data/lib/appwrite/models/insight.rb +4 -4
  212. data/lib/appwrite/models/insight_cta.rb +1 -1
  213. data/lib/appwrite/models/insight_list.rb +1 -1
  214. data/lib/appwrite/models/jwt.rb +1 -1
  215. data/lib/appwrite/models/key.rb +1 -1
  216. data/lib/appwrite/models/key_list.rb +1 -1
  217. data/lib/appwrite/models/language.rb +1 -1
  218. data/lib/appwrite/models/language_list.rb +1 -1
  219. data/lib/appwrite/models/locale.rb +12 -12
  220. data/lib/appwrite/models/locale_code.rb +1 -1
  221. data/lib/appwrite/models/locale_code_list.rb +1 -1
  222. data/lib/appwrite/models/log.rb +1 -1
  223. data/lib/appwrite/models/log_list.rb +1 -1
  224. data/lib/appwrite/models/membership.rb +1 -1
  225. data/lib/appwrite/models/membership_list.rb +1 -1
  226. data/lib/appwrite/models/message.rb +4 -5
  227. data/lib/appwrite/models/message_list.rb +1 -1
  228. data/lib/appwrite/models/mfa_challenge.rb +1 -1
  229. data/lib/appwrite/models/mfa_challenge_secret.rb +1 -1
  230. data/lib/appwrite/models/mfa_factors.rb +1 -1
  231. data/lib/appwrite/models/mfa_recovery_codes.rb +1 -1
  232. data/lib/appwrite/models/mfa_type.rb +1 -1
  233. data/lib/appwrite/models/mock_number.rb +1 -1
  234. data/lib/appwrite/models/mock_number_list.rb +1 -1
  235. data/lib/appwrite/models/o_auth2_amazon.rb +1 -1
  236. data/lib/appwrite/models/o_auth2_apple.rb +1 -1
  237. data/lib/appwrite/models/o_auth2_appwrite.rb +1 -1
  238. data/lib/appwrite/models/o_auth2_auth0.rb +1 -1
  239. data/lib/appwrite/models/o_auth2_authentik.rb +1 -1
  240. data/lib/appwrite/models/o_auth2_autodesk.rb +1 -1
  241. data/lib/appwrite/models/o_auth2_bitbucket.rb +1 -1
  242. data/lib/appwrite/models/o_auth2_bitly.rb +1 -1
  243. data/lib/appwrite/models/o_auth2_box.rb +1 -1
  244. data/lib/appwrite/models/o_auth2_dailymotion.rb +1 -1
  245. data/lib/appwrite/models/o_auth2_discord.rb +1 -1
  246. data/lib/appwrite/models/o_auth2_disqus.rb +1 -1
  247. data/lib/appwrite/models/o_auth2_dropbox.rb +1 -1
  248. data/lib/appwrite/models/o_auth2_etsy.rb +1 -1
  249. data/lib/appwrite/models/o_auth2_facebook.rb +1 -1
  250. data/lib/appwrite/models/o_auth2_figma.rb +1 -1
  251. data/lib/appwrite/models/o_auth2_fusion_auth.rb +1 -1
  252. data/lib/appwrite/models/o_auth2_github.rb +1 -1
  253. data/lib/appwrite/models/o_auth2_gitlab.rb +1 -1
  254. data/lib/appwrite/models/o_auth2_google.rb +18 -2
  255. data/lib/appwrite/models/o_auth2_hugging_face.rb +42 -0
  256. data/lib/appwrite/models/o_auth2_keycloak.rb +1 -1
  257. data/lib/appwrite/models/o_auth2_kick.rb +1 -1
  258. data/lib/appwrite/models/o_auth2_linkedin.rb +1 -1
  259. data/lib/appwrite/models/o_auth2_microsoft.rb +1 -1
  260. data/lib/appwrite/models/o_auth2_notion.rb +1 -1
  261. data/lib/appwrite/models/o_auth2_oidc.rb +20 -3
  262. data/lib/appwrite/models/o_auth2_okta.rb +1 -1
  263. data/lib/appwrite/models/o_auth2_paypal.rb +1 -1
  264. data/lib/appwrite/models/o_auth2_podio.rb +1 -1
  265. data/lib/appwrite/models/o_auth2_provider_list.rb +1 -1
  266. data/lib/appwrite/models/o_auth2_salesforce.rb +1 -1
  267. data/lib/appwrite/models/o_auth2_slack.rb +1 -1
  268. data/lib/appwrite/models/o_auth2_spotify.rb +1 -1
  269. data/lib/appwrite/models/o_auth2_stripe.rb +1 -1
  270. data/lib/appwrite/models/o_auth2_tradeshift.rb +1 -1
  271. data/lib/appwrite/models/o_auth2_twitch.rb +1 -1
  272. data/lib/appwrite/models/o_auth2_word_press.rb +1 -1
  273. data/lib/appwrite/models/o_auth2_x.rb +1 -1
  274. data/lib/appwrite/models/o_auth2_yahoo.rb +1 -1
  275. data/lib/appwrite/models/o_auth2_yandex.rb +1 -1
  276. data/lib/appwrite/models/o_auth2_zoho.rb +1 -1
  277. data/lib/appwrite/models/o_auth2_zoom.rb +1 -1
  278. data/lib/appwrite/models/oauth2_approve.rb +1 -1
  279. data/lib/appwrite/models/oauth2_authorize.rb +1 -1
  280. data/lib/appwrite/models/oauth2_consent.rb +1 -1
  281. data/lib/appwrite/models/oauth2_consent_list.rb +1 -1
  282. data/lib/appwrite/models/oauth2_consent_token.rb +1 -1
  283. data/lib/appwrite/models/oauth2_consent_token_list.rb +1 -1
  284. data/lib/appwrite/models/oauth2_device_authorization.rb +1 -1
  285. data/lib/appwrite/models/oauth2_grant.rb +1 -1
  286. data/lib/appwrite/models/oauth2_organization.rb +1 -1
  287. data/lib/appwrite/models/oauth2_organization_list.rb +1 -1
  288. data/lib/appwrite/models/oauth2_par.rb +1 -1
  289. data/lib/appwrite/models/oauth2_project.rb +1 -1
  290. data/lib/appwrite/models/oauth2_project_list.rb +1 -1
  291. data/lib/appwrite/models/oauth2_reject.rb +1 -1
  292. data/lib/appwrite/models/oauth2_token.rb +3 -3
  293. data/lib/appwrite/models/organization.rb +14 -14
  294. data/lib/appwrite/models/phone.rb +1 -1
  295. data/lib/appwrite/models/phone_list.rb +1 -1
  296. data/lib/appwrite/models/platform_android.rb +1 -2
  297. data/lib/appwrite/models/platform_apple.rb +1 -2
  298. data/lib/appwrite/models/platform_linux.rb +1 -2
  299. data/lib/appwrite/models/platform_list.rb +1 -1
  300. data/lib/appwrite/models/platform_web.rb +1 -2
  301. data/lib/appwrite/models/platform_windows.rb +1 -2
  302. data/lib/appwrite/models/policy_deny_aliased_email.rb +1 -1
  303. data/lib/appwrite/models/policy_deny_corporate_email.rb +1 -1
  304. data/lib/appwrite/models/policy_deny_disposable_email.rb +1 -1
  305. data/lib/appwrite/models/policy_deny_free_email.rb +1 -1
  306. data/lib/appwrite/models/policy_list.rb +1 -1
  307. data/lib/appwrite/models/policy_membership_privacy.rb +1 -1
  308. data/lib/appwrite/models/policy_mfa_factors.rb +1 -1
  309. data/lib/appwrite/models/policy_password_dictionary.rb +1 -1
  310. data/lib/appwrite/models/policy_password_history.rb +1 -1
  311. data/lib/appwrite/models/policy_password_personal_data.rb +1 -1
  312. data/lib/appwrite/models/policy_password_strength.rb +1 -1
  313. data/lib/appwrite/models/policy_session_alert.rb +1 -1
  314. data/lib/appwrite/models/policy_session_duration.rb +1 -1
  315. data/lib/appwrite/models/policy_session_invalidation.rb +1 -1
  316. data/lib/appwrite/models/policy_session_limit.rb +1 -1
  317. data/lib/appwrite/models/policy_user_limit.rb +1 -1
  318. data/lib/appwrite/models/postgres_extension.rb +42 -0
  319. data/lib/appwrite/models/preferences.rb +1 -1
  320. data/lib/appwrite/models/presence.rb +4 -4
  321. data/lib/appwrite/models/presence_list.rb +1 -1
  322. data/lib/appwrite/models/program.rb +1 -1
  323. data/lib/appwrite/models/project.rb +19 -19
  324. data/lib/appwrite/models/project_auth_method.rb +1 -2
  325. data/lib/appwrite/models/project_list.rb +1 -1
  326. data/lib/appwrite/models/project_protocol.rb +1 -2
  327. data/lib/appwrite/models/project_service.rb +1 -2
  328. data/lib/appwrite/models/provider.rb +2 -2
  329. data/lib/appwrite/models/provider_list.rb +1 -1
  330. data/lib/appwrite/models/proxy_invalidation.rb +1 -1
  331. data/lib/appwrite/models/proxy_rule.rb +2 -3
  332. data/lib/appwrite/models/proxy_rule_list.rb +1 -1
  333. data/lib/appwrite/models/report.rb +2 -2
  334. data/lib/appwrite/models/report_list.rb +1 -1
  335. data/lib/appwrite/models/resource_token.rb +1 -1
  336. data/lib/appwrite/models/resource_token_list.rb +1 -1
  337. data/lib/appwrite/models/row.rb +1 -1
  338. data/lib/appwrite/models/row_list.rb +1 -1
  339. data/lib/appwrite/models/runtime.rb +1 -1
  340. data/lib/appwrite/models/runtime_list.rb +1 -1
  341. data/lib/appwrite/models/session.rb +1 -1
  342. data/lib/appwrite/models/session_list.rb +1 -1
  343. data/lib/appwrite/models/site.rb +6 -1
  344. data/lib/appwrite/models/site_list.rb +1 -1
  345. data/lib/appwrite/models/specification.rb +1 -1
  346. data/lib/appwrite/models/specification_list.rb +1 -1
  347. data/lib/appwrite/models/subscriber.rb +1 -1
  348. data/lib/appwrite/models/subscriber_list.rb +1 -1
  349. data/lib/appwrite/models/table.rb +1 -1
  350. data/lib/appwrite/models/table_list.rb +1 -1
  351. data/lib/appwrite/models/target.rb +2 -2
  352. data/lib/appwrite/models/target_list.rb +1 -1
  353. data/lib/appwrite/models/team.rb +1 -1
  354. data/lib/appwrite/models/team_list.rb +1 -1
  355. data/lib/appwrite/models/token.rb +1 -1
  356. data/lib/appwrite/models/topic.rb +1 -1
  357. data/lib/appwrite/models/topic_list.rb +1 -1
  358. data/lib/appwrite/models/transaction.rb +1 -1
  359. data/lib/appwrite/models/transaction_list.rb +1 -1
  360. data/lib/appwrite/models/usage_billing_plan.rb +4 -4
  361. data/lib/appwrite/models/user.rb +11 -11
  362. data/lib/appwrite/models/user_list.rb +1 -1
  363. data/lib/appwrite/models/variable.rb +1 -1
  364. data/lib/appwrite/models/variable_list.rb +1 -1
  365. data/lib/appwrite/models/vectorsdb_collection.rb +87 -0
  366. data/lib/appwrite/models/vectorsdb_collection_list.rb +32 -0
  367. data/lib/appwrite/models/webhook.rb +1 -1
  368. data/lib/appwrite/models/webhook_list.rb +1 -1
  369. data/lib/appwrite/operator.rb +6 -0
  370. data/lib/appwrite/permission.rb +4 -0
  371. data/lib/appwrite/query.rb +4 -4
  372. data/lib/appwrite/role.rb +12 -14
  373. data/lib/appwrite/service.rb +1 -1
  374. data/lib/appwrite/services/account.rb +328 -289
  375. data/lib/appwrite/services/activities.rb +13 -14
  376. data/lib/appwrite/services/advisor.rb +41 -37
  377. data/lib/appwrite/services/apps.rb +185 -130
  378. data/lib/appwrite/services/avatars.rb +156 -55
  379. data/lib/appwrite/services/backups.rb +102 -83
  380. data/lib/appwrite/services/databases.rb +871 -512
  381. data/lib/appwrite/services/documents_db.rb +1683 -0
  382. data/lib/appwrite/services/embeddings.rb +9 -9
  383. data/lib/appwrite/services/functions.rb +276 -172
  384. data/lib/appwrite/services/graphql.rb +12 -12
  385. data/lib/appwrite/services/locale.rb +19 -37
  386. data/lib/appwrite/services/messaging.rb +544 -259
  387. data/lib/appwrite/services/mongo.rb +1359 -0
  388. data/lib/appwrite/services/mysql.rb +1503 -0
  389. data/lib/appwrite/services/oauth2.rb +122 -53
  390. data/lib/appwrite/services/organization.rb +153 -123
  391. data/lib/appwrite/services/postgresql.rb +1615 -0
  392. data/lib/appwrite/services/presences.rb +49 -35
  393. data/lib/appwrite/services/project.rb +842 -528
  394. data/lib/appwrite/services/proxy.rb +73 -58
  395. data/lib/appwrite/services/sites.rb +269 -164
  396. data/lib/appwrite/services/storage.rb +151 -92
  397. data/lib/appwrite/services/tables_db.rb +947 -568
  398. data/lib/appwrite/services/teams.rb +161 -122
  399. data/lib/appwrite/services/tokens.rb +38 -31
  400. data/lib/appwrite/services/users.rb +376 -274
  401. data/lib/appwrite/services/vectors_db.rb +1614 -0
  402. data/lib/appwrite/services/webhooks.rb +59 -40
  403. data/lib/appwrite.rb +27 -0
  404. metadata +31 -4
@@ -0,0 +1,1683 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class DocumentsDB < Service
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ # Get a list of all databases from the current Appwrite project. You can use
10
+ # the search parameter to filter your results.
11
+ #
12
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name
13
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
14
+ #
15
+ # @return [DatabaseList]
16
+ def list(
17
+ queries: nil,
18
+ total: nil
19
+ )
20
+ api_path = '/documentsdb'
21
+
22
+ api_params = {
23
+ queries: queries,
24
+ total: total,
25
+ }
26
+
27
+ api_headers = {
28
+ "X-Appwrite-Project": @client.get_config('project'),
29
+ "accept": 'application/json',
30
+ }
31
+
32
+ @client.call(
33
+ method: 'GET',
34
+ path: api_path,
35
+ headers: api_headers,
36
+ params: api_params,
37
+ response_type: Models::DatabaseList
38
+ )
39
+ end
40
+
41
+ # Create a new Database.
42
+ #
43
+ #
44
+ # @param [String] database_id 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&#039;t start with a special char. Max length is 36 chars.
45
+ # @param [String] name Database name. Max length: 128 chars.
46
+ # @param [] enabled Is the database enabled? When set to &#039;disabled&#039;, users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
47
+ # @param [String] specification Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification.
48
+ # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0.
49
+ # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum.
50
+ #
51
+ # @return [Database]
52
+ def create(
53
+ database_id:,
54
+ name:,
55
+ enabled: nil,
56
+ specification: nil,
57
+ replicas: nil,
58
+ sync_mode: nil
59
+ )
60
+ api_path = '/documentsdb'
61
+
62
+ if database_id.nil?
63
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
64
+ end
65
+
66
+ if name.nil?
67
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
68
+ end
69
+
70
+ api_params = {
71
+ databaseId: database_id,
72
+ name: name,
73
+ enabled: enabled,
74
+ specification: specification,
75
+ replicas: replicas,
76
+ syncMode: sync_mode,
77
+ }
78
+
79
+ api_headers = {
80
+ "X-Appwrite-Project": @client.get_config('project'),
81
+ "content-type": 'application/json',
82
+ "accept": 'application/json',
83
+ }
84
+
85
+ @client.call(
86
+ method: 'POST',
87
+ path: api_path,
88
+ headers: api_headers,
89
+ params: api_params,
90
+ response_type: Models::Database
91
+ )
92
+ end
93
+
94
+ # List the dedicated database specifications available on the current plan.
95
+ # Each specification reports its resource limits, pricing, and whether it is
96
+ # enabled for the organization.
97
+ #
98
+ #
99
+ # @return [DedicatedDatabaseSpecificationList]
100
+ def list_specifications()
101
+ api_path = '/documentsdb/specifications'
102
+
103
+ api_params = {}
104
+
105
+ api_headers = {
106
+ "X-Appwrite-Project": @client.get_config('project'),
107
+ "accept": 'application/json',
108
+ }
109
+
110
+ @client.call(
111
+ method: 'GET',
112
+ path: api_path,
113
+ headers: api_headers,
114
+ params: api_params,
115
+ response_type: Models::DedicatedDatabaseSpecificationList
116
+ )
117
+ end
118
+
119
+ # List transactions across all databases.
120
+ #
121
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
122
+ #
123
+ # @return [TransactionList]
124
+ def list_transactions(
125
+ queries: nil
126
+ )
127
+ api_path = '/documentsdb/transactions'
128
+
129
+ api_params = {
130
+ queries: queries,
131
+ }
132
+
133
+ api_headers = {
134
+ "X-Appwrite-Project": @client.get_config('project'),
135
+ "accept": 'application/json',
136
+ }
137
+
138
+ @client.call(
139
+ method: 'GET',
140
+ path: api_path,
141
+ headers: api_headers,
142
+ params: api_params,
143
+ response_type: Models::TransactionList
144
+ )
145
+ end
146
+
147
+ # Create a new transaction.
148
+ #
149
+ # @param [Integer] ttl Seconds before the transaction expires.
150
+ #
151
+ # @return [Transaction]
152
+ def create_transaction(
153
+ ttl: nil
154
+ )
155
+ api_path = '/documentsdb/transactions'
156
+
157
+ api_params = {
158
+ ttl: ttl,
159
+ }
160
+
161
+ api_headers = {
162
+ "X-Appwrite-Project": @client.get_config('project'),
163
+ "content-type": 'application/json',
164
+ "accept": 'application/json',
165
+ }
166
+
167
+ @client.call(
168
+ method: 'POST',
169
+ path: api_path,
170
+ headers: api_headers,
171
+ params: api_params,
172
+ response_type: Models::Transaction
173
+ )
174
+ end
175
+
176
+ # Get a transaction by its unique ID.
177
+ #
178
+ # @param [String] transaction_id Transaction ID.
179
+ #
180
+ # @return [Transaction]
181
+ def get_transaction(
182
+ transaction_id:
183
+ )
184
+ api_path = '/documentsdb/transactions/{transactionId}'
185
+ .gsub('{transactionId}', transaction_id)
186
+
187
+ if transaction_id.nil?
188
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
189
+ end
190
+
191
+ api_params = {}
192
+
193
+ api_headers = {
194
+ "X-Appwrite-Project": @client.get_config('project'),
195
+ "accept": 'application/json',
196
+ }
197
+
198
+ @client.call(
199
+ method: 'GET',
200
+ path: api_path,
201
+ headers: api_headers,
202
+ params: api_params,
203
+ response_type: Models::Transaction
204
+ )
205
+ end
206
+
207
+ # Update a transaction, to either commit or roll back its operations.
208
+ #
209
+ # @param [String] transaction_id Transaction ID.
210
+ # @param [] commit Commit transaction?
211
+ # @param [] rollback Rollback transaction?
212
+ #
213
+ # @return [Transaction]
214
+ def update_transaction(
215
+ transaction_id:,
216
+ commit: nil,
217
+ rollback: nil
218
+ )
219
+ api_path = '/documentsdb/transactions/{transactionId}'
220
+ .gsub('{transactionId}', transaction_id)
221
+
222
+ if transaction_id.nil?
223
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
224
+ end
225
+
226
+ api_params = {
227
+ commit: commit,
228
+ rollback: rollback,
229
+ }
230
+
231
+ api_headers = {
232
+ "X-Appwrite-Project": @client.get_config('project'),
233
+ "content-type": 'application/json',
234
+ "accept": 'application/json',
235
+ }
236
+
237
+ @client.call(
238
+ method: 'PATCH',
239
+ path: api_path,
240
+ headers: api_headers,
241
+ params: api_params,
242
+ response_type: Models::Transaction
243
+ )
244
+ end
245
+
246
+ # Delete a transaction by its unique ID.
247
+ #
248
+ # @param [String] transaction_id Transaction ID.
249
+ #
250
+ # @return []
251
+ def delete_transaction(
252
+ transaction_id:
253
+ )
254
+ api_path = '/documentsdb/transactions/{transactionId}'
255
+ .gsub('{transactionId}', transaction_id)
256
+
257
+ if transaction_id.nil?
258
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
259
+ end
260
+
261
+ api_params = {}
262
+
263
+ api_headers = {
264
+ "X-Appwrite-Project": @client.get_config('project'),
265
+ "content-type": 'application/json',
266
+ }
267
+
268
+ @client.call(
269
+ method: 'DELETE',
270
+ path: api_path,
271
+ headers: api_headers,
272
+ params: api_params,
273
+ )
274
+ end
275
+
276
+ # Create multiple operations in a single transaction.
277
+ #
278
+ # @param [String] transaction_id Transaction ID.
279
+ # @param [Array] operations Array of staged operations.
280
+ #
281
+ # @return [Transaction]
282
+ def create_operations(
283
+ transaction_id:,
284
+ operations: nil
285
+ )
286
+ api_path = '/documentsdb/transactions/{transactionId}/operations'
287
+ .gsub('{transactionId}', transaction_id)
288
+
289
+ if transaction_id.nil?
290
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
291
+ end
292
+
293
+ api_params = {
294
+ operations: operations,
295
+ }
296
+
297
+ api_headers = {
298
+ "X-Appwrite-Project": @client.get_config('project'),
299
+ "content-type": 'application/json',
300
+ "accept": 'application/json',
301
+ }
302
+
303
+ @client.call(
304
+ method: 'POST',
305
+ path: api_path,
306
+ headers: api_headers,
307
+ params: api_params,
308
+ response_type: Models::Transaction
309
+ )
310
+ end
311
+
312
+ # Get a database by its unique ID. This endpoint response returns a JSON
313
+ # object with the database metadata.
314
+ #
315
+ # @param [String] database_id Database ID.
316
+ #
317
+ # @return [Database]
318
+ def get(
319
+ database_id:
320
+ )
321
+ api_path = '/documentsdb/{databaseId}'
322
+ .gsub('{databaseId}', database_id)
323
+
324
+ if database_id.nil?
325
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
326
+ end
327
+
328
+ api_params = {}
329
+
330
+ api_headers = {
331
+ "X-Appwrite-Project": @client.get_config('project'),
332
+ "accept": 'application/json',
333
+ }
334
+
335
+ @client.call(
336
+ method: 'GET',
337
+ path: api_path,
338
+ headers: api_headers,
339
+ params: api_params,
340
+ response_type: Models::Database
341
+ )
342
+ end
343
+
344
+ # Update a database by its unique ID.
345
+ #
346
+ # @param [String] database_id Database ID.
347
+ # @param [String] name Database name. Max length: 128 chars.
348
+ # @param [] enabled Is database enabled? When set to &#039;disabled&#039;, users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.
349
+ # @param [String] specification Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize.
350
+ # @param [Integer] replicas Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0.
351
+ # @param [String] sync_mode Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum.
352
+ #
353
+ # @return [Database]
354
+ def update(
355
+ database_id:,
356
+ name:,
357
+ enabled: nil,
358
+ specification: nil,
359
+ replicas: nil,
360
+ sync_mode: nil
361
+ )
362
+ api_path = '/documentsdb/{databaseId}'
363
+ .gsub('{databaseId}', database_id)
364
+
365
+ if database_id.nil?
366
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
367
+ end
368
+
369
+ if name.nil?
370
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
371
+ end
372
+
373
+ api_params = {
374
+ name: name,
375
+ enabled: enabled,
376
+ specification: specification,
377
+ replicas: replicas,
378
+ syncMode: sync_mode,
379
+ }
380
+
381
+ api_headers = {
382
+ "X-Appwrite-Project": @client.get_config('project'),
383
+ "content-type": 'application/json',
384
+ "accept": 'application/json',
385
+ }
386
+
387
+ @client.call(
388
+ method: 'PUT',
389
+ path: api_path,
390
+ headers: api_headers,
391
+ params: api_params,
392
+ response_type: Models::Database
393
+ )
394
+ end
395
+
396
+ # Delete a database by its unique ID. Only API keys with with databases.write
397
+ # scope can delete a database.
398
+ #
399
+ # @param [String] database_id Database ID.
400
+ #
401
+ # @return []
402
+ def delete(
403
+ database_id:
404
+ )
405
+ api_path = '/documentsdb/{databaseId}'
406
+ .gsub('{databaseId}', database_id)
407
+
408
+ if database_id.nil?
409
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
410
+ end
411
+
412
+ api_params = {}
413
+
414
+ api_headers = {
415
+ "X-Appwrite-Project": @client.get_config('project'),
416
+ "content-type": 'application/json',
417
+ }
418
+
419
+ @client.call(
420
+ method: 'DELETE',
421
+ path: api_path,
422
+ headers: api_headers,
423
+ params: api_params,
424
+ )
425
+ end
426
+
427
+ # Get a list of all collections that belong to the provided databaseId. You
428
+ # can use the search parameter to filter your results.
429
+ #
430
+ # @param [String] database_id Database ID.
431
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity
432
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
433
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
434
+ #
435
+ # @return [CollectionList]
436
+ def list_collections(
437
+ database_id:,
438
+ queries: nil,
439
+ search: nil,
440
+ total: nil
441
+ )
442
+ api_path = '/documentsdb/{databaseId}/collections'
443
+ .gsub('{databaseId}', database_id)
444
+
445
+ if database_id.nil?
446
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
447
+ end
448
+
449
+ api_params = {
450
+ queries: queries,
451
+ search: search,
452
+ total: total,
453
+ }
454
+
455
+ api_headers = {
456
+ "X-Appwrite-Project": @client.get_config('project'),
457
+ "accept": 'application/json',
458
+ }
459
+
460
+ @client.call(
461
+ method: 'GET',
462
+ path: api_path,
463
+ headers: api_headers,
464
+ params: api_params,
465
+ response_type: Models::CollectionList
466
+ )
467
+ end
468
+
469
+ # Create a new Collection. Before using this route, you should create a new
470
+ # database resource using either a [server
471
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
472
+ # API or directly from your database console.
473
+ #
474
+ # @param [String] database_id Database ID.
475
+ # @param [String] collection_id 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&#039;t start with a special char. Max length is 36 chars.
476
+ # @param [String] name Collection name. Max length: 128 chars.
477
+ # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
478
+ # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
479
+ # @param [] enabled Is collection enabled? When set to &#039;disabled&#039;, users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
480
+ # @param [Array] attributes Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options.
481
+ # @param [Array] indexes Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional).
482
+ #
483
+ # @return [Collection]
484
+ def create_collection(
485
+ database_id:,
486
+ collection_id:,
487
+ name:,
488
+ permissions: nil,
489
+ document_security: nil,
490
+ enabled: nil,
491
+ attributes: nil,
492
+ indexes: nil
493
+ )
494
+ api_path = '/documentsdb/{databaseId}/collections'
495
+ .gsub('{databaseId}', database_id)
496
+
497
+ if database_id.nil?
498
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
499
+ end
500
+
501
+ if collection_id.nil?
502
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
503
+ end
504
+
505
+ if name.nil?
506
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
507
+ end
508
+
509
+ api_params = {
510
+ collectionId: collection_id,
511
+ name: name,
512
+ permissions: permissions,
513
+ documentSecurity: document_security,
514
+ enabled: enabled,
515
+ attributes: attributes,
516
+ indexes: indexes,
517
+ }
518
+
519
+ api_headers = {
520
+ "X-Appwrite-Project": @client.get_config('project'),
521
+ "content-type": 'application/json',
522
+ "accept": 'application/json',
523
+ }
524
+
525
+ @client.call(
526
+ method: 'POST',
527
+ path: api_path,
528
+ headers: api_headers,
529
+ params: api_params,
530
+ response_type: Models::Collection
531
+ )
532
+ end
533
+
534
+ # Get a collection by its unique ID. This endpoint response returns a JSON
535
+ # object with the collection metadata.
536
+ #
537
+ # @param [String] database_id Database ID.
538
+ # @param [String] collection_id Collection ID.
539
+ #
540
+ # @return [Collection]
541
+ def get_collection(
542
+ database_id:,
543
+ collection_id:
544
+ )
545
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}'
546
+ .gsub('{databaseId}', database_id)
547
+ .gsub('{collectionId}', collection_id)
548
+
549
+ if database_id.nil?
550
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
551
+ end
552
+
553
+ if collection_id.nil?
554
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
555
+ end
556
+
557
+ api_params = {}
558
+
559
+ api_headers = {
560
+ "X-Appwrite-Project": @client.get_config('project'),
561
+ "accept": 'application/json',
562
+ }
563
+
564
+ @client.call(
565
+ method: 'GET',
566
+ path: api_path,
567
+ headers: api_headers,
568
+ params: api_params,
569
+ response_type: Models::Collection
570
+ )
571
+ end
572
+
573
+ # Update a collection by its unique ID.
574
+ #
575
+ # @param [String] database_id Database ID.
576
+ # @param [String] collection_id Collection ID.
577
+ # @param [String] name Collection name. Max length: 128 chars.
578
+ # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
579
+ # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).
580
+ # @param [] enabled Is collection enabled? When set to &#039;disabled&#039;, users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.
581
+ # @param [] purge When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire.
582
+ #
583
+ # @return [Collection]
584
+ def update_collection(
585
+ database_id:,
586
+ collection_id:,
587
+ name:,
588
+ permissions: nil,
589
+ document_security: nil,
590
+ enabled: nil,
591
+ purge: nil
592
+ )
593
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}'
594
+ .gsub('{databaseId}', database_id)
595
+ .gsub('{collectionId}', collection_id)
596
+
597
+ if database_id.nil?
598
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
599
+ end
600
+
601
+ if collection_id.nil?
602
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
603
+ end
604
+
605
+ if name.nil?
606
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
607
+ end
608
+
609
+ api_params = {
610
+ name: name,
611
+ permissions: permissions,
612
+ documentSecurity: document_security,
613
+ enabled: enabled,
614
+ purge: purge,
615
+ }
616
+
617
+ api_headers = {
618
+ "X-Appwrite-Project": @client.get_config('project'),
619
+ "content-type": 'application/json',
620
+ "accept": 'application/json',
621
+ }
622
+
623
+ @client.call(
624
+ method: 'PUT',
625
+ path: api_path,
626
+ headers: api_headers,
627
+ params: api_params,
628
+ response_type: Models::Collection
629
+ )
630
+ end
631
+
632
+ # Delete a collection by its unique ID. Only users with write permissions
633
+ # have access to delete this resource.
634
+ #
635
+ # @param [String] database_id Database ID.
636
+ # @param [String] collection_id Collection ID.
637
+ #
638
+ # @return []
639
+ def delete_collection(
640
+ database_id:,
641
+ collection_id:
642
+ )
643
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}'
644
+ .gsub('{databaseId}', database_id)
645
+ .gsub('{collectionId}', collection_id)
646
+
647
+ if database_id.nil?
648
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
649
+ end
650
+
651
+ if collection_id.nil?
652
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
653
+ end
654
+
655
+ api_params = {}
656
+
657
+ api_headers = {
658
+ "X-Appwrite-Project": @client.get_config('project'),
659
+ "content-type": 'application/json',
660
+ }
661
+
662
+ @client.call(
663
+ method: 'DELETE',
664
+ path: api_path,
665
+ headers: api_headers,
666
+ params: api_params,
667
+ )
668
+ end
669
+
670
+ # Get a list of all the user&#039;s documents in a given collection. You can use
671
+ # the query params to filter your results.
672
+ #
673
+ # @param [String] database_id Database ID.
674
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
675
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
676
+ # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
677
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
678
+ # @param [Integer] ttl TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
679
+ #
680
+ # @return [DocumentList]
681
+ def list_documents(
682
+ database_id:,
683
+ collection_id:,
684
+ queries: nil,
685
+ transaction_id: nil,
686
+ total: nil,
687
+ ttl: nil
688
+ )
689
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
690
+ .gsub('{databaseId}', database_id)
691
+ .gsub('{collectionId}', collection_id)
692
+
693
+ if database_id.nil?
694
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
695
+ end
696
+
697
+ if collection_id.nil?
698
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
699
+ end
700
+
701
+ api_params = {
702
+ queries: queries,
703
+ transactionId: transaction_id,
704
+ total: total,
705
+ ttl: ttl,
706
+ }
707
+
708
+ api_headers = {
709
+ "X-Appwrite-Project": @client.get_config('project'),
710
+ "accept": 'application/json',
711
+ }
712
+
713
+ @client.call(
714
+ method: 'GET',
715
+ path: api_path,
716
+ headers: api_headers,
717
+ params: api_params,
718
+ response_type: Models::DocumentList
719
+ )
720
+ end
721
+
722
+ # Create a new Document. Before using this route, you should create a new
723
+ # collection resource using either a [server
724
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
725
+ # API or directly from your database console.
726
+ #
727
+ # @param [String] database_id Database ID.
728
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
729
+ # @param [String] document_id Document 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&#039;t start with a special char. Max length is 36 chars.
730
+ # @param [Hash] data Document data as JSON object.
731
+ # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
732
+ #
733
+ # @return [Document]
734
+ def create_document(
735
+ database_id:,
736
+ collection_id:,
737
+ document_id:,
738
+ data:,
739
+ permissions: nil
740
+ )
741
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
742
+ .gsub('{databaseId}', database_id)
743
+ .gsub('{collectionId}', collection_id)
744
+
745
+ if database_id.nil?
746
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
747
+ end
748
+
749
+ if collection_id.nil?
750
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
751
+ end
752
+
753
+ if document_id.nil?
754
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
755
+ end
756
+
757
+ if data.nil?
758
+ raise Appwrite::Exception.new('Missing required parameter: "data"')
759
+ end
760
+
761
+ api_params = {
762
+ documentId: document_id,
763
+ data: data,
764
+ permissions: permissions,
765
+ }
766
+
767
+ api_headers = {
768
+ "X-Appwrite-Project": @client.get_config('project'),
769
+ "content-type": 'application/json',
770
+ "accept": 'application/json',
771
+ }
772
+
773
+ @client.call(
774
+ method: 'POST',
775
+ path: api_path,
776
+ headers: api_headers,
777
+ params: api_params,
778
+ response_type: Models::Document
779
+ )
780
+ end
781
+
782
+ # Create new Documents. Before using this route, you should create a new
783
+ # collection resource using either a [server
784
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
785
+ # API or directly from your database console.
786
+ #
787
+ # @param [String] database_id Database ID.
788
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
789
+ # @param [Array] documents Array of documents data as JSON objects.
790
+ #
791
+ # @return [DocumentList]
792
+ def create_documents(
793
+ database_id:,
794
+ collection_id:,
795
+ documents:
796
+ )
797
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
798
+ .gsub('{databaseId}', database_id)
799
+ .gsub('{collectionId}', collection_id)
800
+
801
+ if database_id.nil?
802
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
803
+ end
804
+
805
+ if collection_id.nil?
806
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
807
+ end
808
+
809
+ if documents.nil?
810
+ raise Appwrite::Exception.new('Missing required parameter: "documents"')
811
+ end
812
+
813
+ api_params = {
814
+ documents: documents,
815
+ }
816
+
817
+ api_headers = {
818
+ "X-Appwrite-Project": @client.get_config('project'),
819
+ "content-type": 'application/json',
820
+ "accept": 'application/json',
821
+ }
822
+
823
+ @client.call(
824
+ method: 'POST',
825
+ path: api_path,
826
+ headers: api_headers,
827
+ params: api_params,
828
+ response_type: Models::DocumentList
829
+ )
830
+ end
831
+
832
+ # Create or update Documents. Before using this route, you should create a
833
+ # new collection resource using either a [server
834
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
835
+ # API or directly from your database console.
836
+ #
837
+ #
838
+ # @param [String] database_id Database ID.
839
+ # @param [String] collection_id Collection ID.
840
+ # @param [Array] documents Array of document data as JSON objects. May contain partial documents.
841
+ # @param [String] transaction_id Transaction ID for staging the operation.
842
+ #
843
+ # @return [DocumentList]
844
+ def upsert_documents(
845
+ database_id:,
846
+ collection_id:,
847
+ documents:,
848
+ transaction_id: nil
849
+ )
850
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
851
+ .gsub('{databaseId}', database_id)
852
+ .gsub('{collectionId}', collection_id)
853
+
854
+ if database_id.nil?
855
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
856
+ end
857
+
858
+ if collection_id.nil?
859
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
860
+ end
861
+
862
+ if documents.nil?
863
+ raise Appwrite::Exception.new('Missing required parameter: "documents"')
864
+ end
865
+
866
+ api_params = {
867
+ documents: documents,
868
+ transactionId: transaction_id,
869
+ }
870
+
871
+ api_headers = {
872
+ "X-Appwrite-Project": @client.get_config('project'),
873
+ "content-type": 'application/json',
874
+ "accept": 'application/json',
875
+ }
876
+
877
+ @client.call(
878
+ method: 'PUT',
879
+ path: api_path,
880
+ headers: api_headers,
881
+ params: api_params,
882
+ response_type: Models::DocumentList
883
+ )
884
+ end
885
+
886
+ # Update all documents that match your queries, if no queries are submitted
887
+ # then all documents are updated. You can pass only specific fields to be
888
+ # updated.
889
+ #
890
+ # @param [String] database_id Database ID.
891
+ # @param [String] collection_id Collection ID.
892
+ # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
893
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
894
+ # @param [String] transaction_id Transaction ID for staging the operation.
895
+ #
896
+ # @return [DocumentList]
897
+ def update_documents(
898
+ database_id:,
899
+ collection_id:,
900
+ data: nil,
901
+ queries: nil,
902
+ transaction_id: nil
903
+ )
904
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
905
+ .gsub('{databaseId}', database_id)
906
+ .gsub('{collectionId}', collection_id)
907
+
908
+ if database_id.nil?
909
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
910
+ end
911
+
912
+ if collection_id.nil?
913
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
914
+ end
915
+
916
+ api_params = {
917
+ data: data,
918
+ queries: queries,
919
+ transactionId: transaction_id,
920
+ }
921
+
922
+ api_headers = {
923
+ "X-Appwrite-Project": @client.get_config('project'),
924
+ "content-type": 'application/json',
925
+ "accept": 'application/json',
926
+ }
927
+
928
+ @client.call(
929
+ method: 'PATCH',
930
+ path: api_path,
931
+ headers: api_headers,
932
+ params: api_params,
933
+ response_type: Models::DocumentList
934
+ )
935
+ end
936
+
937
+ # Bulk delete documents using queries, if no queries are passed then all
938
+ # documents are deleted.
939
+ #
940
+ # @param [String] database_id Database ID.
941
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
942
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
943
+ # @param [String] transaction_id Transaction ID for staging the operation.
944
+ #
945
+ # @return [DocumentList]
946
+ def delete_documents(
947
+ database_id:,
948
+ collection_id:,
949
+ queries: nil,
950
+ transaction_id: nil
951
+ )
952
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
953
+ .gsub('{databaseId}', database_id)
954
+ .gsub('{collectionId}', collection_id)
955
+
956
+ if database_id.nil?
957
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
958
+ end
959
+
960
+ if collection_id.nil?
961
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
962
+ end
963
+
964
+ api_params = {
965
+ queries: queries,
966
+ transactionId: transaction_id,
967
+ }
968
+
969
+ api_headers = {
970
+ "X-Appwrite-Project": @client.get_config('project'),
971
+ "content-type": 'application/json',
972
+ "accept": 'application/json',
973
+ }
974
+
975
+ @client.call(
976
+ method: 'DELETE',
977
+ path: api_path,
978
+ headers: api_headers,
979
+ params: api_params,
980
+ response_type: Models::DocumentList
981
+ )
982
+ end
983
+
984
+ # Get a document by its unique ID. This endpoint response returns a JSON
985
+ # object with the document data.
986
+ #
987
+ # @param [String] database_id Database ID.
988
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
989
+ # @param [String] document_id Document ID.
990
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
991
+ # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
992
+ #
993
+ # @return [Document]
994
+ def get_document(
995
+ database_id:,
996
+ collection_id:,
997
+ document_id:,
998
+ queries: nil,
999
+ transaction_id: nil
1000
+ )
1001
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1002
+ .gsub('{databaseId}', database_id)
1003
+ .gsub('{collectionId}', collection_id)
1004
+ .gsub('{documentId}', document_id)
1005
+
1006
+ if database_id.nil?
1007
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1008
+ end
1009
+
1010
+ if collection_id.nil?
1011
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1012
+ end
1013
+
1014
+ if document_id.nil?
1015
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1016
+ end
1017
+
1018
+ api_params = {
1019
+ queries: queries,
1020
+ transactionId: transaction_id,
1021
+ }
1022
+
1023
+ api_headers = {
1024
+ "X-Appwrite-Project": @client.get_config('project'),
1025
+ "accept": 'application/json',
1026
+ }
1027
+
1028
+ @client.call(
1029
+ method: 'GET',
1030
+ path: api_path,
1031
+ headers: api_headers,
1032
+ params: api_params,
1033
+ response_type: Models::Document
1034
+ )
1035
+ end
1036
+
1037
+ # Create or update a Document. Before using this route, you should create a
1038
+ # new collection resource using either a [server
1039
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
1040
+ # API or directly from your database console.
1041
+ #
1042
+ # @param [String] database_id Database ID.
1043
+ # @param [String] collection_id Collection ID.
1044
+ # @param [String] document_id Document ID.
1045
+ # @param [Hash] data Document data as JSON object. Include all required fields of the document to be created or updated.
1046
+ # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1047
+ # @param [String] transaction_id Transaction ID for staging the operation.
1048
+ #
1049
+ # @return [Document]
1050
+ def upsert_document(
1051
+ database_id:,
1052
+ collection_id:,
1053
+ document_id:,
1054
+ data: nil,
1055
+ permissions: nil,
1056
+ transaction_id: nil
1057
+ )
1058
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1059
+ .gsub('{databaseId}', database_id)
1060
+ .gsub('{collectionId}', collection_id)
1061
+ .gsub('{documentId}', document_id)
1062
+
1063
+ if database_id.nil?
1064
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1065
+ end
1066
+
1067
+ if collection_id.nil?
1068
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1069
+ end
1070
+
1071
+ if document_id.nil?
1072
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1073
+ end
1074
+
1075
+ api_params = {
1076
+ data: data,
1077
+ permissions: permissions,
1078
+ transactionId: transaction_id,
1079
+ }
1080
+
1081
+ api_headers = {
1082
+ "X-Appwrite-Project": @client.get_config('project'),
1083
+ "content-type": 'application/json',
1084
+ "accept": 'application/json',
1085
+ }
1086
+
1087
+ @client.call(
1088
+ method: 'PUT',
1089
+ path: api_path,
1090
+ headers: api_headers,
1091
+ params: api_params,
1092
+ response_type: Models::Document
1093
+ )
1094
+ end
1095
+
1096
+ # Update a document by its unique ID. Using the patch method you can pass
1097
+ # only specific fields that will get updated.
1098
+ #
1099
+ # @param [String] database_id Database ID.
1100
+ # @param [String] collection_id Collection ID.
1101
+ # @param [String] document_id Document ID.
1102
+ # @param [Hash] data Document data as JSON object. Include only fields and value pairs to be updated.
1103
+ # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1104
+ # @param [String] transaction_id Transaction ID for staging the operation.
1105
+ #
1106
+ # @return [Document]
1107
+ def update_document(
1108
+ database_id:,
1109
+ collection_id:,
1110
+ document_id:,
1111
+ data: nil,
1112
+ permissions: nil,
1113
+ transaction_id: nil
1114
+ )
1115
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1116
+ .gsub('{databaseId}', database_id)
1117
+ .gsub('{collectionId}', collection_id)
1118
+ .gsub('{documentId}', document_id)
1119
+
1120
+ if database_id.nil?
1121
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1122
+ end
1123
+
1124
+ if collection_id.nil?
1125
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1126
+ end
1127
+
1128
+ if document_id.nil?
1129
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1130
+ end
1131
+
1132
+ api_params = {
1133
+ data: data,
1134
+ permissions: permissions,
1135
+ transactionId: transaction_id,
1136
+ }
1137
+
1138
+ api_headers = {
1139
+ "X-Appwrite-Project": @client.get_config('project'),
1140
+ "content-type": 'application/json',
1141
+ "accept": 'application/json',
1142
+ }
1143
+
1144
+ @client.call(
1145
+ method: 'PATCH',
1146
+ path: api_path,
1147
+ headers: api_headers,
1148
+ params: api_params,
1149
+ response_type: Models::Document
1150
+ )
1151
+ end
1152
+
1153
+ # Delete a document by its unique ID.
1154
+ #
1155
+ # @param [String] database_id Database ID.
1156
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1157
+ # @param [String] document_id Document ID.
1158
+ # @param [String] transaction_id Transaction ID for staging the operation.
1159
+ #
1160
+ # @return []
1161
+ def delete_document(
1162
+ database_id:,
1163
+ collection_id:,
1164
+ document_id:,
1165
+ transaction_id: nil
1166
+ )
1167
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1168
+ .gsub('{databaseId}', database_id)
1169
+ .gsub('{collectionId}', collection_id)
1170
+ .gsub('{documentId}', document_id)
1171
+
1172
+ if database_id.nil?
1173
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1174
+ end
1175
+
1176
+ if collection_id.nil?
1177
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1178
+ end
1179
+
1180
+ if document_id.nil?
1181
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1182
+ end
1183
+
1184
+ api_params = {
1185
+ transactionId: transaction_id,
1186
+ }
1187
+
1188
+ api_headers = {
1189
+ "X-Appwrite-Project": @client.get_config('project'),
1190
+ "content-type": 'application/json',
1191
+ }
1192
+
1193
+ @client.call(
1194
+ method: 'DELETE',
1195
+ path: api_path,
1196
+ headers: api_headers,
1197
+ params: api_params,
1198
+ )
1199
+ end
1200
+
1201
+ # Decrement a specific column of a row by a given value.
1202
+ #
1203
+ # @param [String] database_id Database ID.
1204
+ # @param [String] collection_id Collection ID.
1205
+ # @param [String] document_id Document ID.
1206
+ # @param [String] attribute Attribute key.
1207
+ # @param [Float] value Value to decrement the attribute by. The value must be a number.
1208
+ # @param [Float] min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
1209
+ # @param [String] transaction_id Transaction ID for staging the operation.
1210
+ #
1211
+ # @return [Document]
1212
+ def decrement_document_attribute(
1213
+ database_id:,
1214
+ collection_id:,
1215
+ document_id:,
1216
+ attribute:,
1217
+ value: nil,
1218
+ min: nil,
1219
+ transaction_id: nil
1220
+ )
1221
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'
1222
+ .gsub('{databaseId}', database_id)
1223
+ .gsub('{collectionId}', collection_id)
1224
+ .gsub('{documentId}', document_id)
1225
+ .gsub('{attribute}', attribute)
1226
+
1227
+ if database_id.nil?
1228
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1229
+ end
1230
+
1231
+ if collection_id.nil?
1232
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1233
+ end
1234
+
1235
+ if document_id.nil?
1236
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1237
+ end
1238
+
1239
+ if attribute.nil?
1240
+ raise Appwrite::Exception.new('Missing required parameter: "attribute"')
1241
+ end
1242
+
1243
+ api_params = {
1244
+ value: value,
1245
+ min: min,
1246
+ transactionId: transaction_id,
1247
+ }
1248
+
1249
+ api_headers = {
1250
+ "X-Appwrite-Project": @client.get_config('project'),
1251
+ "content-type": 'application/json',
1252
+ "accept": 'application/json',
1253
+ }
1254
+
1255
+ @client.call(
1256
+ method: 'PATCH',
1257
+ path: api_path,
1258
+ headers: api_headers,
1259
+ params: api_params,
1260
+ response_type: Models::Document
1261
+ )
1262
+ end
1263
+
1264
+ # Increment a specific column of a row by a given value.
1265
+ #
1266
+ # @param [String] database_id Database ID.
1267
+ # @param [String] collection_id Collection ID.
1268
+ # @param [String] document_id Document ID.
1269
+ # @param [String] attribute Attribute key.
1270
+ # @param [Float] value Value to increment the attribute by. The value must be a number.
1271
+ # @param [Float] max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
1272
+ # @param [String] transaction_id Transaction ID for staging the operation.
1273
+ #
1274
+ # @return [Document]
1275
+ def increment_document_attribute(
1276
+ database_id:,
1277
+ collection_id:,
1278
+ document_id:,
1279
+ attribute:,
1280
+ value: nil,
1281
+ max: nil,
1282
+ transaction_id: nil
1283
+ )
1284
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'
1285
+ .gsub('{databaseId}', database_id)
1286
+ .gsub('{collectionId}', collection_id)
1287
+ .gsub('{documentId}', document_id)
1288
+ .gsub('{attribute}', attribute)
1289
+
1290
+ if database_id.nil?
1291
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1292
+ end
1293
+
1294
+ if collection_id.nil?
1295
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1296
+ end
1297
+
1298
+ if document_id.nil?
1299
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1300
+ end
1301
+
1302
+ if attribute.nil?
1303
+ raise Appwrite::Exception.new('Missing required parameter: "attribute"')
1304
+ end
1305
+
1306
+ api_params = {
1307
+ value: value,
1308
+ max: max,
1309
+ transactionId: transaction_id,
1310
+ }
1311
+
1312
+ api_headers = {
1313
+ "X-Appwrite-Project": @client.get_config('project'),
1314
+ "content-type": 'application/json',
1315
+ "accept": 'application/json',
1316
+ }
1317
+
1318
+ @client.call(
1319
+ method: 'PATCH',
1320
+ path: api_path,
1321
+ headers: api_headers,
1322
+ params: api_params,
1323
+ response_type: Models::Document
1324
+ )
1325
+ end
1326
+
1327
+ # List indexes in the collection.
1328
+ #
1329
+ # @param [String] database_id Database ID.
1330
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1331
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error
1332
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
1333
+ #
1334
+ # @return [IndexList]
1335
+ def list_indexes(
1336
+ database_id:,
1337
+ collection_id:,
1338
+ queries: nil,
1339
+ total: nil
1340
+ )
1341
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes'
1342
+ .gsub('{databaseId}', database_id)
1343
+ .gsub('{collectionId}', collection_id)
1344
+
1345
+ if database_id.nil?
1346
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1347
+ end
1348
+
1349
+ if collection_id.nil?
1350
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1351
+ end
1352
+
1353
+ api_params = {
1354
+ queries: queries,
1355
+ total: total,
1356
+ }
1357
+
1358
+ api_headers = {
1359
+ "X-Appwrite-Project": @client.get_config('project'),
1360
+ "accept": 'application/json',
1361
+ }
1362
+
1363
+ @client.call(
1364
+ method: 'GET',
1365
+ path: api_path,
1366
+ headers: api_headers,
1367
+ params: api_params,
1368
+ response_type: Models::IndexList
1369
+ )
1370
+ end
1371
+
1372
+ # Creates an index on the attributes listed. Your index should include all
1373
+ # the attributes you will query in a single request.
1374
+ # Attributes can be `key`, `fulltext`, and `unique`.
1375
+ #
1376
+ # @param [String] database_id Database ID.
1377
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1378
+ # @param [String] key Index Key.
1379
+ # @param [DocumentsDBIndexType] type Index type.
1380
+ # @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
1381
+ # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed.
1382
+ # @param [Array] lengths Length of index. Maximum of 100
1383
+ #
1384
+ # @return [Index]
1385
+ def create_index(
1386
+ database_id:,
1387
+ collection_id:,
1388
+ key:,
1389
+ type:,
1390
+ attributes:,
1391
+ orders: nil,
1392
+ lengths: nil
1393
+ )
1394
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes'
1395
+ .gsub('{databaseId}', database_id)
1396
+ .gsub('{collectionId}', collection_id)
1397
+
1398
+ if database_id.nil?
1399
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1400
+ end
1401
+
1402
+ if collection_id.nil?
1403
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1404
+ end
1405
+
1406
+ if key.nil?
1407
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
1408
+ end
1409
+
1410
+ if type.nil?
1411
+ raise Appwrite::Exception.new('Missing required parameter: "type"')
1412
+ end
1413
+
1414
+ if attributes.nil?
1415
+ raise Appwrite::Exception.new('Missing required parameter: "attributes"')
1416
+ end
1417
+
1418
+ api_params = {
1419
+ key: key,
1420
+ type: type,
1421
+ attributes: attributes,
1422
+ orders: orders,
1423
+ lengths: lengths,
1424
+ }
1425
+
1426
+ api_headers = {
1427
+ "X-Appwrite-Project": @client.get_config('project'),
1428
+ "content-type": 'application/json',
1429
+ "accept": 'application/json',
1430
+ }
1431
+
1432
+ @client.call(
1433
+ method: 'POST',
1434
+ path: api_path,
1435
+ headers: api_headers,
1436
+ params: api_params,
1437
+ response_type: Models::Index
1438
+ )
1439
+ end
1440
+
1441
+ # Get index by ID.
1442
+ #
1443
+ # @param [String] database_id Database ID.
1444
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1445
+ # @param [String] key Index Key.
1446
+ #
1447
+ # @return [Index]
1448
+ def get_index(
1449
+ database_id:,
1450
+ collection_id:,
1451
+ key:
1452
+ )
1453
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}'
1454
+ .gsub('{databaseId}', database_id)
1455
+ .gsub('{collectionId}', collection_id)
1456
+ .gsub('{key}', key)
1457
+
1458
+ if database_id.nil?
1459
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1460
+ end
1461
+
1462
+ if collection_id.nil?
1463
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1464
+ end
1465
+
1466
+ if key.nil?
1467
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
1468
+ end
1469
+
1470
+ api_params = {}
1471
+
1472
+ api_headers = {
1473
+ "X-Appwrite-Project": @client.get_config('project'),
1474
+ "accept": 'application/json',
1475
+ }
1476
+
1477
+ @client.call(
1478
+ method: 'GET',
1479
+ path: api_path,
1480
+ headers: api_headers,
1481
+ params: api_params,
1482
+ response_type: Models::Index
1483
+ )
1484
+ end
1485
+
1486
+ # Delete an index.
1487
+ #
1488
+ # @param [String] database_id Database ID.
1489
+ # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
1490
+ # @param [String] key Index Key.
1491
+ #
1492
+ # @return []
1493
+ def delete_index(
1494
+ database_id:,
1495
+ collection_id:,
1496
+ key:
1497
+ )
1498
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}'
1499
+ .gsub('{databaseId}', database_id)
1500
+ .gsub('{collectionId}', collection_id)
1501
+ .gsub('{key}', key)
1502
+
1503
+ if database_id.nil?
1504
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1505
+ end
1506
+
1507
+ if collection_id.nil?
1508
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1509
+ end
1510
+
1511
+ if key.nil?
1512
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
1513
+ end
1514
+
1515
+ api_params = {}
1516
+
1517
+ api_headers = {
1518
+ "X-Appwrite-Project": @client.get_config('project'),
1519
+ "content-type": 'application/json',
1520
+ }
1521
+
1522
+ @client.call(
1523
+ method: 'DELETE',
1524
+ path: api_path,
1525
+ headers: api_headers,
1526
+ params: api_params,
1527
+ )
1528
+ end
1529
+
1530
+ # Trigger a manual failover for a dedicated database with high availability
1531
+ # enabled. Promotes a replica to primary. The failover runs asynchronously;
1532
+ # poll the database document for status updates. A database left
1533
+ # mid-operation also accepts this call as a repair once nothing is driving
1534
+ # the operation it is stuck in. Repairing a failover that did not finish, a
1535
+ # `failed` database, a stranded upgrade or migrate, or a stranded compute
1536
+ # resize additionally requires `targetReplicaId` to name the member to
1537
+ # promote, because the default target may be the member that operation
1538
+ # already promoted.
1539
+ #
1540
+ # @param [String] database_id Database ID.
1541
+ # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected.
1542
+ #
1543
+ # @return [DedicatedDatabase]
1544
+ def create_failover(
1545
+ database_id:,
1546
+ target_replica_id: nil
1547
+ )
1548
+ api_path = '/documentsdb/{databaseId}/failovers'
1549
+ .gsub('{databaseId}', database_id)
1550
+
1551
+ if database_id.nil?
1552
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1553
+ end
1554
+
1555
+ api_params = {
1556
+ targetReplicaId: target_replica_id,
1557
+ }
1558
+
1559
+ api_headers = {
1560
+ "X-Appwrite-Project": @client.get_config('project'),
1561
+ "content-type": 'application/json',
1562
+ "accept": 'application/json',
1563
+ }
1564
+
1565
+ @client.call(
1566
+ method: 'POST',
1567
+ path: api_path,
1568
+ headers: api_headers,
1569
+ params: api_params,
1570
+ response_type: Models::DedicatedDatabase
1571
+ )
1572
+ end
1573
+
1574
+ # List the lifecycle operations recorded for a dedicated database, newest
1575
+ # first. Every provision, update, restore, backup and replication action is
1576
+ # recorded here with its outcome, including an attempt that was abandoned
1577
+ # because another worker took over the database.
1578
+ #
1579
+ # @param [String] database_id Database ID.
1580
+ # @param [String] status Filter by operation status.
1581
+ # @param [Integer] limit Maximum number of operations to return.
1582
+ # @param [Integer] offset Number of operations to skip.
1583
+ #
1584
+ # @return [DedicatedDatabaseOperationList]
1585
+ def list_operations(
1586
+ database_id:,
1587
+ status: nil,
1588
+ limit: nil,
1589
+ offset: nil
1590
+ )
1591
+ api_path = '/documentsdb/{databaseId}/operations'
1592
+ .gsub('{databaseId}', database_id)
1593
+
1594
+ if database_id.nil?
1595
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1596
+ end
1597
+
1598
+ api_params = {
1599
+ status: status,
1600
+ limit: limit,
1601
+ offset: offset,
1602
+ }
1603
+
1604
+ api_headers = {
1605
+ "X-Appwrite-Project": @client.get_config('project'),
1606
+ "accept": 'application/json',
1607
+ }
1608
+
1609
+ @client.call(
1610
+ method: 'GET',
1611
+ path: api_path,
1612
+ headers: api_headers,
1613
+ params: api_params,
1614
+ response_type: Models::DedicatedDatabaseOperationList
1615
+ )
1616
+ end
1617
+
1618
+ # Get high availability status for a dedicated database. Returns replica
1619
+ # statuses, replication lag, and sync mode.
1620
+ #
1621
+ # @param [String] database_id Database ID.
1622
+ #
1623
+ # @return [DedicatedDatabaseReplicas]
1624
+ def get_replicas(
1625
+ database_id:
1626
+ )
1627
+ api_path = '/documentsdb/{databaseId}/replicas'
1628
+ .gsub('{databaseId}', database_id)
1629
+
1630
+ if database_id.nil?
1631
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1632
+ end
1633
+
1634
+ api_params = {}
1635
+
1636
+ api_headers = {
1637
+ "X-Appwrite-Project": @client.get_config('project'),
1638
+ "accept": 'application/json',
1639
+ }
1640
+
1641
+ @client.call(
1642
+ method: 'GET',
1643
+ path: api_path,
1644
+ headers: api_headers,
1645
+ params: api_params,
1646
+ response_type: Models::DedicatedDatabaseReplicas
1647
+ )
1648
+ end
1649
+
1650
+ # Get real-time health and status information for a dedicated database.
1651
+ # Returns health status, readiness, uptime, connection info, replica status,
1652
+ # and volume information.
1653
+ #
1654
+ # @param [String] database_id Database ID.
1655
+ #
1656
+ # @return [DatabaseStatus]
1657
+ def get_status(
1658
+ database_id:
1659
+ )
1660
+ api_path = '/documentsdb/{databaseId}/status'
1661
+ .gsub('{databaseId}', database_id)
1662
+
1663
+ if database_id.nil?
1664
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1665
+ end
1666
+
1667
+ api_params = {}
1668
+
1669
+ api_headers = {
1670
+ "X-Appwrite-Project": @client.get_config('project'),
1671
+ "accept": 'application/json',
1672
+ }
1673
+
1674
+ @client.call(
1675
+ method: 'GET',
1676
+ path: api_path,
1677
+ headers: api_headers,
1678
+ params: api_params,
1679
+ response_type: Models::DatabaseStatus
1680
+ )
1681
+ end
1682
+ end
1683
+ end