From 47f8298cd0bd13d05be6ec1f7ecb27090870ac38 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 18 May 2026 12:31:50 +0000 Subject: [PATCH] chore: update Ruby SDK to 24.0.0 --- .github/workflows/publish.yml | 4 +- CHANGELOG.md | 16 + README.md | 2 +- appwrite.gemspec | 2 +- docs/examples/advisor/delete-report.md | 16 + docs/examples/advisor/get-insight.md | 17 + docs/examples/advisor/get-report.md | 16 + docs/examples/advisor/list-insights.md | 18 ++ docs/examples/advisor/list-reports.md | 17 + docs/examples/presences/delete.md | 16 + docs/examples/presences/get.md | 16 + docs/examples/presences/list.md | 18 ++ docs/examples/presences/update-presence.md | 24 ++ docs/examples/presences/upsert.md | 23 ++ docs/examples/project/create-ephemeral-key.md | 2 +- docs/examples/project/create-key.md | 2 +- docs/examples/project/get-email-template.md | 4 +- .../examples/project/get-o-auth-2-provider.md | 2 +- docs/examples/project/get-policy.md | 2 +- docs/examples/project/get.md | 14 + docs/examples/project/update-auth-method.md | 2 +- .../update-deny-aliased-email-policy.md | 16 + .../update-deny-disposable-email-policy.md | 16 + .../project/update-deny-free-email-policy.md | 16 + .../examples/project/update-email-template.md | 4 +- docs/examples/project/update-key.md | 2 +- .../project/update-o-auth-2-google.md | 2 + docs/examples/project/update-protocol.md | 2 +- docs/examples/project/update-service.md | 2 +- docs/examples/project/update-smtp.md | 2 +- docs/examples/usage/list-events.md | 17 + docs/examples/usage/list-gauges.md | 17 + lib/appwrite.rb | 36 ++- lib/appwrite/client.rb | 4 +- lib/appwrite/enums/o_auth2_google_prompt.rb | 9 + lib/appwrite/enums/o_auth_provider.rb | 2 - ...th_method.rb => project_auth_method_id.rb} | 2 +- ...e_type.rb => project_email_template_id.rb} | 2 +- ...le.rb => project_email_template_locale.rb} | 2 +- lib/appwrite/enums/project_key_scopes.rb | 100 ++++++ .../enums/project_o_auth2_google_prompt.rb | 9 + .../enums/project_o_auth_provider_id.rb | 51 +++ ...project_policy.rb => project_policy_id.rb} | 2 +- ...{protocol_id.rb => project_protocol_id.rb} | 2 +- .../{service_id.rb => project_service_id.rb} | 3 +- .../{secure.rb => project_smtp_secure.rb} | 2 +- lib/appwrite/enums/scopes.rb | 7 + lib/appwrite/models/auth_provider.rb | 47 --- lib/appwrite/models/database.rb | 4 +- lib/appwrite/models/insight.rb | 107 +++++++ lib/appwrite/models/insight_cta.rb | 42 +++ lib/appwrite/models/insight_list.rb | 32 ++ lib/appwrite/models/o_auth2_google.rb | 11 +- lib/appwrite/models/presence.rb | 71 +++++ lib/appwrite/models/presence_list.rb | 36 +++ lib/appwrite/models/project.rb | 300 +----------------- lib/appwrite/models/project_auth_method.rb | 53 ++++ lib/appwrite/models/project_protocol.rb | 49 +++ lib/appwrite/models/project_service.rb | 64 ++++ lib/appwrite/models/report.rb | 82 +++++ lib/appwrite/models/report_list.rb | 32 ++ lib/appwrite/models/usage_event.rb | 72 +++++ lib/appwrite/models/usage_event_list.rb | 32 ++ lib/appwrite/models/usage_gauge.rb | 37 +++ lib/appwrite/models/usage_gauge_list.rb | 32 ++ lib/appwrite/services/advisor.rb | 173 ++++++++++ lib/appwrite/services/presences.rb | 199 ++++++++++++ lib/appwrite/services/project.rb | 222 ++++++++++--- lib/appwrite/services/usage.rb | 86 +++++ 69 files changed, 1920 insertions(+), 425 deletions(-) create mode 100644 docs/examples/advisor/delete-report.md create mode 100644 docs/examples/advisor/get-insight.md create mode 100644 docs/examples/advisor/get-report.md create mode 100644 docs/examples/advisor/list-insights.md create mode 100644 docs/examples/advisor/list-reports.md create mode 100644 docs/examples/presences/delete.md create mode 100644 docs/examples/presences/get.md create mode 100644 docs/examples/presences/list.md create mode 100644 docs/examples/presences/update-presence.md create mode 100644 docs/examples/presences/upsert.md create mode 100644 docs/examples/project/get.md create mode 100644 docs/examples/project/update-deny-aliased-email-policy.md create mode 100644 docs/examples/project/update-deny-disposable-email-policy.md create mode 100644 docs/examples/project/update-deny-free-email-policy.md create mode 100644 docs/examples/usage/list-events.md create mode 100644 docs/examples/usage/list-gauges.md create mode 100644 lib/appwrite/enums/o_auth2_google_prompt.rb rename lib/appwrite/enums/{auth_method.rb => project_auth_method_id.rb} (89%) rename lib/appwrite/enums/{email_template_type.rb => project_email_template_id.rb} (89%) rename lib/appwrite/enums/{email_template_locale.rb => project_email_template_locale.rb} (98%) create mode 100644 lib/appwrite/enums/project_key_scopes.rb create mode 100644 lib/appwrite/enums/project_o_auth2_google_prompt.rb create mode 100644 lib/appwrite/enums/project_o_auth_provider_id.rb rename lib/appwrite/enums/{project_policy.rb => project_policy_id.rb} (94%) rename lib/appwrite/enums/{protocol_id.rb => project_protocol_id.rb} (81%) rename lib/appwrite/enums/{service_id.rb => project_service_id.rb} (90%) rename lib/appwrite/enums/{secure.rb => project_smtp_secure.rb} (75%) delete mode 100644 lib/appwrite/models/auth_provider.rb create mode 100644 lib/appwrite/models/insight.rb create mode 100644 lib/appwrite/models/insight_cta.rb create mode 100644 lib/appwrite/models/insight_list.rb create mode 100644 lib/appwrite/models/presence.rb create mode 100644 lib/appwrite/models/presence_list.rb create mode 100644 lib/appwrite/models/project_auth_method.rb create mode 100644 lib/appwrite/models/project_protocol.rb create mode 100644 lib/appwrite/models/project_service.rb create mode 100644 lib/appwrite/models/report.rb create mode 100644 lib/appwrite/models/report_list.rb create mode 100644 lib/appwrite/models/usage_event.rb create mode 100644 lib/appwrite/models/usage_event_list.rb create mode 100644 lib/appwrite/models/usage_gauge.rb create mode 100644 lib/appwrite/models/usage_gauge_list.rb create mode 100644 lib/appwrite/services/advisor.rb create mode 100644 lib/appwrite/services/presences.rb create mode 100644 lib/appwrite/services/usage.rb diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0a4fe47..31e26c4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,10 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: ruby-version: 2.7 bundler-cache: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 22db296..e13a9d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Change Log +## 24.0.0 + +* Breaking: Renamed `AuthMethod` enum to `ProjectAuthMethodId` +* Breaking: Renamed `EmailTemplateType` to `ProjectEmailTemplateId` and `EmailTemplateLocale` to `ProjectEmailTemplateLocale` +* Breaking: Renamed `ServiceId` to `ProjectServiceId`, `ProtocolId` to `ProjectProtocolId`, `Secure` to `ProjectSMTPSecure`, `ProjectPolicy` to `ProjectPolicyId` +* Breaking: Replaced `Scopes` enum with `ProjectKeyScopes` for project key endpoints +* Breaking: Removed `Project#update_deny_canonical_email_policy`; replaced with `update_deny_aliased_email_policy`, `update_deny_disposable_email_policy`, and `update_deny_free_email_policy` +* Breaking: Removed `AuthProvider` model; use new `ProjectOAuthProviderId` enum instead +* Added: `Project#get` method to fetch current project details +* Added: `Advisor`, `Presences`, and `Usage` services +* Added: `Insight`, `Presence`, `Report`, `UsageEvent`, and `UsageGauge` models with list variants +* Added: `ProjectAuthMethod`, `ProjectProtocol`, and `ProjectService` models +* Added: `ProjectOAuthProviderId` and `ProjectOAuth2GooglePrompt` enums +* Updated: `Project`, `Database`, and `OAuth2Google` model schemas +* Updated: `X-Appwrite-Response-Format` header to `1.9.5` + ## 23.1.0 * Added: Introduced `bigint` create/update APIs for legacy Databases attributes diff --git a/README.md b/README.md index 466e07e..9b88505 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Ruby SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.4-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/appwrite.gemspec b/appwrite.gemspec index 9293ca0..75f3443 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '23.1.0' + spec.version = '24.0.0' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md new file mode 100644 index 0000000..1139bb7 --- /dev/null +++ b/docs/examples/advisor/delete-report.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +advisor = Advisor.new(client) + +result = advisor.delete_report( + report_id: '' +) +``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md new file mode 100644 index 0000000..63639f5 --- /dev/null +++ b/docs/examples/advisor/get-insight.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +advisor = Advisor.new(client) + +result = advisor.get_insight( + report_id: '', + insight_id: '' +) +``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md new file mode 100644 index 0000000..059a6b9 --- /dev/null +++ b/docs/examples/advisor/get-report.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +advisor = Advisor.new(client) + +result = advisor.get_report( + report_id: '' +) +``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md new file mode 100644 index 0000000..5e1ef34 --- /dev/null +++ b/docs/examples/advisor/list-insights.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +advisor = Advisor.new(client) + +result = advisor.list_insights( + report_id: '', + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md new file mode 100644 index 0000000..3209aba --- /dev/null +++ b/docs/examples/advisor/list-reports.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_session('') # The user session to authenticate with + +advisor = Advisor.new(client) + +result = advisor.list_reports( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 0000000..b9b0152 --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +presences = Presences.new(client) + +result = presences.delete( + presence_id: '' +) +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 0000000..18307cf --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +presences = Presences.new(client) + +result = presences.get( + presence_id: '' +) +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 0000000..ff2ad46 --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,18 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +presences = Presences.new(client) + +result = presences.list( + queries: [], # optional + total: false, # optional + ttl: 0 # optional +) +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 0000000..c54e6ac --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,24 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +presences = Presences.new(client) + +result = presences.update_presence( + presence_id: '', + user_id: '', + status: '', # optional + expires_at: '2020-10-15T06:38:00.000+00:00', # optional + metadata: {}, # optional + permissions: [Permission.read(Role.any())], # optional + purge: false # optional +) +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 0000000..cc0801a --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,23 @@ +```ruby +require 'appwrite' + +include Appwrite +include Appwrite::Permission +include Appwrite::Role + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +presences = Presences.new(client) + +result = presences.upsert( + presence_id: '', + user_id: '', + status: '', + permissions: [Permission.read(Role.any())], # optional + expires_at: '2020-10-15T06:38:00.000+00:00', # optional + metadata: {} # optional +) +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index 15d925d..6f0d9b6 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -12,7 +12,7 @@ client = Client.new project = Project.new(client) result = project.create_ephemeral_key( - scopes: [Scopes::PROJECT_READ], + scopes: [ProjectKeyScopes::PROJECT_READ], duration: 600 ) ``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index f5f74b7..0721a6b 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -14,7 +14,7 @@ project = Project.new(client) result = project.create_key( key_id: '', name: '', - scopes: [Scopes::PROJECT_READ], + scopes: [ProjectKeyScopes::PROJECT_READ], expire: '2020-10-15T06:38:00.000+00:00' # optional ) ``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md index 983f051..1bb1a4b 100644 --- a/docs/examples/project/get-email-template.md +++ b/docs/examples/project/get-email-template.md @@ -12,7 +12,7 @@ client = Client.new project = Project.new(client) result = project.get_email_template( - template_id: EmailTemplateType::VERIFICATION, - locale: EmailTemplateLocale::AF # optional + template_id: ProjectEmailTemplateId::VERIFICATION, + locale: ProjectEmailTemplateLocale::AF # optional ) ``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index 836143a..d5bde47 100644 --- a/docs/examples/project/get-o-auth-2-provider.md +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -12,6 +12,6 @@ client = Client.new project = Project.new(client) result = project.get_o_auth2_provider( - provider_id: OAuthProvider::AMAZON + provider_id: ProjectOAuthProviderId::AMAZON ) ``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index 54e44cb..57b186f 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -12,6 +12,6 @@ client = Client.new project = Project.new(client) result = project.get_policy( - policy_id: ProjectPolicy::PASSWORD_DICTIONARY + policy_id: ProjectPolicyId::PASSWORD_DICTIONARY ) ``` diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md new file mode 100644 index 0000000..3a702de --- /dev/null +++ b/docs/examples/project/get.md @@ -0,0 +1,14 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.get() +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md index 3740622..a717e10 100644 --- a/docs/examples/project/update-auth-method.md +++ b/docs/examples/project/update-auth-method.md @@ -12,7 +12,7 @@ client = Client.new project = Project.new(client) result = project.update_auth_method( - method_id: AuthMethod::EMAIL_PASSWORD, + method_id: ProjectAuthMethodId::EMAIL_PASSWORD, enabled: false ) ``` diff --git a/docs/examples/project/update-deny-aliased-email-policy.md b/docs/examples/project/update-deny-aliased-email-policy.md new file mode 100644 index 0000000..f1ce424 --- /dev/null +++ b/docs/examples/project/update-deny-aliased-email-policy.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.update_deny_aliased_email_policy( + enabled: false +) +``` diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md new file mode 100644 index 0000000..39725fb --- /dev/null +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.update_deny_disposable_email_policy( + enabled: false +) +``` diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md new file mode 100644 index 0000000..7a373db --- /dev/null +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -0,0 +1,16 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +project = Project.new(client) + +result = project.update_deny_free_email_policy( + enabled: false +) +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md index a20bdee..d845017 100644 --- a/docs/examples/project/update-email-template.md +++ b/docs/examples/project/update-email-template.md @@ -12,8 +12,8 @@ client = Client.new project = Project.new(client) result = project.update_email_template( - template_id: EmailTemplateType::VERIFICATION, - locale: EmailTemplateLocale::AF, # optional + template_id: ProjectEmailTemplateId::VERIFICATION, + locale: ProjectEmailTemplateLocale::AF, # optional subject: '', # optional message: '', # optional sender_name: '', # optional diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 9c86320..b192315 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -14,7 +14,7 @@ project = Project.new(client) result = project.update_key( key_id: '', name: '', - scopes: [Scopes::PROJECT_READ], + scopes: [ProjectKeyScopes::PROJECT_READ], expire: '2020-10-15T06:38:00.000+00:00' # optional ) ``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md index 9cb8007..be38c0f 100644 --- a/docs/examples/project/update-o-auth-2-google.md +++ b/docs/examples/project/update-o-auth-2-google.md @@ -2,6 +2,7 @@ require 'appwrite' include Appwrite +include Appwrite::Enums client = Client.new .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -13,6 +14,7 @@ project = Project.new(client) result = project.update_o_auth2_google( client_id: '', # optional client_secret: '', # optional + prompt: [ProjectOAuth2GooglePrompt::NONE], # optional enabled: false # optional ) ``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md index f0a7a15..6ff3cc1 100644 --- a/docs/examples/project/update-protocol.md +++ b/docs/examples/project/update-protocol.md @@ -12,7 +12,7 @@ client = Client.new project = Project.new(client) result = project.update_protocol( - protocol_id: ProtocolId::REST, + protocol_id: ProjectProtocolId::REST, enabled: false ) ``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md index 889d9be..0cabe6a 100644 --- a/docs/examples/project/update-service.md +++ b/docs/examples/project/update-service.md @@ -12,7 +12,7 @@ client = Client.new project = Project.new(client) result = project.update_service( - service_id: ServiceId::ACCOUNT, + service_id: ProjectServiceId::ACCOUNT, enabled: false ) ``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index e2ad561..ca53c6b 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -20,7 +20,7 @@ result = project.update_smtp( sender_name: '', # optional reply_to_email: 'email@example.com', # optional reply_to_name: '', # optional - secure: Secure::TLS, # optional + secure: ProjectSMTPSecure::TLS, # optional enabled: false # optional ) ``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md new file mode 100644 index 0000000..ec26a6d --- /dev/null +++ b/docs/examples/usage/list-events.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +usage = Usage.new(client) + +result = usage.list_events( + queries: [], # optional + total: false # optional +) +``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md new file mode 100644 index 0000000..ba3061f --- /dev/null +++ b/docs/examples/usage/list-gauges.md @@ -0,0 +1,17 @@ +```ruby +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('') # Your project ID + .set_key('') # Your secret API key + +usage = Usage.new(client) + +result = usage.list_gauges( + queries: [], # optional + total: false # optional +) +``` diff --git a/lib/appwrite.rb b/lib/appwrite.rb index dc929a8..7bb0453 100644 --- a/lib/appwrite.rb +++ b/lib/appwrite.rb @@ -15,6 +15,7 @@ require_relative 'appwrite/models/row_list' require_relative 'appwrite/models/document_list' +require_relative 'appwrite/models/presence_list' require_relative 'appwrite/models/table_list' require_relative 'appwrite/models/collection_list' require_relative 'appwrite/models/database_list' @@ -56,6 +57,8 @@ require_relative 'appwrite/models/target_list' require_relative 'appwrite/models/transaction_list' require_relative 'appwrite/models/specification_list' +require_relative 'appwrite/models/insight_list' +require_relative 'appwrite/models/report_list' require_relative 'appwrite/models/database' require_relative 'appwrite/models/collection' require_relative 'appwrite/models/attribute_list' @@ -101,6 +104,7 @@ require_relative 'appwrite/models/column_index' require_relative 'appwrite/models/row' require_relative 'appwrite/models/document' +require_relative 'appwrite/models/presence' require_relative 'appwrite/models/log' require_relative 'appwrite/models/user' require_relative 'appwrite/models/algo_md5' @@ -130,6 +134,9 @@ require_relative 'appwrite/models/deployment' require_relative 'appwrite/models/execution' require_relative 'appwrite/models/project' +require_relative 'appwrite/models/project_auth_method' +require_relative 'appwrite/models/project_service' +require_relative 'appwrite/models/project_protocol' require_relative 'appwrite/models/webhook' require_relative 'appwrite/models/key' require_relative 'appwrite/models/ephemeral_key' @@ -185,7 +192,6 @@ require_relative 'appwrite/models/policy_session_limit' require_relative 'appwrite/models/policy_user_limit' require_relative 'appwrite/models/policy_membership_privacy' -require_relative 'appwrite/models/auth_provider' require_relative 'appwrite/models/platform_web' require_relative 'appwrite/models/platform_apple' require_relative 'appwrite/models/platform_android' @@ -217,12 +223,19 @@ require_relative 'appwrite/models/transaction' require_relative 'appwrite/models/subscriber' require_relative 'appwrite/models/target' +require_relative 'appwrite/models/insight' +require_relative 'appwrite/models/insight_cta' +require_relative 'appwrite/models/report' require_relative 'appwrite/models/activity_event' require_relative 'appwrite/models/backup_archive' require_relative 'appwrite/models/billing_limits' require_relative 'appwrite/models/block' require_relative 'appwrite/models/backup_policy' require_relative 'appwrite/models/backup_restoration' +require_relative 'appwrite/models/usage_event' +require_relative 'appwrite/models/usage_event_list' +require_relative 'appwrite/models/usage_gauge' +require_relative 'appwrite/models/usage_gauge_list' require_relative 'appwrite/models/activity_event_list' require_relative 'appwrite/models/backup_archive_list' require_relative 'appwrite/models/backup_policy_list' @@ -252,13 +265,16 @@ require_relative 'appwrite/enums/name' require_relative 'appwrite/enums/message_priority' require_relative 'appwrite/enums/smtp_encryption' -require_relative 'appwrite/enums/auth_method' -require_relative 'appwrite/enums/project_policy' -require_relative 'appwrite/enums/protocol_id' -require_relative 'appwrite/enums/service_id' -require_relative 'appwrite/enums/secure' -require_relative 'appwrite/enums/email_template_type' -require_relative 'appwrite/enums/email_template_locale' +require_relative 'appwrite/enums/project_auth_method_id' +require_relative 'appwrite/enums/project_key_scopes' +require_relative 'appwrite/enums/project_o_auth2_google_prompt' +require_relative 'appwrite/enums/project_o_auth_provider_id' +require_relative 'appwrite/enums/project_policy_id' +require_relative 'appwrite/enums/project_protocol_id' +require_relative 'appwrite/enums/project_service_id' +require_relative 'appwrite/enums/project_smtp_secure' +require_relative 'appwrite/enums/project_email_template_id' +require_relative 'appwrite/enums/project_email_template_locale' require_relative 'appwrite/enums/status_code' require_relative 'appwrite/enums/proxy_resource_type' require_relative 'appwrite/enums/framework' @@ -276,6 +292,7 @@ require_relative 'appwrite/enums/deployment_status' require_relative 'appwrite/enums/execution_trigger' require_relative 'appwrite/enums/execution_status' +require_relative 'appwrite/enums/o_auth2_google_prompt' require_relative 'appwrite/enums/platform_type' require_relative 'appwrite/enums/health_antivirus_status' require_relative 'appwrite/enums/health_check_status' @@ -293,12 +310,15 @@ require_relative 'appwrite/services/health' require_relative 'appwrite/services/locale' require_relative 'appwrite/services/messaging' +require_relative 'appwrite/services/presences' require_relative 'appwrite/services/project' require_relative 'appwrite/services/proxy' +require_relative 'appwrite/services/advisor' require_relative 'appwrite/services/sites' require_relative 'appwrite/services/storage' require_relative 'appwrite/services/tables_db' require_relative 'appwrite/services/teams' require_relative 'appwrite/services/tokens' +require_relative 'appwrite/services/usage' require_relative 'appwrite/services/users' require_relative 'appwrite/services/webhooks' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 6b25218..13f1aa7 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,8 +15,8 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '23.1.0', - 'X-Appwrite-Response-Format' => '1.9.4' + 'x-sdk-version'=> '24.0.0', + 'X-Appwrite-Response-Format' => '1.9.5' } @endpoint = 'https://cloud.appwrite.io/v1' end diff --git a/lib/appwrite/enums/o_auth2_google_prompt.rb b/lib/appwrite/enums/o_auth2_google_prompt.rb new file mode 100644 index 0000000..700ce95 --- /dev/null +++ b/lib/appwrite/enums/o_auth2_google_prompt.rb @@ -0,0 +1,9 @@ +module Appwrite + module Enums + module OAuth2GooglePrompt + NONE = 'none' + CONSENT = 'consent' + SELECT_ACCOUNT = 'select_account' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/o_auth_provider.rb b/lib/appwrite/enums/o_auth_provider.rb index 3c7c814..5962eb4 100644 --- a/lib/appwrite/enums/o_auth_provider.rb +++ b/lib/appwrite/enums/o_auth_provider.rb @@ -44,8 +44,6 @@ module OAuthProvider YANDEX = 'yandex' ZOHO = 'zoho' ZOOM = 'zoom' - GITHUBIMAGINE = 'githubImagine' - GOOGLEIMAGINE = 'googleImagine' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/auth_method.rb b/lib/appwrite/enums/project_auth_method_id.rb similarity index 89% rename from lib/appwrite/enums/auth_method.rb rename to lib/appwrite/enums/project_auth_method_id.rb index f9adab6..a442f73 100644 --- a/lib/appwrite/enums/auth_method.rb +++ b/lib/appwrite/enums/project_auth_method_id.rb @@ -1,6 +1,6 @@ module Appwrite module Enums - module AuthMethod + module ProjectAuthMethodId EMAIL_PASSWORD = 'email-password' MAGIC_URL = 'magic-url' EMAIL_OTP = 'email-otp' diff --git a/lib/appwrite/enums/email_template_type.rb b/lib/appwrite/enums/project_email_template_id.rb similarity index 89% rename from lib/appwrite/enums/email_template_type.rb rename to lib/appwrite/enums/project_email_template_id.rb index f5a2888..39773c0 100644 --- a/lib/appwrite/enums/email_template_type.rb +++ b/lib/appwrite/enums/project_email_template_id.rb @@ -1,6 +1,6 @@ module Appwrite module Enums - module EmailTemplateType + module ProjectEmailTemplateId VERIFICATION = 'verification' MAGICSESSION = 'magicSession' RECOVERY = 'recovery' diff --git a/lib/appwrite/enums/email_template_locale.rb b/lib/appwrite/enums/project_email_template_locale.rb similarity index 98% rename from lib/appwrite/enums/email_template_locale.rb rename to lib/appwrite/enums/project_email_template_locale.rb index 26f345d..6427f6c 100644 --- a/lib/appwrite/enums/email_template_locale.rb +++ b/lib/appwrite/enums/project_email_template_locale.rb @@ -1,6 +1,6 @@ module Appwrite module Enums - module EmailTemplateLocale + module ProjectEmailTemplateLocale AF = 'af' AR_AE = 'ar-ae' AR_BH = 'ar-bh' diff --git a/lib/appwrite/enums/project_key_scopes.rb b/lib/appwrite/enums/project_key_scopes.rb new file mode 100644 index 0000000..14d0108 --- /dev/null +++ b/lib/appwrite/enums/project_key_scopes.rb @@ -0,0 +1,100 @@ +module Appwrite + module Enums + module ProjectKeyScopes + PROJECT_READ = 'project.read' + PROJECT_WRITE = 'project.write' + KEYS_READ = 'keys.read' + KEYS_WRITE = 'keys.write' + PLATFORMS_READ = 'platforms.read' + PLATFORMS_WRITE = 'platforms.write' + MOCKS_READ = 'mocks.read' + MOCKS_WRITE = 'mocks.write' + POLICIES_READ = 'policies.read' + POLICIES_WRITE = 'policies.write' + PROJECT_POLICIES_READ = 'project.policies.read' + PROJECT_POLICIES_WRITE = 'project.policies.write' + TEMPLATES_READ = 'templates.read' + TEMPLATES_WRITE = 'templates.write' + OAUTH2_READ = 'oauth2.read' + OAUTH2_WRITE = 'oauth2.write' + USERS_READ = 'users.read' + USERS_WRITE = 'users.write' + SESSIONS_READ = 'sessions.read' + SESSIONS_WRITE = 'sessions.write' + TEAMS_READ = 'teams.read' + TEAMS_WRITE = 'teams.write' + DATABASES_READ = 'databases.read' + DATABASES_WRITE = 'databases.write' + TABLES_READ = 'tables.read' + TABLES_WRITE = 'tables.write' + COLUMNS_READ = 'columns.read' + COLUMNS_WRITE = 'columns.write' + INDEXES_READ = 'indexes.read' + INDEXES_WRITE = 'indexes.write' + ROWS_READ = 'rows.read' + ROWS_WRITE = 'rows.write' + COLLECTIONS_READ = 'collections.read' + COLLECTIONS_WRITE = 'collections.write' + ATTRIBUTES_READ = 'attributes.read' + ATTRIBUTES_WRITE = 'attributes.write' + DOCUMENTS_READ = 'documents.read' + DOCUMENTS_WRITE = 'documents.write' + BUCKETS_READ = 'buckets.read' + BUCKETS_WRITE = 'buckets.write' + FILES_READ = 'files.read' + FILES_WRITE = 'files.write' + TOKENS_READ = 'tokens.read' + TOKENS_WRITE = 'tokens.write' + FUNCTIONS_READ = 'functions.read' + FUNCTIONS_WRITE = 'functions.write' + EXECUTIONS_READ = 'executions.read' + EXECUTIONS_WRITE = 'executions.write' + EXECUTION_READ = 'execution.read' + EXECUTION_WRITE = 'execution.write' + SITES_READ = 'sites.read' + SITES_WRITE = 'sites.write' + LOG_READ = 'log.read' + LOG_WRITE = 'log.write' + PROVIDERS_READ = 'providers.read' + PROVIDERS_WRITE = 'providers.write' + TOPICS_READ = 'topics.read' + TOPICS_WRITE = 'topics.write' + SUBSCRIBERS_READ = 'subscribers.read' + SUBSCRIBERS_WRITE = 'subscribers.write' + TARGETS_READ = 'targets.read' + TARGETS_WRITE = 'targets.write' + MESSAGES_READ = 'messages.read' + MESSAGES_WRITE = 'messages.write' + RULES_READ = 'rules.read' + RULES_WRITE = 'rules.write' + WEBHOOKS_READ = 'webhooks.read' + WEBHOOKS_WRITE = 'webhooks.write' + LOCALE_READ = 'locale.read' + AVATARS_READ = 'avatars.read' + HEALTH_READ = 'health.read' + ASSISTANT_READ = 'assistant.read' + MIGRATIONS_READ = 'migrations.read' + MIGRATIONS_WRITE = 'migrations.write' + SCHEDULES_READ = 'schedules.read' + SCHEDULES_WRITE = 'schedules.write' + VCS_READ = 'vcs.read' + VCS_WRITE = 'vcs.write' + INSIGHTS_READ = 'insights.read' + INSIGHTS_WRITE = 'insights.write' + REPORTS_READ = 'reports.read' + REPORTS_WRITE = 'reports.write' + PRESENCES_READ = 'presences.read' + PRESENCES_WRITE = 'presences.write' + BACKUPS_POLICIES_READ = 'backups.policies.read' + BACKUPS_POLICIES_WRITE = 'backups.policies.write' + ARCHIVES_READ = 'archives.read' + ARCHIVES_WRITE = 'archives.write' + RESTORATIONS_READ = 'restorations.read' + RESTORATIONS_WRITE = 'restorations.write' + DOMAINS_READ = 'domains.read' + DOMAINS_WRITE = 'domains.write' + EVENTS_READ = 'events.read' + USAGE_READ = 'usage.read' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/project_o_auth2_google_prompt.rb b/lib/appwrite/enums/project_o_auth2_google_prompt.rb new file mode 100644 index 0000000..4effa04 --- /dev/null +++ b/lib/appwrite/enums/project_o_auth2_google_prompt.rb @@ -0,0 +1,9 @@ +module Appwrite + module Enums + module ProjectOAuth2GooglePrompt + NONE = 'none' + CONSENT = 'consent' + SELECT_ACCOUNT = 'select_account' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/project_o_auth_provider_id.rb b/lib/appwrite/enums/project_o_auth_provider_id.rb new file mode 100644 index 0000000..f0a0ddc --- /dev/null +++ b/lib/appwrite/enums/project_o_auth_provider_id.rb @@ -0,0 +1,51 @@ +module Appwrite + module Enums + module ProjectOAuthProviderId + AMAZON = 'amazon' + APPLE = 'apple' + AUTH0 = 'auth0' + AUTHENTIK = 'authentik' + AUTODESK = 'autodesk' + BITBUCKET = 'bitbucket' + BITLY = 'bitly' + BOX = 'box' + DAILYMOTION = 'dailymotion' + DISCORD = 'discord' + DISQUS = 'disqus' + DROPBOX = 'dropbox' + ETSY = 'etsy' + FACEBOOK = 'facebook' + FIGMA = 'figma' + FUSIONAUTH = 'fusionauth' + GITHUB = 'github' + GITLAB = 'gitlab' + GOOGLE = 'google' + KEYCLOAK = 'keycloak' + KICK = 'kick' + LINKEDIN = 'linkedin' + MICROSOFT = 'microsoft' + NOTION = 'notion' + OIDC = 'oidc' + OKTA = 'okta' + PAYPAL = 'paypal' + PAYPALSANDBOX = 'paypalSandbox' + PODIO = 'podio' + SALESFORCE = 'salesforce' + SLACK = 'slack' + SPOTIFY = 'spotify' + STRIPE = 'stripe' + TRADESHIFT = 'tradeshift' + TRADESHIFTBOX = 'tradeshiftBox' + TWITCH = 'twitch' + WORDPRESS = 'wordpress' + X = 'x' + YAHOO = 'yahoo' + YAMMER = 'yammer' + YANDEX = 'yandex' + ZOHO = 'zoho' + ZOOM = 'zoom' + GITHUBIMAGINE = 'githubImagine' + GOOGLEIMAGINE = 'googleImagine' + end + end +end \ No newline at end of file diff --git a/lib/appwrite/enums/project_policy.rb b/lib/appwrite/enums/project_policy_id.rb similarity index 94% rename from lib/appwrite/enums/project_policy.rb rename to lib/appwrite/enums/project_policy_id.rb index 0697b65..3b64acc 100644 --- a/lib/appwrite/enums/project_policy.rb +++ b/lib/appwrite/enums/project_policy_id.rb @@ -1,6 +1,6 @@ module Appwrite module Enums - module ProjectPolicy + module ProjectPolicyId PASSWORD_DICTIONARY = 'password-dictionary' PASSWORD_HISTORY = 'password-history' PASSWORD_PERSONAL_DATA = 'password-personal-data' diff --git a/lib/appwrite/enums/protocol_id.rb b/lib/appwrite/enums/project_protocol_id.rb similarity index 81% rename from lib/appwrite/enums/protocol_id.rb rename to lib/appwrite/enums/project_protocol_id.rb index a04646c..f3948b6 100644 --- a/lib/appwrite/enums/protocol_id.rb +++ b/lib/appwrite/enums/project_protocol_id.rb @@ -1,6 +1,6 @@ module Appwrite module Enums - module ProtocolId + module ProjectProtocolId REST = 'rest' GRAPHQL = 'graphql' WEBSOCKET = 'websocket' diff --git a/lib/appwrite/enums/service_id.rb b/lib/appwrite/enums/project_service_id.rb similarity index 90% rename from lib/appwrite/enums/service_id.rb rename to lib/appwrite/enums/project_service_id.rb index 12ad0cd..0343ee5 100644 --- a/lib/appwrite/enums/service_id.rb +++ b/lib/appwrite/enums/project_service_id.rb @@ -1,6 +1,6 @@ module Appwrite module Enums - module ServiceId + module ProjectServiceId ACCOUNT = 'account' AVATARS = 'avatars' DATABASES = 'databases' @@ -18,6 +18,7 @@ module ServiceId GRAPHQL = 'graphql' MIGRATIONS = 'migrations' MESSAGING = 'messaging' + ADVISOR = 'advisor' end end end \ No newline at end of file diff --git a/lib/appwrite/enums/secure.rb b/lib/appwrite/enums/project_smtp_secure.rb similarity index 75% rename from lib/appwrite/enums/secure.rb rename to lib/appwrite/enums/project_smtp_secure.rb index b3bf869..0166b21 100644 --- a/lib/appwrite/enums/secure.rb +++ b/lib/appwrite/enums/project_smtp_secure.rb @@ -1,6 +1,6 @@ module Appwrite module Enums - module Secure + module ProjectSMTPSecure TLS = 'tls' SSL = 'ssl' end diff --git a/lib/appwrite/enums/scopes.rb b/lib/appwrite/enums/scopes.rb index 938dac0..42b3464 100644 --- a/lib/appwrite/enums/scopes.rb +++ b/lib/appwrite/enums/scopes.rb @@ -79,6 +79,12 @@ module Scopes SCHEDULES_WRITE = 'schedules.write' VCS_READ = 'vcs.read' VCS_WRITE = 'vcs.write' + INSIGHTS_READ = 'insights.read' + INSIGHTS_WRITE = 'insights.write' + REPORTS_READ = 'reports.read' + REPORTS_WRITE = 'reports.write' + PRESENCES_READ = 'presences.read' + PRESENCES_WRITE = 'presences.write' BACKUPS_POLICIES_READ = 'backups.policies.read' BACKUPS_POLICIES_WRITE = 'backups.policies.write' ARCHIVES_READ = 'archives.read' @@ -88,6 +94,7 @@ module Scopes DOMAINS_READ = 'domains.read' DOMAINS_WRITE = 'domains.write' EVENTS_READ = 'events.read' + USAGE_READ = 'usage.read' end end end \ No newline at end of file diff --git a/lib/appwrite/models/auth_provider.rb b/lib/appwrite/models/auth_provider.rb deleted file mode 100644 index c1e79e3..0000000 --- a/lib/appwrite/models/auth_provider.rb +++ /dev/null @@ -1,47 +0,0 @@ -#frozen_string_literal: true - -module Appwrite - module Models - class AuthProvider - attr_reader :key - attr_reader :name - attr_reader :app_id - attr_reader :secret - attr_reader :enabled - - def initialize( - key:, - name:, - app_id:, - secret:, - enabled: - ) - @key = key - @name = name - @app_id = app_id - @secret = secret - @enabled = enabled - end - - def self.from(map:) - AuthProvider.new( - key: map["key"], - name: map["name"], - app_id: map["appId"], - secret: map["secret"], - enabled: map["enabled"] - ) - end - - def to_map - { - "key": @key, - "name": @name, - "appId": @app_id, - "secret": @secret, - "enabled": @enabled - } - end - end - end -end diff --git a/lib/appwrite/models/database.rb b/lib/appwrite/models/database.rb index 8f1d295..aac839c 100644 --- a/lib/appwrite/models/database.rb +++ b/lib/appwrite/models/database.rb @@ -40,8 +40,8 @@ def self.from(map:) updated_at: map["$updatedAt"], enabled: map["enabled"], type: map["type"], - policies: map["policies"].map { |it| Index.from(map: it) }, - archives: map["archives"].map { |it| Collection.from(map: it) } + policies: map["policies"].map { |it| BackupPolicy.from(map: it) }, + archives: map["archives"].map { |it| BackupArchive.from(map: it) } ) end diff --git a/lib/appwrite/models/insight.rb b/lib/appwrite/models/insight.rb new file mode 100644 index 0000000..b5131c8 --- /dev/null +++ b/lib/appwrite/models/insight.rb @@ -0,0 +1,107 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Insight + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :report_id + attr_reader :type + attr_reader :severity + attr_reader :status + attr_reader :resource_type + attr_reader :resource_id + attr_reader :parent_resource_type + attr_reader :parent_resource_id + attr_reader :title + attr_reader :summary + attr_reader :ctas + attr_reader :analyzed_at + attr_reader :dismissed_at + attr_reader :dismissed_by + + def initialize( + id:, + created_at:, + updated_at:, + report_id:, + type:, + severity:, + status:, + resource_type:, + resource_id:, + parent_resource_type:, + parent_resource_id:, + title:, + summary:, + ctas:, + analyzed_at: , + dismissed_at: , + dismissed_by: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @report_id = report_id + @type = type + @severity = severity + @status = status + @resource_type = resource_type + @resource_id = resource_id + @parent_resource_type = parent_resource_type + @parent_resource_id = parent_resource_id + @title = title + @summary = summary + @ctas = ctas + @analyzed_at = analyzed_at + @dismissed_at = dismissed_at + @dismissed_by = dismissed_by + end + + def self.from(map:) + Insight.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + report_id: map["reportId"], + type: map["type"], + severity: map["severity"], + status: map["status"], + resource_type: map["resourceType"], + resource_id: map["resourceId"], + parent_resource_type: map["parentResourceType"], + parent_resource_id: map["parentResourceId"], + title: map["title"], + summary: map["summary"], + ctas: map["ctas"].map { |it| InsightCTA.from(map: it) }, + analyzed_at: map["analyzedAt"], + dismissed_at: map["dismissedAt"], + dismissed_by: map["dismissedBy"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "reportId": @report_id, + "type": @type, + "severity": @severity, + "status": @status, + "resourceType": @resource_type, + "resourceId": @resource_id, + "parentResourceType": @parent_resource_type, + "parentResourceId": @parent_resource_id, + "title": @title, + "summary": @summary, + "ctas": @ctas.map { |it| it.to_map }, + "analyzedAt": @analyzed_at, + "dismissedAt": @dismissed_at, + "dismissedBy": @dismissed_by + } + end + end + end +end diff --git a/lib/appwrite/models/insight_cta.rb b/lib/appwrite/models/insight_cta.rb new file mode 100644 index 0000000..82d61bf --- /dev/null +++ b/lib/appwrite/models/insight_cta.rb @@ -0,0 +1,42 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class InsightCTA + attr_reader :label + attr_reader :service + attr_reader :method + attr_reader :params + + def initialize( + label:, + service:, + method:, + params: + ) + @label = label + @service = service + @method = method + @params = params + end + + def self.from(map:) + InsightCTA.new( + label: map["label"], + service: map["service"], + method: map["method"], + params: map["params"] + ) + end + + def to_map + { + "label": @label, + "service": @service, + "method": @method, + "params": @params + } + end + end + end +end diff --git a/lib/appwrite/models/insight_list.rb b/lib/appwrite/models/insight_list.rb new file mode 100644 index 0000000..541023a --- /dev/null +++ b/lib/appwrite/models/insight_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class InsightList + attr_reader :total + attr_reader :insights + + def initialize( + total:, + insights: + ) + @total = total + @insights = insights + end + + def self.from(map:) + InsightList.new( + total: map["total"], + insights: map["insights"].map { |it| Insight.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "insights": @insights.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/o_auth2_google.rb b/lib/appwrite/models/o_auth2_google.rb index 1796909..5f6df20 100644 --- a/lib/appwrite/models/o_auth2_google.rb +++ b/lib/appwrite/models/o_auth2_google.rb @@ -7,17 +7,20 @@ class OAuth2Google attr_reader :enabled attr_reader :client_id attr_reader :client_secret + attr_reader :prompt def initialize( id:, enabled:, client_id:, - client_secret: + client_secret:, + prompt: ) @id = id @enabled = enabled @client_id = client_id @client_secret = client_secret + @prompt = prompt end def self.from(map:) @@ -25,7 +28,8 @@ def self.from(map:) id: map["$id"], enabled: map["enabled"], client_id: map["clientId"], - client_secret: map["clientSecret"] + client_secret: map["clientSecret"], + prompt: map["prompt"] ) end @@ -34,7 +38,8 @@ def to_map "$id": @id, "enabled": @enabled, "clientId": @client_id, - "clientSecret": @client_secret + "clientSecret": @client_secret, + "prompt": @prompt } end end diff --git a/lib/appwrite/models/presence.rb b/lib/appwrite/models/presence.rb new file mode 100644 index 0000000..f5eadfc --- /dev/null +++ b/lib/appwrite/models/presence.rb @@ -0,0 +1,71 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Presence + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :permissions + attr_reader :user_id + attr_reader :status + attr_reader :source + attr_reader :expires_at + attr_reader :metadata + + def initialize( + id:, + created_at:, + updated_at:, + permissions:, + user_id:, + status: , + source:, + expires_at: , + metadata: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @permissions = permissions + @user_id = user_id + @status = status + @source = source + @expires_at = expires_at + @metadata = metadata + end + + def self.from(map:) + Presence.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + permissions: map["$permissions"], + user_id: map["userId"], + status: map["status"], + source: map["source"], + expires_at: map["expiresAt"], + metadata: map["metadata"] || map + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "$permissions": @permissions, + "userId": @user_id, + "status": @status, + "source": @source, + "expiresAt": @expires_at, + "metadata": @metadata + } + end + + def convert_to(from_json) + from_json.call(metadata) + end + end + end +end diff --git a/lib/appwrite/models/presence_list.rb b/lib/appwrite/models/presence_list.rb new file mode 100644 index 0000000..5e977fe --- /dev/null +++ b/lib/appwrite/models/presence_list.rb @@ -0,0 +1,36 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class PresenceList + attr_reader :total + attr_reader :presences + + def initialize( + total:, + presences: + ) + @total = total + @presences = presences + end + + def self.from(map:) + PresenceList.new( + total: map["total"], + presences: map["presences"].map { |it| Presence.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "presences": @presences.map { |it| it.to_map } + } + end + + def convert_to(from_json) + presences.map { |it| it.convert_to(from_json) } + end + end + end +end diff --git a/lib/appwrite/models/project.rb b/lib/appwrite/models/project.rb index e0d5d1e..ae03157 100644 --- a/lib/appwrite/models/project.rb +++ b/lib/appwrite/models/project.rb @@ -7,37 +7,7 @@ class Project attr_reader :created_at attr_reader :updated_at attr_reader :name - attr_reader :description attr_reader :team_id - attr_reader :logo - attr_reader :url - attr_reader :legal_name - attr_reader :legal_country - attr_reader :legal_state - attr_reader :legal_city - attr_reader :legal_address - attr_reader :legal_tax_id - attr_reader :auth_duration - attr_reader :auth_limit - attr_reader :auth_sessions_limit - attr_reader :auth_password_history - attr_reader :auth_password_dictionary - attr_reader :auth_personal_data_check - attr_reader :auth_disposable_emails - attr_reader :auth_canonical_emails - attr_reader :auth_free_emails - attr_reader :auth_mock_numbers - attr_reader :auth_session_alerts - attr_reader :auth_memberships_user_name - attr_reader :auth_memberships_user_email - attr_reader :auth_memberships_mfa - attr_reader :auth_memberships_user_id - attr_reader :auth_memberships_user_phone - attr_reader :auth_invalidate_sessions - attr_reader :o_auth_providers - attr_reader :platforms - attr_reader :webhooks - attr_reader :keys attr_reader :dev_keys attr_reader :smtp_enabled attr_reader :smtp_sender_name @@ -53,33 +23,9 @@ class Project attr_reader :pinged_at attr_reader :labels attr_reader :status - attr_reader :auth_email_password - attr_reader :auth_users_auth_magic_url - attr_reader :auth_email_otp - attr_reader :auth_anonymous - attr_reader :auth_invites - attr_reader :auth_jwt - attr_reader :auth_phone - attr_reader :service_status_for_account - attr_reader :service_status_for_avatars - attr_reader :service_status_for_databases - attr_reader :service_status_for_tablesdb - attr_reader :service_status_for_locale - attr_reader :service_status_for_health - attr_reader :service_status_for_project - attr_reader :service_status_for_storage - attr_reader :service_status_for_teams - attr_reader :service_status_for_users - attr_reader :service_status_for_vcs - attr_reader :service_status_for_sites - attr_reader :service_status_for_functions - attr_reader :service_status_for_proxy - attr_reader :service_status_for_graphql - attr_reader :service_status_for_migrations - attr_reader :service_status_for_messaging - attr_reader :protocol_status_for_rest - attr_reader :protocol_status_for_graphql - attr_reader :protocol_status_for_websocket + attr_reader :auth_methods + attr_reader :services + attr_reader :protocols attr_reader :region attr_reader :billing_limits attr_reader :blocks @@ -90,37 +36,7 @@ def initialize( created_at:, updated_at:, name:, - description:, team_id:, - logo:, - url:, - legal_name:, - legal_country:, - legal_state:, - legal_city:, - legal_address:, - legal_tax_id:, - auth_duration:, - auth_limit:, - auth_sessions_limit:, - auth_password_history:, - auth_password_dictionary:, - auth_personal_data_check:, - auth_disposable_emails:, - auth_canonical_emails:, - auth_free_emails:, - auth_mock_numbers:, - auth_session_alerts:, - auth_memberships_user_name:, - auth_memberships_user_email:, - auth_memberships_mfa:, - auth_memberships_user_id:, - auth_memberships_user_phone:, - auth_invalidate_sessions:, - o_auth_providers:, - platforms:, - webhooks:, - keys:, dev_keys:, smtp_enabled:, smtp_sender_name:, @@ -136,33 +52,9 @@ def initialize( pinged_at:, labels:, status:, - auth_email_password:, - auth_users_auth_magic_url:, - auth_email_otp:, - auth_anonymous:, - auth_invites:, - auth_jwt:, - auth_phone:, - service_status_for_account:, - service_status_for_avatars:, - service_status_for_databases:, - service_status_for_tablesdb:, - service_status_for_locale:, - service_status_for_health:, - service_status_for_project:, - service_status_for_storage:, - service_status_for_teams:, - service_status_for_users:, - service_status_for_vcs:, - service_status_for_sites:, - service_status_for_functions:, - service_status_for_proxy:, - service_status_for_graphql:, - service_status_for_migrations:, - service_status_for_messaging:, - protocol_status_for_rest:, - protocol_status_for_graphql:, - protocol_status_for_websocket:, + auth_methods:, + services:, + protocols:, region:, billing_limits:, blocks:, @@ -172,37 +64,7 @@ def initialize( @created_at = created_at @updated_at = updated_at @name = name - @description = description @team_id = team_id - @logo = logo - @url = url - @legal_name = legal_name - @legal_country = legal_country - @legal_state = legal_state - @legal_city = legal_city - @legal_address = legal_address - @legal_tax_id = legal_tax_id - @auth_duration = auth_duration - @auth_limit = auth_limit - @auth_sessions_limit = auth_sessions_limit - @auth_password_history = auth_password_history - @auth_password_dictionary = auth_password_dictionary - @auth_personal_data_check = auth_personal_data_check - @auth_disposable_emails = auth_disposable_emails - @auth_canonical_emails = auth_canonical_emails - @auth_free_emails = auth_free_emails - @auth_mock_numbers = auth_mock_numbers - @auth_session_alerts = auth_session_alerts - @auth_memberships_user_name = auth_memberships_user_name - @auth_memberships_user_email = auth_memberships_user_email - @auth_memberships_mfa = auth_memberships_mfa - @auth_memberships_user_id = auth_memberships_user_id - @auth_memberships_user_phone = auth_memberships_user_phone - @auth_invalidate_sessions = auth_invalidate_sessions - @o_auth_providers = o_auth_providers - @platforms = platforms - @webhooks = webhooks - @keys = keys @dev_keys = dev_keys @smtp_enabled = smtp_enabled @smtp_sender_name = smtp_sender_name @@ -218,33 +80,9 @@ def initialize( @pinged_at = pinged_at @labels = labels @status = status - @auth_email_password = auth_email_password - @auth_users_auth_magic_url = auth_users_auth_magic_url - @auth_email_otp = auth_email_otp - @auth_anonymous = auth_anonymous - @auth_invites = auth_invites - @auth_jwt = auth_jwt - @auth_phone = auth_phone - @service_status_for_account = service_status_for_account - @service_status_for_avatars = service_status_for_avatars - @service_status_for_databases = service_status_for_databases - @service_status_for_tablesdb = service_status_for_tablesdb - @service_status_for_locale = service_status_for_locale - @service_status_for_health = service_status_for_health - @service_status_for_project = service_status_for_project - @service_status_for_storage = service_status_for_storage - @service_status_for_teams = service_status_for_teams - @service_status_for_users = service_status_for_users - @service_status_for_vcs = service_status_for_vcs - @service_status_for_sites = service_status_for_sites - @service_status_for_functions = service_status_for_functions - @service_status_for_proxy = service_status_for_proxy - @service_status_for_graphql = service_status_for_graphql - @service_status_for_migrations = service_status_for_migrations - @service_status_for_messaging = service_status_for_messaging - @protocol_status_for_rest = protocol_status_for_rest - @protocol_status_for_graphql = protocol_status_for_graphql - @protocol_status_for_websocket = protocol_status_for_websocket + @auth_methods = auth_methods + @services = services + @protocols = protocols @region = region @billing_limits = billing_limits @blocks = blocks @@ -257,37 +95,7 @@ def self.from(map:) created_at: map["$createdAt"], updated_at: map["$updatedAt"], name: map["name"], - description: map["description"], team_id: map["teamId"], - logo: map["logo"], - url: map["url"], - legal_name: map["legalName"], - legal_country: map["legalCountry"], - legal_state: map["legalState"], - legal_city: map["legalCity"], - legal_address: map["legalAddress"], - legal_tax_id: map["legalTaxId"], - auth_duration: map["authDuration"], - auth_limit: map["authLimit"], - auth_sessions_limit: map["authSessionsLimit"], - auth_password_history: map["authPasswordHistory"], - auth_password_dictionary: map["authPasswordDictionary"], - auth_personal_data_check: map["authPersonalDataCheck"], - auth_disposable_emails: map["authDisposableEmails"], - auth_canonical_emails: map["authCanonicalEmails"], - auth_free_emails: map["authFreeEmails"], - auth_mock_numbers: map["authMockNumbers"].map { |it| MockNumber.from(map: it) }, - auth_session_alerts: map["authSessionAlerts"], - auth_memberships_user_name: map["authMembershipsUserName"], - auth_memberships_user_email: map["authMembershipsUserEmail"], - auth_memberships_mfa: map["authMembershipsMfa"], - auth_memberships_user_id: map["authMembershipsUserId"], - auth_memberships_user_phone: map["authMembershipsUserPhone"], - auth_invalidate_sessions: map["authInvalidateSessions"], - o_auth_providers: map["oAuthProviders"].map { |it| AuthProvider.from(map: it) }, - platforms: map["platforms"], - webhooks: map["webhooks"].map { |it| Webhook.from(map: it) }, - keys: map["keys"].map { |it| Key.from(map: it) }, dev_keys: map["devKeys"].map { |it| DevKey.from(map: it) }, smtp_enabled: map["smtpEnabled"], smtp_sender_name: map["smtpSenderName"], @@ -303,33 +111,9 @@ def self.from(map:) pinged_at: map["pingedAt"], labels: map["labels"], status: map["status"], - auth_email_password: map["authEmailPassword"], - auth_users_auth_magic_url: map["authUsersAuthMagicURL"], - auth_email_otp: map["authEmailOtp"], - auth_anonymous: map["authAnonymous"], - auth_invites: map["authInvites"], - auth_jwt: map["authJWT"], - auth_phone: map["authPhone"], - service_status_for_account: map["serviceStatusForAccount"], - service_status_for_avatars: map["serviceStatusForAvatars"], - service_status_for_databases: map["serviceStatusForDatabases"], - service_status_for_tablesdb: map["serviceStatusForTablesdb"], - service_status_for_locale: map["serviceStatusForLocale"], - service_status_for_health: map["serviceStatusForHealth"], - service_status_for_project: map["serviceStatusForProject"], - service_status_for_storage: map["serviceStatusForStorage"], - service_status_for_teams: map["serviceStatusForTeams"], - service_status_for_users: map["serviceStatusForUsers"], - service_status_for_vcs: map["serviceStatusForVcs"], - service_status_for_sites: map["serviceStatusForSites"], - service_status_for_functions: map["serviceStatusForFunctions"], - service_status_for_proxy: map["serviceStatusForProxy"], - service_status_for_graphql: map["serviceStatusForGraphql"], - service_status_for_migrations: map["serviceStatusForMigrations"], - service_status_for_messaging: map["serviceStatusForMessaging"], - protocol_status_for_rest: map["protocolStatusForRest"], - protocol_status_for_graphql: map["protocolStatusForGraphql"], - protocol_status_for_websocket: map["protocolStatusForWebsocket"], + auth_methods: map["authMethods"].map { |it| ProjectAuthMethod.from(map: it) }, + services: map["services"].map { |it| ProjectService.from(map: it) }, + protocols: map["protocols"].map { |it| ProjectProtocol.from(map: it) }, region: map["region"], billing_limits: BillingLimits.from(map: map["billingLimits"]), blocks: map["blocks"].map { |it| Block.from(map: it) }, @@ -343,37 +127,7 @@ def to_map "$createdAt": @created_at, "$updatedAt": @updated_at, "name": @name, - "description": @description, "teamId": @team_id, - "logo": @logo, - "url": @url, - "legalName": @legal_name, - "legalCountry": @legal_country, - "legalState": @legal_state, - "legalCity": @legal_city, - "legalAddress": @legal_address, - "legalTaxId": @legal_tax_id, - "authDuration": @auth_duration, - "authLimit": @auth_limit, - "authSessionsLimit": @auth_sessions_limit, - "authPasswordHistory": @auth_password_history, - "authPasswordDictionary": @auth_password_dictionary, - "authPersonalDataCheck": @auth_personal_data_check, - "authDisposableEmails": @auth_disposable_emails, - "authCanonicalEmails": @auth_canonical_emails, - "authFreeEmails": @auth_free_emails, - "authMockNumbers": @auth_mock_numbers.map { |it| it.to_map }, - "authSessionAlerts": @auth_session_alerts, - "authMembershipsUserName": @auth_memberships_user_name, - "authMembershipsUserEmail": @auth_memberships_user_email, - "authMembershipsMfa": @auth_memberships_mfa, - "authMembershipsUserId": @auth_memberships_user_id, - "authMembershipsUserPhone": @auth_memberships_user_phone, - "authInvalidateSessions": @auth_invalidate_sessions, - "oAuthProviders": @o_auth_providers.map { |it| it.to_map }, - "platforms": @platforms, - "webhooks": @webhooks.map { |it| it.to_map }, - "keys": @keys.map { |it| it.to_map }, "devKeys": @dev_keys.map { |it| it.to_map }, "smtpEnabled": @smtp_enabled, "smtpSenderName": @smtp_sender_name, @@ -389,33 +143,9 @@ def to_map "pingedAt": @pinged_at, "labels": @labels, "status": @status, - "authEmailPassword": @auth_email_password, - "authUsersAuthMagicURL": @auth_users_auth_magic_url, - "authEmailOtp": @auth_email_otp, - "authAnonymous": @auth_anonymous, - "authInvites": @auth_invites, - "authJWT": @auth_jwt, - "authPhone": @auth_phone, - "serviceStatusForAccount": @service_status_for_account, - "serviceStatusForAvatars": @service_status_for_avatars, - "serviceStatusForDatabases": @service_status_for_databases, - "serviceStatusForTablesdb": @service_status_for_tablesdb, - "serviceStatusForLocale": @service_status_for_locale, - "serviceStatusForHealth": @service_status_for_health, - "serviceStatusForProject": @service_status_for_project, - "serviceStatusForStorage": @service_status_for_storage, - "serviceStatusForTeams": @service_status_for_teams, - "serviceStatusForUsers": @service_status_for_users, - "serviceStatusForVcs": @service_status_for_vcs, - "serviceStatusForSites": @service_status_for_sites, - "serviceStatusForFunctions": @service_status_for_functions, - "serviceStatusForProxy": @service_status_for_proxy, - "serviceStatusForGraphql": @service_status_for_graphql, - "serviceStatusForMigrations": @service_status_for_migrations, - "serviceStatusForMessaging": @service_status_for_messaging, - "protocolStatusForRest": @protocol_status_for_rest, - "protocolStatusForGraphql": @protocol_status_for_graphql, - "protocolStatusForWebsocket": @protocol_status_for_websocket, + "authMethods": @auth_methods.map { |it| it.to_map }, + "services": @services.map { |it| it.to_map }, + "protocols": @protocols.map { |it| it.to_map }, "region": @region, "billingLimits": @billing_limits.to_map, "blocks": @blocks.map { |it| it.to_map }, diff --git a/lib/appwrite/models/project_auth_method.rb b/lib/appwrite/models/project_auth_method.rb new file mode 100644 index 0000000..d94439a --- /dev/null +++ b/lib/appwrite/models/project_auth_method.rb @@ -0,0 +1,53 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ProjectAuthMethod + attr_reader :id + attr_reader :enabled + + def initialize( + id:, + enabled: + ) + @id = validate_id(id) + @enabled = enabled + end + + def self.from(map:) + ProjectAuthMethod.new( + id: map["$id"], + enabled: map["enabled"] + ) + end + + def to_map + { + "$id": @id, + "enabled": @enabled + } + end + + private + + def validate_id(id) + valid_id = [ + Appwrite::Enums::ProjectAuthMethodId::EMAIL-PASSWORD, + Appwrite::Enums::ProjectAuthMethodId::MAGIC-URL, + Appwrite::Enums::ProjectAuthMethodId::EMAIL-OTP, + Appwrite::Enums::ProjectAuthMethodId::ANONYMOUS, + Appwrite::Enums::ProjectAuthMethodId::INVITES, + Appwrite::Enums::ProjectAuthMethodId::JWT, + Appwrite::Enums::ProjectAuthMethodId::PHONE, + ] + + unless valid_id.include?(id) + raise ArgumentError, "Invalid " + id + ". Must be one of: " + valid_id.join(', ') + end + + id + end + + end + end +end diff --git a/lib/appwrite/models/project_protocol.rb b/lib/appwrite/models/project_protocol.rb new file mode 100644 index 0000000..2c8f0b8 --- /dev/null +++ b/lib/appwrite/models/project_protocol.rb @@ -0,0 +1,49 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ProjectProtocol + attr_reader :id + attr_reader :enabled + + def initialize( + id:, + enabled: + ) + @id = validate_id(id) + @enabled = enabled + end + + def self.from(map:) + ProjectProtocol.new( + id: map["$id"], + enabled: map["enabled"] + ) + end + + def to_map + { + "$id": @id, + "enabled": @enabled + } + end + + private + + def validate_id(id) + valid_id = [ + Appwrite::Enums::ProjectProtocolId::REST, + Appwrite::Enums::ProjectProtocolId::GRAPHQL, + Appwrite::Enums::ProjectProtocolId::WEBSOCKET, + ] + + unless valid_id.include?(id) + raise ArgumentError, "Invalid " + id + ". Must be one of: " + valid_id.join(', ') + end + + id + end + + end + end +end diff --git a/lib/appwrite/models/project_service.rb b/lib/appwrite/models/project_service.rb new file mode 100644 index 0000000..b533675 --- /dev/null +++ b/lib/appwrite/models/project_service.rb @@ -0,0 +1,64 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ProjectService + attr_reader :id + attr_reader :enabled + + def initialize( + id:, + enabled: + ) + @id = validate_id(id) + @enabled = enabled + end + + def self.from(map:) + ProjectService.new( + id: map["$id"], + enabled: map["enabled"] + ) + end + + def to_map + { + "$id": @id, + "enabled": @enabled + } + end + + private + + def validate_id(id) + valid_id = [ + Appwrite::Enums::ProjectServiceId::ACCOUNT, + Appwrite::Enums::ProjectServiceId::AVATARS, + Appwrite::Enums::ProjectServiceId::DATABASES, + Appwrite::Enums::ProjectServiceId::TABLESDB, + Appwrite::Enums::ProjectServiceId::LOCALE, + Appwrite::Enums::ProjectServiceId::HEALTH, + Appwrite::Enums::ProjectServiceId::PROJECT, + Appwrite::Enums::ProjectServiceId::STORAGE, + Appwrite::Enums::ProjectServiceId::TEAMS, + Appwrite::Enums::ProjectServiceId::USERS, + Appwrite::Enums::ProjectServiceId::VCS, + Appwrite::Enums::ProjectServiceId::SITES, + Appwrite::Enums::ProjectServiceId::FUNCTIONS, + Appwrite::Enums::ProjectServiceId::PROXY, + Appwrite::Enums::ProjectServiceId::GRAPHQL, + Appwrite::Enums::ProjectServiceId::MIGRATIONS, + Appwrite::Enums::ProjectServiceId::MESSAGING, + Appwrite::Enums::ProjectServiceId::ADVISOR, + ] + + unless valid_id.include?(id) + raise ArgumentError, "Invalid " + id + ". Must be one of: " + valid_id.join(', ') + end + + id + end + + end + end +end diff --git a/lib/appwrite/models/report.rb b/lib/appwrite/models/report.rb new file mode 100644 index 0000000..3459791 --- /dev/null +++ b/lib/appwrite/models/report.rb @@ -0,0 +1,82 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class Report + attr_reader :id + attr_reader :created_at + attr_reader :updated_at + attr_reader :app_id + attr_reader :type + attr_reader :title + attr_reader :summary + attr_reader :target_type + attr_reader :target + attr_reader :categories + attr_reader :insights + attr_reader :analyzed_at + + def initialize( + id:, + created_at:, + updated_at:, + app_id:, + type:, + title:, + summary:, + target_type:, + target:, + categories:, + insights:, + analyzed_at: + ) + @id = id + @created_at = created_at + @updated_at = updated_at + @app_id = app_id + @type = type + @title = title + @summary = summary + @target_type = target_type + @target = target + @categories = categories + @insights = insights + @analyzed_at = analyzed_at + end + + def self.from(map:) + Report.new( + id: map["$id"], + created_at: map["$createdAt"], + updated_at: map["$updatedAt"], + app_id: map["appId"], + type: map["type"], + title: map["title"], + summary: map["summary"], + target_type: map["targetType"], + target: map["target"], + categories: map["categories"], + insights: map["insights"].map { |it| Insight.from(map: it) }, + analyzed_at: map["analyzedAt"] + ) + end + + def to_map + { + "$id": @id, + "$createdAt": @created_at, + "$updatedAt": @updated_at, + "appId": @app_id, + "type": @type, + "title": @title, + "summary": @summary, + "targetType": @target_type, + "target": @target, + "categories": @categories, + "insights": @insights.map { |it| it.to_map }, + "analyzedAt": @analyzed_at + } + end + end + end +end diff --git a/lib/appwrite/models/report_list.rb b/lib/appwrite/models/report_list.rb new file mode 100644 index 0000000..a8eb1f5 --- /dev/null +++ b/lib/appwrite/models/report_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class ReportList + attr_reader :total + attr_reader :reports + + def initialize( + total:, + reports: + ) + @total = total + @reports = reports + end + + def self.from(map:) + ReportList.new( + total: map["total"], + reports: map["reports"].map { |it| Report.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "reports": @reports.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/usage_event.rb b/lib/appwrite/models/usage_event.rb new file mode 100644 index 0000000..c7d9fa6 --- /dev/null +++ b/lib/appwrite/models/usage_event.rb @@ -0,0 +1,72 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class UsageEvent + attr_reader :metric + attr_reader :value + attr_reader :time + attr_reader :xpath + attr_reader :method + attr_reader :status + attr_reader :resource_type + attr_reader :resource_id + attr_reader :country_code + attr_reader :user_agent + + def initialize( + metric:, + value:, + time:, + xpath:, + method:, + status:, + resource_type:, + resource_id:, + country_code:, + user_agent: + ) + @metric = metric + @value = value + @time = time + @xpath = xpath + @method = method + @status = status + @resource_type = resource_type + @resource_id = resource_id + @country_code = country_code + @user_agent = user_agent + end + + def self.from(map:) + UsageEvent.new( + metric: map["metric"], + value: map["value"], + time: map["time"], + xpath: map["path"], + method: map["method"], + status: map["status"], + resource_type: map["resourceType"], + resource_id: map["resourceId"], + country_code: map["countryCode"], + user_agent: map["userAgent"] + ) + end + + def to_map + { + "metric": @metric, + "value": @value, + "time": @time, + "path": @xpath, + "method": @method, + "status": @status, + "resourceType": @resource_type, + "resourceId": @resource_id, + "countryCode": @country_code, + "userAgent": @user_agent + } + end + end + end +end diff --git a/lib/appwrite/models/usage_event_list.rb b/lib/appwrite/models/usage_event_list.rb new file mode 100644 index 0000000..2909885 --- /dev/null +++ b/lib/appwrite/models/usage_event_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class UsageEventList + attr_reader :total + attr_reader :events + + def initialize( + total:, + events: + ) + @total = total + @events = events + end + + def self.from(map:) + UsageEventList.new( + total: map["total"], + events: map["events"].map { |it| UsageEvent.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "events": @events.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/models/usage_gauge.rb b/lib/appwrite/models/usage_gauge.rb new file mode 100644 index 0000000..35875c2 --- /dev/null +++ b/lib/appwrite/models/usage_gauge.rb @@ -0,0 +1,37 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class UsageGauge + attr_reader :metric + attr_reader :value + attr_reader :time + + def initialize( + metric:, + value:, + time: + ) + @metric = metric + @value = value + @time = time + end + + def self.from(map:) + UsageGauge.new( + metric: map["metric"], + value: map["value"], + time: map["time"] + ) + end + + def to_map + { + "metric": @metric, + "value": @value, + "time": @time + } + end + end + end +end diff --git a/lib/appwrite/models/usage_gauge_list.rb b/lib/appwrite/models/usage_gauge_list.rb new file mode 100644 index 0000000..e924801 --- /dev/null +++ b/lib/appwrite/models/usage_gauge_list.rb @@ -0,0 +1,32 @@ +#frozen_string_literal: true + +module Appwrite + module Models + class UsageGaugeList + attr_reader :total + attr_reader :gauges + + def initialize( + total:, + gauges: + ) + @total = total + @gauges = gauges + end + + def self.from(map:) + UsageGaugeList.new( + total: map["total"], + gauges: map["gauges"].map { |it| UsageGauge.from(map: it) } + ) + end + + def to_map + { + "total": @total, + "gauges": @gauges.map { |it| it.to_map } + } + end + end + end +end diff --git a/lib/appwrite/services/advisor.rb b/lib/appwrite/services/advisor.rb new file mode 100644 index 0000000..864025c --- /dev/null +++ b/lib/appwrite/services/advisor.rb @@ -0,0 +1,173 @@ +#frozen_string_literal: true + +module Appwrite + class Advisor < Service + + def initialize(client) + @client = client + end + + # Get a list of all the project's analyzer reports. You can use the query + # params to filter your results. + # + # + # @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: appId, type, targetType, target, analyzedAt + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [ReportList] + def list_reports(queries: nil, total: nil) + api_path = '/reports' + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::ReportList + ) + + end + + # Get an analyzer report by its unique ID. The response includes the report's + # metadata and the nested insights it produced. + # + # + # @param [String] report_id Report ID. + # + # @return [Report] + def get_report(report_id:) + api_path = '/reports/{reportId}' + .gsub('{reportId}', report_id) + + if report_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "reportId"') + end + + api_params = { + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Report + ) + + end + + # Delete an analyzer report by its unique ID. Nested insights and CTA + # metadata are removed asynchronously by the deletes worker. + # + # + # @param [String] report_id Report ID. + # + # @return [] + def delete_report(report_id:) + api_path = '/reports/{reportId}' + .gsub('{reportId}', report_id) + + if report_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "reportId"') + end + + api_params = { + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + + end + + # List the insights produced under a single analyzer report. You can use the + # query params to filter your results further. + # + # + # @param [String] report_id Parent report ID. + # @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [InsightList] + def list_insights(report_id:, queries: nil, total: nil) + api_path = '/reports/{reportId}/insights' + .gsub('{reportId}', report_id) + + if report_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "reportId"') + end + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::InsightList + ) + + end + + # Get an insight by its unique ID, scoped to its parent report. + # + # + # @param [String] report_id Parent report ID. + # @param [String] insight_id Insight ID. + # + # @return [Insight] + def get_insight(report_id:, insight_id:) + api_path = '/reports/{reportId}/insights/{insightId}' + .gsub('{reportId}', report_id) + .gsub('{insightId}', insight_id) + + if report_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "reportId"') + end + + if insight_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "insightId"') + end + + api_params = { + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Insight + ) + + end + + end +end diff --git a/lib/appwrite/services/presences.rb b/lib/appwrite/services/presences.rb new file mode 100644 index 0000000..1bb2f9c --- /dev/null +++ b/lib/appwrite/services/presences.rb @@ -0,0 +1,199 @@ +#frozen_string_literal: true + +module Appwrite + class Presences < Service + + def initialize(client) + @client = client + end + + # List presence logs. Expired entries are filtered out automatically. + # + # + # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # @param [Integer] ttl TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + # + # @return [PresenceList] + def list(queries: nil, total: nil, ttl: nil) + api_path = '/presences' + + api_params = { + queries: queries, + total: total, + ttl: ttl, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::PresenceList + ) + + end + + # Get a presence log by its unique ID. Entries whose `expiresAt` is in the + # past are treated as not found. + # + # + # @param [String] presence_id Presence unique ID. + # + # @return [Presence] + def get(presence_id:) + api_path = '/presences/{presenceId}' + .gsub('{presenceId}', presence_id) + + if presence_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + end + + api_params = { + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Presence + ) + + end + + # Create or update a presence log by its user ID. + # + # + # @param [String] presence_id Presence unique ID. + # @param [String] user_id User ID. + # @param [String] status Presence status. + # @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). + # @param [String] expires_at Presence expiry datetime. + # @param [Hash] metadata Presence metadata object. + # + # @return [Presence] + def upsert(presence_id:, user_id:, status:, permissions: nil, expires_at: nil, metadata: nil) + api_path = '/presences/{presenceId}' + .gsub('{presenceId}', presence_id) + + if presence_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + end + + if user_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "userId"') + end + + if status.nil? + raise Appwrite::Exception.new('Missing required parameter: "status"') + end + + api_params = { + userId: user_id, + status: status, + permissions: permissions, + expiresAt: expires_at, + metadata: metadata, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PUT', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Presence + ) + + end + + # Update a presence log by its unique ID. Using the patch method you can pass + # only specific fields that will get updated. + # + # + # @param [String] presence_id Presence unique ID. + # @param [String] user_id User ID. + # @param [String] status Presence status. + # @param [String] expires_at Presence expiry datetime. + # @param [Hash] metadata Presence metadata object. + # @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). + # @param [] purge When true, purge cached responses used by list presences endpoint. + # + # @return [Presence] + def update_presence(presence_id:, user_id:, status: nil, expires_at: nil, metadata: nil, permissions: nil, purge: nil) + api_path = '/presences/{presenceId}' + .gsub('{presenceId}', presence_id) + + if presence_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + end + + if user_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "userId"') + end + + api_params = { + userId: user_id, + status: status, + expiresAt: expires_at, + metadata: metadata, + permissions: permissions, + purge: purge, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Presence + ) + + end + + # Delete a presence log by its unique ID. + # + # + # @param [String] presence_id Presence unique ID. + # + # @return [] + def delete(presence_id:) + api_path = '/presences/{presenceId}' + .gsub('{presenceId}', presence_id) + + if presence_id.nil? + raise Appwrite::Exception.new('Missing required parameter: "presenceId"') + end + + api_params = { + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'DELETE', + path: api_path, + headers: api_headers, + params: api_params, + ) + + end + + end +end diff --git a/lib/appwrite/services/project.rb b/lib/appwrite/services/project.rb index 50530b8..540b4a4 100644 --- a/lib/appwrite/services/project.rb +++ b/lib/appwrite/services/project.rb @@ -7,6 +7,29 @@ def initialize(client) @client = client end + # Get a project. + # + # + # @return [Project] + def get() + api_path = '/project' + + api_params = { + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Project + ) + + end + # Delete a project. # # @@ -33,7 +56,7 @@ def delete() # Update properties of a specific auth method. Use this endpoint to enable or # disable a method in your project. # - # @param [AuthMethod] method_id Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + # @param [ProjectAuthMethodId] method_id Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone # @param [] enabled Auth method status. # # @return [Project] @@ -511,7 +534,7 @@ def list_o_auth2_providers(queries: nil, total: nil) # Update the project OAuth2 Amazon configuration. # # @param [String] client_id 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - # @param [String] client_secret 'Client Secret' of Amazon OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Amazon] @@ -575,7 +598,7 @@ def update_o_auth2_apple(service_id: nil, key_id: nil, team_id: nil, p8_file: ni # Update the project OAuth2 Auth0 configuration. # # @param [String] client_id 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - # @param [String] client_secret 'Client Secret' of Auth0 OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF # @param [String] endpoint Domain of Auth0 instance. For example: example.us.auth0.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # @@ -607,7 +630,7 @@ def update_o_auth2_auth0(client_id: nil, client_secret: nil, endpoint: nil, enab # Update the project OAuth2 Authentik configuration. # # @param [String] client_id 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - # @param [String] client_secret 'Client Secret' of Authentik OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK # @param [String] endpoint Domain of Authentik instance. For example: example.authentik.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # @@ -639,7 +662,7 @@ def update_o_auth2_authentik(client_id: nil, client_secret: nil, endpoint: nil, # Update the project OAuth2 Autodesk configuration. # # @param [String] client_id 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - # @param [String] client_secret 'Client Secret' of Autodesk OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Autodesk] @@ -669,7 +692,7 @@ def update_o_auth2_autodesk(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Bitbucket configuration. # # @param [String] key 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - # @param [String] secret 'Secret' of Bitbucket OAuth2 app. For example: + # @param [String] secret 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Bitbucket] @@ -699,7 +722,7 @@ def update_o_auth2_bitbucket(key: nil, secret: nil, enabled: nil) # Update the project OAuth2 Bitly configuration. # # @param [String] client_id 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - # @param [String] client_secret 'Client Secret' of Bitly OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Bitly] @@ -729,7 +752,7 @@ def update_o_auth2_bitly(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Box configuration. # # @param [String] client_id 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - # @param [String] client_secret 'Client Secret' of Box OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Box] @@ -759,7 +782,7 @@ def update_o_auth2_box(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Dailymotion configuration. # # @param [String] api_key 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - # @param [String] api_secret 'API Secret' of Dailymotion OAuth2 app. For example: + # @param [String] api_secret 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Dailymotion] @@ -789,7 +812,7 @@ def update_o_auth2_dailymotion(api_key: nil, api_secret: nil, enabled: nil) # Update the project OAuth2 Discord configuration. # # @param [String] client_id 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - # @param [String] client_secret 'Client Secret' of Discord OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Discord] @@ -819,7 +842,7 @@ def update_o_auth2_discord(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Disqus configuration. # # @param [String] public_key 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - # @param [String] secret_key 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: + # @param [String] secret_key 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Disqus] @@ -849,7 +872,7 @@ def update_o_auth2_disqus(public_key: nil, secret_key: nil, enabled: nil) # Update the project OAuth2 Dropbox configuration. # # @param [String] app_key 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - # @param [String] app_secret 'App Secret' of Dropbox OAuth2 app. For example: + # @param [String] app_secret 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Dropbox] @@ -879,7 +902,7 @@ def update_o_auth2_dropbox(app_key: nil, app_secret: nil, enabled: nil) # Update the project OAuth2 Etsy configuration. # # @param [String] key_string 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - # @param [String] shared_secret 'Shared Secret' of Etsy OAuth2 app. For example: + # @param [String] shared_secret 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Etsy] @@ -909,7 +932,7 @@ def update_o_auth2_etsy(key_string: nil, shared_secret: nil, enabled: nil) # Update the project OAuth2 Facebook configuration. # # @param [String] app_id 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - # @param [String] app_secret 'App Secret' of Facebook OAuth2 app. For example: + # @param [String] app_secret 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Facebook] @@ -939,7 +962,7 @@ def update_o_auth2_facebook(app_id: nil, app_secret: nil, enabled: nil) # Update the project OAuth2 Figma configuration. # # @param [String] client_id 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - # @param [String] client_secret 'Client Secret' of Figma OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Figma] @@ -969,7 +992,7 @@ def update_o_auth2_figma(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 FusionAuth configuration. # # @param [String] client_id 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - # @param [String] client_secret 'Client Secret' of FusionAuth OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc # @param [String] endpoint Domain of FusionAuth instance. For example: example.fusionauth.io # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # @@ -1001,7 +1024,7 @@ def update_o_auth2_fusion_auth(client_id: nil, client_secret: nil, endpoint: nil # Update the project OAuth2 GitHub configuration. # # @param [String] client_id 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - # @param [String] client_secret 'Client Secret' of GitHub OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Github] @@ -1031,7 +1054,7 @@ def update_o_auth2_git_hub(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Gitlab configuration. # # @param [String] application_id 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - # @param [String] secret 'Secret' of Gitlab OAuth2 app. For example: + # @param [String] secret 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 # @param [String] endpoint Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # @@ -1063,16 +1086,18 @@ def update_o_auth2_gitlab(application_id: nil, secret: nil, endpoint: nil, enabl # Update the project OAuth2 Google configuration. # # @param [String] client_id 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - # @param [String] client_secret 'Client Secret' of Google OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret + # @param [Array] prompt Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Google] - def update_o_auth2_google(client_id: nil, client_secret: nil, enabled: nil) + def update_o_auth2_google(client_id: nil, client_secret: nil, prompt: nil, enabled: nil) api_path = '/project/oauth2/google' api_params = { clientId: client_id, clientSecret: client_secret, + prompt: prompt, enabled: enabled, } @@ -1093,7 +1118,7 @@ def update_o_auth2_google(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Keycloak configuration. # # @param [String] client_id 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - # @param [String] client_secret 'Client Secret' of Keycloak OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO # @param [String] endpoint Domain of Keycloak instance. For example: keycloak.example.com # @param [String] realm_name Keycloak realm name. For example: appwrite-realm # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1127,7 +1152,7 @@ def update_o_auth2_keycloak(client_id: nil, client_secret: nil, endpoint: nil, r # Update the project OAuth2 Kick configuration. # # @param [String] client_id 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - # @param [String] client_secret 'Client Secret' of Kick OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Kick] @@ -1157,7 +1182,7 @@ def update_o_auth2_kick(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Linkedin configuration. # # @param [String] client_id 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - # @param [String] primary_client_secret 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: + # @param [String] primary_client_secret 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Linkedin] @@ -1187,7 +1212,7 @@ def update_o_auth2_linkedin(client_id: nil, primary_client_secret: nil, enabled: # Update the project OAuth2 Microsoft configuration. # # @param [String] application_id 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - # @param [String] application_secret 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: + # @param [String] application_secret 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u # @param [String] tenant Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # @@ -1219,7 +1244,7 @@ def update_o_auth2_microsoft(application_id: nil, application_secret: nil, tenan # Update the project OAuth2 Notion configuration. # # @param [String] oauth_client_id 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - # @param [String] oauth_client_secret 'OAuth Client Secret' of Notion OAuth2 app. For example: + # @param [String] oauth_client_secret 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Notion] @@ -1249,7 +1274,7 @@ def update_o_auth2_notion(oauth_client_id: nil, oauth_client_secret: nil, enable # Update the project OAuth2 Oidc configuration. # # @param [String] client_id 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - # @param [String] client_secret 'Client Secret' of Oidc OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV # @param [String] well_known_url OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration # @param [String] authorization_url OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize # @param [String] token_url OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token @@ -1287,7 +1312,7 @@ def update_o_auth2_oidc(client_id: nil, client_secret: nil, well_known_url: nil, # Update the project OAuth2 Okta configuration. # # @param [String] client_id 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - # @param [String] client_secret 'Client Secret' of Okta OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV # @param [String] domain Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ # @param [String] authorization_server_id Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -1321,7 +1346,7 @@ def update_o_auth2_okta(client_id: nil, client_secret: nil, domain: nil, authori # Update the project OAuth2 Paypal configuration. # # @param [String] client_id 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: + # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Paypal] @@ -1351,7 +1376,7 @@ def update_o_auth2_paypal(client_id: nil, secret_key: nil, enabled: nil) # Update the project OAuth2 PaypalSandbox configuration. # # @param [String] client_id 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: + # @param [String] secret_key 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Paypal] @@ -1381,7 +1406,7 @@ def update_o_auth2_paypal_sandbox(client_id: nil, secret_key: nil, enabled: nil) # Update the project OAuth2 Podio configuration. # # @param [String] client_id 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - # @param [String] client_secret 'Client Secret' of Podio OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Podio] @@ -1411,7 +1436,7 @@ def update_o_auth2_podio(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Salesforce configuration. # # @param [String] customer_key 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - # @param [String] customer_secret 'Consumer Secret' of Salesforce OAuth2 app. For example: + # @param [String] customer_secret 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Salesforce] @@ -1441,7 +1466,7 @@ def update_o_auth2_salesforce(customer_key: nil, customer_secret: nil, enabled: # Update the project OAuth2 Slack configuration. # # @param [String] client_id 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - # @param [String] client_secret 'Client Secret' of Slack OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Slack] @@ -1471,7 +1496,7 @@ def update_o_auth2_slack(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Spotify configuration. # # @param [String] client_id 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - # @param [String] client_secret 'Client Secret' of Spotify OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Spotify] @@ -1501,7 +1526,7 @@ def update_o_auth2_spotify(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Stripe configuration. # # @param [String] client_id 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - # @param [String] api_secret_key 'API Secret Key' of Stripe OAuth2 app. For example: + # @param [String] api_secret_key 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Stripe] @@ -1531,7 +1556,7 @@ def update_o_auth2_stripe(client_id: nil, api_secret_key: nil, enabled: nil) # Update the project OAuth2 Tradeshift configuration. # # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: + # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Tradeshift] @@ -1561,7 +1586,7 @@ def update_o_auth2_tradeshift(oauth2_client_id: nil, oauth2_client_secret: nil, # Update the project OAuth2 Tradeshift Sandbox configuration. # # @param [String] oauth2_client_id 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: + # @param [String] oauth2_client_secret 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Tradeshift] @@ -1591,7 +1616,7 @@ def update_o_auth2_tradeshift_sandbox(oauth2_client_id: nil, oauth2_client_secre # Update the project OAuth2 Twitch configuration. # # @param [String] client_id 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - # @param [String] client_secret 'Client Secret' of Twitch OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Twitch] @@ -1621,7 +1646,7 @@ def update_o_auth2_twitch(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 WordPress configuration. # # @param [String] client_id 'Client ID' of WordPress OAuth2 app. For example: 130005 - # @param [String] client_secret 'Client Secret' of WordPress OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2WordPress] @@ -1651,7 +1676,7 @@ def update_o_auth2_word_press(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 X configuration. # # @param [String] customer_key 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - # @param [String] secret_key 'Secret Key' of X OAuth2 app. For example: + # @param [String] secret_key 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2X] @@ -1681,7 +1706,7 @@ def update_o_auth2_x(customer_key: nil, secret_key: nil, enabled: nil) # Update the project OAuth2 Yahoo configuration. # # @param [String] client_id 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - # @param [String] client_secret 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: + # @param [String] client_secret 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Yahoo] @@ -1711,7 +1736,7 @@ def update_o_auth2_yahoo(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Yandex configuration. # # @param [String] client_id 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - # @param [String] client_secret 'Client Secret' of Yandex OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Yandex] @@ -1741,7 +1766,7 @@ def update_o_auth2_yandex(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Zoho configuration. # # @param [String] client_id 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - # @param [String] client_secret 'Client Secret' of Zoho OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Zoho] @@ -1771,7 +1796,7 @@ def update_o_auth2_zoho(client_id: nil, client_secret: nil, enabled: nil) # Update the project OAuth2 Zoom configuration. # # @param [String] client_id 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - # @param [String] client_secret 'Client Secret' of Zoom OAuth2 app. For example: + # @param [String] client_secret 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON # @param [] enabled OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. # # @return [OAuth2Zoom] @@ -1801,7 +1826,7 @@ def update_o_auth2_zoom(client_id: nil, client_secret: nil, enabled: nil) # Get a single OAuth2 provider configuration. Credential fields (client # secret, p8 file, key/team IDs) are write-only and always returned empty. # - # @param [OAuthProvider] provider_id OAuth2 provider key. For example: github, google, apple. + # @param [ProjectOAuthProviderId] provider_id OAuth2 provider key. For example: github, google, apple. # # @return [OAuth2Github, OAuth2Discord, OAuth2Figma, OAuth2Dropbox, OAuth2Dailymotion, OAuth2Bitbucket, OAuth2Bitly, OAuth2Box, OAuth2Autodesk, OAuth2Google, OAuth2Zoom, OAuth2Zoho, OAuth2Yandex, OAuth2X, OAuth2WordPress, OAuth2Twitch, OAuth2Stripe, OAuth2Spotify, OAuth2Slack, OAuth2Podio, OAuth2Notion, OAuth2Salesforce, OAuth2Yahoo, OAuth2Linkedin, OAuth2Disqus, OAuth2Amazon, OAuth2Etsy, OAuth2Facebook, OAuth2Tradeshift, OAuth2Paypal, OAuth2Gitlab, OAuth2Authentik, OAuth2Auth0, OAuth2FusionAuth, OAuth2Keycloak, OAuth2Oidc, OAuth2Apple, OAuth2Okta, OAuth2Kick, OAuth2Microsoft] def get_o_auth2_provider(provider_id:) @@ -2613,6 +2638,99 @@ def list_policies(queries: nil, total: nil) end + # Configures if aliased emails such as subaddresses and emails with suffixes + # are denied during new users sign-ups and email updates. + # + # @param [] enabled Set whether or not to block aliased emails during signup and email updates. + # + # @return [Project] + def update_deny_aliased_email_policy(enabled:) + api_path = '/project/policies/deny-aliased-email' + + if enabled.nil? + raise Appwrite::Exception.new('Missing required parameter: "enabled"') + end + + api_params = { + enabled: enabled, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Project + ) + + end + + # Configures if disposable emails from known temporary domains are denied + # during new users sign-ups and email updates. + # + # @param [] enabled Set whether or not to block disposable email addresses during signup and email updates. + # + # @return [Project] + def update_deny_disposable_email_policy(enabled:) + api_path = '/project/policies/deny-disposable-email' + + if enabled.nil? + raise Appwrite::Exception.new('Missing required parameter: "enabled"') + end + + api_params = { + enabled: enabled, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Project + ) + + end + + # Configures if emails from free providers such as Gmail or Yahoo are denied + # during new users sign-ups and email updates. + # + # @param [] enabled Set whether or not to block free email addresses during signup and email updates. + # + # @return [Project] + def update_deny_free_email_policy(enabled:) + api_path = '/project/policies/deny-free-email' + + if enabled.nil? + raise Appwrite::Exception.new('Missing required parameter: "enabled"') + end + + api_params = { + enabled: enabled, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'PATCH', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::Project + ) + + end + # Updating this policy allows you to control if team members can see other # members information. When enabled, all team members can see ID, name, # email, phone number, and MFA status of other members.. @@ -2915,7 +3033,7 @@ def update_user_limit_policy(total:) # Get a policy by its unique ID. This endpoint returns the current # configuration for the requested project policy. # - # @param [ProjectPolicy] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + # @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. # # @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy] def get_policy(policy_id:) @@ -2995,7 +3113,7 @@ def get_policy(policy_id:) # Update properties of a specific protocol. Use this endpoint to enable or # disable a protocol in your project. # - # @param [ProtocolId] protocol_id Protocol name. Can be one of: rest, graphql, websocket + # @param [ProjectProtocolId] protocol_id Protocol name. Can be one of: rest, graphql, websocket # @param [] enabled Protocol status. # # @return [Project] @@ -3032,7 +3150,7 @@ def update_protocol(protocol_id:, enabled:) # Update properties of a specific service. Use this endpoint to enable or # disable a service in your project. # - # @param [ServiceId] service_id Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging + # @param [ProjectServiceId] service_id Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor # @param [] enabled Service status. # # @return [Project] @@ -3078,7 +3196,7 @@ def update_service(service_id:, enabled:) # @param [String] sender_name Name shown in inbox as the sender of the email. # @param [String] reply_to_email Email used when user replies to the email. # @param [String] reply_to_name Name used when user replies to the email. - # @param [Secure] secure Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. + # @param [ProjectSMTPSecure] secure Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. # @param [] enabled Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. # # @return [Project] @@ -3173,8 +3291,8 @@ def list_email_templates(queries: nil, total: nil) # Update a custom email template for the specified locale and type. Use this # endpoint to modify the content of your email templates. # - # @param [EmailTemplateType] template_id Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - # @param [EmailTemplateLocale] locale Custom email template locale. If left empty, the fallback locale (en) will be used. + # @param [ProjectEmailTemplateId] template_id Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + # @param [ProjectEmailTemplateLocale] locale Custom email template locale. If left empty, the fallback locale (en) will be used. # @param [String] subject Subject of the email template. Can be up to 255 characters. # @param [String] message Plain or HTML body of the email template message. Can be up to 10MB of content. # @param [String] sender_name Name of the email sender. @@ -3219,8 +3337,8 @@ def update_email_template(template_id:, locale: nil, subject: nil, message: nil, # endpoint returns the template content, subject, and other configuration # details. # - # @param [EmailTemplateType] template_id Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - # @param [EmailTemplateLocale] locale Custom email template locale. If left empty, the fallback locale (en) will be used. + # @param [ProjectEmailTemplateId] template_id Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + # @param [ProjectEmailTemplateLocale] locale Custom email template locale. If left empty, the fallback locale (en) will be used. # # @return [EmailTemplate] def get_email_template(template_id:, locale: nil) diff --git a/lib/appwrite/services/usage.rb b/lib/appwrite/services/usage.rb new file mode 100644 index 0000000..e95d095 --- /dev/null +++ b/lib/appwrite/services/usage.rb @@ -0,0 +1,86 @@ +#frozen_string_literal: true + +module Appwrite + class Usage < Service + + def initialize(client) + @client = client + end + + # Query usage event metrics from the usage database. Returns individual event + # rows with full metadata. Pass Query objects as JSON strings to filter, + # paginate, and order results. Supported query methods: equal, + # greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. + # Supported filter attributes: metric, path, method, status, resource, + # resourceId, country, userAgent, time (these match the underlying column + # names — note that the response surfaces `resource` as `resourceType` and + # `country` as `countryCode`). When no time filter is supplied the endpoint + # defaults to the last 7 days. Default `limit(100)` is applied if none is + # given; user-supplied limits are capped at 500. The `total` field is capped + # at 5000 to keep counts predictable — pass `total=false` to skip the count + # entirely. + # + # @param [Array] queries Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [UsageEventList] + def list_events(queries: nil, total: nil) + api_path = '/usage/events' + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::UsageEventList + ) + + end + + # Query usage gauge metrics (point-in-time resource snapshots) from the usage + # database. Returns individual gauge snapshots with metric, value, and + # timestamp. Pass Query objects as JSON strings to filter, paginate, and + # order results. Supported query methods: equal, greaterThanEqual, + # lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter + # attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the + # most recent snapshot. When no time filter is supplied the endpoint defaults + # to the last 7 days. Default `limit(100)` is applied if none is given; + # user-supplied limits are capped at 500. The `total` field is capped at 5000 + # to keep counts predictable — pass `total=false` to skip the count + # entirely. + # + # @param [Array] queries Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + # @param [] total When set to false, the total count returned will be 0 and will not be calculated. + # + # @return [UsageGaugeList] + def list_gauges(queries: nil, total: nil) + api_path = '/usage/gauges' + + api_params = { + queries: queries, + total: total, + } + + api_headers = { + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::UsageGaugeList + ) + + end + + end +end