From b5c42ab88e96d6c254ecb5eae8264ea7354f3329 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 2 May 2020 07:23:56 +0300 Subject: [PATCH] Updated server SDKs --- app/sdks/console-javascript/README.md | 3 + .../examples/database/get-collection-logs.md | 14 + .../docs/examples/health/get-cache.md | 14 + .../docs/examples/health/get-d-b.md | 14 + .../examples/health/get-queue-certificates.md | 14 + .../docs/examples/health/get-queue-logs.md | 14 + .../docs/examples/health/get-queue-tasks.md | 14 + .../docs/examples/health/get-queue-usage.md | 14 + .../examples/health/get-queue-webhooks.md | 14 + .../examples/health/get-storage-anti-virus.md | 14 + .../docs/examples/health/get-storage-local.md | 14 + .../docs/examples/health/get-time.md | 14 + .../docs/examples/health/get.md | 14 + app/sdks/console-javascript/package.json | 2 +- app/sdks/console-javascript/src/sdk.js | 294 ++++++++++++++++-- app/sdks/console-javascript/src/sdk.min.js | 33 +- app/sdks/console-javascript/types/index.d.ts | 147 ++++++++- app/sdks/flutter-dart/README.md | 3 + .../docs/examples/account/update-recovery.md | 4 +- .../flutter-dart/lib/services/account.dart | 8 +- .../flutter-dart/lib/services/database.dart | 8 +- app/sdks/server-go/README.md | 3 + app/sdks/server-go/database.go | 17 +- .../examples/database/get-collection-logs.md | 25 ++ .../docs/examples/health/get-cache.md | 25 ++ .../server-go/docs/examples/health/get-d-b.md | 25 ++ .../examples/health/get-queue-certificates.md | 25 ++ .../docs/examples/health/get-queue-logs.md | 25 ++ .../docs/examples/health/get-queue-tasks.md | 25 ++ .../docs/examples/health/get-queue-usage.md | 25 ++ .../examples/health/get-queue-webhooks.md | 25 ++ .../examples/health/get-storage-anti-virus.md | 25 ++ .../docs/examples/health/get-storage-local.md | 25 ++ .../docs/examples/health/get-time.md | 25 ++ .../server-go/docs/examples/health/get.md | 25 ++ app/sdks/server-go/health.go | 143 +++++++++ app/sdks/server-go/users.go | 5 +- app/sdks/server-nodejs/README.md | 3 + .../examples/database/get-collection-logs.md | 19 ++ .../docs/examples/health/get-cache.md | 19 ++ .../docs/examples/health/get-d-b.md | 19 ++ .../examples/health/get-queue-certificates.md | 19 ++ .../docs/examples/health/get-queue-logs.md | 19 ++ .../docs/examples/health/get-queue-tasks.md | 19 ++ .../docs/examples/health/get-queue-usage.md | 19 ++ .../examples/health/get-queue-webhooks.md | 19 ++ .../examples/health/get-storage-anti-virus.md | 19 ++ .../docs/examples/health/get-storage-local.md | 19 ++ .../docs/examples/health/get-time.md | 19 ++ .../server-nodejs/docs/examples/health/get.md | 19 ++ app/sdks/server-nodejs/index.js | 2 + .../server-nodejs/lib/services/database.js | 23 +- app/sdks/server-nodejs/lib/services/health.js | 217 +++++++++++++ app/sdks/server-nodejs/lib/services/users.js | 3 +- app/sdks/server-nodejs/package.json | 2 +- app/sdks/server-php/README.md | 3 + app/sdks/server-php/composer.json | 4 +- app/sdks/server-php/docs/avatars.md | 2 +- app/sdks/server-php/docs/database.md | 18 +- .../examples/database/get-collection-logs.md | 15 + .../docs/examples/health/get-cache.md | 15 + .../docs/examples/health/get-d-b.md | 15 + .../examples/health/get-queue-certificates.md | 15 + .../docs/examples/health/get-queue-logs.md | 15 + .../docs/examples/health/get-queue-tasks.md | 15 + .../docs/examples/health/get-queue-usage.md | 15 + .../examples/health/get-queue-webhooks.md | 15 + .../examples/health/get-storage-anti-virus.md | 15 + .../docs/examples/health/get-storage-local.md | 15 + .../docs/examples/health/get-time.md | 15 + .../server-php/docs/examples/health/get.md | 15 + app/sdks/server-php/docs/health.md | 90 ++++++ app/sdks/server-php/docs/users.md | 4 +- .../src/Appwrite/Services/Database.php | 24 +- .../src/Appwrite/Services/Health.php | 233 ++++++++++++++ .../src/Appwrite/Services/Users.php | 3 +- app/sdks/server-python/README.md | 3 + .../appwrite/services/database.py | 17 +- .../server-python/appwrite/services/health.py | 117 +++++++ .../server-python/appwrite/services/users.py | 4 +- .../examples/database/get-collection-logs.md | 13 + .../docs/examples/health/get-cache.md | 13 + .../docs/examples/health/get-d-b.md | 13 + .../examples/health/get-queue-certificates.md | 13 + .../docs/examples/health/get-queue-logs.md | 13 + .../docs/examples/health/get-queue-tasks.md | 13 + .../docs/examples/health/get-queue-usage.md | 13 + .../examples/health/get-queue-webhooks.md | 13 + .../examples/health/get-storage-anti-virus.md | 13 + .../docs/examples/health/get-storage-local.md | 13 + .../docs/examples/health/get-time.md | 13 + .../server-python/docs/examples/health/get.md | 13 + app/sdks/server-python/setup.py | 4 +- app/sdks/server-ruby/README.md | 3 + app/sdks/server-ruby/appwrite.gemspec | 4 +- app/sdks/server-ruby/lib/appwrite.rb | 1 + .../lib/appwrite/services/database.rb | 18 +- .../lib/appwrite/services/health.rb | 130 ++++++++ .../lib/appwrite/services/users.rb | 4 +- app/sdks/web-javascript/README.md | 3 + app/sdks/web-javascript/package.json | 2 +- app/sdks/web-javascript/src/sdk.js | 32 +- app/sdks/web-javascript/src/sdk.min.js | 20 +- app/sdks/web-javascript/types/index.d.ts | 6 +- 104 files changed, 2582 insertions(+), 119 deletions(-) create mode 100644 app/sdks/console-javascript/docs/examples/database/get-collection-logs.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-cache.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-d-b.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-queue-certificates.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-queue-logs.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-queue-tasks.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-queue-usage.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-queue-webhooks.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-storage-anti-virus.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-storage-local.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get-time.md create mode 100644 app/sdks/console-javascript/docs/examples/health/get.md create mode 100644 app/sdks/server-go/docs/examples/database/get-collection-logs.md create mode 100644 app/sdks/server-go/docs/examples/health/get-cache.md create mode 100644 app/sdks/server-go/docs/examples/health/get-d-b.md create mode 100644 app/sdks/server-go/docs/examples/health/get-queue-certificates.md create mode 100644 app/sdks/server-go/docs/examples/health/get-queue-logs.md create mode 100644 app/sdks/server-go/docs/examples/health/get-queue-tasks.md create mode 100644 app/sdks/server-go/docs/examples/health/get-queue-usage.md create mode 100644 app/sdks/server-go/docs/examples/health/get-queue-webhooks.md create mode 100644 app/sdks/server-go/docs/examples/health/get-storage-anti-virus.md create mode 100644 app/sdks/server-go/docs/examples/health/get-storage-local.md create mode 100644 app/sdks/server-go/docs/examples/health/get-time.md create mode 100644 app/sdks/server-go/docs/examples/health/get.md create mode 100644 app/sdks/server-go/health.go create mode 100644 app/sdks/server-nodejs/docs/examples/database/get-collection-logs.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-cache.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-d-b.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-queue-certificates.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-queue-logs.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-queue-tasks.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-queue-usage.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-queue-webhooks.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-storage-anti-virus.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-storage-local.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get-time.md create mode 100644 app/sdks/server-nodejs/docs/examples/health/get.md create mode 100644 app/sdks/server-nodejs/lib/services/health.js create mode 100644 app/sdks/server-php/docs/examples/database/get-collection-logs.md create mode 100644 app/sdks/server-php/docs/examples/health/get-cache.md create mode 100644 app/sdks/server-php/docs/examples/health/get-d-b.md create mode 100644 app/sdks/server-php/docs/examples/health/get-queue-certificates.md create mode 100644 app/sdks/server-php/docs/examples/health/get-queue-logs.md create mode 100644 app/sdks/server-php/docs/examples/health/get-queue-tasks.md create mode 100644 app/sdks/server-php/docs/examples/health/get-queue-usage.md create mode 100644 app/sdks/server-php/docs/examples/health/get-queue-webhooks.md create mode 100644 app/sdks/server-php/docs/examples/health/get-storage-anti-virus.md create mode 100644 app/sdks/server-php/docs/examples/health/get-storage-local.md create mode 100644 app/sdks/server-php/docs/examples/health/get-time.md create mode 100644 app/sdks/server-php/docs/examples/health/get.md create mode 100644 app/sdks/server-php/docs/health.md create mode 100644 app/sdks/server-php/src/Appwrite/Services/Health.php create mode 100644 app/sdks/server-python/appwrite/services/health.py create mode 100644 app/sdks/server-python/docs/examples/database/get-collection-logs.md create mode 100644 app/sdks/server-python/docs/examples/health/get-cache.md create mode 100644 app/sdks/server-python/docs/examples/health/get-d-b.md create mode 100644 app/sdks/server-python/docs/examples/health/get-queue-certificates.md create mode 100644 app/sdks/server-python/docs/examples/health/get-queue-logs.md create mode 100644 app/sdks/server-python/docs/examples/health/get-queue-tasks.md create mode 100644 app/sdks/server-python/docs/examples/health/get-queue-usage.md create mode 100644 app/sdks/server-python/docs/examples/health/get-queue-webhooks.md create mode 100644 app/sdks/server-python/docs/examples/health/get-storage-anti-virus.md create mode 100644 app/sdks/server-python/docs/examples/health/get-storage-local.md create mode 100644 app/sdks/server-python/docs/examples/health/get-time.md create mode 100644 app/sdks/server-python/docs/examples/health/get.md create mode 100644 app/sdks/server-ruby/lib/appwrite/services/health.rb diff --git a/app/sdks/console-javascript/README.md b/app/sdks/console-javascript/README.md index 68d952074c..3911d7c430 100644 --- a/app/sdks/console-javascript/README.md +++ b/app/sdks/console-javascript/README.md @@ -3,6 +3,9 @@ ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?v=1) ![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the JS SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ![Appwrite](https://appwrite.io/images/github.png) diff --git a/app/sdks/console-javascript/docs/examples/database/get-collection-logs.md b/app/sdks/console-javascript/docs/examples/database/get-collection-logs.md new file mode 100644 index 0000000000..09a05445ed --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/database/get-collection-logs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.getCollectionLogs('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-cache.md b/app/sdks/console-javascript/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..046c5ea191 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-cache.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getCache(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-d-b.md b/app/sdks/console-javascript/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..5ce56a6c4e --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-d-b.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getDB(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-queue-certificates.md b/app/sdks/console-javascript/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..0ab304c378 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-queue-logs.md b/app/sdks/console-javascript/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..35078edc21 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-queue-logs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-queue-tasks.md b/app/sdks/console-javascript/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..90ae978371 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-queue-usage.md b/app/sdks/console-javascript/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..1c04d04fe9 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-queue-usage.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-queue-webhooks.md b/app/sdks/console-javascript/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..18970f2157 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-storage-anti-virus.md b/app/sdks/console-javascript/docs/examples/health/get-storage-anti-virus.md new file mode 100644 index 0000000000..06cc087c43 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-storage-anti-virus.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getStorageAntiVirus(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-storage-local.md b/app/sdks/console-javascript/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..f034f47f9a --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-storage-local.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get-time.md b/app/sdks/console-javascript/docs/examples/health/get-time.md new file mode 100644 index 0000000000..d579c981a3 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get-time.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getTime(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/docs/examples/health/get.md b/app/sdks/console-javascript/docs/examples/health/get.md new file mode 100644 index 0000000000..0f7b186341 --- /dev/null +++ b/app/sdks/console-javascript/docs/examples/health/get.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/console-javascript/package.json b/app/sdks/console-javascript/package.json index 4f57b56fa0..6c53a70307 100644 --- a/app/sdks/console-javascript/package.json +++ b/app/sdks/console-javascript/package.json @@ -1,7 +1,7 @@ { "name": "appwrite", "homepage": "https://appwrite.io/support", - "description": "", + "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", "version": "1.0.0", "license": "BSD-3-Clause", "main": "src/sdk.js", diff --git a/app/sdks/console-javascript/src/sdk.js b/app/sdks/console-javascript/src/sdk.js index 42fb66ee94..1379f8ced7 100644 --- a/app/sdks/console-javascript/src/sdk.js +++ b/app/sdks/console-javascript/src/sdk.js @@ -494,7 +494,7 @@ } if(oldPassword) { - payload['old-password'] = oldPassword; + payload['oldPassword'] = oldPassword; } return http @@ -608,12 +608,12 @@ * * @param {string} userId * @param {string} secret - * @param {string} passwordA - * @param {string} passwordB + * @param {string} password + * @param {string} passwordAgain * @throws {Error} * @return {Promise} */ - updateRecovery: function(userId, secret, passwordA, passwordB) { + updateRecovery: function(userId, secret, password, passwordAgain) { if(userId === undefined) { throw new Error('Missing required parameter: "userId"'); } @@ -622,12 +622,12 @@ throw new Error('Missing required parameter: "secret"'); } - if(passwordA === undefined) { - throw new Error('Missing required parameter: "passwordA"'); + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); } - if(passwordB === undefined) { - throw new Error('Missing required parameter: "passwordB"'); + if(passwordAgain === undefined) { + throw new Error('Missing required parameter: "passwordAgain"'); } let path = '/account/recovery'; @@ -642,12 +642,12 @@ payload['secret'] = secret; } - if(passwordA) { - payload['password-a'] = passwordA; + if(password) { + payload['password'] = password; } - if(passwordB) { - payload['password-b'] = passwordB; + if(passwordAgain) { + payload['passwordAgain'] = passwordAgain; } return http @@ -748,7 +748,7 @@ * @throws {Error} * @return {Promise} */ - createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') { + createOAuth2Session: function(provider, success = 'https://localhost:2444/auth/oauth2/success', failure = 'https://localhost:2444/auth/oauth2/failure') { if(provider === undefined) { throw new Error('Missing required parameter: "provider"'); } @@ -1371,15 +1371,15 @@ } if(orderField) { - payload['order-field'] = orderField; + payload['orderField'] = orderField; } if(orderType) { - payload['order-type'] = orderType; + payload['orderType'] = orderType; } if(orderCast) { - payload['order-cast'] = orderCast; + payload['orderCast'] = orderCast; } if(search) { @@ -1580,6 +1580,254 @@ .delete(path, { 'content-type': 'application/json', }, payload); + }, + + /** + * Get Collection Logs + * + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + getCollectionLogs: function(collectionId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let health = { + + /** + * Check API HTTP Health + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/health'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check Cache Health + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws {Error} + * @return {Promise} + */ + getCache: function() { + let path = '/health/cache'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check DB Health + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getDB: function() { + let path = '/health/db'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check the number of pending certificate messages + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueCertificates: function() { + let path = '/health/queue/certificates'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check the number of pending log messages + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueLogs: function() { + let path = '/health/queue/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check the number of pending task messages + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueTasks: function() { + let path = '/health/queue/tasks'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check the number of pending usage messages + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueUsage: function() { + let path = '/health/queue/usage'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check number of pending webhook messages + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueWebhooks: function() { + let path = '/health/queue/webhooks'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check Anti virus Health + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageAntiVirus: function() { + let path = '/health/storage/anti-virus'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check File System Health + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageLocal: function() { + let path = '/health/storage/local'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Check Time Health + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws {Error} + * @return {Promise} + */ + getTime: function() { + let path = '/health/time'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); } }; @@ -2751,10 +2999,11 @@ * * * @param {string} projectId + * @param {string} range * @throws {Error} * @return {Promise} */ - getUsage: function(projectId) { + getUsage: function(projectId, range = 'last30') { if(projectId === undefined) { throw new Error('Missing required parameter: "projectId"'); } @@ -2763,6 +3012,10 @@ let payload = {}; + if(range) { + payload['range'] = range; + } + return http .get(path, { 'content-type': 'application/json', @@ -3888,14 +4141,10 @@ throw new Error('Missing required parameter: "sessionId"'); } - let path = '/users/{userId}/sessions/:session'.replace(new RegExp('{userId}', 'g'), userId); + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); let payload = {}; - if(sessionId) { - payload['sessionId'] = sessionId; - } - return http .delete(path, { 'content-type': 'application/json', @@ -3945,6 +4194,7 @@ account: account, avatars: avatars, database: database, + health: health, locale: locale, projects: projects, storage: storage, diff --git a/app/sdks/console-javascript/src/sdk.min.js b/app/sdks/console-javascript/src/sdk.min.js index 5bc56c5a32..0023277bf9 100644 --- a/app/sdks/console-javascript/src/sdk.min.js +++ b/app/sdks/console-javascript/src/sdk.min.js @@ -26,26 +26,26 @@ let path='/account/name';let payload={};if(name){payload.name=name} return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')} let path='/account/password';let payload={};if(password){payload.password=password} -if(oldPassword){payload['old-password']=oldPassword} +if(oldPassword){payload.oldPassword=oldPassword} return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs} return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} if(url===undefined){throw new Error('Missing required parameter: "url"')} let path='/account/recovery';let payload={};if(email){payload.email=email} if(url){payload.url=url} -return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} if(secret===undefined){throw new Error('Missing required parameter: "secret"')} -if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"')} -if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"')} let path='/account/recovery';let payload={};if(userId){payload.userId=userId} if(secret){payload.secret=secret} -if(passwordA){payload['password-a']=passwordA} -if(passwordB){payload['password-b']=passwordB} +if(password){payload.password=password} +if(passwordAgain){payload.passwordAgain=passwordAgain} return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} if(password===undefined){throw new Error('Missing required parameter: "password"')} let path='/account/sessions';let payload={};if(email){payload.email=email} if(password){payload.password=password} -return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} +return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://localhost:2444/auth/oauth2/success',failure='https://localhost:2444/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} if(failure){payload.failure=failure} payload.project=config.project;payload.key=config.key;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')} @@ -104,9 +104,9 @@ let path='/database/collections/{collectionId}'.replace(new RegExp('{collectionI let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters} if(offset){payload.offset=offset} if(limit){payload.limit=limit} -if(orderField){payload['order-field']=orderField} -if(orderType){payload['order-type']=orderType} -if(orderCast){payload['order-cast']=orderCast} +if(orderField){payload.orderField=orderField} +if(orderType){payload.orderType=orderType} +if(orderCast){payload.orderCast=orderCast} if(search){payload.search=search} if(first){payload.first=first} if(last){payload.last=last} @@ -132,7 +132,8 @@ if(read){payload.read=read} if(write){payload.write=write} return http.patch(path,{'content-type':'application/json',},payload)},deleteDocument:function(collectionId,documentId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} if(documentId===undefined){throw new Error('Missing required parameter: "documentId"')} -let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')} +let path='/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}','g'),collectionId).replace(new RegExp('{documentId}','g'),documentId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getCollectionLogs:function(collectionId){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')} +let path='/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let health={get:function(){let path='/health';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCache:function(){let path='/health/cache';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getDB:function(){let path='/health/db';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueCertificates:function(){let path='/health/queue/certificates';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueLogs:function(){let path='/health/queue/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueTasks:function(){let path='/health/queue/tasks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueUsage:function(){let path='/health/queue/usage';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getQueueWebhooks:function(){let path='/health/queue/webhooks';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getStorageAntiVirus:function(){let path='/health/storage/anti-virus';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getStorageLocal:function(){let path='/health/storage/local';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getTime:function(){let path='/health/time';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let locale={get:function(){let path='/locale';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getContinents:function(){let path='/locale/continents';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountries:function(){let path='/locale/countries';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesEU:function(){let path='/locale/countries/eu';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCountriesPhones:function(){let path='/locale/countries/phones';let payload={};return http.get(path,{'content-type':'application/json',},payload)},getCurrencies:function(){let path='/locale/currencies';let payload={};return http.get(path,{'content-type':'application/json',},payload)}};let projects={list:function(){let path='/projects';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(name,teamId,description='',logo='',url='',legalName='',legalCountry='',legalState='',legalCity='',legalAddress='',legalTaxId=''){if(name===undefined){throw new Error('Missing required parameter: "name"')} if(teamId===undefined){throw new Error('Missing required parameter: "teamId"')} let path='/projects';let payload={};if(name){payload.name=name} if(teamId){payload.teamId=teamId} @@ -250,8 +251,9 @@ if(httpUser){payload.httpUser=httpUser} if(httpPass){payload.httpPass=httpPass} return http.put(path,{'content-type':'application/json',},payload)},deleteTask:function(projectId,taskId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')} if(taskId===undefined){throw new Error('Missing required parameter: "taskId"')} -let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getUsage:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')} -let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')} +let path='/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{taskId}','g'),taskId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getUsage:function(projectId,range='last30'){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')} +let path='/projects/{projectId}/usage'.replace(new RegExp('{projectId}','g'),projectId);let payload={};if(range){payload.range=range} +return http.get(path,{'content-type':'application/json',},payload)},listWebhooks:function(projectId){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')} let path='/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}','g'),projectId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},createWebhook:function(projectId,name,events,url,security,httpUser='',httpPass=''){if(projectId===undefined){throw new Error('Missing required parameter: "projectId"')} if(name===undefined){throw new Error('Missing required parameter: "name"')} if(events===undefined){throw new Error('Missing required parameter: "events"')} @@ -353,8 +355,7 @@ return http.patch(path,{'content-type':'application/json',},payload)},getSession let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},deleteSessions:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} let path='/users/{userId}/sessions'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},deleteSession:function(userId,sessionId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')} -let path='/users/{userId}/sessions/:session'.replace(new RegExp('{userId}','g'),userId);let payload={};if(sessionId){payload.sessionId=sessionId} -return http.delete(path,{'content-type':'application/json',},payload)},updateStatus:function(userId,status){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +let path='/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}','g'),userId).replace(new RegExp('{sessionId}','g'),sessionId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateStatus:function(userId,status){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} if(status===undefined){throw new Error('Missing required parameter: "status"')} let path='/users/{userId}/status'.replace(new RegExp('{userId}','g'),userId);let payload={};if(status){payload.status=status} -return http.patch(path,{'content-type':'application/json',},payload)}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,avatars:avatars,database:database,locale:locale,projects:projects,storage:storage,teams:teams,users:users}};if(typeof module!=="undefined"){module.exports=window.Appwrite}})((typeof window!=="undefined")?window:{}) \ No newline at end of file +return http.patch(path,{'content-type':'application/json',},payload)}};return{setEndpoint:setEndpoint,setProject:setProject,setKey:setKey,setLocale:setLocale,setMode:setMode,account:account,avatars:avatars,database:database,health:health,locale:locale,projects:projects,storage:storage,teams:teams,users:users}};if(typeof module!=="undefined"){module.exports=window.Appwrite}})((typeof window!=="undefined")?window:{}) \ No newline at end of file diff --git a/app/sdks/console-javascript/types/index.d.ts b/app/sdks/console-javascript/types/index.d.ts index 359cb31935..5416bcd5a9 100644 --- a/app/sdks/console-javascript/types/index.d.ts +++ b/app/sdks/console-javascript/types/index.d.ts @@ -57,6 +57,7 @@ declare class Appwrite { account:Appwrite.Account; avatars:Appwrite.Avatars; database:Appwrite.Database; + health:Appwrite.Health; locale:Appwrite.Locale; projects:Appwrite.Projects; storage:Appwrite.Storage; @@ -215,12 +216,12 @@ declare namespace Appwrite { * * @param {string} userId * @param {string} secret - * @param {string} passwordA - * @param {string} passwordB + * @param {string} password + * @param {string} passwordAgain * @throws {Error} * @return {Promise} */ - updateRecovery(userId: string, secret: string, passwordA: string, passwordB: string): Promise; + updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise; /** * Get Account Sessions @@ -576,6 +577,143 @@ declare namespace Appwrite { */ deleteDocument(collectionId: string, documentId: string): Promise; + /** + * Get Collection Logs + * + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + getCollectionLogs(collectionId: string): Promise; + + } + + export interface Health { + + /** + * Check API HTTP Health + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {Error} + * @return {Promise} + */ + get(): Promise; + + /** + * Check Cache Health + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws {Error} + * @return {Promise} + */ + getCache(): Promise; + + /** + * Check DB Health + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getDB(): Promise; + + /** + * Check the number of pending certificate messages + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueCertificates(): Promise; + + /** + * Check the number of pending log messages + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueLogs(): Promise; + + /** + * Check the number of pending task messages + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueTasks(): Promise; + + /** + * Check the number of pending usage messages + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueUsage(): Promise; + + /** + * Check number of pending webhook messages + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueWebhooks(): Promise; + + /** + * Check Anti virus Health + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageAntiVirus(): Promise; + + /** + * Check File System Health + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageLocal(): Promise; + + /** + * Check Time Health + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws {Error} + * @return {Promise} + */ + getTime(): Promise; + } export interface Locale { @@ -987,10 +1125,11 @@ declare namespace Appwrite { * * * @param {string} projectId + * @param {string} range * @throws {Error} * @return {Promise} */ - getUsage(projectId: string): Promise; + getUsage(projectId: string, range: string): Promise; /** * List Webhooks diff --git a/app/sdks/flutter-dart/README.md b/app/sdks/flutter-dart/README.md index 97c2116265..7c84ddd863 100644 --- a/app/sdks/flutter-dart/README.md +++ b/app/sdks/flutter-dart/README.md @@ -6,6 +6,9 @@ **This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.** +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Dart SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/app/sdks/flutter-dart/docs/examples/account/update-recovery.md b/app/sdks/flutter-dart/docs/examples/account/update-recovery.md index d1e420e549..07c892deb6 100644 --- a/app/sdks/flutter-dart/docs/examples/account/update-recovery.md +++ b/app/sdks/flutter-dart/docs/examples/account/update-recovery.md @@ -11,8 +11,8 @@ client Future result = account.updateRecovery( userId: '[USER_ID]', secret: '[SECRET]', - passwordA: 'password', - passwordB: 'password', + password: 'password', + passwordAgain: 'password', ); result diff --git a/app/sdks/flutter-dart/lib/services/account.dart b/app/sdks/flutter-dart/lib/services/account.dart index ea87290a8e..92951ce5cf 100644 --- a/app/sdks/flutter-dart/lib/services/account.dart +++ b/app/sdks/flutter-dart/lib/services/account.dart @@ -143,7 +143,7 @@ class Account extends Service { final Map params = { 'password': password, - 'old-password': oldPassword, + 'oldPassword': oldPassword, }; final Map headers = { @@ -225,14 +225,14 @@ class Account extends Service { /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. /// - Future updateRecovery({@required String userId, @required String secret, @required String passwordA, @required String passwordB}) { + Future updateRecovery({@required String userId, @required String secret, @required String password, @required String passwordAgain}) { final String path = '/account/recovery'; final Map params = { 'userId': userId, 'secret': secret, - 'password-a': passwordA, - 'password-b': passwordB, + 'password': password, + 'passwordAgain': passwordAgain, }; final Map headers = { diff --git a/app/sdks/flutter-dart/lib/services/database.dart b/app/sdks/flutter-dart/lib/services/database.dart index 9b9ed854eb..1163c9dbb5 100644 --- a/app/sdks/flutter-dart/lib/services/database.dart +++ b/app/sdks/flutter-dart/lib/services/database.dart @@ -17,16 +17,16 @@ class Database extends Service { /// of the project documents. [Learn more about different API /// modes](/docs/admin). /// - Future listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', String orderType = 'ASC', String orderCast = 'string', String search = '', int first = 0, int last = 0}) { + Future listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = '', int first = 0, int last = 0}) { final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); final Map params = { 'filters': filters, 'offset': offset, 'limit': limit, - 'order-field': orderField, - 'order-type': orderType, - 'order-cast': orderCast, + 'orderField': orderField, + 'orderType': orderType.name(), + 'orderCast': orderCast, 'search': search, 'first': first, 'last': last, diff --git a/app/sdks/server-go/README.md b/app/sdks/server-go/README.md index ffb4abf27e..6769ae8da2 100644 --- a/app/sdks/server-go/README.md +++ b/app/sdks/server-go/README.md @@ -5,6 +5,9 @@ **This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.** +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Go SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/app/sdks/server-go/database.go b/app/sdks/server-go/database.go index 7e5f686bdb..d420d69fde 100644 --- a/app/sdks/server-go/database.go +++ b/app/sdks/server-go/database.go @@ -99,9 +99,9 @@ func (srv *Database) ListDocuments(CollectionId string, Filters []interface{}, O "filters": Filters, "offset": Offset, "limit": Limit, - "order-field": OrderField, - "order-type": OrderType, - "order-cast": OrderCast, + "orderField": OrderField, + "orderType": OrderType, + "orderCast": OrderCast, "search": Search, "first": First, "last": Last, @@ -165,3 +165,14 @@ func (srv *Database) DeleteDocument(CollectionId string, DocumentId string) (map return srv.client.Call("DELETE", path, nil, params) } + +// GetCollectionLogs +func (srv *Database) GetCollectionLogs(CollectionId string) (map[string]interface{}, error) { + r := strings.NewReplacer("{collectionId}", CollectionId) + path := r.Replace("/database/collections/{collectionId}/logs") + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} diff --git a/app/sdks/server-go/docs/examples/database/get-collection-logs.md b/app/sdks/server-go/docs/examples/database/get-collection-logs.md new file mode 100644 index 0000000000..4427295371 --- /dev/null +++ b/app/sdks/server-go/docs/examples/database/get-collection-logs.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Database{ + client: &client + } + + var response, error := service.GetCollectionLogs("[COLLECTION_ID]") + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-cache.md b/app/sdks/server-go/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..ce7b1c6f93 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-cache.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetCache() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-d-b.md b/app/sdks/server-go/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..6d86894417 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-d-b.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetDB() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-queue-certificates.md b/app/sdks/server-go/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..9954551580 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetQueueCertificates() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-queue-logs.md b/app/sdks/server-go/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..0b6280a42a --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-queue-logs.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetQueueLogs() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-queue-tasks.md b/app/sdks/server-go/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..28d615dc2c --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetQueueTasks() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-queue-usage.md b/app/sdks/server-go/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..e9fe988aa2 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-queue-usage.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetQueueUsage() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-queue-webhooks.md b/app/sdks/server-go/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..2f92835a12 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetQueueWebhooks() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-storage-anti-virus.md b/app/sdks/server-go/docs/examples/health/get-storage-anti-virus.md new file mode 100644 index 0000000000..8369b5ba07 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-storage-anti-virus.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetStorageAntiVirus() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-storage-local.md b/app/sdks/server-go/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..db0d5a5b21 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-storage-local.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetStorageLocal() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get-time.md b/app/sdks/server-go/docs/examples/health/get-time.md new file mode 100644 index 0000000000..dd8486a484 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get-time.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.GetTime() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/docs/examples/health/get.md b/app/sdks/server-go/docs/examples/health/get.md new file mode 100644 index 0000000000..df1cb27243 --- /dev/null +++ b/app/sdks/server-go/docs/examples/health/get.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go" +) + +func main() { + var client := appwrite.Client{} + + client.SetProject("5df5acd0d48c2") // Your project ID + client.SetKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key + + var service := appwrite.Health{ + client: &client + } + + var response, error := service.Get() + + if error != nil { + panic(error) + } + + fmt.Println(response) +} \ No newline at end of file diff --git a/app/sdks/server-go/health.go b/app/sdks/server-go/health.go new file mode 100644 index 0000000000..eb4832cebf --- /dev/null +++ b/app/sdks/server-go/health.go @@ -0,0 +1,143 @@ +package appwrite + +import ( +) + +// Health service +type Health struct { + client Client +} + +func NewHealth(clt Client) Health { + service := Health{ + client: clt, + } + + return service +} + +// Get check the Appwrite HTTP server is up and responsive. +func (srv *Health) Get() (map[string]interface{}, error) { + path := "/health" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetCache check the Appwrite in-memory cache server is up and connection is +// successful. +func (srv *Health) GetCache() (map[string]interface{}, error) { + path := "/health/cache" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetDB check the Appwrite database server is up and connection is +// successful. +func (srv *Health) GetDB() (map[string]interface{}, error) { + path := "/health/db" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetQueueCertificates get the number of certificates that are waiting to be +// issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite +// internal queue server. +func (srv *Health) GetQueueCertificates() (map[string]interface{}, error) { + path := "/health/queue/certificates" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetQueueLogs get the number of logs that are waiting to be processed in the +// Appwrite internal queue server. +func (srv *Health) GetQueueLogs() (map[string]interface{}, error) { + path := "/health/queue/logs" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetQueueTasks get the number of tasks that are waiting to be processed in +// the Appwrite internal queue server. +func (srv *Health) GetQueueTasks() (map[string]interface{}, error) { + path := "/health/queue/tasks" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetQueueUsage get the number of usage stats that are waiting to be +// processed in the Appwrite internal queue server. +func (srv *Health) GetQueueUsage() (map[string]interface{}, error) { + path := "/health/queue/usage" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetQueueWebhooks get the number of webhooks that are waiting to be +// processed in the Appwrite internal queue server. +func (srv *Health) GetQueueWebhooks() (map[string]interface{}, error) { + path := "/health/queue/webhooks" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetStorageAntiVirus check the Appwrite Anti Virus server is up and +// connection is successful. +func (srv *Health) GetStorageAntiVirus() (map[string]interface{}, error) { + path := "/health/storage/anti-virus" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetStorageLocal check the Appwrite local storage device is up and +// connection is successful. +func (srv *Health) GetStorageLocal() (map[string]interface{}, error) { + path := "/health/storage/local" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} + +// GetTime check the Appwrite server time is synced with Google remote NTP +// server. We use this technology to smoothly handle leap seconds with no +// disruptive events. The [Network Time +// Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is +// used by hundreds of millions of computers and devices to synchronize their +// clocks over the Internet. If your computer sets its own clock, it likely +// uses NTP. +func (srv *Health) GetTime() (map[string]interface{}, error) { + path := "/health/time" + + params := map[string]interface{}{ + } + + return srv.client.Call("GET", path, nil, params) +} diff --git a/app/sdks/server-go/users.go b/app/sdks/server-go/users.go index dc1b6be977..405b5a3209 100644 --- a/app/sdks/server-go/users.go +++ b/app/sdks/server-go/users.go @@ -115,11 +115,10 @@ func (srv *Users) DeleteSessions(UserId string) (map[string]interface{}, error) // DeleteSession delete user sessions by its unique ID. func (srv *Users) DeleteSession(UserId string, SessionId string) (map[string]interface{}, error) { - r := strings.NewReplacer("{userId}", UserId) - path := r.Replace("/users/{userId}/sessions/:session") + r := strings.NewReplacer("{userId}", UserId, "{sessionId}", SessionId) + path := r.Replace("/users/{userId}/sessions/{sessionId}") params := map[string]interface{}{ - "sessionId": SessionId, } return srv.client.Call("DELETE", path, nil, params) diff --git a/app/sdks/server-nodejs/README.md b/app/sdks/server-nodejs/README.md index 6195e94bd0..b51df55ce9 100644 --- a/app/sdks/server-nodejs/README.md +++ b/app/sdks/server-nodejs/README.md @@ -3,6 +3,9 @@ ![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?v=1) ![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Node.js SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/app/sdks/server-nodejs/docs/examples/database/get-collection-logs.md b/app/sdks/server-nodejs/docs/examples/database/get-collection-logs.md new file mode 100644 index 0000000000..580ca8fc3a --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/database/get-collection-logs.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.getCollectionLogs('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-cache.md b/app/sdks/server-nodejs/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..6b49af6ffd --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-cache.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getCache(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-d-b.md b/app/sdks/server-nodejs/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..273ad1ad74 --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-d-b.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getDB(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-queue-certificates.md b/app/sdks/server-nodejs/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..23494f189b --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-queue-logs.md b/app/sdks/server-nodejs/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..b4423c5c96 --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-queue-logs.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-queue-tasks.md b/app/sdks/server-nodejs/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..f581d8c1ed --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-queue-usage.md b/app/sdks/server-nodejs/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..e8774856ce --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-queue-usage.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-queue-webhooks.md b/app/sdks/server-nodejs/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..24333e8ec4 --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-storage-anti-virus.md b/app/sdks/server-nodejs/docs/examples/health/get-storage-anti-virus.md new file mode 100644 index 0000000000..70c3850375 --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-storage-anti-virus.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getStorageAntiVirus(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-storage-local.md b/app/sdks/server-nodejs/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..2323be7d9d --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-storage-local.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get-time.md b/app/sdks/server-nodejs/docs/examples/health/get-time.md new file mode 100644 index 0000000000..c3d2a369d4 --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get-time.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getTime(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/docs/examples/health/get.md b/app/sdks/server-nodejs/docs/examples/health/get.md new file mode 100644 index 0000000000..8b504497ef --- /dev/null +++ b/app/sdks/server-nodejs/docs/examples/health/get.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/server-nodejs/index.js b/app/sdks/server-nodejs/index.js index d9e8b5a391..f5259f59dc 100644 --- a/app/sdks/server-nodejs/index.js +++ b/app/sdks/server-nodejs/index.js @@ -1,6 +1,7 @@ const Client = require('./lib/client.js'); const Avatars = require('./lib/services/avatars.js'); const Database = require('./lib/services/database.js'); +const Health = require('./lib/services/health.js'); const Locale = require('./lib/services/locale.js'); const Storage = require('./lib/services/storage.js'); const Teams = require('./lib/services/teams.js'); @@ -10,6 +11,7 @@ module.exports = { Client, Avatars, Database, + Health, Locale, Storage, Teams, diff --git a/app/sdks/server-nodejs/lib/services/database.js b/app/sdks/server-nodejs/lib/services/database.js index 3a3057eba8..ce1c09e391 100644 --- a/app/sdks/server-nodejs/lib/services/database.js +++ b/app/sdks/server-nodejs/lib/services/database.js @@ -155,9 +155,9 @@ class Database extends Service { 'filters': filters, 'offset': offset, 'limit': limit, - 'order-field': orderField, - 'order-type': orderType, - 'order-cast': orderCast, + 'orderField': orderField, + 'orderType': orderType, + 'orderCast': orderCast, 'search': search, 'first': first, 'last': last @@ -261,6 +261,23 @@ class Database extends Service { { }); } + + /** + * Get Collection Logs + * + * @param string collectionId + * @throws Exception + * @return {} + */ + async getCollectionLogs(collectionId) { + let path = '/database/collections/{collectionId}/logs'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } } module.exports = Database; \ No newline at end of file diff --git a/app/sdks/server-nodejs/lib/services/health.js b/app/sdks/server-nodejs/lib/services/health.js new file mode 100644 index 0000000000..a77e07eb64 --- /dev/null +++ b/app/sdks/server-nodejs/lib/services/health.js @@ -0,0 +1,217 @@ +const Service = require('../service.js'); + +class Health extends Service { + + /** + * Check API HTTP Health + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws Exception + * @return {} + */ + async get() { + let path = '/health'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check Cache Health + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return {} + */ + async getCache() { + let path = '/health/cache'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check DB Health + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getDB() { + let path = '/health/db'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check the number of pending certificate messages + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return {} + */ + async getQueueCertificates() { + let path = '/health/queue/certificates'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check the number of pending log messages + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueLogs() { + let path = '/health/queue/logs'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check the number of pending task messages + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueTasks() { + let path = '/health/queue/tasks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check the number of pending usage messages + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueUsage() { + let path = '/health/queue/usage'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check number of pending webhook messages + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueWebhooks() { + let path = '/health/queue/webhooks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check Anti virus Health + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getStorageAntiVirus() { + let path = '/health/storage/anti-virus'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check File System Health + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getStorageLocal() { + let path = '/health/storage/local'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Check Time Health + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return {} + */ + async getTime() { + let path = '/health/time'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Health; \ No newline at end of file diff --git a/app/sdks/server-nodejs/lib/services/users.js b/app/sdks/server-nodejs/lib/services/users.js index abcdd4ed9f..2292fb2664 100644 --- a/app/sdks/server-nodejs/lib/services/users.js +++ b/app/sdks/server-nodejs/lib/services/users.js @@ -181,13 +181,12 @@ class Users extends Service { * @return {} */ async deleteSession(userId, sessionId) { - let path = '/users/{userId}/sessions/:session'.replace(new RegExp('{userId}', 'g'), userId); + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); return await this.client.call('delete', path, { 'content-type': 'application/json', }, { - 'sessionId': sessionId }); } diff --git a/app/sdks/server-nodejs/package.json b/app/sdks/server-nodejs/package.json index 2e21e2871c..f55aed2719 100644 --- a/app/sdks/server-nodejs/package.json +++ b/app/sdks/server-nodejs/package.json @@ -1,7 +1,7 @@ { "name": "node-appwrite", "homepage": "https://appwrite.io/support", - "description": "", + "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", "version": "1.0.32", "license": "BSD-3-Clause", "main": "index.js", diff --git a/app/sdks/server-php/README.md b/app/sdks/server-php/README.md index 621acded33..140173b028 100644 --- a/app/sdks/server-php/README.md +++ b/app/sdks/server-php/README.md @@ -3,6 +3,9 @@ ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?v=1) ![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/app/sdks/server-php/composer.json b/app/sdks/server-php/composer.json index d02081daf9..fc13cb3bed 100644 --- a/app/sdks/server-php/composer.json +++ b/app/sdks/server-php/composer.json @@ -1,6 +1,8 @@ { "name": "appwrite/appwrite", - "description": "", + "description": "Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)", "type": "library", "license": "BSD-3-Clause", "support": { diff --git a/app/sdks/server-php/docs/avatars.md b/app/sdks/server-php/docs/avatars.md index cf506e0db1..9fa1ee61f1 100644 --- a/app/sdks/server-php/docs/avatars.md +++ b/app/sdks/server-php/docs/avatars.md @@ -95,6 +95,6 @@ GET https://appwrite.io/v1/avatars/qr | --- | --- | --- | --- | | text | string | **Required** Plain text to be converted to QR code image. | | | size | integer | QR code size. Pass an integer between 0 to 1000. Defaults to 400. | 400 | -| margin | integer | Margin From Edge. Pass an integer between 0 to 10. Defaults to 1. | 1 | +| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 | | download | integer | Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. | 0 | diff --git a/app/sdks/server-php/docs/database.md b/app/sdks/server-php/docs/database.md index ca98eb03eb..f192a92fc8 100644 --- a/app/sdks/server-php/docs/database.md +++ b/app/sdks/server-php/docs/database.md @@ -96,9 +96,9 @@ GET https://appwrite.io/v1/database/collections/{collectionId}/documents | filters | array | Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'. | [] | | offset | integer | Offset value. Use this value to manage pagination. | 0 | | limit | integer | Maximum number of documents to return in response. Use this value to manage pagination. | 50 | -| order-field | string | Document field that results will be sorted by. | $id | -| order-type | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC | -| order-cast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string | +| orderField | string | Document field that results will be sorted by. | $id | +| orderType | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC | +| orderCast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string | | search | string | Search query. Enter any free text search. The database will try to find a match against all document attributes and children. | | | first | integer | Return only the first document. Pass 1 for true or 0 for false. The default value is 0. | 0 | | last | integer | Return only the last document. Pass 1 for true or 0 for false. The default value is 0. | 0 | @@ -169,3 +169,15 @@ DELETE https://appwrite.io/v1/database/collections/{collectionId}/documents/{doc | collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection). | | | documentId | string | **Required** Document unique ID. | | +## Get Collection Logs + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId}/logs +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. | | + diff --git a/app/sdks/server-php/docs/examples/database/get-collection-logs.md b/app/sdks/server-php/docs/examples/database/get-collection-logs.md new file mode 100644 index 0000000000..bcb8374ce2 --- /dev/null +++ b/app/sdks/server-php/docs/examples/database/get-collection-logs.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->getCollectionLogs('[COLLECTION_ID]'); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-cache.md b/app/sdks/server-php/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..4599dea724 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-cache.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getCache(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-d-b.md b/app/sdks/server-php/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..2626ebe356 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-d-b.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getDB(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-queue-certificates.md b/app/sdks/server-php/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..e6805e0ed7 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueCertificates(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-queue-logs.md b/app/sdks/server-php/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..70d4b7ee18 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueLogs(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-queue-tasks.md b/app/sdks/server-php/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..a63faabfc1 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueTasks(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-queue-usage.md b/app/sdks/server-php/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..a48385aea5 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueUsage(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-queue-webhooks.md b/app/sdks/server-php/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..e8433ee986 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueWebhooks(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-storage-anti-virus.md b/app/sdks/server-php/docs/examples/health/get-storage-anti-virus.md new file mode 100644 index 0000000000..0d1958e4f2 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-storage-anti-virus.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getStorageAntiVirus(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-storage-local.md b/app/sdks/server-php/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..b5c751bfbc --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-storage-local.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getStorageLocal(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get-time.md b/app/sdks/server-php/docs/examples/health/get-time.md new file mode 100644 index 0000000000..04acfa3be5 --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get-time.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getTime(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/examples/health/get.md b/app/sdks/server-php/docs/examples/health/get.md new file mode 100644 index 0000000000..76c8e0b46a --- /dev/null +++ b/app/sdks/server-php/docs/examples/health/get.md @@ -0,0 +1,15 @@ +setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->get(); \ No newline at end of file diff --git a/app/sdks/server-php/docs/health.md b/app/sdks/server-php/docs/health.md new file mode 100644 index 0000000000..0161105d15 --- /dev/null +++ b/app/sdks/server-php/docs/health.md @@ -0,0 +1,90 @@ +# Health Service + +## Check API HTTP Health + +```http request +GET https://appwrite.io/v1/health +``` + +** Check the Appwrite HTTP server is up and responsive. ** + +## Check Cache Health + +```http request +GET https://appwrite.io/v1/health/cache +``` + +** Check the Appwrite in-memory cache server is up and connection is successful. ** + +## Check DB Health + +```http request +GET https://appwrite.io/v1/health/db +``` + +** Check the Appwrite database server is up and connection is successful. ** + +## Check the number of pending certificate messages + +```http request +GET https://appwrite.io/v1/health/queue/certificates +``` + +** Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. ** + +## Check the number of pending log messages + +```http request +GET https://appwrite.io/v1/health/queue/logs +``` + +** Get the number of logs that are waiting to be processed in the Appwrite internal queue server. ** + +## Check the number of pending task messages + +```http request +GET https://appwrite.io/v1/health/queue/tasks +``` + +** Get the number of tasks that are waiting to be processed in the Appwrite internal queue server. ** + +## Check the number of pending usage messages + +```http request +GET https://appwrite.io/v1/health/queue/usage +``` + +** Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server. ** + +## Check number of pending webhook messages + +```http request +GET https://appwrite.io/v1/health/queue/webhooks +``` + +** Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. ** + +## Check Anti virus Health + +```http request +GET https://appwrite.io/v1/health/storage/anti-virus +``` + +** Check the Appwrite Anti Virus server is up and connection is successful. ** + +## Check File System Health + +```http request +GET https://appwrite.io/v1/health/storage/local +``` + +** Check the Appwrite local storage device is up and connection is successful. ** + +## Check Time Health + +```http request +GET https://appwrite.io/v1/health/time +``` + +** Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. ** + diff --git a/app/sdks/server-php/docs/users.md b/app/sdks/server-php/docs/users.md index fe68614cab..fd884b254f 100644 --- a/app/sdks/server-php/docs/users.md +++ b/app/sdks/server-php/docs/users.md @@ -121,7 +121,7 @@ DELETE https://appwrite.io/v1/users/{userId}/sessions ## Delete User Session ```http request -DELETE https://appwrite.io/v1/users/{userId}/sessions/:session +DELETE https://appwrite.io/v1/users/{userId}/sessions/{sessionId} ``` ** Delete user sessions by its unique ID. ** @@ -131,7 +131,7 @@ DELETE https://appwrite.io/v1/users/{userId}/sessions/:session | Field Name | Type | Description | Default | | --- | --- | --- | --- | | userId | string | **Required** User unique ID. | | -| sessionId | string | User unique session ID. | | +| sessionId | string | **Required** User unique session ID. | | ## Update User Status diff --git a/app/sdks/server-php/src/Appwrite/Services/Database.php b/app/sdks/server-php/src/Appwrite/Services/Database.php index d91cbab534..7ce8ac359f 100644 --- a/app/sdks/server-php/src/Appwrite/Services/Database.php +++ b/app/sdks/server-php/src/Appwrite/Services/Database.php @@ -164,9 +164,9 @@ class Database extends Service $params['filters'] = $filters; $params['offset'] = $offset; $params['limit'] = $limit; - $params['order-field'] = $orderField; - $params['order-type'] = $orderType; - $params['order-cast'] = $orderCast; + $params['orderField'] = $orderField; + $params['orderType'] = $orderType; + $params['orderCast'] = $orderCast; $params['search'] = $search; $params['first'] = $first; $params['last'] = $last; @@ -278,4 +278,22 @@ class Database extends Service ], $params); } + /** + * Get Collection Logs + * + * @param string $collectionId + * @throws Exception + * @return array + */ + public function getCollectionLogs(string $collectionId):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/logs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + } \ No newline at end of file diff --git a/app/sdks/server-php/src/Appwrite/Services/Health.php b/app/sdks/server-php/src/Appwrite/Services/Health.php new file mode 100644 index 0000000000..a8423aa188 --- /dev/null +++ b/app/sdks/server-php/src/Appwrite/Services/Health.php @@ -0,0 +1,233 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check Cache Health + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return array + */ + public function getCache():array + { + $path = str_replace([], [], '/health/cache'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check DB Health + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getDB():array + { + $path = str_replace([], [], '/health/db'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check the number of pending certificate messages + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return array + */ + public function getQueueCertificates():array + { + $path = str_replace([], [], '/health/queue/certificates'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check the number of pending log messages + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueLogs():array + { + $path = str_replace([], [], '/health/queue/logs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check the number of pending task messages + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueTasks():array + { + $path = str_replace([], [], '/health/queue/tasks'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check the number of pending usage messages + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueUsage():array + { + $path = str_replace([], [], '/health/queue/usage'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check number of pending webhook messages + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueWebhooks():array + { + $path = str_replace([], [], '/health/queue/webhooks'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check Anti virus Health + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getStorageAntiVirus():array + { + $path = str_replace([], [], '/health/storage/anti-virus'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check File System Health + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getStorageLocal():array + { + $path = str_replace([], [], '/health/storage/local'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Check Time Health + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return array + */ + public function getTime():array + { + $path = str_replace([], [], '/health/time'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/server-php/src/Appwrite/Services/Users.php b/app/sdks/server-php/src/Appwrite/Services/Users.php index 89189b0d63..b2b4f576cc 100644 --- a/app/sdks/server-php/src/Appwrite/Services/Users.php +++ b/app/sdks/server-php/src/Appwrite/Services/Users.php @@ -196,10 +196,9 @@ class Users extends Service */ public function deleteSession(string $userId, string $sessionId):array { - $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions/:session'); + $path = str_replace(['{userId}', '{sessionId}'], [$userId, $sessionId], '/users/{userId}/sessions/{sessionId}'); $params = []; - $params['sessionId'] = $sessionId; return $this->client->call(Client::METHOD_DELETE, $path, [ 'content-type' => 'application/json', diff --git a/app/sdks/server-python/README.md b/app/sdks/server-python/README.md index d1bf3c5f41..11e9a9a7cd 100644 --- a/app/sdks/server-python/README.md +++ b/app/sdks/server-python/README.md @@ -5,6 +5,9 @@ **This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.** +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/app/sdks/server-python/appwrite/services/database.py b/app/sdks/server-python/appwrite/services/database.py index ea07962ebc..2549e689d5 100644 --- a/app/sdks/server-python/appwrite/services/database.py +++ b/app/sdks/server-python/appwrite/services/database.py @@ -80,9 +80,9 @@ class Database(Service): params['filters'] = filters params['offset'] = offset params['limit'] = limit - params['order-field'] = order_field - params['order-type'] = order_type - params['order-cast'] = order_cast + params['orderField'] = order_field + params['orderType'] = order_type + params['orderCast'] = order_cast params['search'] = search params['first'] = first params['last'] = last @@ -146,3 +146,14 @@ class Database(Service): return self.client.call('delete', path, { 'content-type': 'application/json', }, params) + + def get_collection_logs(self, collection_id): + """Get Collection Logs""" + + params = {} + path = '/database/collections/{collectionId}/logs' + path = path.replace('{collectionId}', collection_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/server-python/appwrite/services/health.py b/app/sdks/server-python/appwrite/services/health.py new file mode 100644 index 0000000000..aa2a3fe37e --- /dev/null +++ b/app/sdks/server-python/appwrite/services/health.py @@ -0,0 +1,117 @@ +from ..service import Service + + +class Health(Service): + + def __init__(self, client): + super(Health, self).__init__(client) + + def get(self): + """Check API HTTP Health""" + + params = {} + path = '/health' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_cache(self): + """Check Cache Health""" + + params = {} + path = '/health/cache' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_d_b(self): + """Check DB Health""" + + params = {} + path = '/health/db' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_certificates(self): + """Check the number of pending certificate messages""" + + params = {} + path = '/health/queue/certificates' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_logs(self): + """Check the number of pending log messages""" + + params = {} + path = '/health/queue/logs' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_tasks(self): + """Check the number of pending task messages""" + + params = {} + path = '/health/queue/tasks' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_usage(self): + """Check the number of pending usage messages""" + + params = {} + path = '/health/queue/usage' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_webhooks(self): + """Check number of pending webhook messages""" + + params = {} + path = '/health/queue/webhooks' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_storage_anti_virus(self): + """Check Anti virus Health""" + + params = {} + path = '/health/storage/anti-virus' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_storage_local(self): + """Check File System Health""" + + params = {} + path = '/health/storage/local' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_time(self): + """Check Time Health""" + + params = {} + path = '/health/time' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/server-python/appwrite/services/users.py b/app/sdks/server-python/appwrite/services/users.py index be9b2da8de..2608f07a50 100644 --- a/app/sdks/server-python/appwrite/services/users.py +++ b/app/sdks/server-python/appwrite/services/users.py @@ -104,9 +104,9 @@ class Users(Service): """Delete User Session""" params = {} - path = '/users/{userId}/sessions/:session' + path = '/users/{userId}/sessions/{sessionId}' path = path.replace('{userId}', user_id) - params['sessionId'] = session_id + path = path.replace('{sessionId}', session_id) return self.client.call('delete', path, { 'content-type': 'application/json', diff --git a/app/sdks/server-python/docs/examples/database/get-collection-logs.md b/app/sdks/server-python/docs/examples/database/get-collection-logs.md new file mode 100644 index 0000000000..7776a1e31d --- /dev/null +++ b/app/sdks/server-python/docs/examples/database/get-collection-logs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.get_collection_logs('[COLLECTION_ID]') diff --git a/app/sdks/server-python/docs/examples/health/get-cache.md b/app/sdks/server-python/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..308bdee556 --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-cache.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_cache() diff --git a/app/sdks/server-python/docs/examples/health/get-d-b.md b/app/sdks/server-python/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..6c4fe2e4f9 --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-d-b.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_d_b() diff --git a/app/sdks/server-python/docs/examples/health/get-queue-certificates.md b/app/sdks/server-python/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..6b0361e13b --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_certificates() diff --git a/app/sdks/server-python/docs/examples/health/get-queue-logs.md b/app/sdks/server-python/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..5b3e387ab7 --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-queue-logs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_logs() diff --git a/app/sdks/server-python/docs/examples/health/get-queue-tasks.md b/app/sdks/server-python/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..b33bc081d0 --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_tasks() diff --git a/app/sdks/server-python/docs/examples/health/get-queue-usage.md b/app/sdks/server-python/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..774f2a892a --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-queue-usage.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_usage() diff --git a/app/sdks/server-python/docs/examples/health/get-queue-webhooks.md b/app/sdks/server-python/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..7cef20570f --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_webhooks() diff --git a/app/sdks/server-python/docs/examples/health/get-storage-anti-virus.md b/app/sdks/server-python/docs/examples/health/get-storage-anti-virus.md new file mode 100644 index 0000000000..5ce63ac816 --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-storage-anti-virus.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_storage_anti_virus() diff --git a/app/sdks/server-python/docs/examples/health/get-storage-local.md b/app/sdks/server-python/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..7b1a30f615 --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-storage-local.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_storage_local() diff --git a/app/sdks/server-python/docs/examples/health/get-time.md b/app/sdks/server-python/docs/examples/health/get-time.md new file mode 100644 index 0000000000..42390722c3 --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get-time.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_time() diff --git a/app/sdks/server-python/docs/examples/health/get.md b/app/sdks/server-python/docs/examples/health/get.md new file mode 100644 index 0000000000..831b34768f --- /dev/null +++ b/app/sdks/server-python/docs/examples/health/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get() diff --git a/app/sdks/server-python/setup.py b/app/sdks/server-python/setup.py index fca389a870..a0e64f1a9a 100644 --- a/app/sdks/server-python/setup.py +++ b/app/sdks/server-python/setup.py @@ -5,7 +5,9 @@ setuptools.setup( packages = ['appwrite', 'appwrite/services'], version = '0.0.4', license='BSD-3-Clause', - description = '', + description = 'Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)', author = 'Appwrite Team', author_email = 'team@appwrite.io', maintainer = 'Appwrite Team', diff --git a/app/sdks/server-ruby/README.md b/app/sdks/server-ruby/README.md index 8feb38c230..6b71d0ccee 100644 --- a/app/sdks/server-ruby/README.md +++ b/app/sdks/server-ruby/README.md @@ -5,6 +5,9 @@ **This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.** +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/app/sdks/server-ruby/appwrite.gemspec b/app/sdks/server-ruby/appwrite.gemspec index 3894375419..99fa047a96 100644 --- a/app/sdks/server-ruby/appwrite.gemspec +++ b/app/sdks/server-ruby/appwrite.gemspec @@ -2,7 +2,9 @@ Gem::Specification.new do |s| s.name = 'appwrite' s.version = '1.0.9' - s.summary = "" + s.summary = "Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Ruby SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)" s.author = 'Appwrite Team' s.homepage = 'https://appwrite.io/support' s.email = 'team@appwrite.io' diff --git a/app/sdks/server-ruby/lib/appwrite.rb b/app/sdks/server-ruby/lib/appwrite.rb index 0d0dcd156e..8e88842789 100644 --- a/app/sdks/server-ruby/lib/appwrite.rb +++ b/app/sdks/server-ruby/lib/appwrite.rb @@ -5,6 +5,7 @@ require_relative 'appwrite/client' require_relative 'appwrite/service' require_relative 'appwrite/services/avatars' require_relative 'appwrite/services/database' +require_relative 'appwrite/services/health' require_relative 'appwrite/services/locale' require_relative 'appwrite/services/storage' require_relative 'appwrite/services/teams' diff --git a/app/sdks/server-ruby/lib/appwrite/services/database.rb b/app/sdks/server-ruby/lib/appwrite/services/database.rb index 0e897a942e..8bb9c3bbb4 100644 --- a/app/sdks/server-ruby/lib/appwrite/services/database.rb +++ b/app/sdks/server-ruby/lib/appwrite/services/database.rb @@ -79,9 +79,9 @@ module Appwrite 'filters': filters, 'offset': offset, 'limit': limit, - 'order-field': order_field, - 'order-type': order_type, - 'order-cast': order_cast, + 'orderField': order_field, + 'orderType': order_type, + 'orderCast': order_cast, 'search': search, 'first': first, 'last': last @@ -152,6 +152,18 @@ module Appwrite }, params); end + def get_collection_logs(collection_id:) + path = '/database/collections/{collectionId}/logs' + .gsub('{collection_id}', collection_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + protected diff --git a/app/sdks/server-ruby/lib/appwrite/services/health.rb b/app/sdks/server-ruby/lib/appwrite/services/health.rb new file mode 100644 index 0000000000..f48069ff25 --- /dev/null +++ b/app/sdks/server-ruby/lib/appwrite/services/health.rb @@ -0,0 +1,130 @@ +module Appwrite + class Health < Service + + def get() + path = '/health' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_cache() + path = '/health/cache' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_d_b() + path = '/health/db' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_certificates() + path = '/health/queue/certificates' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_logs() + path = '/health/queue/logs' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_tasks() + path = '/health/queue/tasks' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_usage() + path = '/health/queue/usage' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_webhooks() + path = '/health/queue/webhooks' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_storage_anti_virus() + path = '/health/storage/anti-virus' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_storage_local() + path = '/health/storage/local' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_time() + path = '/health/time' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/server-ruby/lib/appwrite/services/users.rb b/app/sdks/server-ruby/lib/appwrite/services/users.rb index 75b1701f2d..ae790c9403 100644 --- a/app/sdks/server-ruby/lib/appwrite/services/users.rb +++ b/app/sdks/server-ruby/lib/appwrite/services/users.rb @@ -104,11 +104,11 @@ module Appwrite end def delete_session(user_id:, session_id:) - path = '/users/{userId}/sessions/:session' + path = '/users/{userId}/sessions/{sessionId}' .gsub('{user_id}', user_id) + .gsub('{session_id}', session_id) params = { - 'sessionId': session_id } return @client.call('delete', path, { diff --git a/app/sdks/web-javascript/README.md b/app/sdks/web-javascript/README.md index 7f6cb4956a..812e31fd29 100644 --- a/app/sdks/web-javascript/README.md +++ b/app/sdks/web-javascript/README.md @@ -3,6 +3,9 @@ ![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1) ![Version](https://img.shields.io/badge/api%20version-0.5.3-blue.svg?v=1) +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the JavaScript SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ![Appwrite](https://appwrite.io/images/github.png) diff --git a/app/sdks/web-javascript/package.json b/app/sdks/web-javascript/package.json index f79194ad79..c28785e89f 100644 --- a/app/sdks/web-javascript/package.json +++ b/app/sdks/web-javascript/package.json @@ -1,7 +1,7 @@ { "name": "appwrite", "homepage": "https://appwrite.io/support", - "description": "", + "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", "version": "1.0.29", "license": "BSD-3-Clause", "main": "src/sdk.js", diff --git a/app/sdks/web-javascript/src/sdk.js b/app/sdks/web-javascript/src/sdk.js index 0148b33440..664f978ce1 100644 --- a/app/sdks/web-javascript/src/sdk.js +++ b/app/sdks/web-javascript/src/sdk.js @@ -494,7 +494,7 @@ } if(oldPassword) { - payload['old-password'] = oldPassword; + payload['oldPassword'] = oldPassword; } return http @@ -608,12 +608,12 @@ * * @param {string} userId * @param {string} secret - * @param {string} passwordA - * @param {string} passwordB + * @param {string} password + * @param {string} passwordAgain * @throws {Error} * @return {Promise} */ - updateRecovery: function(userId, secret, passwordA, passwordB) { + updateRecovery: function(userId, secret, password, passwordAgain) { if(userId === undefined) { throw new Error('Missing required parameter: "userId"'); } @@ -622,12 +622,12 @@ throw new Error('Missing required parameter: "secret"'); } - if(passwordA === undefined) { - throw new Error('Missing required parameter: "passwordA"'); + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); } - if(passwordB === undefined) { - throw new Error('Missing required parameter: "passwordB"'); + if(passwordAgain === undefined) { + throw new Error('Missing required parameter: "passwordAgain"'); } let path = '/account/recovery'; @@ -642,12 +642,12 @@ payload['secret'] = secret; } - if(passwordA) { - payload['password-a'] = passwordA; + if(password) { + payload['password'] = password; } - if(passwordB) { - payload['password-b'] = passwordB; + if(passwordAgain) { + payload['passwordAgain'] = passwordAgain; } return http @@ -748,7 +748,7 @@ * @throws {Error} * @return {Promise} */ - createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') { + createOAuth2Session: function(provider, success = 'https://localhost:2444/auth/oauth2/success', failure = 'https://localhost:2444/auth/oauth2/failure') { if(provider === undefined) { throw new Error('Missing required parameter: "provider"'); } @@ -1166,15 +1166,15 @@ } if(orderField) { - payload['order-field'] = orderField; + payload['orderField'] = orderField; } if(orderType) { - payload['order-type'] = orderType; + payload['orderType'] = orderType; } if(orderCast) { - payload['order-cast'] = orderCast; + payload['orderCast'] = orderCast; } if(search) { diff --git a/app/sdks/web-javascript/src/sdk.min.js b/app/sdks/web-javascript/src/sdk.min.js index 1440c643d6..b2f00fac60 100644 --- a/app/sdks/web-javascript/src/sdk.min.js +++ b/app/sdks/web-javascript/src/sdk.min.js @@ -26,26 +26,26 @@ let path='/account/name';let payload={};if(name){payload.name=name} return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')} let path='/account/password';let payload={};if(password){payload.password=password} -if(oldPassword){payload['old-password']=oldPassword} +if(oldPassword){payload.oldPassword=oldPassword} return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs} return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} if(url===undefined){throw new Error('Missing required parameter: "url"')} let path='/account/recovery';let payload={};if(email){payload.email=email} if(url){payload.url=url} -return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} if(secret===undefined){throw new Error('Missing required parameter: "secret"')} -if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"')} -if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"')} let path='/account/recovery';let payload={};if(userId){payload.userId=userId} if(secret){payload.secret=secret} -if(passwordA){payload['password-a']=passwordA} -if(passwordB){payload['password-b']=passwordB} +if(password){payload.password=password} +if(passwordAgain){payload.passwordAgain=passwordAgain} return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} if(password===undefined){throw new Error('Missing required parameter: "password"')} let path='/account/sessions';let payload={};if(email){payload.email=email} if(password){payload.password=password} -return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} +return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://localhost:2444/auth/oauth2/success',failure='https://localhost:2444/auth/oauth2/failure'){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} if(failure){payload.failure=failure} payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')} @@ -82,9 +82,9 @@ return http.get(path,{'content-type':'application/json',},payload)}};let databas let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters} if(offset){payload.offset=offset} if(limit){payload.limit=limit} -if(orderField){payload['order-field']=orderField} -if(orderType){payload['order-type']=orderType} -if(orderCast){payload['order-cast']=orderCast} +if(orderField){payload.orderField=orderField} +if(orderType){payload.orderType=orderType} +if(orderCast){payload.orderCast=orderCast} if(search){payload.search=search} if(first){payload.first=first} if(last){payload.last=last} diff --git a/app/sdks/web-javascript/types/index.d.ts b/app/sdks/web-javascript/types/index.d.ts index 0921b15b22..7ddfd77a15 100644 --- a/app/sdks/web-javascript/types/index.d.ts +++ b/app/sdks/web-javascript/types/index.d.ts @@ -213,12 +213,12 @@ declare namespace Appwrite { * * @param {string} userId * @param {string} secret - * @param {string} passwordA - * @param {string} passwordB + * @param {string} password + * @param {string} passwordAgain * @throws {Error} * @return {Promise} */ - updateRecovery(userId: string, secret: string, passwordA: string, passwordB: string): Promise; + updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise; /** * Get Account Sessions