Skip to content

Commit

Permalink
Update console SDK with new descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
PineappleIOnic committed Jan 22, 2025
1 parent 9876f42 commit d59de63
Show file tree
Hide file tree
Showing 25 changed files with 256 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <body> tag, but before you use any Appwrite services:

```html
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/[email protected].6"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/[email protected].7"></script>
```


Expand Down
1 change: 0 additions & 1 deletion docs/examples/account/update-payment-method.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Client, Account } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const account = new Account(client);

Expand Down
13 changes: 13 additions & 0 deletions docs/examples/health/get-queue-usage-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client, Health } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const health = new Health(client);

const result = await health.getQueueUsageCount(
null // threshold (optional)
);

console.log(result);
13 changes: 8 additions & 5 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Messaging } from "@appwrite.io/console";
import { Client, Messaging, MessagePriority } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,8 +8,8 @@ const messaging = new Messaging(client);

const result = await messaging.createPush(
'<MESSAGE_ID>', // messageId
'<TITLE>', // title
'<BODY>', // body
'<TITLE>', // title (optional)
'<BODY>', // body (optional)
[], // topics (optional)
[], // users (optional)
[], // targets (optional)
Expand All @@ -20,9 +20,12 @@ const result = await messaging.createPush(
'<SOUND>', // sound (optional)
'<COLOR>', // color (optional)
'<TAG>', // tag (optional)
'<BADGE>', // badge (optional)
null, // badge (optional)
false, // draft (optional)
'' // scheduledAt (optional)
'', // scheduledAt (optional)
false, // contentAvailable (optional)
false, // critical (optional)
MessagePriority.Normal // priority (optional)
);

console.log(result);
7 changes: 5 additions & 2 deletions docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Messaging } from "@appwrite.io/console";
import { Client, Messaging, MessagePriority } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -22,7 +22,10 @@ const result = await messaging.updatePush(
'<TAG>', // tag (optional)
null, // badge (optional)
false, // draft (optional)
'' // scheduledAt (optional)
'', // scheduledAt (optional)
false, // contentAvailable (optional)
false, // critical (optional)
MessagePriority.Normal // priority (optional)
);

console.log(result);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.6",
"version": "1.4.7",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class Client {
'x-sdk-name': 'Console',
'x-sdk-platform': 'console',
'x-sdk-language': 'web',
'x-sdk-version': '1.4.6',
'x-sdk-version': '1.4.7',
'X-Appwrite-Response-Format': '1.6.0',
};

