diff --git a/CHANGELOG.md b/CHANGELOG.md index b44e079b..a956f58e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## 6.0.0 + +* Breaking: Renamed `domains.confirmPurchase()` to `domains.updatePurchase()` +* Breaking: Renamed `domains.confirmTransferIn()` to `domains.updateTransferIn()` +* Breaking: Replaced `Projects` API with `Webhooks` for webhook usage +* Breaking: Renamed `updateWebhook()` to `update()` on `Webhooks` +* Breaking: Renamed `listWebhooks()` to `list()` on `Webhooks` +* Breaking: Replaced `DomainPurchasePaymentStatus` with `DomainPurchaseStatus` +* Breaking: Renamed `DomainTransferStatusStatus` to `DomainTransferStatus` +* Breaking: Removed `Deno121`, `Deno124`, `Deno135` from `BuildRuntime`/`Runtime` enums +* Updated README badge to API version `1.8.2` +* Added `queries` option to `webhooks.list()` + ## 5.0.0 * Breaking: Functions and Sites now require `specification` parameter and support `deploymentRetention` diff --git a/README.md b/README.md index 6dc128a3..1515aa85 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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.8.1-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.2-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) @@ -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/domains/confirm-purchase.md b/docs/examples/domains/update-purchase.md similarity index 88% rename from docs/examples/domains/confirm-purchase.md rename to docs/examples/domains/update-purchase.md index f3cd1ea5..2f3b6bed 100644 --- a/docs/examples/domains/confirm-purchase.md +++ b/docs/examples/domains/update-purchase.md @@ -7,7 +7,7 @@ const client = new Client() const domains = new Domains(client); -const result = await domains.confirmPurchase({ +const result = await domains.updatePurchase({ domainId: '', organizationId: '' }); diff --git a/docs/examples/domains/confirm-transfer-in.md b/docs/examples/domains/update-transfer-in.md similarity index 88% rename from docs/examples/domains/confirm-transfer-in.md rename to docs/examples/domains/update-transfer-in.md index 717c2f76..9dc3e260 100644 --- a/docs/examples/domains/confirm-transfer-in.md +++ b/docs/examples/domains/update-transfer-in.md @@ -7,7 +7,7 @@ const client = new Client() const domains = new Domains(client); -const result = await domains.confirmTransferIn({ +const result = await domains.updateTransferIn({ domainId: '', organizationId: '' }); diff --git a/docs/examples/projects/update-webhook.md b/docs/examples/webhooks/create.md similarity index 67% rename from docs/examples/projects/update-webhook.md rename to docs/examples/webhooks/create.md index 93b6aa93..c4ad5f3a 100644 --- a/docs/examples/projects/update-webhook.md +++ b/docs/examples/webhooks/create.md @@ -1,20 +1,19 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Webhooks } 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 webhooks = new Webhooks(client); -const result = await projects.updateWebhook({ - projectId: '', +const result = await webhooks.create({ webhookId: '', + url: '', name: '', events: [], - url: '', - security: false, enabled: false, // optional + security: false, // optional httpUser: '', // optional httpPass: '' // optional }); diff --git a/docs/examples/projects/get-webhook.md b/docs/examples/webhooks/delete.md similarity index 58% rename from docs/examples/projects/get-webhook.md rename to docs/examples/webhooks/delete.md index 314a7500..1ba3b99d 100644 --- a/docs/examples/projects/get-webhook.md +++ b/docs/examples/webhooks/delete.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Webhooks } 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 webhooks = new Webhooks(client); -const result = await projects.getWebhook({ - projectId: '', +const result = await webhooks.delete({ webhookId: '' }); diff --git a/docs/examples/projects/delete-webhook.md b/docs/examples/webhooks/get.md similarity index 58% rename from docs/examples/projects/delete-webhook.md rename to docs/examples/webhooks/get.md index cac83907..f8afc2f9 100644 --- a/docs/examples/projects/delete-webhook.md +++ b/docs/examples/webhooks/get.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Webhooks } 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 webhooks = new Webhooks(client); -const result = await projects.deleteWebhook({ - projectId: '', +const result = await webhooks.get({ webhookId: '' }); diff --git a/docs/examples/projects/list-webhooks.md b/docs/examples/webhooks/list.md similarity index 58% rename from docs/examples/projects/list-webhooks.md rename to docs/examples/webhooks/list.md index de37755d..ebdd766a 100644 --- a/docs/examples/projects/list-webhooks.md +++ b/docs/examples/webhooks/list.md @@ -1,14 +1,14 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Webhooks } 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 webhooks = new Webhooks(client); -const result = await projects.listWebhooks({ - projectId: '', +const result = await webhooks.list({ + queries: [], // optional total: false // optional }); diff --git a/docs/examples/projects/update-webhook-signature.md b/docs/examples/webhooks/update-signature.md similarity index 56% rename from docs/examples/projects/update-webhook-signature.md rename to docs/examples/webhooks/update-signature.md index 19cdb2e8..a472c3b8 100644 --- a/docs/examples/projects/update-webhook-signature.md +++ b/docs/examples/webhooks/update-signature.md @@ -1,14 +1,13 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Webhooks } 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 webhooks = new Webhooks(client); -const result = await projects.updateWebhookSignature({ - projectId: '', +const result = await webhooks.updateSignature({ webhookId: '' }); diff --git a/docs/examples/projects/create-webhook.md b/docs/examples/webhooks/update.md similarity index 65% rename from docs/examples/projects/create-webhook.md rename to docs/examples/webhooks/update.md index 847eb386..52cb3553 100644 --- a/docs/examples/projects/create-webhook.md +++ b/docs/examples/webhooks/update.md @@ -1,19 +1,19 @@ ```javascript -import { Client, Projects } from "@appwrite.io/console"; +import { Client, Webhooks } 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 webhooks = new Webhooks(client); -const result = await projects.createWebhook({ - projectId: '', +const result = await webhooks.update({ + webhookId: '', name: '', - events: [], url: '', - security: false, + events: [], enabled: false, // optional + security: false, // optional httpUser: '', // optional httpPass: '' // optional }); diff --git a/package.json b/package.json index c87487a4..526320e0 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 abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "5.0.0", + "version": "6.0.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 86dacf96..8b673e19 100644 --- a/src/client.ts +++ b/src/client.ts @@ -400,7 +400,7 @@ class Client { 'x-sdk-name': 'Console', 'x-sdk-platform': 'console', 'x-sdk-language': 'web', - 'x-sdk-version': '5.0.0', + 'x-sdk-version': '6.0.0', 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index 0741a17e..be56a9f4 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -30,9 +30,6 @@ export enum BuildRuntime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', @@ -88,4 +85,90 @@ export enum BuildRuntime { Flutter332 = 'flutter-3.32', Flutter335 = 'flutter-3.35', Flutter338 = 'flutter-3.38', + Node145rc = 'node-14.5-rc', + Node160rc = 'node-16.0-rc', + Node180rc = 'node-18.0-rc', + Node190rc = 'node-19.0-rc', + Node200rc = 'node-20.0-rc', + Node210rc = 'node-21.0-rc', + Node22rc = 'node-22-rc', + Node23rc = 'node-23-rc', + Node24rc = 'node-24-rc', + Node25rc = 'node-25-rc', + Php80rc = 'php-8.0-rc', + Php81rc = 'php-8.1-rc', + Php82rc = 'php-8.2-rc', + Php83rc = 'php-8.3-rc', + Php84rc = 'php-8.4-rc', + Ruby30rc = 'ruby-3.0-rc', + Ruby31rc = 'ruby-3.1-rc', + Ruby32rc = 'ruby-3.2-rc', + Ruby33rc = 'ruby-3.3-rc', + Ruby34rc = 'ruby-3.4-rc', + Ruby40rc = 'ruby-4.0-rc', + Python38rc = 'python-3.8-rc', + Python39rc = 'python-3.9-rc', + Python310rc = 'python-3.10-rc', + Python311rc = 'python-3.11-rc', + Python312rc = 'python-3.12-rc', + Python313rc = 'python-3.13-rc', + Python314rc = 'python-3.14-rc', + Pythonml311rc = 'python-ml-3.11-rc', + Pythonml312rc = 'python-ml-3.12-rc', + Pythonml313rc = 'python-ml-3.13-rc', + Deno140rc = 'deno-1.40-rc', + Deno146rc = 'deno-1.46-rc', + Deno20rc = 'deno-2.0-rc', + Deno25rc = 'deno-2.5-rc', + Deno26rc = 'deno-2.6-rc', + Dart215rc = 'dart-2.15-rc', + Dart216rc = 'dart-2.16-rc', + Dart217rc = 'dart-2.17-rc', + Dart218rc = 'dart-2.18-rc', + Dart219rc = 'dart-2.19-rc', + Dart30rc = 'dart-3.0-rc', + Dart31rc = 'dart-3.1-rc', + Dart33rc = 'dart-3.3-rc', + Dart35rc = 'dart-3.5-rc', + Dart38rc = 'dart-3.8-rc', + Dart39rc = 'dart-3.9-rc', + Dart310rc = 'dart-3.10-rc', + Dotnet60rc = 'dotnet-6.0-rc', + Dotnet70rc = 'dotnet-7.0-rc', + Dotnet80rc = 'dotnet-8.0-rc', + Dotnet10rc = 'dotnet-10-rc', + Java80rc = 'java-8.0-rc', + Java110rc = 'java-11.0-rc', + Java170rc = 'java-17.0-rc', + Java180rc = 'java-18.0-rc', + Java210rc = 'java-21.0-rc', + Java22rc = 'java-22-rc', + Java25rc = 'java-25-rc', + Swift55rc = 'swift-5.5-rc', + Swift58rc = 'swift-5.8-rc', + Swift59rc = 'swift-5.9-rc', + Swift510rc = 'swift-5.10-rc', + Swift62rc = 'swift-6.2-rc', + Kotlin16rc = 'kotlin-1.6-rc', + Kotlin18rc = 'kotlin-1.8-rc', + Kotlin19rc = 'kotlin-1.9-rc', + Kotlin20rc = 'kotlin-2.0-rc', + Kotlin23rc = 'kotlin-2.3-rc', + Cpp17rc = 'cpp-17-rc', + Cpp20rc = 'cpp-20-rc', + Bun10rc = 'bun-1.0-rc', + Bun11rc = 'bun-1.1-rc', + Bun12rc = 'bun-1.2-rc', + Bun13rc = 'bun-1.3-rc', + Go123rc = 'go-1.23-rc', + Go124rc = 'go-1.24-rc', + Go125rc = 'go-1.25-rc', + Go126rc = 'go-1.26-rc', + Static1rc = 'static-1-rc', + Flutter324rc = 'flutter-3.24-rc', + Flutter327rc = 'flutter-3.27-rc', + Flutter329rc = 'flutter-3.29-rc', + Flutter332rc = 'flutter-3.32-rc', + Flutter335rc = 'flutter-3.35-rc', + Flutter338rc = 'flutter-3.38-rc', } \ No newline at end of file diff --git a/src/enums/domain-purchase-payment-status.ts b/src/enums/domain-purchase-payment-status.ts deleted file mode 100644 index 8ad1b734..00000000 --- a/src/enums/domain-purchase-payment-status.ts +++ /dev/null @@ -1,10 +0,0 @@ -export enum DomainPurchasePaymentStatus { - Pending = 'pending', - PendingConfirmation = 'pending_confirmation', - PendingPaymentProcessing = 'pending_payment_processing', - Authorized = 'authorized', - Captured = 'captured', - Failed = 'failed', - CaptureFailed = 'capture_failed', - RenewalCaptureFailed = 'renewal_capture_failed', -} \ No newline at end of file diff --git a/src/enums/domain-purchase-status.ts b/src/enums/domain-purchase-status.ts new file mode 100644 index 00000000..e21a3ffd --- /dev/null +++ b/src/enums/domain-purchase-status.ts @@ -0,0 +1,6 @@ +export enum DomainPurchaseStatus { + Pending = 'pending', + Succeeded = 'succeeded', + Failed = 'failed', + Cancelled = 'cancelled', +} \ No newline at end of file diff --git a/src/enums/domain-transfer-status-status.ts b/src/enums/domain-transfer-status-enum.ts similarity index 88% rename from src/enums/domain-transfer-status-status.ts rename to src/enums/domain-transfer-status-enum.ts index c612d28c..1cc6eb88 100644 --- a/src/enums/domain-transfer-status-status.ts +++ b/src/enums/domain-transfer-status-enum.ts @@ -1,4 +1,4 @@ -export enum DomainTransferStatusStatus { +export enum DomainTransferStatusEnum { Transferrable = 'transferrable', NotTransferrable = 'not_transferrable', PendingOwner = 'pending_owner', diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index 68765627..cfd4a735 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -30,9 +30,6 @@ export enum Runtime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', @@ -88,4 +85,90 @@ export enum Runtime { Flutter332 = 'flutter-3.32', Flutter335 = 'flutter-3.35', Flutter338 = 'flutter-3.38', + Node145rc = 'node-14.5-rc', + Node160rc = 'node-16.0-rc', + Node180rc = 'node-18.0-rc', + Node190rc = 'node-19.0-rc', + Node200rc = 'node-20.0-rc', + Node210rc = 'node-21.0-rc', + Node22rc = 'node-22-rc', + Node23rc = 'node-23-rc', + Node24rc = 'node-24-rc', + Node25rc = 'node-25-rc', + Php80rc = 'php-8.0-rc', + Php81rc = 'php-8.1-rc', + Php82rc = 'php-8.2-rc', + Php83rc = 'php-8.3-rc', + Php84rc = 'php-8.4-rc', + Ruby30rc = 'ruby-3.0-rc', + Ruby31rc = 'ruby-3.1-rc', + Ruby32rc = 'ruby-3.2-rc', + Ruby33rc = 'ruby-3.3-rc', + Ruby34rc = 'ruby-3.4-rc', + Ruby40rc = 'ruby-4.0-rc', + Python38rc = 'python-3.8-rc', + Python39rc = 'python-3.9-rc', + Python310rc = 'python-3.10-rc', + Python311rc = 'python-3.11-rc', + Python312rc = 'python-3.12-rc', + Python313rc = 'python-3.13-rc', + Python314rc = 'python-3.14-rc', + Pythonml311rc = 'python-ml-3.11-rc', + Pythonml312rc = 'python-ml-3.12-rc', + Pythonml313rc = 'python-ml-3.13-rc', + Deno140rc = 'deno-1.40-rc', + Deno146rc = 'deno-1.46-rc', + Deno20rc = 'deno-2.0-rc', + Deno25rc = 'deno-2.5-rc', + Deno26rc = 'deno-2.6-rc', + Dart215rc = 'dart-2.15-rc', + Dart216rc = 'dart-2.16-rc', + Dart217rc = 'dart-2.17-rc', + Dart218rc = 'dart-2.18-rc', + Dart219rc = 'dart-2.19-rc', + Dart30rc = 'dart-3.0-rc', + Dart31rc = 'dart-3.1-rc', + Dart33rc = 'dart-3.3-rc', + Dart35rc = 'dart-3.5-rc', + Dart38rc = 'dart-3.8-rc', + Dart39rc = 'dart-3.9-rc', + Dart310rc = 'dart-3.10-rc', + Dotnet60rc = 'dotnet-6.0-rc', + Dotnet70rc = 'dotnet-7.0-rc', + Dotnet80rc = 'dotnet-8.0-rc', + Dotnet10rc = 'dotnet-10-rc', + Java80rc = 'java-8.0-rc', + Java110rc = 'java-11.0-rc', + Java170rc = 'java-17.0-rc', + Java180rc = 'java-18.0-rc', + Java210rc = 'java-21.0-rc', + Java22rc = 'java-22-rc', + Java25rc = 'java-25-rc', + Swift55rc = 'swift-5.5-rc', + Swift58rc = 'swift-5.8-rc', + Swift59rc = 'swift-5.9-rc', + Swift510rc = 'swift-5.10-rc', + Swift62rc = 'swift-6.2-rc', + Kotlin16rc = 'kotlin-1.6-rc', + Kotlin18rc = 'kotlin-1.8-rc', + Kotlin19rc = 'kotlin-1.9-rc', + Kotlin20rc = 'kotlin-2.0-rc', + Kotlin23rc = 'kotlin-2.3-rc', + Cpp17rc = 'cpp-17-rc', + Cpp20rc = 'cpp-20-rc', + Bun10rc = 'bun-1.0-rc', + Bun11rc = 'bun-1.1-rc', + Bun12rc = 'bun-1.2-rc', + Bun13rc = 'bun-1.3-rc', + Go123rc = 'go-1.23-rc', + Go124rc = 'go-1.24-rc', + Go125rc = 'go-1.25-rc', + Go126rc = 'go-1.26-rc', + Static1rc = 'static-1-rc', + Flutter324rc = 'flutter-3.24-rc', + Flutter327rc = 'flutter-3.27-rc', + Flutter329rc = 'flutter-3.29-rc', + Flutter332rc = 'flutter-3.32-rc', + Flutter335rc = 'flutter-3.35-rc', + Flutter338rc = 'flutter-3.38-rc', } \ No newline at end of file diff --git a/src/enums/runtimes.ts b/src/enums/runtimes.ts index 646bb23c..5b1deeac 100644 --- a/src/enums/runtimes.ts +++ b/src/enums/runtimes.ts @@ -30,9 +30,6 @@ export enum Runtimes { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', @@ -88,4 +85,90 @@ export enum Runtimes { Flutter332 = 'flutter-3.32', Flutter335 = 'flutter-3.35', Flutter338 = 'flutter-3.38', + Node145rc = 'node-14.5-rc', + Node160rc = 'node-16.0-rc', + Node180rc = 'node-18.0-rc', + Node190rc = 'node-19.0-rc', + Node200rc = 'node-20.0-rc', + Node210rc = 'node-21.0-rc', + Node22rc = 'node-22-rc', + Node23rc = 'node-23-rc', + Node24rc = 'node-24-rc', + Node25rc = 'node-25-rc', + Php80rc = 'php-8.0-rc', + Php81rc = 'php-8.1-rc', + Php82rc = 'php-8.2-rc', + Php83rc = 'php-8.3-rc', + Php84rc = 'php-8.4-rc', + Ruby30rc = 'ruby-3.0-rc', + Ruby31rc = 'ruby-3.1-rc', + Ruby32rc = 'ruby-3.2-rc', + Ruby33rc = 'ruby-3.3-rc', + Ruby34rc = 'ruby-3.4-rc', + Ruby40rc = 'ruby-4.0-rc', + Python38rc = 'python-3.8-rc', + Python39rc = 'python-3.9-rc', + Python310rc = 'python-3.10-rc', + Python311rc = 'python-3.11-rc', + Python312rc = 'python-3.12-rc', + Python313rc = 'python-3.13-rc', + Python314rc = 'python-3.14-rc', + Pythonml311rc = 'python-ml-3.11-rc', + Pythonml312rc = 'python-ml-3.12-rc', + Pythonml313rc = 'python-ml-3.13-rc', + Deno140rc = 'deno-1.40-rc', + Deno146rc = 'deno-1.46-rc', + Deno20rc = 'deno-2.0-rc', + Deno25rc = 'deno-2.5-rc', + Deno26rc = 'deno-2.6-rc', + Dart215rc = 'dart-2.15-rc', + Dart216rc = 'dart-2.16-rc', + Dart217rc = 'dart-2.17-rc', + Dart218rc = 'dart-2.18-rc', + Dart219rc = 'dart-2.19-rc', + Dart30rc = 'dart-3.0-rc', + Dart31rc = 'dart-3.1-rc', + Dart33rc = 'dart-3.3-rc', + Dart35rc = 'dart-3.5-rc', + Dart38rc = 'dart-3.8-rc', + Dart39rc = 'dart-3.9-rc', + Dart310rc = 'dart-3.10-rc', + Dotnet60rc = 'dotnet-6.0-rc', + Dotnet70rc = 'dotnet-7.0-rc', + Dotnet80rc = 'dotnet-8.0-rc', + Dotnet10rc = 'dotnet-10-rc', + Java80rc = 'java-8.0-rc', + Java110rc = 'java-11.0-rc', + Java170rc = 'java-17.0-rc', + Java180rc = 'java-18.0-rc', + Java210rc = 'java-21.0-rc', + Java22rc = 'java-22-rc', + Java25rc = 'java-25-rc', + Swift55rc = 'swift-5.5-rc', + Swift58rc = 'swift-5.8-rc', + Swift59rc = 'swift-5.9-rc', + Swift510rc = 'swift-5.10-rc', + Swift62rc = 'swift-6.2-rc', + Kotlin16rc = 'kotlin-1.6-rc', + Kotlin18rc = 'kotlin-1.8-rc', + Kotlin19rc = 'kotlin-1.9-rc', + Kotlin20rc = 'kotlin-2.0-rc', + Kotlin23rc = 'kotlin-2.3-rc', + Cpp17rc = 'cpp-17-rc', + Cpp20rc = 'cpp-20-rc', + Bun10rc = 'bun-1.0-rc', + Bun11rc = 'bun-1.1-rc', + Bun12rc = 'bun-1.2-rc', + Bun13rc = 'bun-1.3-rc', + Go123rc = 'go-1.23-rc', + Go124rc = 'go-1.24-rc', + Go125rc = 'go-1.25-rc', + Go126rc = 'go-1.26-rc', + Static1rc = 'static-1-rc', + Flutter324rc = 'flutter-3.24-rc', + Flutter327rc = 'flutter-3.27-rc', + Flutter329rc = 'flutter-3.29-rc', + Flutter332rc = 'flutter-3.32-rc', + Flutter335rc = 'flutter-3.35-rc', + Flutter338rc = 'flutter-3.38-rc', } \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts index 083114b2..cd8f0474 100644 --- a/src/enums/scopes.ts +++ b/src/enums/scopes.ts @@ -56,6 +56,8 @@ export enum Scopes { AssistantRead = 'assistant.read', TokensRead = 'tokens.read', TokensWrite = 'tokens.write', + WebhooksRead = 'webhooks.read', + WebhooksWrite = 'webhooks.write', PoliciesWrite = 'policies.write', PoliciesRead = 'policies.read', ArchivesRead = 'archives.read', diff --git a/src/index.ts b/src/index.ts index 9d337642..9ff1cc3d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,6 +31,7 @@ export { Teams } from './services/teams'; export { Tokens } from './services/tokens'; export { Users } from './services/users'; export { Vcs } from './services/vcs'; +export { Webhooks } from './services/webhooks'; export { Realtime } from './services/realtime'; export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; export type { RealtimeSubscription } from './services/realtime'; @@ -112,5 +113,5 @@ export { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-r export { ProxyRuleStatus } from './enums/proxy-rule-status'; export { MessageStatus } from './enums/message-status'; export { BillingPlanGroup } from './enums/billing-plan-group'; -export { DomainPurchasePaymentStatus } from './enums/domain-purchase-payment-status'; -export { DomainTransferStatusStatus } from './enums/domain-transfer-status-status'; +export { DomainTransferStatusEnum } from './enums/domain-transfer-status-enum'; +export { DomainPurchaseStatus } from './enums/domain-purchase-status'; diff --git a/src/models.ts b/src/models.ts index 1ccd6437..205b78cb 100644 --- a/src/models.ts +++ b/src/models.ts @@ -12,8 +12,8 @@ import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-r import { ProxyRuleStatus } from "./enums/proxy-rule-status" import { MessageStatus } from "./enums/message-status" import { BillingPlanGroup } from "./enums/billing-plan-group" -import { DomainPurchasePaymentStatus } from "./enums/domain-purchase-payment-status" -import { DomainTransferStatusStatus } from "./enums/domain-transfer-status-status" +import { DomainTransferStatusEnum } from "./enums/domain-transfer-status-enum" +import { DomainPurchaseStatus } from "./enums/domain-purchase-status" /** * Appwrite Models @@ -7206,9 +7206,17 @@ export namespace Models { */ usageBandwidth: number; /** - * Total realtime usage for the billing period + * Peak concurrent realtime connections for the billing period */ usageRealtime: number; + /** + * Total realtime messages sent for the billing period + */ + usageRealtimeMessages: number; + /** + * Total realtime bandwidth usage for the billing period + */ + usageRealtimeBandwidth: number; /** * Additional members */ @@ -8725,14 +8733,6 @@ export namespace Models { * Domain registrar (e.g. "appwrite" or "third_party"). */ registrar: string; - /** - * Payment status for domain purchase. - */ - paymentStatus: DomainPurchasePaymentStatus; - /** - * Client secret for payment confirmation. Present only when paymentStatus is pending_confirmation. - */ - clientSecret: string; /** * Nameservers setting. "Appwrite" or empty string. */ @@ -8753,6 +8753,10 @@ export namespace Models { * Renewal price (in cents). */ renewalPrice: number; + /** + * Transfer status for domains being transferred in. + */ + transferStatus: DomainTransferStatusEnum; /** * Team ID. */ @@ -8761,14 +8765,52 @@ export namespace Models { * Dns records */ dnsRecords: DnsRecord[]; + } + + /** + * DomainPurchase + */ + export type DomainPurchase = { + /** + * Purchase/invoice ID. + */ + $id: string; /** - * Domain transfer status (e.g., "pending", "completed", "failed"). + * Purchase creation time in ISO 8601 format. */ - transferStatus: string; + $createdAt: string; /** - * Retry attempts for the current domain payment flow. Development only. + * Purchase update date in ISO 8601 format. */ - attempts: number; + $updatedAt: string; + /** + * Domain document ID. + */ + domainId: string; + /** + * Domain name. + */ + domain: string; + /** + * Team ID that owns the domain. + */ + organizationId: string; + /** + * Domain purchase status. + */ + status: DomainPurchaseStatus; + /** + * Stripe client secret for 3DS; empty when not applicable. + */ + clientSecret: string; + /** + * Purchase amount. + */ + amount: number; + /** + * Currency code. + */ + currency: string; } /** @@ -9070,7 +9112,7 @@ export namespace Models { /** * Transfer status. */ - status: DomainTransferStatusStatus; + status: DomainTransferStatusEnum; /** * Additional transfer status information. */ diff --git a/src/services/domains.ts b/src/services/domains.ts index 147fc38b..087d486f 100644 --- a/src/services/domains.ts +++ b/src/services/domains.ts @@ -221,9 +221,9 @@ export class Domains { * @param {string} params.companyName - Company or organization name for the registrant. * @param {number} params.periodYears - Registration term in years (1-10). * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - createPurchase(params: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number }): Promise; + createPurchase(params: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number }): Promise; /** * Create a domain purchase with registrant information. * @@ -239,14 +239,14 @@ export class Domains { * @param {string} companyName - Company or organization name for the registrant. * @param {number} periodYears - Registration term in years (1-10). * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createPurchase(domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number): Promise; + createPurchase(domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number): Promise; createPurchase( paramsOrFirst: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number } | string, ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?] - ): Promise { + ): Promise { let params: { domain: string, organizationId: string, firstName: string, lastName: string, email: string, phone: string, billingAddressId: string, paymentMethodId: string, addressLine3?: string, companyName?: string, periodYears?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -354,28 +354,28 @@ export class Domains { } /** - * Confirm a domain purchase after payment authentication. Call this after the client has confirmed the payment via Stripe.js. + * Confirm and complete a domain purchase after payment authentication. * * @param {string} params.domainId - Domain ID to confirm purchase for. * @param {string} params.organizationId - Team ID that owns the domain. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - confirmPurchase(params: { domainId: string, organizationId: string }): Promise; + updatePurchase(params: { domainId: string, organizationId: string }): Promise; /** - * Confirm a domain purchase after payment authentication. Call this after the client has confirmed the payment via Stripe.js. + * Confirm and complete a domain purchase after payment authentication. * * @param {string} domainId - Domain ID to confirm purchase for. * @param {string} organizationId - Team ID that owns the domain. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - confirmPurchase(domainId: string, organizationId: string): Promise; - confirmPurchase( + updatePurchase(domainId: string, organizationId: string): Promise; + updatePurchase( paramsOrFirst: { domainId: string, organizationId: string } | string, ...rest: [(string)?] - ): Promise { + ): Promise { let params: { domainId: string, organizationId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -397,7 +397,7 @@ export class Domains { throw new AppwriteException('Missing required parameter: "organizationId"'); } - const apiPath = '/domains/purchases/{domainId}/confirm'.replace('{domainId}', domainId); + const apiPath = '/domains/purchases/{domainId}'.replace('{domainId}', domainId); const payload: Payload = {}; if (typeof organizationId !== 'undefined') { payload['organizationId'] = organizationId; @@ -409,7 +409,7 @@ export class Domains { } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload @@ -514,9 +514,9 @@ export class Domains { * @param {string} params.authCode - Authorization code for the domain transfer. * @param {string} params.paymentMethodId - Payment method ID to authorize and capture the transfer. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - createTransferIn(params: { domain: string, organizationId: string, authCode: string, paymentMethodId: string }): Promise; + createTransferIn(params: { domain: string, organizationId: string, authCode: string, paymentMethodId: string }): Promise; /** * Create a domain transfer in with authorization code and registrant information. * @@ -525,14 +525,14 @@ export class Domains { * @param {string} authCode - Authorization code for the domain transfer. * @param {string} paymentMethodId - Payment method ID to authorize and capture the transfer. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - createTransferIn(domain: string, organizationId: string, authCode: string, paymentMethodId: string): Promise; + createTransferIn(domain: string, organizationId: string, authCode: string, paymentMethodId: string): Promise; createTransferIn( paramsOrFirst: { domain: string, organizationId: string, authCode: string, paymentMethodId: string } | string, ...rest: [(string)?, (string)?, (string)?] - ): Promise { + ): Promise { let params: { domain: string, organizationId: string, authCode: string, paymentMethodId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -593,28 +593,28 @@ export class Domains { } /** - * Confirm a domain transfer in after payment authentication. Call this after the client has confirmed the payment via Stripe.js. + * Confirm and complete a domain transfer in after payment authentication. * * @param {string} params.domainId - Domain ID to confirm transfer for. * @param {string} params.organizationId - Team ID that owns the domain. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} */ - confirmTransferIn(params: { domainId: string, organizationId: string }): Promise; + updateTransferIn(params: { domainId: string, organizationId: string }): Promise; /** - * Confirm a domain transfer in after payment authentication. Call this after the client has confirmed the payment via Stripe.js. + * Confirm and complete a domain transfer in after payment authentication. * * @param {string} domainId - Domain ID to confirm transfer for. * @param {string} organizationId - Team ID that owns the domain. * @throws {AppwriteException} - * @returns {Promise} + * @returns {Promise} * @deprecated Use the object parameter style method for a better developer experience. */ - confirmTransferIn(domainId: string, organizationId: string): Promise; - confirmTransferIn( + updateTransferIn(domainId: string, organizationId: string): Promise; + updateTransferIn( paramsOrFirst: { domainId: string, organizationId: string } | string, ...rest: [(string)?] - ): Promise { + ): Promise { let params: { domainId: string, organizationId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -636,7 +636,7 @@ export class Domains { throw new AppwriteException('Missing required parameter: "organizationId"'); } - const apiPath = '/domains/transfers/in/{domainId}/confirm'.replace('{domainId}', domainId); + const apiPath = '/domains/transfers/in/{domainId}'.replace('{domainId}', domainId); const payload: Payload = {}; if (typeof organizationId !== 'undefined') { payload['organizationId'] = organizationId; @@ -648,7 +648,7 @@ export class Domains { } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload diff --git a/src/services/projects.ts b/src/services/projects.ts index 3a890d9a..6998bbab 100644 --- a/src/services/projects.ts +++ b/src/services/projects.ts @@ -4428,477 +4428,4 @@ export class Projects { payload ); } - - /** - * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. - * - * @param {string} params.projectId - Project unique ID. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - */ - listWebhooks(params: { projectId: string, total?: boolean }): Promise; - /** - * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. - * - * @param {string} projectId - Project unique ID. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listWebhooks(projectId: string, total?: boolean): Promise; - listWebhooks( - paramsOrFirst: { projectId: string, total?: boolean } | string, - ...rest: [(boolean)?] - ): Promise { - let params: { projectId: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, total?: boolean }; - } else { - params = { - projectId: paramsOrFirst as string, - total: rest[0] as boolean - }; - } - - const projectId = params.projectId; - const total = params.total; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - - const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.name - Webhook name. Max length: 128 chars. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {string} params.url - Webhook URL. - * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled. - * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - createWebhook(params: { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }): Promise; - /** - * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. - * - * @param {string} projectId - Project unique ID. - * @param {string} name - Webhook name. Max length: 128 chars. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {string} url - Webhook URL. - * @param {boolean} security - Certificate verification, false for disabled or true for enabled. - * @param {boolean} enabled - Enable or disable a webhook. - * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createWebhook(projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string): Promise; - createWebhook( - paramsOrFirst: { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?] - ): Promise { - let params: { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - name: rest[0] as string, - events: rest[1] as string[], - url: rest[2] as string, - security: rest[3] as boolean, - enabled: rest[4] as boolean, - httpUser: rest[5] as string, - httpPass: rest[6] as string - }; - } - - const projectId = params.projectId; - const name = params.name; - const events = params.events; - const url = params.url; - const security = params.security; - const enabled = params.enabled; - const httpUser = params.httpUser; - const httpPass = params.httpPass; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof events === 'undefined') { - throw new AppwriteException('Missing required parameter: "events"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof security === 'undefined') { - throw new AppwriteException('Missing required parameter: "security"'); - } - - const apiPath = '/projects/{projectId}/webhooks'.replace('{projectId}', projectId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof security !== 'undefined') { - payload['security'] = security; - } - if (typeof httpUser !== 'undefined') { - payload['httpUser'] = httpUser; - } - if (typeof httpPass !== 'undefined') { - payload['httpPass'] = httpPass; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.webhookId - Webhook unique ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - getWebhook(params: { projectId: string, webhookId: string }): Promise; - /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. - * - * @param {string} projectId - Project unique ID. - * @param {string} webhookId - Webhook unique ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getWebhook(projectId: string, webhookId: string): Promise; - getWebhook( - paramsOrFirst: { projectId: string, webhookId: string } | string, - ...rest: [(string)?] - ): Promise { - let params: { projectId: string, webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, webhookId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - webhookId: rest[0] as string - }; - } - - const projectId = params.projectId; - const webhookId = params.webhookId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.webhookId - Webhook unique ID. - * @param {string} params.name - Webhook name. Max length: 128 chars. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {string} params.url - Webhook URL. - * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled. - * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateWebhook(params: { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }): Promise; - /** - * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. - * - * @param {string} projectId - Project unique ID. - * @param {string} webhookId - Webhook unique ID. - * @param {string} name - Webhook name. Max length: 128 chars. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {string} url - Webhook URL. - * @param {boolean} security - Certificate verification, false for disabled or true for enabled. - * @param {boolean} enabled - Enable or disable a webhook. - * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars. - * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateWebhook(projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string): Promise; - updateWebhook( - paramsOrFirst: { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?] - ): Promise { - let params: { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, enabled?: boolean, httpUser?: string, httpPass?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - webhookId: rest[0] as string, - name: rest[1] as string, - events: rest[2] as string[], - url: rest[3] as string, - security: rest[4] as boolean, - enabled: rest[5] as boolean, - httpUser: rest[6] as string, - httpPass: rest[7] as string - }; - } - - const projectId = params.projectId; - const webhookId = params.webhookId; - const name = params.name; - const events = params.events; - const url = params.url; - const security = params.security; - const enabled = params.enabled; - const httpUser = params.httpUser; - const httpPass = params.httpPass; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof events === 'undefined') { - throw new AppwriteException('Missing required parameter: "events"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof security === 'undefined') { - throw new AppwriteException('Missing required parameter: "security"'); - } - - const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof security !== 'undefined') { - payload['security'] = security; - } - if (typeof httpUser !== 'undefined') { - payload['httpUser'] = httpUser; - } - if (typeof httpPass !== 'undefined') { - payload['httpPass'] = httpPass; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.webhookId - Webhook unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteWebhook(params: { projectId: string, webhookId: string }): Promise<{}>; - /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. - * - * @param {string} projectId - Project unique ID. - * @param {string} webhookId - Webhook unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteWebhook(projectId: string, webhookId: string): Promise<{}>; - deleteWebhook( - paramsOrFirst: { projectId: string, webhookId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { projectId: string, webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, webhookId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - webhookId: rest[0] as string - }; - } - - const projectId = params.projectId; - const webhookId = params.webhookId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. - * - * @param {string} params.projectId - Project unique ID. - * @param {string} params.webhookId - Webhook unique ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - updateWebhookSignature(params: { projectId: string, webhookId: string }): Promise; - /** - * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. - * - * @param {string} projectId - Project unique ID. - * @param {string} webhookId - Webhook unique ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateWebhookSignature(projectId: string, webhookId: string): Promise; - updateWebhookSignature( - paramsOrFirst: { projectId: string, webhookId: string } | string, - ...rest: [(string)?] - ): Promise { - let params: { projectId: string, webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, webhookId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - webhookId: rest[0] as string - }; - } - - const projectId = params.projectId; - const webhookId = params.webhookId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/projects/{projectId}/webhooks/{webhookId}/signature'.replace('{projectId}', projectId).replace('{webhookId}', webhookId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } } diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts new file mode 100644 index 00000000..ea62d2ca --- /dev/null +++ b/src/services/webhooks.ts @@ -0,0 +1,451 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Webhooks { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, httpUser, security, events, enabled, logs, attempts + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + */ + list(params?: { queries?: string[], total?: boolean }): Promise; + /** + * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, url, httpUser, security, events, enabled, logs, attempts + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise; + list( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/webhooks'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. + * + * @param {string} params.webhookId - Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} params.url - Webhook URL. + * @param {string} params.name - Webhook name. Max length: 128 chars. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {boolean} params.enabled - Enable or disable a webhook. + * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled. + * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }): Promise; + /** + * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. + * + * @param {string} webhookId - Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + * @param {string} url - Webhook URL. + * @param {string} name - Webhook name. Max length: 128 chars. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {boolean} enabled - Enable or disable a webhook. + * @param {boolean} security - Certificate verification, false for disabled or true for enabled. + * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars. + * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string): Promise; + create( + paramsOrFirst: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + url: rest[0] as string, + name: rest[1] as string, + events: rest[2] as string[], + enabled: rest[3] as boolean, + security: rest[4] as boolean, + httpUser: rest[5] as string, + httpPass: rest[6] as string + }; + } + + const webhookId = params.webhookId; + const url = params.url; + const name = params.name; + const events = params.events; + const enabled = params.enabled; + const security = params.security; + const httpUser = params.httpUser; + const httpPass = params.httpPass; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof events === 'undefined') { + throw new AppwriteException('Missing required parameter: "events"'); + } + + const apiPath = '/webhooks'; + const payload: Payload = {}; + if (typeof webhookId !== 'undefined') { + payload['webhookId'] = webhookId; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof security !== 'undefined') { + payload['security'] = security; + } + if (typeof httpUser !== 'undefined') { + payload['httpUser'] = httpUser; + } + if (typeof httpPass !== 'undefined') { + payload['httpPass'] = httpPass; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * + * @param {string} params.webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + get(params: { webhookId: string }): Promise; + /** + * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * + * @param {string} webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(webhookId: string): Promise; + get( + paramsOrFirst: { webhookId: string } | string + ): Promise { + let params: { webhookId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string }; + } else { + params = { + webhookId: paramsOrFirst as string + }; + } + + const webhookId = params.webhookId; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. + * + * @param {string} params.webhookId - Webhook ID. + * @param {string} params.name - Webhook name. Max length: 128 chars. + * @param {string} params.url - Webhook URL. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {boolean} params.enabled - Enable or disable a webhook. + * @param {boolean} params.security - Certificate verification, false for disabled or true for enabled. + * @param {string} params.httpUser - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.httpPass - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + */ + update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }): Promise; + /** + * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. + * + * @param {string} webhookId - Webhook ID. + * @param {string} name - Webhook name. Max length: 128 chars. + * @param {string} url - Webhook URL. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {boolean} enabled - Enable or disable a webhook. + * @param {boolean} security - Certificate verification, false for disabled or true for enabled. + * @param {string} httpUser - Webhook HTTP user. Max length: 256 chars. + * @param {string} httpPass - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string): Promise; + update( + paramsOrFirst: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] + ): Promise { + let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + name: rest[0] as string, + url: rest[1] as string, + events: rest[2] as string[], + enabled: rest[3] as boolean, + security: rest[4] as boolean, + httpUser: rest[5] as string, + httpPass: rest[6] as string + }; + } + + const webhookId = params.webhookId; + const name = params.name; + const url = params.url; + const events = params.events; + const enabled = params.enabled; + const security = params.security; + const httpUser = params.httpUser; + const httpPass = params.httpPass; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof events === 'undefined') { + throw new AppwriteException('Missing required parameter: "events"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof security !== 'undefined') { + payload['security'] = security; + } + if (typeof httpUser !== 'undefined') { + payload['httpUser'] = httpUser; + } + if (typeof httpPass !== 'undefined') { + payload['httpPass'] = httpPass; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * + * @param {string} params.webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { webhookId: string }): Promise<{}>; + /** + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * + * @param {string} webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(webhookId: string): Promise<{}>; + delete( + paramsOrFirst: { webhookId: string } | string + ): Promise<{}> { + let params: { webhookId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string }; + } else { + params = { + webhookId: paramsOrFirst as string + }; + } + + const webhookId = params.webhookId; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. + * + * @param {string} params.webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise} + */ + updateSignature(params: { webhookId: string }): Promise; + /** + * Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. + * + * @param {string} webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSignature(webhookId: string): Promise; + updateSignature( + paramsOrFirst: { webhookId: string } | string + ): Promise { + let params: { webhookId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string }; + } else { + params = { + webhookId: paramsOrFirst as string + }; + } + + const webhookId = params.webhookId; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}/signature'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } +}