appwrite 27.0.0 → 28.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +28 -25
  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 +4 -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 +18 -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 +4 -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 +24 -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 +8 -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_cloudflare.rb +42 -0
  245. data/lib/appwrite/models/o_auth2_dailymotion.rb +1 -1
  246. data/lib/appwrite/models/o_auth2_discord.rb +1 -1
  247. data/lib/appwrite/models/o_auth2_disqus.rb +1 -1
  248. data/lib/appwrite/models/o_auth2_dropbox.rb +1 -1
  249. data/lib/appwrite/models/o_auth2_etsy.rb +1 -1
  250. data/lib/appwrite/models/o_auth2_facebook.rb +1 -1
  251. data/lib/appwrite/models/o_auth2_figma.rb +1 -1
  252. data/lib/appwrite/models/o_auth2_fusion_auth.rb +1 -1
  253. data/lib/appwrite/models/o_auth2_github.rb +1 -1
  254. data/lib/appwrite/models/o_auth2_gitlab.rb +1 -1
  255. data/lib/appwrite/models/o_auth2_google.rb +18 -2
  256. data/lib/appwrite/models/o_auth2_hugging_face.rb +42 -0
  257. data/lib/appwrite/models/o_auth2_keycloak.rb +1 -1
  258. data/lib/appwrite/models/o_auth2_kick.rb +1 -1
  259. data/lib/appwrite/models/o_auth2_linkedin.rb +1 -1
  260. data/lib/appwrite/models/o_auth2_microsoft.rb +1 -1
  261. data/lib/appwrite/models/o_auth2_notion.rb +1 -1
  262. data/lib/appwrite/models/o_auth2_oidc.rb +20 -3
  263. data/lib/appwrite/models/o_auth2_okta.rb +1 -1
  264. data/lib/appwrite/models/o_auth2_paypal.rb +1 -1
  265. data/lib/appwrite/models/o_auth2_podio.rb +1 -1
  266. data/lib/appwrite/models/o_auth2_provider_list.rb +1 -1
  267. data/lib/appwrite/models/o_auth2_resend.rb +42 -0
  268. data/lib/appwrite/models/o_auth2_salesforce.rb +1 -1
  269. data/lib/appwrite/models/o_auth2_slack.rb +1 -1
  270. data/lib/appwrite/models/o_auth2_spotify.rb +1 -1
  271. data/lib/appwrite/models/o_auth2_stripe.rb +1 -1
  272. data/lib/appwrite/models/o_auth2_tradeshift.rb +1 -1
  273. data/lib/appwrite/models/o_auth2_twitch.rb +1 -1
  274. data/lib/appwrite/models/o_auth2_word_press.rb +1 -1
  275. data/lib/appwrite/models/o_auth2_x.rb +1 -1
  276. data/lib/appwrite/models/o_auth2_yahoo.rb +1 -1
  277. data/lib/appwrite/models/o_auth2_yandex.rb +1 -1
  278. data/lib/appwrite/models/o_auth2_zoho.rb +1 -1
  279. data/lib/appwrite/models/o_auth2_zoom.rb +1 -1
  280. data/lib/appwrite/models/oauth2_approve.rb +1 -1
  281. data/lib/appwrite/models/oauth2_authorize.rb +1 -1
  282. data/lib/appwrite/models/oauth2_consent.rb +1 -1
  283. data/lib/appwrite/models/oauth2_consent_list.rb +1 -1
  284. data/lib/appwrite/models/oauth2_consent_token.rb +1 -1
  285. data/lib/appwrite/models/oauth2_consent_token_list.rb +1 -1
  286. data/lib/appwrite/models/oauth2_device_authorization.rb +1 -1
  287. data/lib/appwrite/models/oauth2_grant.rb +1 -1
  288. data/lib/appwrite/models/oauth2_organization.rb +1 -1
  289. data/lib/appwrite/models/oauth2_organization_list.rb +1 -1
  290. data/lib/appwrite/models/oauth2_par.rb +1 -1
  291. data/lib/appwrite/models/oauth2_project.rb +1 -1
  292. data/lib/appwrite/models/oauth2_project_list.rb +1 -1
  293. data/lib/appwrite/models/oauth2_reject.rb +1 -1
  294. data/lib/appwrite/models/oauth2_token.rb +3 -3
  295. data/lib/appwrite/models/organization.rb +14 -14
  296. data/lib/appwrite/models/phone.rb +1 -1
  297. data/lib/appwrite/models/phone_list.rb +1 -1
  298. data/lib/appwrite/models/platform_android.rb +1 -2
  299. data/lib/appwrite/models/platform_apple.rb +1 -2
  300. data/lib/appwrite/models/platform_linux.rb +1 -2
  301. data/lib/appwrite/models/platform_list.rb +1 -1
  302. data/lib/appwrite/models/platform_web.rb +1 -2
  303. data/lib/appwrite/models/platform_windows.rb +1 -2
  304. data/lib/appwrite/models/policy_deny_aliased_email.rb +1 -1
  305. data/lib/appwrite/models/policy_deny_corporate_email.rb +1 -1
  306. data/lib/appwrite/models/policy_deny_disposable_email.rb +1 -1
  307. data/lib/appwrite/models/policy_deny_free_email.rb +1 -1
  308. data/lib/appwrite/models/policy_list.rb +1 -1
  309. data/lib/appwrite/models/policy_membership_privacy.rb +1 -1
  310. data/lib/appwrite/models/policy_mfa_factors.rb +1 -1
  311. data/lib/appwrite/models/policy_password_dictionary.rb +1 -1
  312. data/lib/appwrite/models/policy_password_history.rb +1 -1
  313. data/lib/appwrite/models/policy_password_personal_data.rb +1 -1
  314. data/lib/appwrite/models/policy_password_strength.rb +1 -1
  315. data/lib/appwrite/models/policy_session_alert.rb +1 -1
  316. data/lib/appwrite/models/policy_session_duration.rb +1 -1
  317. data/lib/appwrite/models/policy_session_invalidation.rb +1 -1
  318. data/lib/appwrite/models/policy_session_limit.rb +1 -1
  319. data/lib/appwrite/models/policy_user_limit.rb +1 -1
  320. data/lib/appwrite/models/postgres_extension.rb +42 -0
  321. data/lib/appwrite/models/preferences.rb +1 -1
  322. data/lib/appwrite/models/presence.rb +4 -4
  323. data/lib/appwrite/models/presence_list.rb +1 -1
  324. data/lib/appwrite/models/program.rb +1 -1
  325. data/lib/appwrite/models/project.rb +19 -19
  326. data/lib/appwrite/models/project_auth_method.rb +1 -2
  327. data/lib/appwrite/models/project_list.rb +1 -1
  328. data/lib/appwrite/models/project_protocol.rb +1 -2
  329. data/lib/appwrite/models/project_service.rb +1 -2
  330. data/lib/appwrite/models/provider.rb +2 -2
  331. data/lib/appwrite/models/provider_list.rb +1 -1
  332. data/lib/appwrite/models/proxy_invalidation.rb +1 -1
  333. data/lib/appwrite/models/proxy_rule.rb +2 -3
  334. data/lib/appwrite/models/proxy_rule_list.rb +1 -1
  335. data/lib/appwrite/models/report.rb +2 -2
  336. data/lib/appwrite/models/report_list.rb +1 -1
  337. data/lib/appwrite/models/resource_token.rb +1 -1
  338. data/lib/appwrite/models/resource_token_list.rb +1 -1
  339. data/lib/appwrite/models/row.rb +1 -1
  340. data/lib/appwrite/models/row_list.rb +1 -1
  341. data/lib/appwrite/models/runtime.rb +1 -1
  342. data/lib/appwrite/models/runtime_list.rb +1 -1
  343. data/lib/appwrite/models/session.rb +1 -1
  344. data/lib/appwrite/models/session_list.rb +1 -1
  345. data/lib/appwrite/models/site.rb +6 -1
  346. data/lib/appwrite/models/site_list.rb +1 -1
  347. data/lib/appwrite/models/specification.rb +1 -1
  348. data/lib/appwrite/models/specification_list.rb +1 -1
  349. data/lib/appwrite/models/subscriber.rb +1 -1
  350. data/lib/appwrite/models/subscriber_list.rb +1 -1
  351. data/lib/appwrite/models/table.rb +1 -1
  352. data/lib/appwrite/models/table_list.rb +1 -1
  353. data/lib/appwrite/models/target.rb +2 -2
  354. data/lib/appwrite/models/target_list.rb +1 -1
  355. data/lib/appwrite/models/team.rb +1 -1
  356. data/lib/appwrite/models/team_list.rb +1 -1
  357. data/lib/appwrite/models/token.rb +1 -1
  358. data/lib/appwrite/models/topic.rb +1 -1
  359. data/lib/appwrite/models/topic_list.rb +1 -1
  360. data/lib/appwrite/models/transaction.rb +1 -1
  361. data/lib/appwrite/models/transaction_list.rb +1 -1
  362. data/lib/appwrite/models/usage_billing_plan.rb +4 -4
  363. data/lib/appwrite/models/user.rb +11 -11
  364. data/lib/appwrite/models/user_list.rb +1 -1
  365. data/lib/appwrite/models/variable.rb +1 -1
  366. data/lib/appwrite/models/variable_list.rb +1 -1
  367. data/lib/appwrite/models/vectorsdb_collection.rb +87 -0
  368. data/lib/appwrite/models/vectorsdb_collection_list.rb +32 -0
  369. data/lib/appwrite/models/webhook.rb +1 -1
  370. data/lib/appwrite/models/webhook_list.rb +1 -1
  371. data/lib/appwrite/operator.rb +6 -0
  372. data/lib/appwrite/permission.rb +4 -0
  373. data/lib/appwrite/query.rb +4 -4
  374. data/lib/appwrite/role.rb +12 -14
  375. data/lib/appwrite/service.rb +1 -1
  376. data/lib/appwrite/services/account.rb +328 -289
  377. data/lib/appwrite/services/activities.rb +13 -14
  378. data/lib/appwrite/services/advisor.rb +41 -37
  379. data/lib/appwrite/services/apps.rb +185 -130
  380. data/lib/appwrite/services/avatars.rb +159 -55
  381. data/lib/appwrite/services/backups.rb +102 -83
  382. data/lib/appwrite/services/databases.rb +871 -512
  383. data/lib/appwrite/services/documents_db.rb +1689 -0
  384. data/lib/appwrite/services/embeddings.rb +9 -9
  385. data/lib/appwrite/services/functions.rb +276 -172
  386. data/lib/appwrite/services/graphql.rb +12 -12
  387. data/lib/appwrite/services/locale.rb +19 -37
  388. data/lib/appwrite/services/messaging.rb +544 -259
  389. data/lib/appwrite/services/mongo.rb +1359 -0
  390. data/lib/appwrite/services/mysql.rb +1503 -0
  391. data/lib/appwrite/services/oauth2.rb +122 -53
  392. data/lib/appwrite/services/organization.rb +153 -123
  393. data/lib/appwrite/services/postgresql.rb +1615 -0
  394. data/lib/appwrite/services/presences.rb +49 -35
  395. data/lib/appwrite/services/project.rb +920 -526
  396. data/lib/appwrite/services/proxy.rb +73 -58
  397. data/lib/appwrite/services/sites.rb +269 -164
  398. data/lib/appwrite/services/storage.rb +151 -92
  399. data/lib/appwrite/services/tables_db.rb +948 -569
  400. data/lib/appwrite/services/teams.rb +161 -122
  401. data/lib/appwrite/services/tokens.rb +38 -31
  402. data/lib/appwrite/services/users.rb +376 -274
  403. data/lib/appwrite/services/vectors_db.rb +1620 -0
  404. data/lib/appwrite/services/webhooks.rb +59 -40
  405. data/lib/appwrite.rb +29 -0
  406. metadata +31 -2
