From a85b105505874dcdc632ef48db3206c5456b8017 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 8 Feb 2023 01:57:15 +0000 Subject: [PATCH] cloud SDK with billing --- src/lib/stores/billing.ts | 16 ++++++++++++++++ src/lib/stores/sdk.ts | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/lib/stores/billing.ts diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts new file mode 100644 index 000000000..5aaf0fbbc --- /dev/null +++ b/src/lib/stores/billing.ts @@ -0,0 +1,16 @@ +import type { Client } from "@aw-labs/appwrite-console"; + +export class Billing { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + async createPaymentMethod(teamId: string) { + const path = `/teams/${teamId}/payment-methods`; + const params = {}; + const uri = new URL(this.client.config.endpoint + path); + this.client.call('POST', uri, {}, params); + } +} \ No newline at end of file diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts index cffc23dec..3625958a4 100644 --- a/src/lib/stores/sdk.ts +++ b/src/lib/stores/sdk.ts @@ -48,4 +48,9 @@ const sdkForProject = { users: new Users(clientProject) }; -export { sdkForConsole, sdkForProject, setProject }; +const cloudSdk = { + ...sdkForConsole, + billing: new Billing(clientConsole), +} + +export { sdkForConsole, sdkForProject, cloudSdk, setProject };