From e630940b804a7f6fe82e59e403b9ecdd6b0d52ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 27 Dec 2022 21:02:17 +0100 Subject: [PATCH] Appwrite 1.2.0 support --- LICENSE | 2 +- README.md | 4 +- docs/examples/account/get-logs.md | 21 ------ docs/examples/account/get-sessions.md | 21 ------ docs/examples/account/update-phone.md | 2 +- .../{retry-build.md => create-build.md} | 2 +- .../get-currencies.md => graphql/mutation.md} | 4 +- .../get-languages.md => graphql/query.md} | 4 +- docs/examples/locale/get-continents.md | 21 ------ docs/examples/locale/get-countries-e-u.md | 21 ------ docs/examples/locale/get-countries-phones.md | 21 ------ docs/examples/locale/get-countries.md | 21 ------ docs/examples/teams/get-memberships.md | 21 ------ docs/examples/users/get-logs.md | 21 ------ docs/examples/users/get-memberships.md | 21 ------ docs/examples/users/get-sessions.md | 21 ------ docs/examples/users/update-phone.md | 2 +- mod.ts | 2 + src/client.ts | 2 +- src/models.d.ts | 32 ++++++++ src/services/account.ts | 24 +++--- src/services/databases.ts | 4 +- src/services/functions.ts | 8 +- src/services/graphql.ts | 73 +++++++++++++++++++ src/services/storage.ts | 3 +- src/services/teams.ts | 7 +- 26 files changed, 137 insertions(+), 248 deletions(-) delete mode 100644 docs/examples/account/get-logs.md delete mode 100644 docs/examples/account/get-sessions.md rename docs/examples/functions/{retry-build.md => create-build.md} (84%) rename docs/examples/{locale/get-currencies.md => graphql/mutation.md} (84%) rename docs/examples/{locale/get-languages.md => graphql/query.md} (85%) delete mode 100644 docs/examples/locale/get-continents.md delete mode 100644 docs/examples/locale/get-countries-e-u.md delete mode 100644 docs/examples/locale/get-countries-phones.md delete mode 100644 docs/examples/locale/get-countries.md delete mode 100644 docs/examples/teams/get-memberships.md delete mode 100644 docs/examples/users/get-logs.md delete mode 100644 docs/examples/users/get-memberships.md delete mode 100644 docs/examples/users/get-sessions.md create mode 100644 src/services/graphql.ts diff --git a/LICENSE b/LICENSE index b0761cc..90528c4 100644 --- a/LICENSE +++ b/LICENSE @@ -7,6 +7,6 @@ Redistribution and use in source and binary forms, with or without modification, 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md index 0116c37..fe79136 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Deno SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-deno.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.0.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.2.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.0.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-deno/releases).** +**This SDK is compatible with Appwrite server version 1.2.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-deno/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 Deno 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/docs/examples/account/get-logs.md b/docs/examples/account/get-logs.md deleted file mode 100644 index 43d6707..0000000 --- a/docs/examples/account/get-logs.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let account = new sdk.Account(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token -; - - -let promise = account.getLogs(); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/account/get-sessions.md b/docs/examples/account/get-sessions.md deleted file mode 100644 index 486a153..0000000 --- a/docs/examples/account/get-sessions.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let account = new sdk.Account(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token -; - - -let promise = account.getSessions(); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 1742000..fd639f5 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -12,7 +12,7 @@ client ; -let promise = account.updatePhone('', 'password'); +let promise = account.updatePhone('+12065550100', 'password'); promise.then(function (response) { console.log(response); diff --git a/docs/examples/functions/retry-build.md b/docs/examples/functions/create-build.md similarity index 84% rename from docs/examples/functions/retry-build.md rename to docs/examples/functions/create-build.md index 1130fad..757e048 100644 --- a/docs/examples/functions/retry-build.md +++ b/docs/examples/functions/create-build.md @@ -12,7 +12,7 @@ client ; -let promise = functions.retryBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]'); +let promise = functions.createBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]'); promise.then(function (response) { console.log(response); diff --git a/docs/examples/locale/get-currencies.md b/docs/examples/graphql/mutation.md similarity index 84% rename from docs/examples/locale/get-currencies.md rename to docs/examples/graphql/mutation.md index 34d4e23..0cac77b 100644 --- a/docs/examples/locale/get-currencies.md +++ b/docs/examples/graphql/mutation.md @@ -3,7 +3,7 @@ import * as sdk from "https://deno.land/x/appwrite/mod.ts"; // Init SDK let client = new sdk.Client(); -let locale = new sdk.Locale(client); +let graphql = new sdk.Graphql(client); client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint @@ -12,7 +12,7 @@ client ; -let promise = locale.getCurrencies(); +let promise = graphql.mutation({}); promise.then(function (response) { console.log(response); diff --git a/docs/examples/locale/get-languages.md b/docs/examples/graphql/query.md similarity index 85% rename from docs/examples/locale/get-languages.md rename to docs/examples/graphql/query.md index 3fd5d8b..9e4a79f 100644 --- a/docs/examples/locale/get-languages.md +++ b/docs/examples/graphql/query.md @@ -3,7 +3,7 @@ import * as sdk from "https://deno.land/x/appwrite/mod.ts"; // Init SDK let client = new sdk.Client(); -let locale = new sdk.Locale(client); +let graphql = new sdk.Graphql(client); client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint @@ -12,7 +12,7 @@ client ; -let promise = locale.getLanguages(); +let promise = graphql.query({}); promise.then(function (response) { console.log(response); diff --git a/docs/examples/locale/get-continents.md b/docs/examples/locale/get-continents.md deleted file mode 100644 index 44c18b5..0000000 --- a/docs/examples/locale/get-continents.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let locale = new sdk.Locale(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = locale.getContinents(); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/locale/get-countries-e-u.md b/docs/examples/locale/get-countries-e-u.md deleted file mode 100644 index f14e435..0000000 --- a/docs/examples/locale/get-countries-e-u.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let locale = new sdk.Locale(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = locale.getCountriesEU(); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/locale/get-countries-phones.md b/docs/examples/locale/get-countries-phones.md deleted file mode 100644 index b23eff3..0000000 --- a/docs/examples/locale/get-countries-phones.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let locale = new sdk.Locale(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = locale.getCountriesPhones(); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/locale/get-countries.md b/docs/examples/locale/get-countries.md deleted file mode 100644 index 2f3facd..0000000 --- a/docs/examples/locale/get-countries.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let locale = new sdk.Locale(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = locale.getCountries(); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/teams/get-memberships.md b/docs/examples/teams/get-memberships.md deleted file mode 100644 index 467101c..0000000 --- a/docs/examples/teams/get-memberships.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let teams = new sdk.Teams(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = teams.getMemberships('[TEAM_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/users/get-logs.md b/docs/examples/users/get-logs.md deleted file mode 100644 index 5770e84..0000000 --- a/docs/examples/users/get-logs.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let users = new sdk.Users(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = users.getLogs('[USER_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/users/get-memberships.md b/docs/examples/users/get-memberships.md deleted file mode 100644 index cc3c1e1..0000000 --- a/docs/examples/users/get-memberships.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let users = new sdk.Users(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = users.getMemberships('[USER_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/users/get-sessions.md b/docs/examples/users/get-sessions.md deleted file mode 100644 index 15f0b53..0000000 --- a/docs/examples/users/get-sessions.md +++ /dev/null @@ -1,21 +0,0 @@ -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -// Init SDK -let client = new sdk.Client(); - -let users = new sdk.Users(client); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - - -let promise = users.getSessions('[USER_ID]'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); \ No newline at end of file diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index ce5d356..31a0a16 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -12,7 +12,7 @@ client ; -let promise = users.updatePhone('[USER_ID]', ''); +let promise = users.updatePhone('[USER_ID]', '+12065550100'); promise.then(function (response) { console.log(response); diff --git a/mod.ts b/mod.ts index c122710..0bdaaf9 100644 --- a/mod.ts +++ b/mod.ts @@ -9,6 +9,7 @@ import { Account } from "./src/services/account.ts"; import { Avatars } from "./src/services/avatars.ts"; import { Databases } from "./src/services/databases.ts"; import { Functions } from "./src/services/functions.ts"; +import { Graphql } from "./src/services/graphql.ts"; import { Health } from "./src/services/health.ts"; import { Locale } from "./src/services/locale.ts"; import { Storage } from "./src/services/storage.ts"; @@ -27,6 +28,7 @@ export { Avatars, Databases, Functions, + Graphql, Health, Locale, Storage, diff --git a/src/client.ts b/src/client.ts index 11791c1..633a4ca 100644 --- a/src/client.ts +++ b/src/client.ts @@ -14,7 +14,7 @@ export class Client { 'x-sdk-name': 'Deno', 'x-sdk-platform': 'server', 'x-sdk-language': 'deno', - 'x-sdk-version': '6.1.0', + 'x-sdk-version': '6.2.0', 'X-Appwrite-Response-Format':'1.0.0', }; diff --git a/src/models.d.ts b/src/models.d.ts index d228869..5b2fb48 100644 --- a/src/models.d.ts +++ b/src/models.d.ts @@ -868,26 +868,46 @@ export namespace Models { * AlgoMD5 */ export type AlgoMd5 = { + /** + * Algo type. + */ + type: string; } /** * AlgoSHA */ export type AlgoSha = { + /** + * Algo type. + */ + type: string; } /** * AlgoPHPass */ export type AlgoPhpass = { + /** + * Algo type. + */ + type: string; } /** * AlgoBcrypt */ export type AlgoBcrypt = { + /** + * Algo type. + */ + type: string; } /** * AlgoScrypt */ export type AlgoScrypt = { + /** + * Algo type. + */ + type: string; /** * CPU complexity of computed hash. */ @@ -909,6 +929,10 @@ export namespace Models { * AlgoScryptModified */ export type AlgoScryptModified = { + /** + * Algo type. + */ + type: string; /** * Salt used to compute hash. */ @@ -926,6 +950,10 @@ export namespace Models { * AlgoArgon2 */ export type AlgoArgon2 = { + /** + * Algo type. + */ + type: string; /** * Memory used to compute hash. */ @@ -1486,6 +1514,10 @@ export namespace Models { * The build stderr. */ buildStderr: string; + /** + * The current build time in seconds. + */ + buildTime: number; } /** * Execution diff --git a/src/services/account.ts b/src/services/account.ts index 7616cdb..2a91f18 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -37,7 +37,7 @@ export class Account extends Service { }, payload); } /** - * Update Account Email + * Update Email * * Update currently logged in user account email address. After changing user * address, the user confirmation status will get reset. A new confirmation @@ -76,7 +76,7 @@ export class Account extends Service { }, payload); } /** - * List Account Logs + * List Logs * * Get currently logged in user list of latest security activity logs. Each * log returns user IP address, location and date and time of log. @@ -98,7 +98,7 @@ export class Account extends Service { }, payload); } /** - * Update Account Name + * Update Name * * Update currently logged in user account name. * @@ -122,7 +122,7 @@ export class Account extends Service { }, payload); } /** - * Update Account Password + * Update Password * * Update currently logged in user password. For validation, user is required * to pass in the new password, and the old password. For users created with @@ -152,7 +152,7 @@ export class Account extends Service { }, payload); } /** - * Update Account Phone + * Update Phone * * Update the currently logged in user's phone number. After updating the * phone number, the phone verification status will be reset. A confirmation @@ -204,7 +204,7 @@ export class Account extends Service { }, payload); } /** - * Update Account Preferences + * Update Preferences * * Update currently logged in user account preferences. The object you pass is * stored as is, and replaces any previous value. The maximum allowed prefs @@ -325,7 +325,7 @@ export class Account extends Service { }, payload); } /** - * List Account Sessions + * List Sessions * * Get currently logged in user list of active sessions across different * devices. @@ -342,7 +342,7 @@ export class Account extends Service { }, payload); } /** - * Delete All Account Sessions + * Delete Sessions * * Delete all sessions from the user account and remove any sessions cookies * from the end client. @@ -359,7 +359,7 @@ export class Account extends Service { }, payload); } /** - * Get Session By ID + * Get Session * * Use this endpoint to get a logged in user's session using a Session ID. * Inputting 'current' will return the current session being used. @@ -381,7 +381,7 @@ export class Account extends Service { }, payload); } /** - * Update Session (Refresh Tokens) + * Update OAuth Session (Refresh Tokens) * * Access tokens have limited lifespan and expire to mitigate security risks. * If session was created using an OAuth provider, this route can be used to @@ -404,7 +404,7 @@ export class Account extends Service { }, payload); } /** - * Delete Account Session + * Delete Session * * Use this endpoint to log out the currently logged in user from all their * account sessions across all of their different devices. When using the @@ -428,7 +428,7 @@ export class Account extends Service { }, payload); } /** - * Update Account Status + * Update Status * * Block the currently logged in user account. Behind the scene, the user * record is not deleted but permanently blocked from any access. To diff --git a/src/services/databases.ts b/src/services/databases.ts index 8e647ef..a149935 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -906,9 +906,7 @@ export class Databases extends Service { * List Documents * * Get a list of all the user's documents in a given collection. You can use - * the query params to filter your results. On admin mode, this endpoint will - * return a list of all of documents belonging to the provided collectionId. - * [Learn more about different API modes](/docs/admin). + * the query params to filter your results. * * @param {string} databaseId * @param {string} collectionId diff --git a/src/services/functions.ts b/src/services/functions.ts index 1c72490..9d86bde 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -473,7 +473,7 @@ export class Functions extends Service { }, payload); } /** - * Retry Build + * Create Build * * @param {string} functionId * @param {string} deploymentId @@ -481,7 +481,7 @@ export class Functions extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async retryBuild(functionId: string, deploymentId: string, buildId: string): Promise { + async createBuild(functionId: string, deploymentId: string, buildId: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -505,9 +505,7 @@ export class Functions extends Service { * List Executions * * Get a list of all the current user function execution logs. You can use the - * query params to filter your results. On admin mode, this endpoint will - * return a list of all of the project's executions. [Learn more about - * different API modes](/docs/admin). + * query params to filter your results. * * @param {string} functionId * @param {string[]} queries diff --git a/src/services/graphql.ts b/src/services/graphql.ts new file mode 100644 index 0000000..28d51be --- /dev/null +++ b/src/services/graphql.ts @@ -0,0 +1,73 @@ +import { basename } from "https://deno.land/std@0.122.0/path/mod.ts"; +import { Service } from '../service.ts'; +import { Payload, Client } from '../client.ts'; +import { InputFile } from '../inputFile.ts'; +import { AppwriteException } from '../exception.ts'; +import type { Models } from '../models.d.ts'; + +export type UploadProgress = { + $id: string; + progress: number; + sizeUploaded: number; + chunksTotal: number; + chunksUploaded: number; +} + +export class Graphql extends Service { + + constructor(client: Client) + { + super(client); + } + + /** + * GraphQL Endpoint + * + * Execute a GraphQL mutation. + * + * @param {object} query + * @throws {AppwriteException} + * @returns {Promise} + */ + async query(query: object): Promise { + if (typeof query === 'undefined') { + throw new AppwriteException('Missing required parameter: "query"'); + } + + let path = '/graphql'; + let payload: Payload = {}; + + if (typeof query !== 'undefined') { + payload['query'] = query; + } + return await this.client.call('post', path, { + 'x-sdk-graphql': 'true', + 'content-type': 'application/json', + }, payload); + } + /** + * GraphQL Endpoint + * + * Execute a GraphQL mutation. + * + * @param {object} query + * @throws {AppwriteException} + * @returns {Promise} + */ + async mutation(query: object): Promise { + if (typeof query === 'undefined') { + throw new AppwriteException('Missing required parameter: "query"'); + } + + let path = '/graphql/mutation'; + let payload: Payload = {}; + + if (typeof query !== 'undefined') { + payload['query'] = query; + } + return await this.client.call('post', path, { + 'x-sdk-graphql': 'true', + 'content-type': 'application/json', + }, payload); + } +} \ No newline at end of file diff --git a/src/services/storage.ts b/src/services/storage.ts index f5d07b1..335cca6 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -219,8 +219,7 @@ export class Storage extends Service { * List Files * * Get a list of all the user files. You can use the query params to filter - * your results. On admin mode, this endpoint will return a list of all of the - * project's files. [Learn more about different API modes](/docs/admin). + * your results. * * @param {string} bucketId * @param {string[]} queries diff --git a/src/services/teams.ts b/src/services/teams.ts index 6e82f29..d7304c2 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -24,10 +24,7 @@ export class Teams extends Service { * List Teams * * Get a list of all the teams in which the current user is a member. You can - * use the parameters to filter your results. - * - * In admin mode, this endpoint returns a list of all the teams in the current - * project. [Learn more about different API modes](/docs/admin). + * use the parameters to filter your results. * * @param {string[]} queries * @param {string} search @@ -267,7 +264,7 @@ export class Teams extends Service { * @throws {AppwriteException} * @returns {Promise} */ - async getMembership(teamId: string, membershipId: string): Promise { + async getMembership(teamId: string, membershipId: string): Promise { if (typeof teamId === 'undefined') { throw new AppwriteException('Missing required parameter: "teamId"'); }