From 931260bc35d515856ca93afb905ae3509f32b2a4 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 16 Nov 2023 17:15:58 +1300 Subject: [PATCH 1/2] Fix between query output --- README.md | 2 +- appwrite.gemspec | 2 +- docs/examples/health/get-queue-builds.md | 14 ++ docs/examples/health/get-queue-databases.md | 14 ++ docs/examples/health/get-queue-deletes.md | 14 ++ docs/examples/health/get-queue-mails.md | 14 ++ docs/examples/health/get-queue-messaging.md | 14 ++ docs/examples/health/get-queue-migrations.md | 14 ++ lib/appwrite/client.rb | 2 +- lib/appwrite/query.rb | 8 +- lib/appwrite/services/account.rb | 26 +-- lib/appwrite/services/avatars.rb | 7 +- lib/appwrite/services/databases.rb | 24 +-- lib/appwrite/services/functions.rb | 10 +- lib/appwrite/services/health.rb | 180 ++++++++++++++++++- lib/appwrite/services/storage.rb | 34 ++-- lib/appwrite/services/teams.rb | 12 +- lib/appwrite/services/users.rb | 34 ++-- 18 files changed, 345 insertions(+), 80 deletions(-) create mode 100644 docs/examples/health/get-queue-builds.md create mode 100644 docs/examples/health/get-queue-databases.md create mode 100644 docs/examples/health/get-queue-deletes.md create mode 100644 docs/examples/health/get-queue-mails.md create mode 100644 docs/examples/health/get-queue-messaging.md create mode 100644 docs/examples/health/get-queue-migrations.md diff --git a/README.md b/README.md index 5fa5b90..f14c68e 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.4.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.4.12-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 eb0c7ad..c3bfe79 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '10.0.0' + spec.version = '10.0.1' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md new file mode 100644 index 0000000..56ece06 --- /dev/null +++ b/docs/examples/health/get-queue-builds.md @@ -0,0 +1,14 @@ +require 'Appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key + +health = Health.new(client) + +response = health.get_queue_builds() + +puts response.inspect \ No newline at end of file diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md new file mode 100644 index 0000000..74c879c --- /dev/null +++ b/docs/examples/health/get-queue-databases.md @@ -0,0 +1,14 @@ +require 'Appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key + +health = Health.new(client) + +response = health.get_queue_databases() + +puts response.inspect \ No newline at end of file diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md new file mode 100644 index 0000000..6110cce --- /dev/null +++ b/docs/examples/health/get-queue-deletes.md @@ -0,0 +1,14 @@ +require 'Appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key + +health = Health.new(client) + +response = health.get_queue_deletes() + +puts response.inspect \ No newline at end of file diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md new file mode 100644 index 0000000..c6d8263 --- /dev/null +++ b/docs/examples/health/get-queue-mails.md @@ -0,0 +1,14 @@ +require 'Appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key + +health = Health.new(client) + +response = health.get_queue_mails() + +puts response.inspect \ No newline at end of file diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md new file mode 100644 index 0000000..579a58f --- /dev/null +++ b/docs/examples/health/get-queue-messaging.md @@ -0,0 +1,14 @@ +require 'Appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key + +health = Health.new(client) + +response = health.get_queue_messaging() + +puts response.inspect \ No newline at end of file diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md new file mode 100644 index 0000000..5c2f40e --- /dev/null +++ b/docs/examples/health/get-queue-migrations.md @@ -0,0 +1,14 @@ +require 'Appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key + +health = Health.new(client) + +response = health.get_queue_migrations() + +puts response.inspect \ No newline at end of file diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index a13fccb..715f631 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,7 +15,7 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '10.0.0', + 'x-sdk-version'=> '10.0.1', 'X-Appwrite-Response-Format' => '1.4.0' } @endpoint = 'https://HOSTNAME/v1' diff --git a/lib/appwrite/query.rb b/lib/appwrite/query.rb index 0c6f86b..6961115 100644 --- a/lib/appwrite/query.rb +++ b/lib/appwrite/query.rb @@ -34,7 +34,7 @@ def is_not_null(attribute) end def between(attribute, start, ending) - return add_query(attribute, "between", [start, ending]) + return "between(\"#{attribute}\", #{parse_values(start)}, #{parse_values(ending)})" end def starts_with(attribute, value) @@ -81,13 +81,13 @@ def offset(offset) def add_query(attribute, method, value) if value.is_a?(Array) - "#{method}(\"#{attribute}\", [#{value.map {|item| parseValues(item)}.join(',')}])" + "#{method}(\"#{attribute}\", [#{value.map {|item| parse_values(item)}.join(',')}])" else - return "#{method}(\"#{attribute}\", [#{parseValues(value)}])" + return "#{method}(\"#{attribute}\", [#{parse_values(value)}])" end end - def parseValues(value) + def parse_values(value) return value.is_a?(String) ? "\"#{value}\"" : value end end diff --git a/lib/appwrite/services/account.rb b/lib/appwrite/services/account.rb index 466842a..7a3d2bd 100644 --- a/lib/appwrite/services/account.rb +++ b/lib/appwrite/services/account.rb @@ -223,7 +223,7 @@ def update_password(password:, old_password: nil) # Update the currently logged in user's phone number. After updating the # phone number, the phone verification status will be reset. A confirmation # SMS is not sent automatically, however you can use the [POST - # /account/verification/phone](/docs/client/account#accountCreatePhoneVerification) + # /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) # endpoint to send a confirmation SMS. # # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -321,9 +321,9 @@ def update_prefs(prefs:) # app password reset URL with the secret key and email address values # attached to the URL query string. Use the query string params to submit a # request to the [PUT - # /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to - # complete the process. The verification link sent to the user's email - # address is valid for 1 hour. + # /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) + # endpoint to complete the process. The verification link sent to the user's + # email address is valid for 1 hour. # # @param [String] email User email. # @param [String] url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. @@ -362,7 +362,8 @@ def create_recovery(email:, url:) # Use this endpoint to complete the user account password reset. Both the # **userId** and **secret** arguments will be passed as query parameters to # the redirect URL you have provided when sending your request to the [POST - # /account/recovery](/docs/client/account#accountCreateRecovery) endpoint. + # /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) + # endpoint. # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -530,7 +531,8 @@ def update_session(session_id:) # Logout the user. Use 'current' as the session ID to logout on this device, # use a session ID to logout on another device. If you're looking to logout # the user on all devices, use [Delete - # Sessions](/docs/client/account#accountDeleteSessions) instead. + # Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) + # instead. # # @param [String] session_id Session ID. Use the string 'current' to delete the current device session. # @@ -592,8 +594,8 @@ def update_status() # should redirect the user back to your app and allow you to complete the # verification process by verifying both the **userId** and **secret** # parameters. Learn more about how to [complete the verification - # process](/docs/client/account#accountUpdateEmailVerification). The - # verification link sent to the user's email address is valid for 7 days. + # process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). + # The verification link sent to the user's email address is valid for 7 days. # # Please note that in order to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), @@ -670,10 +672,12 @@ def update_verification(user_id:, secret:) # Use this endpoint to send a verification SMS to the currently logged in # user. This endpoint is meant for use after updating a user's phone number - # using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone) + # using the + # [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) # endpoint. Learn more about how to [complete the verification - # process](/docs/client/account#accountUpdatePhoneVerification). The - # verification code sent to the user's phone number is valid for 15 minutes. + # process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). + # The verification code sent to the user's phone number is valid for 15 + # minutes. # # # @return [Token] diff --git a/lib/appwrite/services/avatars.rb b/lib/appwrite/services/avatars.rb index 266c84f..3100992 100644 --- a/lib/appwrite/services/avatars.rb +++ b/lib/appwrite/services/avatars.rb @@ -9,8 +9,9 @@ def initialize(client) # You can use this endpoint to show different browser icons to your users. # The code argument receives the browser code as it appears in your user [GET - # /account/sessions](/docs/client/account#accountGetSessions) endpoint. Use - # width, height and quality arguments to change the output settings. + # /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) + # endpoint. Use width, height and quality arguments to change the output + # settings. # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an @@ -127,7 +128,7 @@ def get_favicon(url:) # You can use this endpoint to show different country flags icons to your # users. The code argument receives the 2 letter country code. Use width, # height and quality arguments to change the output settings. Country codes - # follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard. + # follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. # # When one dimension is specified and the other is 0, the image is scaled # with preserved aspect ratio. If both dimensions are 0, the API provides an diff --git a/lib/appwrite/services/databases.rb b/lib/appwrite/services/databases.rb index 289b1cf..7dce1bb 100644 --- a/lib/appwrite/services/databases.rb +++ b/lib/appwrite/services/databases.rb @@ -211,14 +211,14 @@ def list_collections(database_id:, queries: nil, search: nil) # Create a new Collection. Before using this route, you should create a new # database resource using either a [server - # integration](/docs/server/databases#databasesCreateCollection) API or - # directly from your database console. + # integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) + # API or directly from your database console. # # @param [String] database_id Database ID. # @param [String] collection_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Collection name. Max length: 128 chars. - # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions). - # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions). + # @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. # # @return [Collection] @@ -302,8 +302,8 @@ def get_collection(database_id:, collection_id:) # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. # @param [String] name Collection name. Max length: 128 chars. - # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions). - # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](/docs/permissions). + # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] document_security Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] enabled Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. # # @return [Collection] @@ -1223,7 +1223,7 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:) # Create relationship attribute. [Learn more about relationship - # attributes](/docs/databases-relationships#relationship-attributes). + # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). # # # @param [String] database_id Database ID. @@ -1589,7 +1589,7 @@ def delete_attribute(database_id:, collection_id:, key:) # Update relationship attribute. [Learn more about relationship - # attributes](/docs/databases-relationships#relationship-attributes). + # attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). # # # @param [String] database_id Database ID. @@ -1675,14 +1675,14 @@ def list_documents(database_id:, collection_id:, queries: nil) # Create a new Document. Before using this route, you should create a new # collection resource using either a [server - # integration](/docs/server/databases#databasesCreateCollection) API or - # directly from your database console. + # integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) + # API or directly from your database console. # # @param [String] database_id Database ID. # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [Hash] data Document data as JSON object. - # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions). + # @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). # # @return [Document] def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil) @@ -1778,7 +1778,7 @@ def get_document(database_id:, collection_id:, document_id:, queries: nil) # @param [String] collection_id Collection ID. # @param [String] document_id Document ID. # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated. - # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions). + # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # # @return [Document] def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil) diff --git a/lib/appwrite/services/functions.rb b/lib/appwrite/services/functions.rb index b1437e3..17fe014 100644 --- a/lib/appwrite/services/functions.rb +++ b/lib/appwrite/services/functions.rb @@ -37,8 +37,9 @@ def list(queries: nil, search: nil) # Create a new function. You can pass a list of - # [permissions](/docs/permissions) to allow different project users or team - # with access to execute the function using the client API. + # [permissions](https://appwrite.io/docs/permissions) to allow different + # project users or team with access to execute the function using the client + # API. # # @param [String] function_id Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Function name. Max length: 128 chars. @@ -303,7 +304,7 @@ def list_deployments(function_id:, queries: nil, search: nil) # This endpoint accepts a tar.gz file compressed with your code. Make sure to # include any dependencies your code has within the compressed file. You can # learn more about code packaging in the [Appwrite Cloud Functions - # tutorial](/docs/functions). + # tutorial](https://appwrite.io/docs/functions). # # Use the "command" param to set the entrypoint used to execute your code. # @@ -507,7 +508,8 @@ def create_build(function_id:, deployment_id:, build_id:) end - # + # Get a Deployment's contents by its unique ID. This endpoint supports range + # requests for partial or streaming file download. # # @param [String] function_id Function ID. # @param [String] deployment_id Deployment ID. diff --git a/lib/appwrite/services/health.rb b/lib/appwrite/services/health.rb index 9d8d66a..205825a 100644 --- a/lib/appwrite/services/health.rb +++ b/lib/appwrite/services/health.rb @@ -153,16 +153,101 @@ def get_queue() end + # Get the number of builds that are waiting to be processed in the Appwrite + # internal queue server. + # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + # + # @return [HealthQueue] + def get_queue_builds(threshold: nil) + api_path = '/health/queue/builds' + + api_params = { + threshold: threshold, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::HealthQueue + ) + end + + # Get the number of certificates that are waiting to be issued against # [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue # server. # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. # # @return [HealthQueue] - def get_queue_certificates() + def get_queue_certificates(threshold: nil) api_path = '/health/queue/certificates' api_params = { + threshold: threshold, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::HealthQueue + ) + end + + + # Get the number of database changes that are waiting to be processed in the + # Appwrite internal queue server. + # + # @param [String] name Queue name for which to check the queue size + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + # + # @return [HealthQueue] + def get_queue_databases(name: nil, threshold: nil) + api_path = '/health/queue/databases' + + api_params = { + name: name, + threshold: threshold, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::HealthQueue + ) + end + + + # Get the number of background destructive changes that are waiting to be + # processed in the Appwrite internal queue server. + # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + # + # @return [HealthQueue] + def get_queue_deletes(threshold: nil) + api_path = '/health/queue/deletes' + + api_params = { + threshold: threshold, } api_headers = { @@ -181,12 +266,14 @@ def get_queue_certificates() # # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. # # @return [HealthQueue] - def get_queue_functions() + def get_queue_functions(threshold: nil) api_path = '/health/queue/functions' api_params = { + threshold: threshold, } api_headers = { @@ -206,12 +293,95 @@ def get_queue_functions() # Get the number of logs that are waiting to be processed in the Appwrite # internal queue server. # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. # # @return [HealthQueue] - def get_queue_logs() + def get_queue_logs(threshold: nil) api_path = '/health/queue/logs' api_params = { + threshold: threshold, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::HealthQueue + ) + end + + + # Get the number of mails that are waiting to be processed in the Appwrite + # internal queue server. + # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + # + # @return [HealthQueue] + def get_queue_mails(threshold: nil) + api_path = '/health/queue/mails' + + api_params = { + threshold: threshold, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::HealthQueue + ) + end + + + # Get the number of messages that are waiting to be processed in the Appwrite + # internal queue server. + # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + # + # @return [HealthQueue] + def get_queue_messaging(threshold: nil) + api_path = '/health/queue/messaging' + + api_params = { + threshold: threshold, + } + + api_headers = { + "content-type": 'application/json', + } + + @client.call( + method: 'GET', + path: api_path, + headers: api_headers, + params: api_params, + response_type: Models::HealthQueue + ) + end + + + # Get the number of migrations that are waiting to be processed in the + # Appwrite internal queue server. + # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + # + # @return [HealthQueue] + def get_queue_migrations(threshold: nil) + api_path = '/health/queue/migrations' + + api_params = { + threshold: threshold, } api_headers = { @@ -231,12 +401,14 @@ def get_queue_logs() # Get the number of webhooks that are waiting to be processed in the Appwrite # internal queue server. # + # @param [Integer] threshold Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. # # @return [HealthQueue] - def get_queue_webhooks() + def get_queue_webhooks(threshold: nil) api_path = '/health/queue/webhooks' api_params = { + threshold: threshold, } api_headers = { diff --git a/lib/appwrite/services/storage.rb b/lib/appwrite/services/storage.rb index 34d828d..1015725 100644 --- a/lib/appwrite/services/storage.rb +++ b/lib/appwrite/services/storage.rb @@ -40,8 +40,8 @@ def list_buckets(queries: nil, search: nil) # # @param [String] bucket_id Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Bucket name - # @param [Array] permissions An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions). - # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions). + # @param [Array] permissions An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB. # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. @@ -123,8 +123,8 @@ def get_bucket(bucket_id:) # # @param [String] bucket_id Bucket unique ID. # @param [String] name Bucket name - # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions). - # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions). + # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). # @param [] enabled Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB. # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. @@ -203,7 +203,7 @@ def delete_bucket(bucket_id:) # Get a list of all the user files. You can use the query params to filter # your results. # - # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded # @param [String] search Search term to filter your list results. Max length: 256 chars. # @@ -237,8 +237,8 @@ def list_files(bucket_id:, queries: nil, search: nil) # Create a new file. Before using this route, you should create a new bucket # resource using either a [server - # integration](/docs/server/storage#storageCreateBucket) API or directly from - # your Appwrite console. + # integration](https://appwrite.io/docs/server/storage#storageCreateBucket) + # API or directly from your Appwrite console. # # Larger files should be uploaded using multiple requests with the # [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) @@ -254,10 +254,10 @@ def list_files(bucket_id:, queries: nil, search: nil) # chunking logic will be managed by the SDK internally. # # - # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - # @param [file] file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](/docs/storage#file-input). - # @param [Array] permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions). + # @param [file] file Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/storage#file-input). + # @param [Array] permissions An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). # # @return [File] def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil) @@ -304,7 +304,7 @@ def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil) # Get a file by its unique ID. This endpoint response returns a JSON object # with the file metadata. # - # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File ID. # # @return [File] @@ -341,10 +341,10 @@ def get_file(bucket_id:, file_id:) # Update a file by its unique ID. Only users with write permissions have # access to update this resource. # - # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File unique ID. # @param [String] name Name of the file - # @param [Array] permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions). + # @param [Array] permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). # # @return [File] def update_file(bucket_id:, file_id:, name: nil, permissions: nil) @@ -382,7 +382,7 @@ def update_file(bucket_id:, file_id:, name: nil, permissions: nil) # Delete a file by its unique ID. Only users with write permissions have # access to delete this resource. # - # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File ID. # # @return [] @@ -419,7 +419,7 @@ def delete_file(bucket_id:, file_id:) # 'Content-Disposition: attachment' header that tells the browser to start # downloading the file to user downloads directory. # - # @param [String] bucket_id Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File ID. # # @return [] @@ -458,7 +458,7 @@ def get_file_download(bucket_id:, file_id:) # string arguments for cutting and resizing your preview image. Preview is # supported only for image files smaller than 10MB. # - # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File ID # @param [Integer] width Resize preview image width, Pass an integer between 0 to 4000. # @param [Integer] height Resize preview image height, Pass an integer between 0 to 4000. @@ -517,7 +517,7 @@ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil # download method but returns with no 'Content-Disposition: attachment' # header. # - # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket). + # @param [String] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). # @param [String] file_id File ID. # # @return [] diff --git a/lib/appwrite/services/teams.rb b/lib/appwrite/services/teams.rb index 27eddc2..cd2534c 100644 --- a/lib/appwrite/services/teams.rb +++ b/lib/appwrite/services/teams.rb @@ -42,7 +42,7 @@ def list(queries: nil, search: nil) # # @param [String] team_id Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] name Team name. Max length: 128 chars. - # @param [Array] roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + # @param [Array] roles Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. # # @return [Team] def create(team_id:, name:, roles: nil) @@ -220,8 +220,8 @@ def list_memberships(team_id:, queries: nil, search: nil) # # Use the `url` parameter to redirect the user from the invitation email to # your app. After the user is redirected, use the [Update Team Membership - # Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow - # the user to accept the invitation to the team. + # Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) + # endpoint to allow the user to accept the invitation to the team. # # Please note that to avoid a [Redirect # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) @@ -230,7 +230,7 @@ def list_memberships(team_id:, queries: nil, search: nil) # # # @param [String] team_id Team ID. - # @param [Array] roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + # @param [Array] roles Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. # @param [String] email Email of the new team member. # @param [String] user_id ID of the user to be added to a team. # @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -312,7 +312,7 @@ def get_membership(team_id:, membership_id:) # Modify the roles of a team member. Only team members with the owner role # have access to this endpoint. Learn more about [roles and - # permissions](/docs/permissions). + # permissions](https://appwrite.io/docs/permissions). # # # @param [String] team_id Team ID. @@ -448,7 +448,7 @@ def update_membership_status(team_id:, membership_id:, user_id:, secret:) # Get the team's shared preferences by its unique ID. If a preference doesn't # need to be shared by all team members, prefer storing them in [user - # preferences](/docs/client/account#accountGetPrefs). + # preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). # # @param [String] team_id Team ID. # diff --git a/lib/appwrite/services/users.rb b/lib/appwrite/services/users.rb index 8175c18..7b622f2 100644 --- a/lib/appwrite/services/users.rb +++ b/lib/appwrite/services/users.rb @@ -76,8 +76,8 @@ def create(user_id:, email: nil, phone: nil, password: nil, name: nil) # Create a new user. Password provided must be hashed with the # [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST - # /users](/docs/server/users#usersCreate) endpoint to create users with a - # plain text password. + # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + # create users with a plain text password. # # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. @@ -123,8 +123,8 @@ def create_argon2_user(user_id:, email:, password:, name: nil) # Create a new user. Password provided must be hashed with the # [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST - # /users](/docs/server/users#usersCreate) endpoint to create users with a - # plain text password. + # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + # create users with a plain text password. # # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. @@ -227,8 +227,8 @@ def delete_identity(identity_id:) # Create a new user. Password provided must be hashed with the # [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST - # /users](/docs/server/users#usersCreate) endpoint to create users with a - # plain text password. + # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + # create users with a plain text password. # # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. @@ -274,8 +274,8 @@ def create_md5_user(user_id:, email:, password:, name: nil) # Create a new user. Password provided must be hashed with the # [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST - # /users](/docs/server/users#usersCreate) endpoint to create users with a - # plain text password. + # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + # create users with a plain text password. # # @param [String] user_id User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. @@ -321,8 +321,8 @@ def create_ph_pass_user(user_id:, email:, password:, name: nil) # Create a new user. Password provided must be hashed with the # [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST - # /users](/docs/server/users#usersCreate) endpoint to create users with a - # plain text password. + # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + # create users with a plain text password. # # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. @@ -398,8 +398,9 @@ def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu # Create a new user. Password provided must be hashed with the [Scrypt # Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) - # algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint - # to create users with a plain text password. + # algorithm. Use the [POST + # /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to + # create users with a plain text password. # # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. @@ -463,8 +464,8 @@ def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, pas # Create a new user. Password provided must be hashed with the # [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use - # the [POST /users](/docs/server/users#usersCreate) endpoint to create users - # with a plain text password. + # the [POST /users](https://appwrite.io/docs/server/users#usersCreate) + # endpoint to create users with a plain text password. # # @param [String] user_id User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. # @param [String] email User email. @@ -543,7 +544,8 @@ def get(user_id:) # Delete a user by its unique ID, thereby releasing it's ID. Since ID is # released and can be reused, all user-related resources like documents or # storage files should be deleted before user deletion. If you want to keep - # ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus) + # ID reserved, use the + # [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) # endpoint instead. # # @param [String] user_id User ID. @@ -614,7 +616,7 @@ def update_email(user_id:, email:) # Labels can be used to grant access to resources. While teams are a way for # user's to share access to a resource, labels can be defined by the # developer to grant access without an invitation. See the [Permissions - # docs](/docs/permissions) for more info. + # docs](https://appwrite.io/docs/permissions) for more info. # # @param [String] user_id User ID. # @param [Array] labels Array of user labels. Replaces the previous labels. Maximum of 100 labels are allowed, each up to 36 alphanumeric characters long. From 05167f02f0b716f85ae9ab9897b93edaadb72e32 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 16 Nov 2023 21:32:09 +1300 Subject: [PATCH 2/2] Fix between query output --- appwrite.gemspec | 2 +- lib/appwrite/client.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appwrite.gemspec b/appwrite.gemspec index c3bfe79..9d54bbd 100644 --- a/appwrite.gemspec +++ b/appwrite.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |spec| spec.name = 'appwrite' - spec.version = '10.0.1' + spec.version = '10.1.0' spec.license = 'BSD-3-Clause' spec.summary = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API' spec.author = 'Appwrite Team' diff --git a/lib/appwrite/client.rb b/lib/appwrite/client.rb index 715f631..89fcfea 100644 --- a/lib/appwrite/client.rb +++ b/lib/appwrite/client.rb @@ -15,7 +15,7 @@ def initialize 'x-sdk-name'=> 'Ruby', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'ruby', - 'x-sdk-version'=> '10.0.1', + 'x-sdk-version'=> '10.1.0', 'X-Appwrite-Response-Format' => '1.4.0' } @endpoint = 'https://HOSTNAME/v1'