Expand Down
4 changes: 4 additions & 0 deletions src/enums/message-priority.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum MessagePriority {
Normal = 'normal',
High = 'high',
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export { Runtime } from './enums/runtime';
export { FunctionUsageRange } from './enums/function-usage-range';
export { ExecutionMethod } from './enums/execution-method';
export { Name } from './enums/name';
export { MessagePriority } from './enums/message-priority';
export { SmtpEncryption } from './enums/smtp-encryption';
export { BillingPlan } from './enums/billing-plan';
export { ProjectUsageRange } from './enums/project-usage-range';
Expand Down
21 changes: 19 additions & 2 deletions src/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class Account {
/**
* List billing addresses
*
* List all billing addresses for a user.
*
* @param {string[]} queries
* @throws {AppwriteException}
Expand Down Expand Up @@ -143,6 +144,7 @@ export class Account {
/**
* Create new billing address
*
* Add a new billing address to a user&#039;s account.
*
* @param {string} country
* @param {string} streetAddress
Expand Down Expand Up @@ -203,6 +205,7 @@ export class Account {
/**
* Get billing address
*
* Get a specific billing address for a user using it&#039;s ID.
*
* @param {string} billingAddressId
* @throws {AppwriteException}
Expand Down Expand Up @@ -231,6 +234,7 @@ export class Account {
/**
* Update billing address
*
* Update a specific billing address using it&#039;s ID.
*
* @param {string} billingAddressId
* @param {string} country
Expand Down Expand Up @@ -295,6 +299,7 @@ export class Account {
/**
* Delete billing address
*
* Delete a specific billing address using it&#039;s ID.
*
* @param {string} billingAddressId
* @throws {AppwriteException}
Expand Down Expand Up @@ -323,6 +328,7 @@ export class Account {
/**
* Get coupon details
*
* Get coupon details for an account.
*
* @param {string} couponId
* @throws {AppwriteException}
Expand Down Expand Up @@ -450,6 +456,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* List invoices
*
* List all invoices tied to an account.
*
* @param {string[]} queries
* @throws {AppwriteException}
Expand Down Expand Up @@ -695,9 +702,9 @@ This endpoint can also be used to convert an anonymous account to a normal one,
* @param {string} challengeId
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise<{}>}
* @returns {Promise<Models.Session>}
*/
async updateMfaChallenge(challengeId: string, otp: string): Promise<{}> {
async updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session> {
if (typeof challengeId === 'undefined') {
throw new AppwriteException('Missing required parameter: "challengeId"');
}
Expand Down Expand Up @@ -897,6 +904,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* List payment methods
*
* List payment methods for this account.
*
* @param {string[]} queries
* @throws {AppwriteException}
Expand Down Expand Up @@ -925,6 +933,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* Create new payment method
*
* Create a new payment method for the current user account.
*
* @throws {AppwriteException}
* @returns {Promise<Models.PaymentMethod>}
Expand All @@ -949,6 +958,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* Get payment method
*
* Get a specific payment method for the user.
*
* @param {string} paymentMethodId
* @throws {AppwriteException}
Expand Down Expand Up @@ -977,6 +987,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* Update payment method
*
* Update a new payment method for the current user account.
*
* @param {string} paymentMethodId
* @param {number} expiryMonth
Expand Down Expand Up @@ -1019,6 +1030,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* Delete payment method
*
* Delete a specific payment method from a user&#039;s account.
*
* @param {string} paymentMethodId
* @throws {AppwriteException}
Expand Down Expand Up @@ -1047,6 +1059,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* Update payment method provider id
*
* Update payment method provider.
*
* @param {string} paymentMethodId
* @param {string} providerMethodId
Expand Down Expand Up @@ -1089,6 +1102,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
/**
* Update payment method with new setup with mandates for indian cards
*
* Update payment method mandate options.
*
* @param {string} paymentMethodId
* @throws {AppwriteException}
Expand Down Expand Up @@ -1695,6 +1709,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
/**
* Create push target
*
* Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
*
* @param {string} targetId
* @param {string} identifier
Expand Down Expand Up @@ -1737,6 +1752,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
/**
* Update push target
*
* Update the currently logged in user&#039;s push notification target. You can modify the target&#039;s identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
*
* @param {string} targetId
* @param {string} identifier
Expand Down Expand Up @@ -1772,6 +1788,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
/**
* Delete push target
*
* Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
*
* @param {string} targetId
* @throws {AppwriteException}
Expand Down
1 change: 1 addition & 0 deletions src/services/assistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class Assistant {
/**
* Ask query
*
* Send a prompt to the AI assistant and receive a response. This endpoint allows you to interact with Appwrite&#039;s AI assistant by sending questions or prompts and receiving helpful responses in real-time through a server-sent events stream.
*
* @param {string} prompt
* @throws {AppwriteException}
Expand Down
16 changes: 14 additions & 2 deletions src/services/backups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class Backups {
/**
* List archives
*
* List all archives for a project.
*
* @param {string[]} queries
* @throws {AppwriteException}
Expand Down Expand Up @@ -40,6 +41,7 @@ export class Backups {
/**
* Create archive
*
* Create a new archive asynchronously for a project.
*
* @param {string[]} services
* @param {string} resourceId
Expand Down Expand Up @@ -75,6 +77,7 @@ export class Backups {
/**
* Get backup archive
*
* Get a backup archive using it&#039;s ID.
*
* @param {string} archiveId
* @throws {AppwriteException}
Expand Down Expand Up @@ -103,6 +106,7 @@ export class Backups {
/**
* Delete archive
*
* Delete an existing archive for a project.
*
* @param {string} archiveId
* @throws {AppwriteException}
Expand Down Expand Up @@ -131,6 +135,7 @@ export class Backups {
/**
* List backup policies
*
* List all policies for a project.
*
* @param {string[]} queries
* @throws {AppwriteException}
Expand Down Expand Up @@ -159,6 +164,7 @@ export class Backups {
/**
* Create backup policy
*
* Create a new backup policy.
*
* @param {string} policyId
* @param {string[]} services
Expand Down Expand Up @@ -223,6 +229,7 @@ export class Backups {
/**
* Get backup policy
*
* Get a backup policy using it&#039;s ID.
*
* @param {string} policyId
* @throws {AppwriteException}
Expand Down Expand Up @@ -251,6 +258,7 @@ export class Backups {
/**
* Update backup policy
*
* Update an existing policy using it&#039;s ID.
*
* @param {string} policyId
* @param {string} name
Expand Down Expand Up @@ -295,6 +303,7 @@ export class Backups {
/**
* Delete backup policy
*
* Delete a policy using it&#039;s ID.
*
* @param {string} policyId
* @throws {AppwriteException}
Expand Down Expand Up @@ -323,6 +332,7 @@ export class Backups {
/**
* Create restoration
*
* Create and trigger a new restoration for a backup on a project.
*
* @param {string} archiveId
* @param {string[]} services
Expand Down Expand Up @@ -369,6 +379,7 @@ export class Backups {
/**
* List restorations
*
* List all backup restorations for a project.
*
* @param {string[]} queries
* @throws {AppwriteException}
Expand Down Expand Up @@ -397,12 +408,13 @@ export class Backups {
/**
* Get backup restoration
*
* Get the current status of a backup restoration.
*
* @param {string} restorationId
* @throws {AppwriteException}
* @returns {Promise<Models.BackupArchive>}
* @returns {Promise<Models.BackupRestoration>}
*/
async getRestoration(restorationId: string): Promise<Models.BackupArchive> {
async getRestoration(restorationId: string): Promise<Models.BackupRestoration> {
if (typeof restorationId === 'undefined') {
throw new AppwriteException('Missing required parameter: "restorationId"');
}
Expand Down
Loading

0 comments on commit d59de63

Please sign in to comment.