@@ -0,0 +1,1689 @@
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
+ # @param [String] transaction_id Transaction ID for staging the operation.
733
+ #
734
+ # @return [Document]
735
+ def create_document(
736
+ database_id:,
737
+ collection_id:,
738
+ document_id:,
739
+ data:,
740
+ permissions: nil,
741
+ transaction_id: nil
742
+ )
743
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
744
+ .gsub('{databaseId}', database_id)
745
+ .gsub('{collectionId}', collection_id)
746
+
747
+ if database_id.nil?
748
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
749
+ end
750
+
751
+ if collection_id.nil?
752
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
753
+ end
754
+
755
+ if document_id.nil?
756
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
757
+ end
758
+
759
+ if data.nil?
760
+ raise Appwrite::Exception.new('Missing required parameter: "data"')
761
+ end
762
+
763
+ api_params = {
764
+ documentId: document_id,
765
+ data: data,
766
+ permissions: permissions,
767
+ transactionId: transaction_id,
768
+ }
769
+
770
+ api_headers = {
771
+ "X-Appwrite-Project": @client.get_config('project'),
772
+ "content-type": 'application/json',
773
+ "accept": 'application/json',
774
+ }
775
+
776
+ @client.call(
777
+ method: 'POST',
778
+ path: api_path,
779
+ headers: api_headers,
780
+ params: api_params,
781
+ response_type: Models::Document
782
+ )
783
+ end
784
+
785
+ # Create new Documents. Before using this route, you should create a new
786
+ # collection resource using either a [server
787
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
788
+ # API or directly from your database console.
789
+ #
790
+ # @param [String] database_id Database ID.
791
+ # @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.
792
+ # @param [Array] documents Array of documents data as JSON objects.
793
+ # @param [String] transaction_id Transaction ID for staging the operation.
794
+ #
795
+ # @return [DocumentList]
796
+ def create_documents(
797
+ database_id:,
798
+ collection_id:,
799
+ documents:,
800
+ transaction_id: nil
801
+ )
802
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
803
+ .gsub('{databaseId}', database_id)
804
+ .gsub('{collectionId}', collection_id)
805
+
806
+ if database_id.nil?
807
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
808
+ end
809
+
810
+ if collection_id.nil?
811
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
812
+ end
813
+
814
+ if documents.nil?
815
+ raise Appwrite::Exception.new('Missing required parameter: "documents"')
816
+ end
817
+
818
+ api_params = {
819
+ documents: documents,
820
+ transactionId: transaction_id,
821
+ }
822
+
823
+ api_headers = {
824
+ "X-Appwrite-Project": @client.get_config('project'),
825
+ "content-type": 'application/json',
826
+ "accept": 'application/json',
827
+ }
828
+
829
+ @client.call(
830
+ method: 'POST',
831
+ path: api_path,
832
+ headers: api_headers,
833
+ params: api_params,
834
+ response_type: Models::DocumentList
835
+ )
836
+ end
837
+
838
+ # Create or update Documents. Before using this route, you should create a
839
+ # new collection resource using either a [server
840
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
841
+ # API or directly from your database console.
842
+ #
843
+ #
844
+ # @param [String] database_id Database ID.
845
+ # @param [String] collection_id Collection ID.
846
+ # @param [Array] documents Array of document data as JSON objects. May contain partial documents.
847
+ # @param [String] transaction_id Transaction ID for staging the operation.
848
+ #
849
+ # @return [DocumentList]
850
+ def upsert_documents(
851
+ database_id:,
852
+ collection_id:,
853
+ documents:,
854
+ transaction_id: nil
855
+ )
856
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
857
+ .gsub('{databaseId}', database_id)
858
+ .gsub('{collectionId}', collection_id)
859
+
860
+ if database_id.nil?
861
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
862
+ end
863
+
864
+ if collection_id.nil?
865
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
866
+ end
867
+
868
+ if documents.nil?
869
+ raise Appwrite::Exception.new('Missing required parameter: "documents"')
870
+ end
871
+
872
+ api_params = {
873
+ documents: documents,
874
+ transactionId: transaction_id,
875
+ }
876
+
877
+ api_headers = {
878
+ "X-Appwrite-Project": @client.get_config('project'),
879
+ "content-type": 'application/json',
880
+ "accept": 'application/json',
881
+ }
882
+
883
+ @client.call(
884
+ method: 'PUT',
885
+ path: api_path,
886
+ headers: api_headers,
887
+ params: api_params,
888
+ response_type: Models::DocumentList
889
+ )
890
+ end
891
+
892
+ # Update all documents that match your queries, if no queries are submitted
893
+ # then all documents are updated. You can pass only specific fields to be
894
+ # updated.
895
+ #
896
+ # @param [String] database_id Database ID.
897
+ # @param [String] collection_id Collection ID.
898
+ # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
899
+ # @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.
900
+ # @param [String] transaction_id Transaction ID for staging the operation.
901
+ #
902
+ # @return [DocumentList]
903
+ def update_documents(
904
+ database_id:,
905
+ collection_id:,
906
+ data: nil,
907
+ queries: nil,
908
+ transaction_id: nil
909
+ )
910
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
911
+ .gsub('{databaseId}', database_id)
912
+ .gsub('{collectionId}', collection_id)
913
+
914
+ if database_id.nil?
915
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
916
+ end
917
+
918
+ if collection_id.nil?
919
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
920
+ end
921
+
922
+ api_params = {
923
+ data: data,
924
+ queries: queries,
925
+ transactionId: transaction_id,
926
+ }
927
+
928
+ api_headers = {
929
+ "X-Appwrite-Project": @client.get_config('project'),
930
+ "content-type": 'application/json',
931
+ "accept": 'application/json',
932
+ }
933
+
934
+ @client.call(
935
+ method: 'PATCH',
936
+ path: api_path,
937
+ headers: api_headers,
938
+ params: api_params,
939
+ response_type: Models::DocumentList
940
+ )
941
+ end
942
+
943
+ # Bulk delete documents using queries, if no queries are passed then all
944
+ # documents are deleted.
945
+ #
946
+ # @param [String] database_id Database ID.
947
+ # @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).
948
+ # @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.
949
+ # @param [String] transaction_id Transaction ID for staging the operation.
950
+ #
951
+ # @return [DocumentList]
952
+ def delete_documents(
953
+ database_id:,
954
+ collection_id:,
955
+ queries: nil,
956
+ transaction_id: nil
957
+ )
958
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents'
959
+ .gsub('{databaseId}', database_id)
960
+ .gsub('{collectionId}', collection_id)
961
+
962
+ if database_id.nil?
963
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
964
+ end
965
+
966
+ if collection_id.nil?
967
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
968
+ end
969
+
970
+ api_params = {
971
+ queries: queries,
972
+ transactionId: transaction_id,
973
+ }
974
+
975
+ api_headers = {
976
+ "X-Appwrite-Project": @client.get_config('project'),
977
+ "content-type": 'application/json',
978
+ "accept": 'application/json',
979
+ }
980
+
981
+ @client.call(
982
+ method: 'DELETE',
983
+ path: api_path,
984
+ headers: api_headers,
985
+ params: api_params,
986
+ response_type: Models::DocumentList
987
+ )
988
+ end
989
+
990
+ # Get a document by its unique ID. This endpoint response returns a JSON
991
+ # object with the document data.
992
+ #
993
+ # @param [String] database_id Database ID.
994
+ # @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).
995
+ # @param [String] document_id Document ID.
996
+ # @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.
997
+ # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
998
+ #
999
+ # @return [Document]
1000
+ def get_document(
1001
+ database_id:,
1002
+ collection_id:,
1003
+ document_id:,
1004
+ queries: nil,
1005
+ transaction_id: nil
1006
+ )
1007
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1008
+ .gsub('{databaseId}', database_id)
1009
+ .gsub('{collectionId}', collection_id)
1010
+ .gsub('{documentId}', document_id)
1011
+
1012
+ if database_id.nil?
1013
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1014
+ end
1015
+
1016
+ if collection_id.nil?
1017
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1018
+ end
1019
+
1020
+ if document_id.nil?
1021
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1022
+ end
1023
+
1024
+ api_params = {
1025
+ queries: queries,
1026
+ transactionId: transaction_id,
1027
+ }
1028
+
1029
+ api_headers = {
1030
+ "X-Appwrite-Project": @client.get_config('project'),
1031
+ "accept": 'application/json',
1032
+ }
1033
+
1034
+ @client.call(
1035
+ method: 'GET',
1036
+ path: api_path,
1037
+ headers: api_headers,
1038
+ params: api_params,
1039
+ response_type: Models::Document
1040
+ )
1041
+ end
1042
+
1043
+ # Create or update a Document. Before using this route, you should create a
1044
+ # new collection resource using either a [server
1045
+ # integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection)
1046
+ # API or directly from your database console.
1047
+ #
1048
+ # @param [String] database_id Database ID.
1049
+ # @param [String] collection_id Collection ID.
1050
+ # @param [String] document_id Document ID.
1051
+ # @param [Hash] data Document data as JSON object. Include all required fields of the document to be created or updated.
1052
+ # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1053
+ # @param [String] transaction_id Transaction ID for staging the operation.
1054
+ #
1055
+ # @return [Document]
1056
+ def upsert_document(
1057
+ database_id:,
1058
+ collection_id:,
1059
+ document_id:,
1060
+ data: nil,
1061
+ permissions: nil,
1062
+ transaction_id: nil
1063
+ )
1064
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1065
+ .gsub('{databaseId}', database_id)
1066
+ .gsub('{collectionId}', collection_id)
1067
+ .gsub('{documentId}', document_id)
1068
+
1069
+ if database_id.nil?
1070
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1071
+ end
1072
+
1073
+ if collection_id.nil?
1074
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1075
+ end
1076
+
1077
+ if document_id.nil?
1078
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1079
+ end
1080
+
1081
+ api_params = {
1082
+ data: data,
1083
+ permissions: permissions,
1084
+ transactionId: transaction_id,
1085
+ }
1086
+
1087
+ api_headers = {
1088
+ "X-Appwrite-Project": @client.get_config('project'),
1089
+ "content-type": 'application/json',
1090
+ "accept": 'application/json',
1091
+ }
1092
+
1093
+ @client.call(
1094
+ method: 'PUT',
1095
+ path: api_path,
1096
+ headers: api_headers,
1097
+ params: api_params,
1098
+ response_type: Models::Document
1099
+ )
1100
+ end
1101
+
1102
+ # Update a document by its unique ID. Using the patch method you can pass
1103
+ # only specific fields that will get updated.
1104
+ #
1105
+ # @param [String] database_id Database ID.
1106
+ # @param [String] collection_id Collection ID.
1107
+ # @param [String] document_id Document ID.
1108
+ # @param [Hash] data Document data as JSON object. Include only fields and value pairs to be updated.
1109
+ # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
1110
+ # @param [String] transaction_id Transaction ID for staging the operation.
1111
+ #
1112
+ # @return [Document]
1113
+ def update_document(
1114
+ database_id:,
1115
+ collection_id:,
1116
+ document_id:,
1117
+ data: nil,
1118
+ permissions: nil,
1119
+ transaction_id: nil
1120
+ )
1121
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1122
+ .gsub('{databaseId}', database_id)
1123
+ .gsub('{collectionId}', collection_id)
1124
+ .gsub('{documentId}', document_id)
1125
+
1126
+ if database_id.nil?
1127
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1128
+ end
1129
+
1130
+ if collection_id.nil?
1131
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1132
+ end
1133
+
1134
+ if document_id.nil?
1135
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1136
+ end
1137
+
1138
+ api_params = {
1139
+ data: data,
1140
+ permissions: permissions,
1141
+ transactionId: transaction_id,
1142
+ }
1143
+
1144
+ api_headers = {
1145
+ "X-Appwrite-Project": @client.get_config('project'),
1146
+ "content-type": 'application/json',
1147
+ "accept": 'application/json',
1148
+ }
1149
+
1150
+ @client.call(
1151
+ method: 'PATCH',
1152
+ path: api_path,
1153
+ headers: api_headers,
1154
+ params: api_params,
1155
+ response_type: Models::Document
1156
+ )
1157
+ end
1158
+
1159
+ # Delete a document by its unique ID.
1160
+ #
1161
+ # @param [String] database_id Database ID.
1162
+ # @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).
1163
+ # @param [String] document_id Document ID.
1164
+ # @param [String] transaction_id Transaction ID for staging the operation.
1165
+ #
1166
+ # @return []
1167
+ def delete_document(
1168
+ database_id:,
1169
+ collection_id:,
1170
+ document_id:,
1171
+ transaction_id: nil
1172
+ )
1173
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}'
1174
+ .gsub('{databaseId}', database_id)
1175
+ .gsub('{collectionId}', collection_id)
1176
+ .gsub('{documentId}', document_id)
1177
+
1178
+ if database_id.nil?
1179
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1180
+ end
1181
+
1182
+ if collection_id.nil?
1183
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1184
+ end
1185
+
1186
+ if document_id.nil?
1187
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1188
+ end
1189
+
1190
+ api_params = {
1191
+ transactionId: transaction_id,
1192
+ }
1193
+
1194
+ api_headers = {
1195
+ "X-Appwrite-Project": @client.get_config('project'),
1196
+ "content-type": 'application/json',
1197
+ }
1198
+
1199
+ @client.call(
1200
+ method: 'DELETE',
1201
+ path: api_path,
1202
+ headers: api_headers,
1203
+ params: api_params,
1204
+ )
1205
+ end
1206
+
1207
+ # Decrement a specific column of a row by a given value.
1208
+ #
1209
+ # @param [String] database_id Database ID.
1210
+ # @param [String] collection_id Collection ID.
1211
+ # @param [String] document_id Document ID.
1212
+ # @param [String] attribute Attribute key.
1213
+ # @param [Float] value Value to decrement the attribute by. The value must be a number.
1214
+ # @param [Float] min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
1215
+ # @param [String] transaction_id Transaction ID for staging the operation.
1216
+ #
1217
+ # @return [Document]
1218
+ def decrement_document_attribute(
1219
+ database_id:,
1220
+ collection_id:,
1221
+ document_id:,
1222
+ attribute:,
1223
+ value: nil,
1224
+ min: nil,
1225
+ transaction_id: nil
1226
+ )
1227
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'
1228
+ .gsub('{databaseId}', database_id)
1229
+ .gsub('{collectionId}', collection_id)
1230
+ .gsub('{documentId}', document_id)
1231
+ .gsub('{attribute}', attribute)
1232
+
1233
+ if database_id.nil?
1234
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1235
+ end
1236
+
1237
+ if collection_id.nil?
1238
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1239
+ end
1240
+
1241
+ if document_id.nil?
1242
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1243
+ end
1244
+
1245
+ if attribute.nil?
1246
+ raise Appwrite::Exception.new('Missing required parameter: "attribute"')
1247
+ end
1248
+
1249
+ api_params = {
1250
+ value: value,
1251
+ min: min,
1252
+ transactionId: transaction_id,
1253
+ }
1254
+
1255
+ api_headers = {
1256
+ "X-Appwrite-Project": @client.get_config('project'),
1257
+ "content-type": 'application/json',
1258
+ "accept": 'application/json',
1259
+ }
1260
+
1261
+ @client.call(
1262
+ method: 'PATCH',
1263
+ path: api_path,
1264
+ headers: api_headers,
1265
+ params: api_params,
1266
+ response_type: Models::Document
1267
+ )
1268
+ end
1269
+
1270
+ # Increment a specific column of a row by a given value.
1271
+ #
1272
+ # @param [String] database_id Database ID.
1273
+ # @param [String] collection_id Collection ID.
1274
+ # @param [String] document_id Document ID.
1275
+ # @param [String] attribute Attribute key.
1276
+ # @param [Float] value Value to increment the attribute by. The value must be a number.
1277
+ # @param [Float] max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
1278
+ # @param [String] transaction_id Transaction ID for staging the operation.
1279
+ #
1280
+ # @return [Document]
1281
+ def increment_document_attribute(
1282
+ database_id:,
1283
+ collection_id:,
1284
+ document_id:,
1285
+ attribute:,
1286
+ value: nil,
1287
+ max: nil,
1288
+ transaction_id: nil
1289
+ )
1290
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'
1291
+ .gsub('{databaseId}', database_id)
1292
+ .gsub('{collectionId}', collection_id)
1293
+ .gsub('{documentId}', document_id)
1294
+ .gsub('{attribute}', attribute)
1295
+
1296
+ if database_id.nil?
1297
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1298
+ end
1299
+
1300
+ if collection_id.nil?
1301
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1302
+ end
1303
+
1304
+ if document_id.nil?
1305
+ raise Appwrite::Exception.new('Missing required parameter: "documentId"')
1306
+ end
1307
+
1308
+ if attribute.nil?
1309
+ raise Appwrite::Exception.new('Missing required parameter: "attribute"')
1310
+ end
1311
+
1312
+ api_params = {
1313
+ value: value,
1314
+ max: max,
1315
+ transactionId: transaction_id,
1316
+ }
1317
+
1318
+ api_headers = {
1319
+ "X-Appwrite-Project": @client.get_config('project'),
1320
+ "content-type": 'application/json',
1321
+ "accept": 'application/json',
1322
+ }
1323
+
1324
+ @client.call(
1325
+ method: 'PATCH',
1326
+ path: api_path,
1327
+ headers: api_headers,
1328
+ params: api_params,
1329
+ response_type: Models::Document
1330
+ )
1331
+ end
1332
+
1333
+ # List indexes in the collection.
1334
+ #
1335
+ # @param [String] database_id Database ID.
1336
+ # @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).
1337
+ # @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
1338
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
1339
+ #
1340
+ # @return [IndexList]
1341
+ def list_indexes(
1342
+ database_id:,
1343
+ collection_id:,
1344
+ queries: nil,
1345
+ total: nil
1346
+ )
1347
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes'
1348
+ .gsub('{databaseId}', database_id)
1349
+ .gsub('{collectionId}', collection_id)
1350
+
1351
+ if database_id.nil?
1352
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1353
+ end
1354
+
1355
+ if collection_id.nil?
1356
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1357
+ end
1358
+
1359
+ api_params = {
1360
+ queries: queries,
1361
+ total: total,
1362
+ }
1363
+
1364
+ api_headers = {
1365
+ "X-Appwrite-Project": @client.get_config('project'),
1366
+ "accept": 'application/json',
1367
+ }
1368
+
1369
+ @client.call(
1370
+ method: 'GET',
1371
+ path: api_path,
1372
+ headers: api_headers,
1373
+ params: api_params,
1374
+ response_type: Models::IndexList
1375
+ )
1376
+ end
1377
+
1378
+ # Creates an index on the attributes listed. Your index should include all
1379
+ # the attributes you will query in a single request.
1380
+ # Attributes can be `key`, `fulltext`, and `unique`.
1381
+ #
1382
+ # @param [String] database_id Database ID.
1383
+ # @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).
1384
+ # @param [String] key Index Key.
1385
+ # @param [DocumentsDBIndexType] type Index type.
1386
+ # @param [Array] attributes Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
1387
+ # @param [Array] orders Array of index orders. Maximum of 100 orders are allowed.
1388
+ # @param [Array] lengths Length of index. Maximum of 100
1389
+ #
1390
+ # @return [Index]
1391
+ def create_index(
1392
+ database_id:,
1393
+ collection_id:,
1394
+ key:,
1395
+ type:,
1396
+ attributes:,
1397
+ orders: nil,
1398
+ lengths: nil
1399
+ )
1400
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes'
1401
+ .gsub('{databaseId}', database_id)
1402
+ .gsub('{collectionId}', collection_id)
1403
+
1404
+ if database_id.nil?
1405
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1406
+ end
1407
+
1408
+ if collection_id.nil?
1409
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1410
+ end
1411
+
1412
+ if key.nil?
1413
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
1414
+ end
1415
+
1416
+ if type.nil?
1417
+ raise Appwrite::Exception.new('Missing required parameter: "type"')
1418
+ end
1419
+
1420
+ if attributes.nil?
1421
+ raise Appwrite::Exception.new('Missing required parameter: "attributes"')
1422
+ end
1423
+
1424
+ api_params = {
1425
+ key: key,
1426
+ type: type,
1427
+ attributes: attributes,
1428
+ orders: orders,
1429
+ lengths: lengths,
1430
+ }
1431
+
1432
+ api_headers = {
1433
+ "X-Appwrite-Project": @client.get_config('project'),
1434
+ "content-type": 'application/json',
1435
+ "accept": 'application/json',
1436
+ }
1437
+
1438
+ @client.call(
1439
+ method: 'POST',
1440
+ path: api_path,
1441
+ headers: api_headers,
1442
+ params: api_params,
1443
+ response_type: Models::Index
1444
+ )
1445
+ end
1446
+
1447
+ # Get index by ID.
1448
+ #
1449
+ # @param [String] database_id Database ID.
1450
+ # @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).
1451
+ # @param [String] key Index Key.
1452
+ #
1453
+ # @return [Index]
1454
+ def get_index(
1455
+ database_id:,
1456
+ collection_id:,
1457
+ key:
1458
+ )
1459
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}'
1460
+ .gsub('{databaseId}', database_id)
1461
+ .gsub('{collectionId}', collection_id)
1462
+ .gsub('{key}', key)
1463
+
1464
+ if database_id.nil?
1465
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1466
+ end
1467
+
1468
+ if collection_id.nil?
1469
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1470
+ end
1471
+
1472
+ if key.nil?
1473
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
1474
+ end
1475
+
1476
+ api_params = {}
1477
+
1478
+ api_headers = {
1479
+ "X-Appwrite-Project": @client.get_config('project'),
1480
+ "accept": 'application/json',
1481
+ }
1482
+
1483
+ @client.call(
1484
+ method: 'GET',
1485
+ path: api_path,
1486
+ headers: api_headers,
1487
+ params: api_params,
1488
+ response_type: Models::Index
1489
+ )
1490
+ end
1491
+
1492
+ # Delete an index.
1493
+ #
1494
+ # @param [String] database_id Database ID.
1495
+ # @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).
1496
+ # @param [String] key Index Key.
1497
+ #
1498
+ # @return []
1499
+ def delete_index(
1500
+ database_id:,
1501
+ collection_id:,
1502
+ key:
1503
+ )
1504
+ api_path = '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}'
1505
+ .gsub('{databaseId}', database_id)
1506
+ .gsub('{collectionId}', collection_id)
1507
+ .gsub('{key}', key)
1508
+
1509
+ if database_id.nil?
1510
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1511
+ end
1512
+
1513
+ if collection_id.nil?
1514
+ raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
1515
+ end
1516
+
1517
+ if key.nil?
1518
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
1519
+ end
1520
+
1521
+ api_params = {}
1522
+
1523
+ api_headers = {
1524
+ "X-Appwrite-Project": @client.get_config('project'),
1525
+ "content-type": 'application/json',
1526
+ }
1527
+
1528
+ @client.call(
1529
+ method: 'DELETE',
1530
+ path: api_path,
1531
+ headers: api_headers,
1532
+ params: api_params,
1533
+ )
1534
+ end
1535
+
1536
+ # Trigger a manual failover for a dedicated database with high availability
1537
+ # enabled. Promotes a replica to primary. The failover runs asynchronously;
1538
+ # poll the database document for status updates. A database left
1539
+ # mid-operation also accepts this call as a repair once nothing is driving
1540
+ # the operation it is stuck in. Repairing a failover that did not finish, a
1541
+ # `failed` database, a stranded upgrade or migrate, or a stranded compute
1542
+ # resize additionally requires `targetReplicaId` to name the member to
1543
+ # promote, because the default target may be the member that operation
1544
+ # already promoted.
1545
+ #
1546
+ # @param [String] database_id Database ID.
1547
+ # @param [String] target_replica_id Target replica ID to promote. If not specified, the healthiest replica is selected.
1548
+ #
1549
+ # @return [DedicatedDatabase]
1550
+ def create_failover(
1551
+ database_id:,
1552
+ target_replica_id: nil
1553
+ )
1554
+ api_path = '/documentsdb/{databaseId}/failovers'
1555
+ .gsub('{databaseId}', database_id)
1556
+
1557
+ if database_id.nil?
1558
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1559
+ end
1560
+
1561
+ api_params = {
1562
+ targetReplicaId: target_replica_id,
1563
+ }
1564
+
1565
+ api_headers = {
1566
+ "X-Appwrite-Project": @client.get_config('project'),
1567
+ "content-type": 'application/json',
1568
+ "accept": 'application/json',
1569
+ }
1570
+
1571
+ @client.call(
1572
+ method: 'POST',
1573
+ path: api_path,
1574
+ headers: api_headers,
1575
+ params: api_params,
1576
+ response_type: Models::DedicatedDatabase
1577
+ )
1578
+ end
1579
+
1580
+ # List the lifecycle operations recorded for a dedicated database, newest
1581
+ # first. Every provision, update, restore, backup and replication action is
1582
+ # recorded here with its outcome, including an attempt that was abandoned
1583
+ # because another worker took over the database.
1584
+ #
1585
+ # @param [String] database_id Database ID.
1586
+ # @param [String] status Filter by operation status.
1587
+ # @param [Integer] limit Maximum number of operations to return.
1588
+ # @param [Integer] offset Number of operations to skip.
1589
+ #
1590
+ # @return [DedicatedDatabaseOperationList]
1591
+ def list_operations(
1592
+ database_id:,
1593
+ status: nil,
1594
+ limit: nil,
1595
+ offset: nil
1596
+ )
1597
+ api_path = '/documentsdb/{databaseId}/operations'
1598
+ .gsub('{databaseId}', database_id)
1599
+
1600
+ if database_id.nil?
1601
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1602
+ end
1603
+
1604
+ api_params = {
1605
+ status: status,
1606
+ limit: limit,
1607
+ offset: offset,
1608
+ }
1609
+
1610
+ api_headers = {
1611
+ "X-Appwrite-Project": @client.get_config('project'),
1612
+ "accept": 'application/json',
1613
+ }
1614
+
1615
+ @client.call(
1616
+ method: 'GET',
1617
+ path: api_path,
1618
+ headers: api_headers,
1619
+ params: api_params,
1620
+ response_type: Models::DedicatedDatabaseOperationList
1621
+ )
1622
+ end
1623
+
1624
+ # Get high availability status for a dedicated database. Returns replica
1625
+ # statuses, replication lag, and sync mode.
1626
+ #
1627
+ # @param [String] database_id Database ID.
1628
+ #
1629
+ # @return [DedicatedDatabaseReplicas]
1630
+ def get_replicas(
1631
+ database_id:
1632
+ )
1633
+ api_path = '/documentsdb/{databaseId}/replicas'
1634
+ .gsub('{databaseId}', database_id)
1635
+
1636
+ if database_id.nil?
1637
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1638
+ end
1639
+
1640
+ api_params = {}
1641
+
1642
+ api_headers = {
1643
+ "X-Appwrite-Project": @client.get_config('project'),
1644
+ "accept": 'application/json',
1645
+ }
1646
+
1647
+ @client.call(
1648
+ method: 'GET',
1649
+ path: api_path,
1650
+ headers: api_headers,
1651
+ params: api_params,
1652
+ response_type: Models::DedicatedDatabaseReplicas
1653
+ )
1654
+ end
1655
+
1656
+ # Get real-time health and status information for a dedicated database.
1657
+ # Returns health status, readiness, uptime, connection info, replica status,
1658
+ # and volume information.
1659
+ #
1660
+ # @param [String] database_id Database ID.
1661
+ #
1662
+ # @return [DatabaseStatus]
1663
+ def get_status(
1664
+ database_id:
1665
+ )
1666
+ api_path = '/documentsdb/{databaseId}/status'
1667
+ .gsub('{databaseId}', database_id)
1668
+
1669
+ if database_id.nil?
1670
+ raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
1671
+ end
1672
+
1673
+ api_params = {}
1674
+
1675
+ api_headers = {
1676
+ "X-Appwrite-Project": @client.get_config('project'),
1677
+ "accept": 'application/json',
1678
+ }
1679
+
1680
+ @client.call(
1681
+ method: 'GET',
1682
+ path: api_path,
1683
+ headers: api_headers,
1684
+ params: api_params,
1685
+ response_type: Models::DatabaseStatus
1686
+ )
1687
+ end
1688
+ end
1689
+ end