From a132bc02032b6227c86c433ac66dc2d4d464000f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 28 Aug 2024 23:39:22 +1200 Subject: [PATCH] Backups beta --- README.md | 6 +- .../create-payment-method.md} | 6 +- .../account/delete-mfa-authenticator.md | 3 +- .../examples/account/delete-payment-method.md | 13 + docs/examples/account/get-billing-address.md | 13 + docs/examples/account/get-payment-method.md | 13 + .../list-billing-addresses.md} | 8 +- docs/examples/account/list-credits.md | 14 + docs/examples/account/list-invoices.md | 13 + docs/examples/account/list-payment-methods.md | 13 + .../update-payment-method-mandate-options.md | 13 + .../account/update-payment-method-provider.md | 15 + .../examples/account/update-payment-method.md | 15 + docs/examples/backups/create-archive.md | 14 + docs/examples/backups/create-policy.md | 19 + docs/examples/backups/create-restoration.md | 16 + docs/examples/backups/delete-archive.md | 13 + docs/examples/backups/delete-policy.md | 13 + docs/examples/backups/get-archive.md | 13 + docs/examples/backups/get-policy.md | 13 + docs/examples/backups/get-restoration.md | 13 + docs/examples/backups/list-archives.md | 13 + docs/examples/backups/list-policies.md | 13 + docs/examples/backups/list-restorations.md | 13 + docs/examples/backups/update-policy.md | 17 + docs/examples/console/create-source.md | 17 + docs/examples/console/get-copon.md | 13 + docs/examples/console/plans.md | 11 + docs/examples/console/regions.md | 11 + docs/examples/functions/create-build.md | 2 +- docs/examples/functions/create-execution.md | 3 +- docs/examples/functions/create.md | 4 +- docs/examples/functions/delete-execution.md | 14 - ...ent-download.md => download-deployment.md} | 2 +- docs/examples/functions/list-templates.md | 16 - .../functions/update-deployment-build.md | 14 - docs/examples/functions/update.md | 4 +- docs/examples/organizations/add-credit.md | 14 + .../organizations/create-invoice-payment.md | 15 + docs/examples/organizations/create.md | 17 + .../delete-backup-payment-method.md | 13 + .../organizations/delete-billing-address.md | 13 + .../delete-default-payment-method.md | 13 + docs/examples/organizations/delete.md | 13 + .../examples/organizations/get-aggregation.md | 14 + .../organizations/get-billing-address.md | 14 + docs/examples/organizations/get-credit.md | 14 + .../organizations/get-invoice-download.md | 14 + .../organizations/get-invoice-view.md | 14 + docs/examples/organizations/get-invoice.md | 14 + .../organizations/get-payment-method.md | 14 + docs/examples/organizations/get-plan.md | 13 + docs/examples/organizations/get-usage.md | 15 + .../organizations/list-aggregations.md | 14 + docs/examples/organizations/list-invoices.md | 14 + docs/examples/organizations/list.md | 14 + .../set-backup-payment-method.md | 14 + .../organizations/set-billing-address.md | 14 + .../organizations/set-billing-email.md | 14 + .../organizations/set-billing-tax-id.md | 14 + .../set-default-payment-method.md | 14 + docs/examples/organizations/update-budget.md | 15 + docs/examples/organizations/update-plan.md | 16 + docs/examples/projects/create-j-w-t.md | 15 - docs/examples/projects/update-mock-numbers.md | 14 - .../projects/update-session-alerts.md | 14 - docs/examples/users/create-j-w-t.md | 15 - docs/examples/vcs/get-repository-contents.md | 15 - package.json | 2 +- src/client.ts | 4 +- src/enums/billing-plan.ts | 5 + src/enums/email-template-type.ts | 2 - src/enums/platform-type.ts | 2 - src/enums/runtime.ts | 1 - src/index.ts | 5 +- src/models.ts | 1238 +++++++++++++---- src/services/account.ts | 347 ++++- src/services/backups.ts | 425 ++++++ src/services/console.ts | 120 ++ src/services/functions.ts | 209 +-- src/services/organizations.ts | 896 ++++++++++++ src/services/projects.ts | 111 +- src/services/users.ts | 37 - src/services/vcs.ts | 36 - 84 files changed, 3497 insertions(+), 809 deletions(-) rename docs/examples/{functions/list-specifications.md => account/create-payment-method.md} (54%) create mode 100644 docs/examples/account/delete-payment-method.md create mode 100644 docs/examples/account/get-billing-address.md create mode 100644 docs/examples/account/get-payment-method.md rename docs/examples/{functions/get-template.md => account/list-billing-addresses.md} (50%) create mode 100644 docs/examples/account/list-credits.md create mode 100644 docs/examples/account/list-invoices.md create mode 100644 docs/examples/account/list-payment-methods.md create mode 100644 docs/examples/account/update-payment-method-mandate-options.md create mode 100644 docs/examples/account/update-payment-method-provider.md create mode 100644 docs/examples/account/update-payment-method.md create mode 100644 docs/examples/backups/create-archive.md create mode 100644 docs/examples/backups/create-policy.md create mode 100644 docs/examples/backups/create-restoration.md create mode 100644 docs/examples/backups/delete-archive.md create mode 100644 docs/examples/backups/delete-policy.md create mode 100644 docs/examples/backups/get-archive.md create mode 100644 docs/examples/backups/get-policy.md create mode 100644 docs/examples/backups/get-restoration.md create mode 100644 docs/examples/backups/list-archives.md create mode 100644 docs/examples/backups/list-policies.md create mode 100644 docs/examples/backups/list-restorations.md create mode 100644 docs/examples/backups/update-policy.md create mode 100644 docs/examples/console/create-source.md create mode 100644 docs/examples/console/get-copon.md create mode 100644 docs/examples/console/plans.md create mode 100644 docs/examples/console/regions.md delete mode 100644 docs/examples/functions/delete-execution.md rename docs/examples/functions/{get-deployment-download.md => download-deployment.md} (88%) delete mode 100644 docs/examples/functions/list-templates.md delete mode 100644 docs/examples/functions/update-deployment-build.md create mode 100644 docs/examples/organizations/add-credit.md create mode 100644 docs/examples/organizations/create-invoice-payment.md create mode 100644 docs/examples/organizations/create.md create mode 100644 docs/examples/organizations/delete-backup-payment-method.md create mode 100644 docs/examples/organizations/delete-billing-address.md create mode 100644 docs/examples/organizations/delete-default-payment-method.md create mode 100644 docs/examples/organizations/delete.md create mode 100644 docs/examples/organizations/get-aggregation.md create mode 100644 docs/examples/organizations/get-billing-address.md create mode 100644 docs/examples/organizations/get-credit.md create mode 100644 docs/examples/organizations/get-invoice-download.md create mode 100644 docs/examples/organizations/get-invoice-view.md create mode 100644 docs/examples/organizations/get-invoice.md create mode 100644 docs/examples/organizations/get-payment-method.md create mode 100644 docs/examples/organizations/get-plan.md create mode 100644 docs/examples/organizations/get-usage.md create mode 100644 docs/examples/organizations/list-aggregations.md create mode 100644 docs/examples/organizations/list-invoices.md create mode 100644 docs/examples/organizations/list.md create mode 100644 docs/examples/organizations/set-backup-payment-method.md create mode 100644 docs/examples/organizations/set-billing-address.md create mode 100644 docs/examples/organizations/set-billing-email.md create mode 100644 docs/examples/organizations/set-billing-tax-id.md create mode 100644 docs/examples/organizations/set-default-payment-method.md create mode 100644 docs/examples/organizations/update-budget.md create mode 100644 docs/examples/organizations/update-plan.md delete mode 100644 docs/examples/projects/create-j-w-t.md delete mode 100644 docs/examples/projects/update-mock-numbers.md delete mode 100644 docs/examples/projects/update-session-alerts.md delete mode 100644 docs/examples/users/create-j-w-t.md delete mode 100644 docs/examples/vcs/get-repository-contents.md create mode 100644 src/enums/billing-plan.ts create mode 100644 src/services/backups.ts create mode 100644 src/services/organizations.ts diff --git a/README.md b/README.md index 0eb1a20..ab71171 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Console SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.5.10-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.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/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 Console 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) @@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/account/create-payment-method.md similarity index 54% rename from docs/examples/functions/list-specifications.md rename to docs/examples/account/create-payment-method.md index a3c11f1..53b31bd 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/account/create-payment-method.md @@ -1,11 +1,11 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const functions = new Functions(client); +const account = new Account(client); -const result = await functions.listSpecifications(); +const result = await account.createPaymentMethod(); console.log(result); diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 64f27fd..4ba25d5 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -7,7 +7,8 @@ const client = new Client() const account = new Account(client); const result = await account.deleteMfaAuthenticator( - AuthenticatorType.Totp // type + AuthenticatorType.Totp, // type + '' // otp ); console.log(result); diff --git a/docs/examples/account/delete-payment-method.md b/docs/examples/account/delete-payment-method.md new file mode 100644 index 0000000..12871b9 --- /dev/null +++ b/docs/examples/account/delete-payment-method.md @@ -0,0 +1,13 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deletePaymentMethod( + '' // paymentMethodId +); + +console.log(result); diff --git a/docs/examples/account/get-billing-address.md b/docs/examples/account/get-billing-address.md new file mode 100644 index 0000000..8c11c4c --- /dev/null +++ b/docs/examples/account/get-billing-address.md @@ -0,0 +1,13 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getBillingAddress( + '' // billingAddressId +); + +console.log(result); diff --git a/docs/examples/account/get-payment-method.md b/docs/examples/account/get-payment-method.md new file mode 100644 index 0000000..22bf34f --- /dev/null +++ b/docs/examples/account/get-payment-method.md @@ -0,0 +1,13 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getPaymentMethod( + '' // paymentMethodId +); + +console.log(result); diff --git a/docs/examples/functions/get-template.md b/docs/examples/account/list-billing-addresses.md similarity index 50% rename from docs/examples/functions/get-template.md rename to docs/examples/account/list-billing-addresses.md index a230c7a..1995d67 100644 --- a/docs/examples/functions/get-template.md +++ b/docs/examples/account/list-billing-addresses.md @@ -1,13 +1,13 @@ -import { Client, Functions } from "@appwrite.io/console"; +import { Client, Account } from "@appwrite.io/console"; const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const functions = new Functions(client); +const account = new Account(client); -const result = await functions.getTemplate( - '' // templateId +const result = await account.listBillingAddresses( + '' // queries (optional) ); console.log(result); diff --git a/docs/examples/account/list-credits.md b/docs/examples/account/list-credits.md new file mode 100644 index 0000000..b1fcb52 --- /dev/null +++ b/docs/examples/account/list-credits.md @@ -0,0 +1,14 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listCredits( + '', // organizationId + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/account/list-invoices.md b/docs/examples/account/list-invoices.md new file mode 100644 index 0000000..9d66618 --- /dev/null +++ b/docs/examples/account/list-invoices.md @@ -0,0 +1,13 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listInvoices( + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/account/list-payment-methods.md b/docs/examples/account/list-payment-methods.md new file mode 100644 index 0000000..bd55cc0 --- /dev/null +++ b/docs/examples/account/list-payment-methods.md @@ -0,0 +1,13 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listPaymentMethods( + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/account/update-payment-method-mandate-options.md b/docs/examples/account/update-payment-method-mandate-options.md new file mode 100644 index 0000000..560bb68 --- /dev/null +++ b/docs/examples/account/update-payment-method-mandate-options.md @@ -0,0 +1,13 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePaymentMethodMandateOptions( + '' // paymentMethodId +); + +console.log(result); diff --git a/docs/examples/account/update-payment-method-provider.md b/docs/examples/account/update-payment-method-provider.md new file mode 100644 index 0000000..122a9db --- /dev/null +++ b/docs/examples/account/update-payment-method-provider.md @@ -0,0 +1,15 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePaymentMethodProvider( + '', // paymentMethodId + '', // providerMethodId + '' // name +); + +console.log(result); diff --git a/docs/examples/account/update-payment-method.md b/docs/examples/account/update-payment-method.md new file mode 100644 index 0000000..2b68c3c --- /dev/null +++ b/docs/examples/account/update-payment-method.md @@ -0,0 +1,15 @@ +import { Client, Account } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePaymentMethod( + '', // paymentMethodId + 1, // expiryMonth + 2024 // expiryYear +); + +console.log(result); diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 0000000..863b1f9 --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,14 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.createArchive( + [], // services + '' // resourceId (optional) +); + +console.log(result); diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md new file mode 100644 index 0000000..b683f30 --- /dev/null +++ b/docs/examples/backups/create-policy.md @@ -0,0 +1,19 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.createPolicy( + '', // policyId + [], // services + 1, // retention + '', // schedule + '', // name (optional) + '', // resourceId (optional) + false // enabled (optional) +); + +console.log(result); diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md new file mode 100644 index 0000000..59cda09 --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,16 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.createRestoration( + '', // archiveId + [], // services + '', // newResourceId (optional) + '' // newResourceName (optional) +); + +console.log(result); diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md new file mode 100644 index 0000000..f839e25 --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.deleteArchive( + '' // archiveId +); + +console.log(result); diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md new file mode 100644 index 0000000..87f6c2c --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.deletePolicy( + '' // policyId +); + +console.log(result); diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md new file mode 100644 index 0000000..10e1b2c --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.getArchive( + '' // archiveId +); + +console.log(result); diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md new file mode 100644 index 0000000..5e9e4c2 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.getPolicy( + '' // policyId +); + +console.log(result); diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md new file mode 100644 index 0000000..98ba11a --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.getRestoration( + '' // restorationId +); + +console.log(result); diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md new file mode 100644 index 0000000..d96b28f --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.listArchives( + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md new file mode 100644 index 0000000..fd06008 --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.listPolicies( + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md new file mode 100644 index 0000000..bd5688e --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,13 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.listRestorations( + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md new file mode 100644 index 0000000..56db011 --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,17 @@ +import { Client, Backups } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.updatePolicy( + '', // policyId + '', // name (optional) + 1, // retention (optional) + '', // schedule (optional) + false // enabled (optional) +); + +console.log(result); diff --git a/docs/examples/console/create-source.md b/docs/examples/console/create-source.md new file mode 100644 index 0000000..46d97c6 --- /dev/null +++ b/docs/examples/console/create-source.md @@ -0,0 +1,17 @@ +import { Client, Console } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const console = new Console(client); + +const result = await console.createSource( + '', // ref (optional) + 'https://example.com', // referrer (optional) + '', // utmSource (optional) + '', // utmCampaign (optional) + '' // utmMedium (optional) +); + +console.log(result); diff --git a/docs/examples/console/get-copon.md b/docs/examples/console/get-copon.md new file mode 100644 index 0000000..b0f901e --- /dev/null +++ b/docs/examples/console/get-copon.md @@ -0,0 +1,13 @@ +import { Client, Console } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const console = new Console(client); + +const result = await console.getCopon( + '' // couponId +); + +console.log(result); diff --git a/docs/examples/console/plans.md b/docs/examples/console/plans.md new file mode 100644 index 0000000..1f99ad4 --- /dev/null +++ b/docs/examples/console/plans.md @@ -0,0 +1,11 @@ +import { Client, Console } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const console = new Console(client); + +const result = await console.plans(); + +console.log(result); diff --git a/docs/examples/console/regions.md b/docs/examples/console/regions.md new file mode 100644 index 0000000..fac4e89 --- /dev/null +++ b/docs/examples/console/regions.md @@ -0,0 +1,11 @@ +import { Client, Console } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const console = new Console(client); + +const result = await console.regions(); + +console.log(result); diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index 89c7d08..05925aa 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -9,7 +9,7 @@ const functions = new Functions(client); const result = await functions.createBuild( '', // functionId '', // deploymentId - '' // buildId (optional) + '' // buildId ); console.log(result); diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index dfaf2ef..78bb249 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -12,8 +12,7 @@ const result = await functions.createExecution( false, // async (optional) '', // path (optional) ExecutionMethod.GET, // method (optional) - {}, // headers (optional) - '' // scheduledAt (optional) + {} // headers (optional) ); console.log(result); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 63df3bf..c99f466 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -18,7 +18,6 @@ const result = await functions.create( false, // logging (optional) '', // entrypoint (optional) '', // commands (optional) - [], // scopes (optional) '', // installationId (optional) '', // providerRepositoryId (optional) '', // providerBranch (optional) @@ -27,8 +26,7 @@ const result = await functions.create( '', // templateRepository (optional) '', // templateOwner (optional) '', // templateRootDirectory (optional) - '', // templateVersion (optional) - '' // specification (optional) + '' // templateBranch (optional) ); console.log(result); diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md deleted file mode 100644 index 2a857d6..0000000 --- a/docs/examples/functions/delete-execution.md +++ /dev/null @@ -1,14 +0,0 @@ -import { Client, Functions } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const functions = new Functions(client); - -const result = await functions.deleteExecution( - '', // functionId - '' // executionId -); - -console.log(result); diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/download-deployment.md similarity index 88% rename from docs/examples/functions/get-deployment-download.md rename to docs/examples/functions/download-deployment.md index 34f5b4e..8115c7e 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/download-deployment.md @@ -6,7 +6,7 @@ const client = new Client() const functions = new Functions(client); -const result = functions.getDeploymentDownload( +const result = functions.downloadDeployment( '', // functionId '' // deploymentId ); diff --git a/docs/examples/functions/list-templates.md b/docs/examples/functions/list-templates.md deleted file mode 100644 index 3970f8f..0000000 --- a/docs/examples/functions/list-templates.md +++ /dev/null @@ -1,16 +0,0 @@ -import { Client, Functions } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const functions = new Functions(client); - -const result = await functions.listTemplates( - [], // runtimes (optional) - [], // useCases (optional) - 1, // limit (optional) - 0 // offset (optional) -); - -console.log(result); diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-build.md deleted file mode 100644 index bd11a2a..0000000 --- a/docs/examples/functions/update-deployment-build.md +++ /dev/null @@ -1,14 +0,0 @@ -import { Client, Functions } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const functions = new Functions(client); - -const result = await functions.updateDeploymentBuild( - '', // functionId - '' // deploymentId -); - -console.log(result); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index a8d1709..3b34a04 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -18,13 +18,11 @@ const result = await functions.update( false, // logging (optional) '', // entrypoint (optional) '', // commands (optional) - [], // scopes (optional) '', // installationId (optional) '', // providerRepositoryId (optional) '', // providerBranch (optional) false, // providerSilentMode (optional) - '', // providerRootDirectory (optional) - '' // specification (optional) + '' // providerRootDirectory (optional) ); console.log(result); diff --git a/docs/examples/organizations/add-credit.md b/docs/examples/organizations/add-credit.md new file mode 100644 index 0000000..9844d5f --- /dev/null +++ b/docs/examples/organizations/add-credit.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.addCredit( + '', // organizationId + '' // couponId +); + +console.log(result); diff --git a/docs/examples/organizations/create-invoice-payment.md b/docs/examples/organizations/create-invoice-payment.md new file mode 100644 index 0000000..4f8b7ac --- /dev/null +++ b/docs/examples/organizations/create-invoice-payment.md @@ -0,0 +1,15 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.createInvoicePayment( + '', // organizationId + '', // invoiceId + '' // paymentMethodId +); + +console.log(result); diff --git a/docs/examples/organizations/create.md b/docs/examples/organizations/create.md new file mode 100644 index 0000000..2244362 --- /dev/null +++ b/docs/examples/organizations/create.md @@ -0,0 +1,17 @@ +import { Client, Organizations, } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.create( + '', // organizationId + '', // name + .Tier0, // billingPlan + '', // paymentMethodId (optional) + '' // billingAddressId (optional) +); + +console.log(result); diff --git a/docs/examples/organizations/delete-backup-payment-method.md b/docs/examples/organizations/delete-backup-payment-method.md new file mode 100644 index 0000000..7dcdea8 --- /dev/null +++ b/docs/examples/organizations/delete-backup-payment-method.md @@ -0,0 +1,13 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.deleteBackupPaymentMethod( + '' // organizationId +); + +console.log(result); diff --git a/docs/examples/organizations/delete-billing-address.md b/docs/examples/organizations/delete-billing-address.md new file mode 100644 index 0000000..4e07602 --- /dev/null +++ b/docs/examples/organizations/delete-billing-address.md @@ -0,0 +1,13 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.deleteBillingAddress( + '' // organizationId +); + +console.log(result); diff --git a/docs/examples/organizations/delete-default-payment-method.md b/docs/examples/organizations/delete-default-payment-method.md new file mode 100644 index 0000000..6b84f4d --- /dev/null +++ b/docs/examples/organizations/delete-default-payment-method.md @@ -0,0 +1,13 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.deleteDefaultPaymentMethod( + '' // organizationId +); + +console.log(result); diff --git a/docs/examples/organizations/delete.md b/docs/examples/organizations/delete.md new file mode 100644 index 0000000..8a3f672 --- /dev/null +++ b/docs/examples/organizations/delete.md @@ -0,0 +1,13 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.delete( + '' // organizationId +); + +console.log(result); diff --git a/docs/examples/organizations/get-aggregation.md b/docs/examples/organizations/get-aggregation.md new file mode 100644 index 0000000..96a9bd7 --- /dev/null +++ b/docs/examples/organizations/get-aggregation.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getAggregation( + '', // organizationId + '' // aggregationId +); + +console.log(result); diff --git a/docs/examples/organizations/get-billing-address.md b/docs/examples/organizations/get-billing-address.md new file mode 100644 index 0000000..d7dae56 --- /dev/null +++ b/docs/examples/organizations/get-billing-address.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getBillingAddress( + '', // organizationId + '' // billingAddressId +); + +console.log(result); diff --git a/docs/examples/organizations/get-credit.md b/docs/examples/organizations/get-credit.md new file mode 100644 index 0000000..9baaf49 --- /dev/null +++ b/docs/examples/organizations/get-credit.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getCredit( + '', // organizationId + '' // creditId +); + +console.log(result); diff --git a/docs/examples/organizations/get-invoice-download.md b/docs/examples/organizations/get-invoice-download.md new file mode 100644 index 0000000..15daaf6 --- /dev/null +++ b/docs/examples/organizations/get-invoice-download.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getInvoiceDownload( + '', // organizationId + '' // invoiceId +); + +console.log(result); diff --git a/docs/examples/organizations/get-invoice-view.md b/docs/examples/organizations/get-invoice-view.md new file mode 100644 index 0000000..d1b7fbb --- /dev/null +++ b/docs/examples/organizations/get-invoice-view.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getInvoiceView( + '', // organizationId + '' // invoiceId +); + +console.log(result); diff --git a/docs/examples/organizations/get-invoice.md b/docs/examples/organizations/get-invoice.md new file mode 100644 index 0000000..42491bb --- /dev/null +++ b/docs/examples/organizations/get-invoice.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getInvoice( + '', // organizationId + '' // invoiceId +); + +console.log(result); diff --git a/docs/examples/organizations/get-payment-method.md b/docs/examples/organizations/get-payment-method.md new file mode 100644 index 0000000..6082938 --- /dev/null +++ b/docs/examples/organizations/get-payment-method.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getPaymentMethod( + '', // organizationId + '' // paymentMethodId +); + +console.log(result); diff --git a/docs/examples/organizations/get-plan.md b/docs/examples/organizations/get-plan.md new file mode 100644 index 0000000..ede4772 --- /dev/null +++ b/docs/examples/organizations/get-plan.md @@ -0,0 +1,13 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getPlan( + '' // organizationId +); + +console.log(result); diff --git a/docs/examples/organizations/get-usage.md b/docs/examples/organizations/get-usage.md new file mode 100644 index 0000000..b6300f9 --- /dev/null +++ b/docs/examples/organizations/get-usage.md @@ -0,0 +1,15 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.getUsage( + '', // organizationId + '', // startDate (optional) + '' // endDate (optional) +); + +console.log(result); diff --git a/docs/examples/organizations/list-aggregations.md b/docs/examples/organizations/list-aggregations.md new file mode 100644 index 0000000..b04053f --- /dev/null +++ b/docs/examples/organizations/list-aggregations.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.listAggregations( + '', // organizationId + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/organizations/list-invoices.md b/docs/examples/organizations/list-invoices.md new file mode 100644 index 0000000..a7fe959 --- /dev/null +++ b/docs/examples/organizations/list-invoices.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.listInvoices( + '', // organizationId + '' // queries (optional) +); + +console.log(result); diff --git a/docs/examples/organizations/list.md b/docs/examples/organizations/list.md new file mode 100644 index 0000000..21edb99 --- /dev/null +++ b/docs/examples/organizations/list.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.list( + '', // queries (optional) + '' // search (optional) +); + +console.log(result); diff --git a/docs/examples/organizations/set-backup-payment-method.md b/docs/examples/organizations/set-backup-payment-method.md new file mode 100644 index 0000000..da59a48 --- /dev/null +++ b/docs/examples/organizations/set-backup-payment-method.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.setBackupPaymentMethod( + '', // organizationId + '' // paymentMethodId +); + +console.log(result); diff --git a/docs/examples/organizations/set-billing-address.md b/docs/examples/organizations/set-billing-address.md new file mode 100644 index 0000000..e9bf045 --- /dev/null +++ b/docs/examples/organizations/set-billing-address.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.setBillingAddress( + '', // organizationId + '' // billingAddressId +); + +console.log(result); diff --git a/docs/examples/organizations/set-billing-email.md b/docs/examples/organizations/set-billing-email.md new file mode 100644 index 0000000..973c3f1 --- /dev/null +++ b/docs/examples/organizations/set-billing-email.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.setBillingEmail( + '', // organizationId + 'email@example.com' // billingEmail +); + +console.log(result); diff --git a/docs/examples/organizations/set-billing-tax-id.md b/docs/examples/organizations/set-billing-tax-id.md new file mode 100644 index 0000000..656a958 --- /dev/null +++ b/docs/examples/organizations/set-billing-tax-id.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.setBillingTaxId( + '', // organizationId + '' // taxId +); + +console.log(result); diff --git a/docs/examples/organizations/set-default-payment-method.md b/docs/examples/organizations/set-default-payment-method.md new file mode 100644 index 0000000..2ccdbd0 --- /dev/null +++ b/docs/examples/organizations/set-default-payment-method.md @@ -0,0 +1,14 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.setDefaultPaymentMethod( + '', // organizationId + '' // paymentMethodId +); + +console.log(result); diff --git a/docs/examples/organizations/update-budget.md b/docs/examples/organizations/update-budget.md new file mode 100644 index 0000000..659b3ce --- /dev/null +++ b/docs/examples/organizations/update-budget.md @@ -0,0 +1,15 @@ +import { Client, Organizations } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.updateBudget( + '', // organizationId + 0, // budget + [] // alerts (optional) +); + +console.log(result); diff --git a/docs/examples/organizations/update-plan.md b/docs/examples/organizations/update-plan.md new file mode 100644 index 0000000..609e602 --- /dev/null +++ b/docs/examples/organizations/update-plan.md @@ -0,0 +1,16 @@ +import { Client, Organizations, } from "@appwrite.io/console"; + +const client = new Client() + .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const organizations = new Organizations(client); + +const result = await organizations.updatePlan( + '', // organizationId + .Tier0, // billingPlan + '', // paymentMethodId (optional) + '' // billingAddressId (optional) +); + +console.log(result); diff --git a/docs/examples/projects/create-j-w-t.md b/docs/examples/projects/create-j-w-t.md deleted file mode 100644 index 2674a12..0000000 --- a/docs/examples/projects/create-j-w-t.md +++ /dev/null @@ -1,15 +0,0 @@ -import { Client, Projects } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.createJWT( - '', // projectId - [], // scopes - 0 // duration (optional) -); - -console.log(result); diff --git a/docs/examples/projects/update-mock-numbers.md b/docs/examples/projects/update-mock-numbers.md deleted file mode 100644 index c371e72..0000000 --- a/docs/examples/projects/update-mock-numbers.md +++ /dev/null @@ -1,14 +0,0 @@ -import { Client, Projects } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.updateMockNumbers( - '', // projectId - [] // numbers -); - -console.log(result); diff --git a/docs/examples/projects/update-session-alerts.md b/docs/examples/projects/update-session-alerts.md deleted file mode 100644 index f718d25..0000000 --- a/docs/examples/projects/update-session-alerts.md +++ /dev/null @@ -1,14 +0,0 @@ -import { Client, Projects } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const projects = new Projects(client); - -const result = await projects.updateSessionAlerts( - '', // projectId - false // alerts -); - -console.log(result); diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-j-w-t.md deleted file mode 100644 index aefc620..0000000 --- a/docs/examples/users/create-j-w-t.md +++ /dev/null @@ -1,15 +0,0 @@ -import { Client, Users } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const users = new Users(client); - -const result = await users.createJWT( - '', // userId - '', // sessionId (optional) - 0 // duration (optional) -); - -console.log(result); diff --git a/docs/examples/vcs/get-repository-contents.md b/docs/examples/vcs/get-repository-contents.md deleted file mode 100644 index 8a2fc29..0000000 --- a/docs/examples/vcs/get-repository-contents.md +++ /dev/null @@ -1,15 +0,0 @@ -import { Client, Vcs } from "@appwrite.io/console"; - -const client = new Client() - .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const vcs = new Vcs(client); - -const result = await vcs.getRepositoryContents( - '', // installationId - '', // providerRepositoryId - '' // providerRootDirectory (optional) -); - -console.log(result); diff --git a/package.json b/package.json index a2c02e6..49f6d8a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@appwrite.io/console", "homepage": "https://appwrite.io/support", "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.1", + "version": "1.1.0-rc.1", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index ed21bc2..7ab890b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -304,8 +304,8 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '1.0.1', - 'X-Appwrite-Response-Format': '1.6.0', + 'x-sdk-version': '1.1.0-rc.1', + 'X-Appwrite-Response-Format': '1.5.0', }; /** diff --git a/src/enums/billing-plan.ts b/src/enums/billing-plan.ts new file mode 100644 index 0000000..b2654ca --- /dev/null +++ b/src/enums/billing-plan.ts @@ -0,0 +1,5 @@ +export enum BillingPlan { + Tier0 = 'tier-0', + Tier1 = 'tier-1', + Tier2 = 'tier-2', +} \ No newline at end of file diff --git a/src/enums/email-template-type.ts b/src/enums/email-template-type.ts index 639340a..e0ab5c6 100644 --- a/src/enums/email-template-type.ts +++ b/src/enums/email-template-type.ts @@ -4,6 +4,4 @@ export enum EmailTemplateType { Recovery = 'recovery', Invitation = 'invitation', Mfachallenge = 'mfachallenge', - Sessionalert = 'sessionalert', - Otpsession = 'otpsession', } \ No newline at end of file diff --git a/src/enums/platform-type.ts b/src/enums/platform-type.ts index e7c72fd..914dda8 100644 --- a/src/enums/platform-type.ts +++ b/src/enums/platform-type.ts @@ -12,6 +12,4 @@ export enum PlatformType { Appletvos = 'apple-tvos', Android = 'android', Unity = 'unity', - Reactnativeios = 'react-native-ios', - Reactnativeandroid = 'react-native-android', } \ No newline at end of file diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index f0524b5..113d655 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -44,5 +44,4 @@ export enum Runtime { Cpp17 = 'cpp-17', Cpp20 = 'cpp-20', Bun10 = 'bun-1.0', - Go123 = 'go-1.23', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6336e23..45f5842 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,14 @@ /** * Appwrite Console SDK * - * This SDK is compatible with Appwrite server version 1.6.x. + * This SDK is compatible with Appwrite server version 1.5.x. * For older versions, please check * [previous releases](https://github.com/appwrite/sdk-for-console/releases). */ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; export { Avatars } from './services/avatars'; +export { Backups } from './services/backups'; export { Assistant } from './services/assistant'; export { Console } from './services/console'; export { Databases } from './services/databases'; @@ -17,6 +18,7 @@ export { Health } from './services/health'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; export { Migrations } from './services/migrations'; +export { Organizations } from './services/organizations'; export { Project } from './services/project'; export { Projects } from './services/projects'; export { Proxy } from './services/proxy'; @@ -44,6 +46,7 @@ export { FunctionUsageRange } from './enums/function-usage-range'; export { ExecutionMethod } from './enums/execution-method'; export { Name } from './enums/name'; export { SmtpEncryption } from './enums/smtp-encryption'; +export { BillingPlan } from './enums/billing-plan'; export { ProjectUsageRange } from './enums/project-usage-range'; export { Region } from './enums/region'; export { Api } from './enums/api'; diff --git a/src/models.ts b/src/models.ts index 6835d08..1502cc5 100644 --- a/src/models.ts +++ b/src/models.ts @@ -171,19 +171,6 @@ export namespace Models { */ functions: Function[]; } - /** - * Function Templates List - */ - export type TemplateFunctionList = { - /** - * Total number of templates documents that matched your query. - */ - total: number; - /** - * List of templates. - */ - templates: TemplateFunction[]; - } /** * Installations List */ @@ -509,32 +496,6 @@ export namespace Models { */ projects: FirebaseProject[]; } - /** - * Specifications List - */ - export type SpecificationList = { - /** - * Total number of specifications documents that matched your query. - */ - total: number; - /** - * List of specifications. - */ - specifications: Specification[]; - } - /** - * VCS Content List - */ - export type VcsContentList = { - /** - * Total number of contents documents that matched your query. - */ - total: number; - /** - * List of contents. - */ - contents: VcsContent[]; - } /** * Database */ @@ -1832,10 +1793,6 @@ export namespace Models { * Function's active deployment ID. */ deployment: string; - /** - * Allowed permission scopes. - */ - scopes: string[]; /** * Function variables. */ @@ -1884,133 +1841,6 @@ export namespace Models { * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests */ providerSilentMode: boolean; - /** - * Machine specification for builds and executions. - */ - specification: string; - } - /** - * Template Function - */ - export type TemplateFunction = { - /** - * Function Template Icon. - */ - icon: string; - /** - * Function Template ID. - */ - id: string; - /** - * Function Template Name. - */ - name: string; - /** - * Function Template Tagline. - */ - tagline: string; - /** - * Execution permissions. - */ - permissions: string[]; - /** - * Function trigger events. - */ - events: string[]; - /** - * Function execution schedult in CRON format. - */ - cron: string; - /** - * Function execution timeout in seconds. - */ - timeout: number; - /** - * Function use cases. - */ - useCases: string[]; - /** - * List of runtimes that can be used with this template. - */ - runtimes: TemplateRuntime[]; - /** - * Function Template Instructions. - */ - instructions: string; - /** - * VCS (Version Control System) Provider. - */ - vcsProvider: string; - /** - * VCS (Version Control System) Repository ID - */ - providerRepositoryId: string; - /** - * VCS (Version Control System) Owner. - */ - providerOwner: string; - /** - * VCS (Version Control System) branch version (tag). - */ - providerVersion: string; - /** - * Function variables. - */ - variables: TemplateVariable[]; - /** - * Function scopes. - */ - scopes: string[]; - } - /** - * Template Runtime - */ - export type TemplateRuntime = { - /** - * Runtime Name. - */ - name: string; - /** - * The build command used to build the deployment. - */ - commands: string; - /** - * The entrypoint file used to execute the deployment. - */ - entrypoint: string; - /** - * Path to function in VCS (Version Control System) repository - */ - providerRootDirectory: string; - } - /** - * Template Variable - */ - export type TemplateVariable = { - /** - * Variable Name. - */ - name: string; - /** - * Variable Description. - */ - description: string; - /** - * Variable Value. - */ - value: string; - /** - * Variable Placeholder. - */ - placeholder: string; - /** - * Is the variable required? - */ - required: boolean; - /** - * Variable Type. - */ - type: string; } /** * Installation @@ -2083,23 +1913,6 @@ export namespace Models { */ runtime: string; } - /** - * VcsContents - */ - export type VcsContent = { - /** - * Content size in bytes. Only files have size, and for directories, 0 is returned. - */ - size?: number; - /** - * If a content is a directory. Directories can be used to check nested contents. - */ - isDirectory?: boolean; - /** - * Name of directory or file. - */ - name: string; - } /** * Branch */ @@ -2117,10 +1930,6 @@ export namespace Models { * Runtime ID. */ $id: string; - /** - * Parent runtime key. - */ - key: string; /** * Runtime Name. */ @@ -2182,10 +1991,6 @@ export namespace Models { * The code size in bytes. */ size: number; - /** - * The build output size in bytes. - */ - buildSize: number; /** * The current build ID. */ @@ -2315,51 +2120,6 @@ export namespace Models { * Function execution duration in seconds. */ duration: number; - /** - * The scheduled time for execution. If left empty, execution will be queued immediately. - */ - scheduledAt?: string; - } - /** - * Build - */ - export type Build = { - /** - * Build ID. - */ - $id: string; - /** - * The deployment that created this build. - */ - deploymentId: string; - /** - * The build status. There are a few different types and each one means something different. \nFailed - The deployment build has failed. More details can usually be found in buildStderr\nReady - The deployment build was successful and the deployment is ready to be deployed\nProcessing - The deployment is currently waiting to have a build triggered\nBuilding - The deployment is currently being built - */ - status: string; - /** - * The stdout of the build. - */ - stdout: string; - /** - * The stderr of the build. - */ - stderr: string; - /** - * The deployment creation date in ISO 8601 format. - */ - startTime: string; - /** - * The time the build was finished in ISO 8601 format. - */ - endTime: string; - /** - * The build duration in seconds. - */ - duration: number; - /** - * The code size in bytes. - */ - size: number; } /** * Project @@ -2445,14 +2205,6 @@ export namespace Models { * Whether or not to check the user password for similarity with their personal data. */ authPersonalDataCheck: boolean; - /** - * An array of mock numbers and their corresponding verification codes (OTPs). - */ - authMockNumbers: MockNumber[]; - /** - * Whether or not to send session alert emails to users. - */ - authSessionAlerts: boolean; /** * List of Auth Providers. */ @@ -2577,6 +2329,10 @@ export namespace Models { * Messaging service status */ serviceStatusForMessaging: boolean; + /** + * Project region + */ + region: number; } /** * Webhook @@ -2676,19 +2432,6 @@ export namespace Models { */ sdks: string[]; } - /** - * Mock Number - */ - export type MockNumber = { - /** - * Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. - */ - phone: string; - /** - * Mock OTP for the number. - */ - otp: string; - } /** * AuthProvider */ @@ -3418,27 +3161,6 @@ export namespace Models { */ value: string; } - /** - * Specification - */ - export type Specification = { - /** - * Memory size in MB. - */ - memory: number; - /** - * Number of CPUs. - */ - cpus: number; - /** - * Is size enabled. - */ - enabled: boolean; - /** - * Size slug. - */ - slug: string; - } /** * Rule */ @@ -3939,4 +3661,956 @@ export namespace Models { */ displayName: string; } + /** + * Billing Invoices List + */ + export type InvoiceList = { + /** + * Total number of invoices documents that matched your query. + */ + total: number; + /** + * List of invoices. + */ + invoices: Invoice[]; + } + /** + * Payment Methods List + */ + export type PaymentMethodList = { + /** + * Total number of paymentMethods documents that matched your query. + */ + total: number; + /** + * List of paymentMethods. + */ + paymentMethods: PaymentMethod[]; + } + /** + * Aggregation team list + */ + export type AggregationTeamList = { + /** + * Total number of aggregations documents that matched your query. + */ + total: number; + /** + * List of aggregations. + */ + aggregations: AggregationTeam[]; + } + /** + * Regions list + */ + export type ConsoleRegionList = { + /** + * Total number of regions documents that matched your query. + */ + total: number; + /** + * List of regions. + */ + regions: ConsoleRegion[]; + } + /** + * Billing plan list + */ + export type BillingPlanList = { + /** + * Total number of plans documents that matched your query. + */ + total: number; + /** + * List of plans. + */ + plans: BillingPlan[]; + } + /** + * Backup policy list + */ + export type BackupPolicyList = { + /** + * Total number of policies documents that matched your query. + */ + total: number; + /** + * List of policies. + */ + policies: BackupPolicy[]; + } + /** + * Backup archive list + */ + export type BackupArchiveList = { + /** + * Total number of archives documents that matched your query. + */ + total: number; + /** + * List of archives. + */ + archives: BackupArchive[]; + } + /** + * Backup restoration list + */ + export type BackupRestorationList = { + /** + * Total number of restorations documents that matched your query. + */ + total: number; + /** + * List of restorations. + */ + restorations: BackupRestoration[]; + } + /** + * Organization + */ + export type Organization = { + /** + * Team ID. + */ + $id: string; + /** + * Team creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Team update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Team name. + */ + name: string; + /** + * Total number of team members. + */ + total: number; + /** + * Team preferences as a key-value object + */ + prefs: Preferences; + /** + * Project budget limit + */ + billingBudget: number; + /** + * Project budget limit + */ + budgetAlerts: string[]; + /** + * Billing plan selected. Can be one of `tier-0`, `tier-1` or `tier-2`. + */ + billingPlan: string; + /** + * Billing email set for the organization. + */ + billingEmail: string; + /** + * Billing cycle start date. + */ + billingStartDate: string; + /** + * Current invoice cycle start date. + */ + billingCurrentInvoiceDate: string; + /** + * Next invoice cycle start date. + */ + billingNextInvoiceDate: string; + /** + * Start date of trial. + */ + billingTrialStartDate: string; + /** + * Number of trial days. + */ + billingTrialDays: number; + /** + * Current active aggregation id. + */ + billingAggregationId: string; + /** + * Default payment method. + */ + paymentMethodId: string; + /** + * Default payment method. + */ + billingAddressId: string; + /** + * Backup payment method. + */ + backupPaymentMethodId: string; + /** + * Organization agreements + */ + agreementBAA: string; + /** + * Program manager's name. + */ + programManagerName: string; + /** + * Program manager's calendar link. + */ + programManagerCalendar: string; + /** + * Program's discord channel name. + */ + programDiscordChannelName: string; + /** + * Program's discord channel URL. + */ + programDiscordChannelUrl: string; + /** + * Billing limits reached + */ + billingLimits: object; + /** + * Billing plan downgrade + */ + billingPlanDowngrade: object; + /** + * Tax Id + */ + billingTaxId: string; + /** + * Marked for deletion + */ + markedForDeletion: boolean; + } + /** + * Credit + */ + export type Credit = { + /** + * Credit ID. + */ + $id: string; + /** + * Credit creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Credit update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Credit permissions. [Learn more about permissions](/docs/permissions). + */ + $permissions: string[]; + /** + * coupon ID + */ + couponId: string; + /** + * ID of the User. + */ + userId: string; + /** + * ID of the Team. + */ + teamId: string; + /** + * Provided credit amount + */ + credits: number; + /** + * Provided credit amount + */ + total: number; + /** + * Credit expiration time in ISO 8601 format. + */ + expiration: string; + /** + * Status of the credit. Can be one of `disabled`, `active` or `expired`. + */ + status: string; + } + /** + * Coupon + */ + export type Coupon = { + /** + * coupon ID + */ + $id: string; + /** + * coupon ID + */ + code: string; + /** + * Provided credit amount + */ + credits: number; + /** + * Coupon expiration time in ISO 8601 format. + */ + expiration: string; + /** + * Credit validity in days. + */ + validity: number; + /** + * Campaign the coupon is associated with`. + */ + campaign: string; + /** + * Status of the coupon. Can be one of `disabled`, `active` or `expired`. + */ + status: string; + } + /** + * Invoice + */ + export type Invoice = { + /** + * Invoice ID. + */ + $id: string; + /** + * Invoice creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Invoice update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Invoice permissions. [Learn more about permissions](/docs/permissions). + */ + $permissions: string[]; + /** + * Project ID + */ + teamId: string; + /** + * Aggregation ID + */ + aggregationId: string; + /** + * Billing plan selected. Can be one of `tier-0`, `tier-1` or `tier-2`. + */ + plan: string; + /** + * Usage breakdown per resource + */ + usage: object; + /** + * Invoice Amount + */ + amount: number; + /** + * Tax percentage + */ + tax: number; + /** + * Tax amount + */ + taxAmount: number; + /** + * VAT percentage + */ + vat: number; + /** + * VAT amount + */ + vatAmount: number; + /** + * Gross amount after vat, tax, and discounts applied. + */ + grossAmount: number; + /** + * Credits used. + */ + creditsUsed: number; + /** + * Currency the invoice is in + */ + currency: string; + /** + * Client secret for processing failed payments in front-end + */ + clientSecret: string; + /** + * Invoice status + */ + status: string; + /** + * Last payment error associated with the invoice + */ + lastError: string; + /** + * Invoice due date. + */ + dueAt: string; + /** + * Beginning date of the invoice + */ + from: string; + /** + * End date of the invoice + */ + to: string; + } + /** + * paymentMethod + */ + export type PaymentMethod = { + /** + * Payment Method ID. + */ + $id: string; + /** + * Payment method creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Payment method update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Payment method permissions. [Learn more about permissions](/docs/permissions). + */ + $permissions: string[]; + /** + * Payment method ID from the payment provider + */ + providerMethodId: string; + /** + * Client secret hash for payment setup + */ + clientSecret: string; + /** + * User ID from the payment provider. + */ + providerUserId: string; + /** + * ID of the Team. + */ + userId: string; + /** + * Expiry month of the payment method. + */ + expiryMonth: number; + /** + * Expiry year of the payment method. + */ + expiryYear: number; + /** + * Last 4 digit of the payment method + */ + last4: string; + /** + * Payment method brand + */ + brand: string; + /** + * Name of the owner + */ + name: string; + /** + * Last payment error associated with the payment method. + */ + lastError: string; + /** + * True when it's the default payment method. + */ + default: boolean; + /** + * True when payment method has expired. + */ + expired: boolean; + /** + * True when payment method has failed to process multiple times. + */ + failed: boolean; + } + /** + * AggregationTeam + */ + export type AggregationTeam = { + /** + * Aggregation ID. + */ + $id: string; + /** + * Aggregation creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Aggregation update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Aggregation permissions. [Learn more about permissions](/docs/permissions). + */ + $permissions: string[]; + /** + * Beginning date of the invoice + */ + from: string; + /** + * End date of the invoice + */ + to: string; + /** + * Total storage usage + */ + usageStorage: number; + /** + * Total active users for the billing period + */ + usageUsers: number; + /** + * Total number of executions for the billing period + */ + usageExecutions: number; + /** + * Total bandwidth usage for the billing period + */ + usageBandwidth: number; + /** + * Total realtime usage for the billing period + */ + usageRealtime: number; + /** + * Additional members + */ + additionalMembers: number; + /** + * Additional members cost + */ + additionalMemberAmount: number; + /** + * Additional storage usage cost + */ + additionalStorageAmount: number; + /** + * Additional users usage cost. + */ + additionalUsersAmount: number; + /** + * Additional executions usage cost + */ + additionalExecutionsAmount: number; + /** + * Additional bandwidth usage cost + */ + additionalBandwidthAmount: number; + /** + * Additional realtime usage cost + */ + additionalRealtimeAmount: number; + /** + * Aggregated amount + */ + amount: number; + } + /** + * Region + */ + export type ConsoleRegion = { + /** + * Region ID + */ + $id: string; + /** + * Region name + */ + name: string; + /** + * Is the region disabled. + */ + disabled: boolean; + /** + * Is this the region default. + */ + default: boolean; + /** + * Region flag code. + */ + flag: string; + } + /** + * BillingAddress + */ + export type BillingAddress = { + /** + * Region ID + */ + $id: string; + /** + * Street address + */ + streetAddress: string; + /** + * Address line 2 + */ + addressLine2: string; + /** + * Address country + */ + country: string; + /** + * city + */ + city: string; + /** + * state + */ + state: string; + /** + * postal code + */ + postalCode: string; + } + /** + * billingPlan + */ + export type BillingPlan = { + /** + * Plan ID. + */ + $id: string; + /** + * Plan name + */ + name: string; + /** + * Price + */ + price: number; + /** + * Trial days + */ + trial: number; + /** + * Bandwidth + */ + bandwidth: number; + /** + * Storage + */ + storage: number; + /** + * Members + */ + members: number; + /** + * Webhooks + */ + webhooks: number; + /** + * Platofrms + */ + platforms: number; + /** + * Users + */ + users: number; + /** + * Teams + */ + teams: number; + /** + * Databases + */ + databases: number; + /** + * Buckets + */ + buckets: number; + /** + * File size + */ + fileSize: number; + /** + * Functions + */ + functions: number; + /** + * Function executions + */ + executions: number; + /** + * Realtime connections + */ + realtime: number; + /** + * Log days + */ + logs: number; + /** + * Additional resources + */ + addons: AdditionalResource[]; + /** + * Custom SMTP + */ + customSmtp: boolean; + /** + * Appwrite branding in email + */ + emailBranding: boolean; + /** + * Does plan require payment method + */ + requiresPaymentMethod: boolean; + /** + * Does plan require billing address + */ + requiresBillingAddress: boolean; + } + /** + * AdditionalResource + */ + export type AdditionalResource = { + /** + * Resource unit + */ + unit: string; + /** + * Price currency + */ + currency: string; + /** + * Price + */ + price: number; + /** + * Resource value + */ + value: number; + } + /** + * UsageOrganization + */ + export type UsageOrganization = { + /** + * Aggregated stats for number of requests. + */ + bandwidth: Metric[]; + /** + * Aggregated stats for consumed bandwidth. + */ + users: Metric[]; + /** + * Aggregated stats for function executions. + */ + executions: Metric[]; + /** + * Aggregated stats for function executions. + */ + usersTotal: number; + /** + * Aggregated stats for function executions. + */ + executionsTotal: number; + /** + * Aggregated stats for number of documents. + */ + storageTotal: number; + /** + * Aggregated stats for each projects. + */ + projects: UsageOrganizationProject[]; + } + /** + * UsageOrganizationProject + */ + export type UsageOrganizationProject = { + /** + * projectId + */ + projectId: string; + /** + * Aggregated stats for number of requests. + */ + bandwidth: Metric[]; + /** + * Aggregated stats for consumed bandwidth. + */ + users: Metric[]; + /** + * Aggregated stats for function executions. + */ + executions: number; + /** + * Aggregated stats for number of documents. + */ + storage: number; + } + /** + * CreditList + */ + export type CreditList = { + /** + * Credits + */ + credits: Credit[]; + /** + * Total number of credits + */ + total: number; + /** + * Total available credit balance in USD + */ + available: number; + } + /** + * backup + */ + export type BackupPolicy = { + /** + * Backup policy ID. + */ + $id: string; + /** + * Backup policy name. + */ + name: string; + /** + * Policy creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Policy update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The services that are backed up by this policy. + */ + services: string[]; + /** + * The resources that are backed up by this policy. + */ + resources: string[]; + /** + * The resource ID to backup. Set only if this policy should backup a single resource. + */ + resourceId?: string; + /** + * The resource type to backup. Set only if this policy should backup a single resource. + */ + resourceType?: string; + /** + * How many days to keep the backup before it will be automatically deleted. + */ + retention: number; + /** + * Policy backup schedule in CRON format. + */ + schedule: string; + /** + * Is this policy enabled. + */ + enabled: boolean; + } + /** + * Archive + */ + export type BackupArchive = { + /** + * Archive ID. + */ + $id: string; + /** + * Archive creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Archive update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Archive policy ID. + */ + policyId: string; + /** + * Archive size in bytes. + */ + size: number; + /** + * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed. + */ + status: string; + /** + * The backup start time. + */ + startedAt: string; + /** + * Migration ID. + */ + migrationId: string; + /** + * The services that are backed up by this policy. + */ + services: string[]; + /** + * The resources that are backed up by this policy. + */ + resources: string[]; + /** + * The resource ID to backup. Set only if this policy should backup a single resource. + */ + resourceId?: string; + /** + * The resource type to backup. Set only if this policy should backup a single resource. + */ + resourceType?: string; + } + /** + * Restoration + */ + export type BackupRestoration = { + /** + * Restoration ID. + */ + $id: string; + /** + * Restoration creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Restoration update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Backup archive ID. + */ + archiveId: string; + /** + * Backup policy ID. + */ + policyId: string; + /** + * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. + */ + status: string; + /** + * The backup start time. + */ + startedAt: string; + /** + * Migration ID. + */ + migrationId: string; + /** + * The services that are backed up by this policy. + */ + services: string[]; + /** + * The resources that are backed up by this policy. + */ + resources: string[]; + /** + * Optional data in key-value object. + */ + options: string; + } } diff --git a/src/services/account.ts b/src/services/account.ts index 291699b..03b5efe 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -112,6 +112,62 @@ export class Account { payload ); } + /** + * List billing addresses + * + * + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listBillingAddresses(queries?: string): Promise { + const apiPath = '/account/billing-addresses'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get billing address + * + * + * @param {string} billingAddressId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getBillingAddress(billingAddressId: string): Promise { + if (typeof billingAddressId === 'undefined') { + throw new AppwriteException('Missing required parameter: "billingAddressId"'); + } + const apiPath = '/account/billing-addresses/{billingAddressId}'.replace('{billingAddressId}', billingAddressId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } /** * Update email * @@ -211,6 +267,34 @@ This endpoint can also be used to convert an anonymous account to a normal one, payload ); } + /** + * List invoices + * + * + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listInvoices(queries?: string): Promise { + const apiPath = '/account/invoices'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } /** * Create JWT * @@ -220,7 +304,7 @@ This endpoint can also be used to convert an anonymous account to a normal one, * @returns {Promise} */ async createJWT(): Promise { - const apiPath = '/account/jwts'; + const apiPath = '/account/jwt'; const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -368,15 +452,22 @@ This endpoint can also be used to convert an anonymous account to a normal one, * Delete an authenticator for a user by ID. * * @param {AuthenticatorType} type + * @param {string} otp * @throws {AppwriteException} * @returns {Promise<{}>} */ - async deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}> { + async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> { if (typeof type === 'undefined') { throw new AppwriteException('Missing required parameter: "type"'); } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); const payload: Payload = {}; + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -623,6 +714,226 @@ This endpoint can also be used to convert an anonymous account to a normal one, } + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * List payment methods + * + * + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listPaymentMethods(queries?: string): Promise { + const apiPath = '/account/payment-methods'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Create new payment method + * + * + * @throws {AppwriteException} + * @returns {Promise} + */ + async createPaymentMethod(): Promise { + const apiPath = '/account/payment-methods'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + /** + * Get payment method + * + * + * @param {string} paymentMethodId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getPaymentMethod(paymentMethodId: string): Promise { + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Update payment method + * + * + * @param {string} paymentMethodId + * @param {number} expiryMonth + * @param {number} expiryYear + * @throws {AppwriteException} + * @returns {Promise} + */ + async updatePaymentMethod(paymentMethodId: string, expiryMonth: number, expiryYear: number): Promise { + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + if (typeof expiryMonth === 'undefined') { + throw new AppwriteException('Missing required parameter: "expiryMonth"'); + } + if (typeof expiryYear === 'undefined') { + throw new AppwriteException('Missing required parameter: "expiryYear"'); + } + const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId); + const payload: Payload = {}; + if (typeof expiryMonth !== 'undefined') { + payload['expiryMonth'] = expiryMonth; + } + if (typeof expiryYear !== 'undefined') { + payload['expiryYear'] = expiryYear; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Delete payment method + * + * + * @param {string} paymentMethodId + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + async deletePaymentMethod(paymentMethodId: string): Promise<{}> { + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + const apiPath = '/account/payment-methods/{paymentMethodId}'.replace('{paymentMethodId}', paymentMethodId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** + * Update payment method provider id + * + * + * @param {string} paymentMethodId + * @param {string} providerMethodId + * @param {string} name + * @throws {AppwriteException} + * @returns {Promise} + */ + async updatePaymentMethodProvider(paymentMethodId: string, providerMethodId: string, name: string): Promise { + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + if (typeof providerMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerMethodId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + const apiPath = '/account/payment-methods/{paymentMethodId}/provider'.replace('{paymentMethodId}', paymentMethodId); + const payload: Payload = {}; + if (typeof providerMethodId !== 'undefined') { + payload['providerMethodId'] = providerMethodId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Update payment method with new setup with mandates for indian cards + * + * + * @param {string} paymentMethodId + * @throws {AppwriteException} + * @returns {Promise} + */ + async updatePaymentMethodMandateOptions(paymentMethodId: string): Promise { + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + const apiPath = '/account/payment-methods/{paymentMethodId}/setup'.replace('{paymentMethodId}', paymentMethodId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return await this.client.call( 'patch', uri, @@ -1636,4 +1947,36 @@ Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/ payload ); } + /** + * List credits + * + * + * @param {string} organizationId + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listCredits(organizationId: string, queries?: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } } diff --git a/src/services/backups.ts b/src/services/backups.ts new file mode 100644 index 0000000..13e2391 --- /dev/null +++ b/src/services/backups.ts @@ -0,0 +1,425 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +export class Backups { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Create archive + * + * + * @param {string[]} services + * @param {string} resourceId + * @throws {AppwriteException} + * @returns {Promise} + */ + async createArchive(services: string[], resourceId?: string): Promise { + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + const apiPath = '/backups/archive'; + const payload: Payload = {}; + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + /** + * Delete archive + * + * + * @param {string} archiveId + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + async deleteArchive(archiveId: string): Promise<{}> { + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + const apiPath = '/backups/archive/{archiveId}'.replace('{archiveId}', archiveId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** + * List archives + * + * + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listArchives(queries?: string): Promise { + const apiPath = '/backups/archives'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get backup archive + * + * + * @param {string} archiveId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getArchive(archiveId: string): Promise { + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * List backup policies + * + * + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listPolicies(queries?: string): Promise { + const apiPath = '/backups/policies'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Create backup policy + * + * + * @param {string} policyId + * @param {string[]} services + * @param {number} retention + * @param {string} schedule + * @param {string} name + * @param {string} resourceId + * @param {boolean} enabled + * @throws {AppwriteException} + * @returns {Promise} + */ + async createPolicy(policyId: string, services: string[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise { + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + if (typeof retention === 'undefined') { + throw new AppwriteException('Missing required parameter: "retention"'); + } + if (typeof schedule === 'undefined') { + throw new AppwriteException('Missing required parameter: "schedule"'); + } + const apiPath = '/backups/policies'; + const payload: Payload = {}; + if (typeof policyId !== 'undefined') { + payload['policyId'] = policyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof retention !== 'undefined') { + payload['retention'] = retention; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + /** + * Get backup policy + * + * + * @param {string} policyId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getPolicy(policyId: string): Promise { + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Update backup policy + * + * + * @param {string} policyId + * @param {string} name + * @param {number} retention + * @param {string} schedule + * @param {boolean} enabled + * @throws {AppwriteException} + * @returns {Promise} + */ + async updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise { + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof retention !== 'undefined') { + payload['retention'] = retention; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Delete backup policy + * + * + * @param {string} policyId + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + async deletePolicy(policyId: string): Promise<{}> { + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** + * Create restoration + * + * + * @param {string} archiveId + * @param {string[]} services + * @param {string} newResourceId + * @param {string} newResourceName + * @throws {AppwriteException} + * @returns {Promise} + */ + async createRestoration(archiveId: string, services: string[], newResourceId?: string, newResourceName?: string): Promise { + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + const apiPath = '/backups/restoration'; + const payload: Payload = {}; + if (typeof archiveId !== 'undefined') { + payload['archiveId'] = archiveId; + } + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof newResourceId !== 'undefined') { + payload['newResourceId'] = newResourceId; + } + if (typeof newResourceName !== 'undefined') { + payload['newResourceName'] = newResourceName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + /** + * List restorations + * + * + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listRestorations(queries?: string): Promise { + const apiPath = '/backups/restorations'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get backup restoration + * + * + * @param {string} restorationId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getRestoration(restorationId: string): Promise { + if (typeof restorationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "restorationId"'); + } + const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/console.ts b/src/services/console.ts index 7749d18..a8fdf90 100644 --- a/src/services/console.ts +++ b/src/services/console.ts @@ -9,6 +9,126 @@ export class Console { this.client = client; } + /** + * Get coupon details + * + * + * @param {string} couponId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getCopon(couponId: string): Promise { + if (typeof couponId === 'undefined') { + throw new AppwriteException('Missing required parameter: "couponId"'); + } + const apiPath = '/console/coupons/{couponId}'.replace('{couponId}', couponId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get plans + * + * + * @throws {AppwriteException} + * @returns {Promise} + */ + async plans(): Promise { + const apiPath = '/console/plans'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get Regions + * + * + * @throws {AppwriteException} + * @returns {Promise} + */ + async regions(): Promise { + const apiPath = '/console/regions'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Create source + * + * + * @param {string} ref + * @param {string} referrer + * @param {string} utmSource + * @param {string} utmCampaign + * @param {string} utmMedium + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + async createSource(ref?: string, referrer?: string, utmSource?: string, utmCampaign?: string, utmMedium?: string): Promise<{}> { + const apiPath = '/console/sources'; + const payload: Payload = {}; + if (typeof ref !== 'undefined') { + payload['ref'] = ref; + } + if (typeof referrer !== 'undefined') { + payload['referrer'] = referrer; + } + if (typeof utmSource !== 'undefined') { + payload['utmSource'] = utmSource; + } + if (typeof utmCampaign !== 'undefined') { + payload['utmCampaign'] = utmCampaign; + } + if (typeof utmMedium !== 'undefined') { + payload['utmMedium'] = utmMedium; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } /** * Get variables * diff --git a/src/services/functions.ts b/src/services/functions.ts index 5bce133..eb278de 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -61,7 +61,6 @@ export class Functions { * @param {boolean} logging * @param {string} entrypoint * @param {string} commands - * @param {string[]} scopes * @param {string} installationId * @param {string} providerRepositoryId * @param {string} providerBranch @@ -70,12 +69,11 @@ export class Functions { * @param {string} templateRepository * @param {string} templateOwner * @param {string} templateRootDirectory - * @param {string} templateVersion - * @param {string} specification + * @param {string} templateBranch * @throws {AppwriteException} * @returns {Promise} */ - async create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateVersion?: string, specification?: string): Promise { + async create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, templateRepository?: string, templateOwner?: string, templateRootDirectory?: string, templateBranch?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -120,9 +118,6 @@ export class Functions { if (typeof commands !== 'undefined') { payload['commands'] = commands; } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } if (typeof installationId !== 'undefined') { payload['installationId'] = installationId; } @@ -147,11 +142,8 @@ export class Functions { if (typeof templateRootDirectory !== 'undefined') { payload['templateRootDirectory'] = templateRootDirectory; } - if (typeof templateVersion !== 'undefined') { - payload['templateVersion'] = templateVersion; - } - if (typeof specification !== 'undefined') { - payload['specification'] = specification; + if (typeof templateBranch !== 'undefined') { + payload['templateBranch'] = templateBranch; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -185,102 +177,6 @@ export class Functions { } - return await this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - /** - * List available function runtime specifications - * - * List allowed function specifications for this instance. - - * - * @throws {AppwriteException} - * @returns {Promise} - */ - async listSpecifications(): Promise { - const apiPath = '/functions/specifications'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - - return await this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - /** - * List function templates - * - * List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. - * - * @param {string[]} runtimes - * @param {string[]} useCases - * @param {number} limit - * @param {number} offset - * @throws {AppwriteException} - * @returns {Promise} - */ - async listTemplates(runtimes?: string[], useCases?: string[], limit?: number, offset?: number): Promise { - const apiPath = '/functions/templates'; - const payload: Payload = {}; - if (typeof runtimes !== 'undefined') { - payload['runtimes'] = runtimes; - } - if (typeof useCases !== 'undefined') { - payload['useCases'] = useCases; - } - if (typeof limit !== 'undefined') { - payload['limit'] = limit; - } - if (typeof offset !== 'undefined') { - payload['offset'] = offset; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - - return await this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - /** - * Get function template - * - * Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. - * - * @param {string} templateId - * @throws {AppwriteException} - * @returns {Promise} - */ - async getTemplate(templateId: string): Promise { - if (typeof templateId === 'undefined') { - throw new AppwriteException('Missing required parameter: "templateId"'); - } - const apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return await this.client.call( 'get', uri, @@ -361,17 +257,15 @@ export class Functions { * @param {boolean} logging * @param {string} entrypoint * @param {string} commands - * @param {string[]} scopes * @param {string} installationId * @param {string} providerRepositoryId * @param {string} providerBranch * @param {boolean} providerSilentMode * @param {string} providerRootDirectory - * @param {string} specification * @throws {AppwriteException} * @returns {Promise} */ - async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: string[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, specification?: string): Promise { + async update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -410,9 +304,6 @@ export class Functions { if (typeof commands !== 'undefined') { payload['commands'] = commands; } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } if (typeof installationId !== 'undefined') { payload['installationId'] = installationId; } @@ -428,9 +319,6 @@ export class Functions { if (typeof providerRootDirectory !== 'undefined') { payload['providerRootDirectory'] = providerRootDirectory; } - if (typeof specification !== 'undefined') { - payload['specification'] = specification; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -667,8 +555,9 @@ Use the "command" param to set the entrypoint used to execute your cod ); } /** - * Rebuild deployment + * Create build * + * Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build. * * @param {string} functionId * @param {string} deploymentId @@ -676,49 +565,17 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {Promise<{}>} */ - async createBuild(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"'); } if (typeof deploymentId === 'undefined') { throw new AppwriteException('Missing required parameter: "deploymentId"'); } - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - if (typeof buildId !== 'undefined') { - payload['buildId'] = buildId; + if (typeof buildId === 'undefined') { + throw new AppwriteException('Missing required parameter: "buildId"'); } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - - return await this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - /** - * Cancel deployment - * - * - * @param {string} functionId - * @param {string} deploymentId - * @throws {AppwriteException} - * @returns {Promise} - */ - async updateDeploymentBuild(functionId: string, deploymentId: string): Promise { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/build'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId).replace('{buildId}', buildId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -728,7 +585,7 @@ Use the "command" param to set the entrypoint used to execute your cod return await this.client.call( - 'patch', + 'post', uri, apiHeaders, payload @@ -744,7 +601,7 @@ Use the "command" param to set the entrypoint used to execute your cod * @throws {AppwriteException} * @returns {string} */ - getDeploymentDownload(functionId: string, deploymentId: string): string { + downloadDeployment(functionId: string, deploymentId: string): string { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -820,11 +677,10 @@ Use the "command" param to set the entrypoint used to execute your cod * @param {string} xpath * @param {ExecutionMethod} method * @param {object} headers - * @param {string} scheduledAt * @throws {AppwriteException} * @returns {Promise} */ - async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise { + async createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object): Promise { if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } @@ -845,9 +701,6 @@ Use the "command" param to set the entrypoint used to execute your cod if (typeof headers !== 'undefined') { payload['headers'] = headers; } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -895,40 +748,6 @@ Use the "command" param to set the entrypoint used to execute your cod payload ); } - /** - * Delete execution - * - * Delete a function execution by its unique ID. - - * - * @param {string} functionId - * @param {string} executionId - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - async deleteExecution(functionId: string, executionId: string): Promise<{}> { - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - - return await this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } /** * Get function usage * diff --git a/src/services/organizations.ts b/src/services/organizations.ts new file mode 100644 index 0000000..d7d37f6 --- /dev/null +++ b/src/services/organizations.ts @@ -0,0 +1,896 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; +import { BillingPlan } from '../enums/billing-plan'; + +export class Organizations { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List Orgnizations + * + * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + * + * @param {string} queries + * @param {string} search + * @throws {AppwriteException} + * @returns {Promise>} + */ + async list(queries?: string, search?: string): Promise> { + const apiPath = '/organizations'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Create Organization + * + * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + * + * @param {string} organizationId + * @param {string} name + * @param {BillingPlan} billingPlan + * @param {string} paymentMethodId + * @param {string} billingAddressId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async create(organizationId: string, name: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof billingPlan === 'undefined') { + throw new AppwriteException('Missing required parameter: "billingPlan"'); + } + const apiPath = '/organizations'; + const payload: Payload = {}; + if (typeof organizationId !== 'undefined') { + payload['organizationId'] = organizationId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof billingPlan !== 'undefined') { + payload['billingPlan'] = billingPlan; + } + if (typeof paymentMethodId !== 'undefined') { + payload['paymentMethodId'] = paymentMethodId; + } + if (typeof billingAddressId !== 'undefined') { + payload['billingAddressId'] = billingAddressId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + /** + * Delete team + * + * Delete a team using its ID. Only team members with the owner role can delete the team. + * + * @param {string} organizationId + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + async delete(organizationId: string): Promise<{}> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** + * List aggregations + * + * + * @param {string} organizationId + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listAggregations(organizationId: string, queries?: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/aggregations'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get invoice + * + * + * @param {string} organizationId + * @param {string} aggregationId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getAggregation(organizationId: string, aggregationId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof aggregationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "aggregationId"'); + } + const apiPath = '/organizations/{organizationId}/aggregations/{aggregationId}'.replace('{organizationId}', organizationId).replace('{aggregationId}', aggregationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Set team's billing address + * + * + * @param {string} organizationId + * @param {string} billingAddressId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async setBillingAddress(organizationId: string, billingAddressId: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof billingAddressId === 'undefined') { + throw new AppwriteException('Missing required parameter: "billingAddressId"'); + } + const apiPath = '/organizations/{organizationId}/billing-address'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof billingAddressId !== 'undefined') { + payload['billingAddressId'] = billingAddressId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Delete team's billing address + * + * + * @param {string} organizationId + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + async deleteBillingAddress(organizationId: string): Promise<{}> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/billing-address'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** + * Get billing address + * + * + * @param {string} organizationId + * @param {string} billingAddressId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getBillingAddress(organizationId: string, billingAddressId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof billingAddressId === 'undefined') { + throw new AppwriteException('Missing required parameter: "billingAddressId"'); + } + const apiPath = '/organizations/{organizationId}/billing-addresses/{billingAddressId}'.replace('{organizationId}', organizationId).replace('{billingAddressId}', billingAddressId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Set team's billing email + * + * + * @param {string} organizationId + * @param {string} billingEmail + * @throws {AppwriteException} + * @returns {Promise>} + */ + async setBillingEmail(organizationId: string, billingEmail: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof billingEmail === 'undefined') { + throw new AppwriteException('Missing required parameter: "billingEmail"'); + } + const apiPath = '/organizations/{organizationId}/billing-email'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof billingEmail !== 'undefined') { + payload['billingEmail'] = billingEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Update organization budget + * + * + * @param {string} organizationId + * @param {number} budget + * @param {number[]} alerts + * @throws {AppwriteException} + * @returns {Promise>} + */ + async updateBudget(organizationId: string, budget: number, alerts?: number[]): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof budget === 'undefined') { + throw new AppwriteException('Missing required parameter: "budget"'); + } + const apiPath = '/organizations/{organizationId}/budget'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof budget !== 'undefined') { + payload['budget'] = budget; + } + if (typeof alerts !== 'undefined') { + payload['alerts'] = alerts; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Add credits from coupon + * + * + * @param {string} organizationId + * @param {string} couponId + * @throws {AppwriteException} + * @returns {Promise} + */ + async addCredit(organizationId: string, couponId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof couponId === 'undefined') { + throw new AppwriteException('Missing required parameter: "couponId"'); + } + const apiPath = '/organizations/{organizationId}/credits'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof couponId !== 'undefined') { + payload['couponId'] = couponId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + /** + * Get credit details + * + * + * @param {string} organizationId + * @param {string} creditId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getCredit(organizationId: string, creditId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof creditId === 'undefined') { + throw new AppwriteException('Missing required parameter: "creditId"'); + } + const apiPath = '/organizations/{organizationId}/credits/{creditId}'.replace('{organizationId}', organizationId).replace('{creditId}', creditId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * List invoices + * + * + * @param {string} organizationId + * @param {string} queries + * @throws {AppwriteException} + * @returns {Promise} + */ + async listInvoices(organizationId: string, queries?: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/invoices'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get invoice + * + * + * @param {string} organizationId + * @param {string} invoiceId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getInvoice(organizationId: string, invoiceId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof invoiceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "invoiceId"'); + } + const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * View invoice in PDF + * + * + * @param {string} organizationId + * @param {string} invoiceId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getInvoiceDownload(organizationId: string, invoiceId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof invoiceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "invoiceId"'); + } + const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}/download'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Initiate payment for failed invoice to pay live from console + * + * + * @param {string} organizationId + * @param {string} invoiceId + * @param {string} paymentMethodId + * @throws {AppwriteException} + * @returns {Promise} + */ + async createInvoicePayment(organizationId: string, invoiceId: string, paymentMethodId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof invoiceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "invoiceId"'); + } + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}/payments'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId); + const payload: Payload = {}; + if (typeof paymentMethodId !== 'undefined') { + payload['paymentMethodId'] = paymentMethodId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + /** + * View invoice in PDF + * + * + * @param {string} organizationId + * @param {string} invoiceId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getInvoiceView(organizationId: string, invoiceId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof invoiceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "invoiceId"'); + } + const apiPath = '/organizations/{organizationId}/invoices/{invoiceId}/view'.replace('{organizationId}', organizationId).replace('{invoiceId}', invoiceId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Set team's payment method + * + * + * @param {string} organizationId + * @param {string} paymentMethodId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async setDefaultPaymentMethod(organizationId: string, paymentMethodId: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + const apiPath = '/organizations/{organizationId}/payment-method'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof paymentMethodId !== 'undefined') { + payload['paymentMethodId'] = paymentMethodId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Delete team's default payment method + * + * + * @param {string} organizationId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async deleteDefaultPaymentMethod(organizationId: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/payment-method'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** + * Set team's backup payment method + * + * + * @param {string} organizationId + * @param {string} paymentMethodId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async setBackupPaymentMethod(organizationId: string, paymentMethodId: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + const apiPath = '/organizations/{organizationId}/payment-method/backup'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof paymentMethodId !== 'undefined') { + payload['paymentMethodId'] = paymentMethodId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Delete team's backup payment method + * + * + * @param {string} organizationId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async deleteBackupPaymentMethod(organizationId: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/payment-method/backup'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + /** + * Get payment method + * + * + * @param {string} organizationId + * @param {string} paymentMethodId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getPaymentMethod(organizationId: string, paymentMethodId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof paymentMethodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "paymentMethodId"'); + } + const apiPath = '/organizations/{organizationId}/payment-methods/{paymentMethodId}'.replace('{organizationId}', organizationId).replace('{paymentMethodId}', paymentMethodId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Get organization billing plan details + * + * + * @param {string} organizationId + * @throws {AppwriteException} + * @returns {Promise} + */ + async getPlan(organizationId: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/plan'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + /** + * Update organization billing plan + * + * + * @param {string} organizationId + * @param {BillingPlan} billingPlan + * @param {string} paymentMethodId + * @param {string} billingAddressId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async updatePlan(organizationId: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof billingPlan === 'undefined') { + throw new AppwriteException('Missing required parameter: "billingPlan"'); + } + const apiPath = '/organizations/{organizationId}/plan'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof billingPlan !== 'undefined') { + payload['billingPlan'] = billingPlan; + } + if (typeof paymentMethodId !== 'undefined') { + payload['paymentMethodId'] = paymentMethodId; + } + if (typeof billingAddressId !== 'undefined') { + payload['billingAddressId'] = billingAddressId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Set team's tax Id + * + * + * @param {string} organizationId + * @param {string} taxId + * @throws {AppwriteException} + * @returns {Promise>} + */ + async setBillingTaxId(organizationId: string, taxId: string): Promise> { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + if (typeof taxId === 'undefined') { + throw new AppwriteException('Missing required parameter: "taxId"'); + } + const apiPath = '/organizations/{organizationId}/taxId'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof taxId !== 'undefined') { + payload['taxId'] = taxId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + /** + * Get team's usage data + * + * + * @param {string} organizationId + * @param {string} startDate + * @param {string} endDate + * @throws {AppwriteException} + * @returns {Promise} + */ + async getUsage(organizationId: string, startDate?: string, endDate?: string): Promise { + if (typeof organizationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "organizationId"'); + } + const apiPath = '/organizations/{organizationId}/usage'.replace('{organizationId}', organizationId); + const payload: Payload = {}; + if (typeof startDate !== 'undefined') { + payload['startDate'] = startDate; + } + if (typeof endDate !== 'undefined') { + payload['endDate'] = endDate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + + return await this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/projects.ts b/src/services/projects.ts index c1de5a4..9ee3928 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -439,41 +439,6 @@ export class Projects { } - return await this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - /** - * Update the mock numbers for the project - * - * - * @param {string} projectId - * @param {object[]} numbers - * @throws {AppwriteException} - * @returns {Promise} - */ - async updateMockNumbers(projectId: string, numbers: object[]): Promise { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof numbers === 'undefined') { - throw new AppwriteException('Missing required parameter: "numbers"'); - } - const apiPath = '/projects/{projectId}/auth/mock-numbers'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof numbers !== 'undefined') { - payload['numbers'] = numbers; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return await this.client.call( 'patch', uri, @@ -579,41 +544,6 @@ export class Projects { } - return await this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - /** - * Update project sessions emails - * - * - * @param {string} projectId - * @param {boolean} alerts - * @throws {AppwriteException} - * @returns {Promise} - */ - async updateSessionAlerts(projectId: string, alerts: boolean): Promise { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof alerts === 'undefined') { - throw new AppwriteException('Missing required parameter: "alerts"'); - } - const apiPath = '/projects/{projectId}/auth/session-alerts'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof alerts !== 'undefined') { - payload['alerts'] = alerts; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return await this.client.call( 'patch', uri, @@ -660,45 +590,6 @@ export class Projects { payload ); } - /** - * Create JWT - * - * - * @param {string} projectId - * @param {string[]} scopes - * @param {number} duration - * @throws {AppwriteException} - * @returns {Promise} - */ - async createJWT(projectId: string, scopes: string[], duration?: number): Promise { - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - const apiPath = '/projects/{projectId}/jwts'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - - return await this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } /** * List keys * @@ -1352,7 +1243,7 @@ export class Projects { ); } /** - * Update project team + * Update Project Team * * * @param {string} projectId diff --git a/src/services/users.ts b/src/services/users.ts index 9b9355d..abf06f0 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -688,43 +688,6 @@ export class Users { payload ); } - /** - * Create user JWT - * - * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. - * - * @param {string} userId - * @param {string} sessionId - * @param {number} duration - * @throws {AppwriteException} - * @returns {Promise} - */ - async createJWT(userId: string, sessionId?: string, duration?: number): Promise { - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - const apiPath = '/users/{userId}/jwts'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof sessionId !== 'undefined') { - payload['sessionId'] = sessionId; - } - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - - return await this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } /** * Update user labels * diff --git a/src/services/vcs.ts b/src/services/vcs.ts index e871f25..0771108 100644 --- a/src/services/vcs.ts +++ b/src/services/vcs.ts @@ -140,42 +140,6 @@ export class Vcs { } - return await this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - /** - * Get files and directories of a VCS repository - * - * - * @param {string} installationId - * @param {string} providerRepositoryId - * @param {string} providerRootDirectory - * @throws {AppwriteException} - * @returns {Promise} - */ - async getRepositoryContents(installationId: string, providerRepositoryId: string, providerRootDirectory?: string): Promise { - if (typeof installationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "installationId"'); - } - if (typeof providerRepositoryId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerRepositoryId"'); - } - const apiPath = '/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/contents'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId); - const payload: Payload = {}; - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return await this.client.call( 'get', uri,