Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Use Node.js
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24.14.1'
registry-url: 'https://registry.npmjs.org'
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min-release-age=7
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.9.4-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.5-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)
Expand Down 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/console@13.0.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@13.1.0"></script>
```


Expand Down
4 changes: 2 additions & 2 deletions docs/examples/account/create-key.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Account, Scopes } from "@appwrite.io/console";
import { Client, Account, AccountKeyScopes } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -9,7 +9,7 @@ const account = new Account(client);

const result = await account.createKey({
name: '<NAME>',
scopes: [Scopes.Account],
scopes: [AccountKeyScopes.Account],
expire: '2020-10-15T06:38:00.000+00:00' // optional
});

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/account/update-key.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Account, Scopes } from "@appwrite.io/console";
import { Client, Account, AccountKeyScopes } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -10,7 +10,7 @@ const account = new Account(client);
const result = await account.updateKey({
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [Scopes.Account],
scopes: [AccountKeyScopes.Account],
expire: '2020-10-15T06:38:00.000+00:00' // optional
});

Expand Down
6 changes: 3 additions & 3 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from "@appwrite.io/console";
import { Client, Avatars, BrowserTheme, Timezone, BrowserPermission, ImageFormat } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -16,11 +16,11 @@ const result = avatars.getScreenshot({
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: Theme.Dark, // optional
theme: BrowserTheme.Dark, // optional
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
fullpage: true, // optional
locale: 'en-US', // optional
timezone: Timezone.AmericaNewYork, // optional
timezone: Timezone.AfricaAbidjan, // optional
latitude: 37.7749, // optional
longitude: -122.4194, // optional
accuracy: 100, // optional
Expand Down
16 changes: 16 additions & 0 deletions docs/examples/console/get-email-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, Console, ProjectEmailTemplateId, ProjectEmailTemplateLocale } from "@appwrite.io/console";

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

const xconsole = new Console(client);

const result = await xconsole.getEmailTemplate({
templateId: ProjectEmailTemplateId.Verification,
locale: ProjectEmailTemplateLocale.Af // optional
});

console.log(result);
```
13 changes: 13 additions & 0 deletions docs/examples/console/list-organization-scopes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```javascript
import { Client, Console } from "@appwrite.io/console";

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

const xconsole = new Console(client);

const result = await xconsole.listOrganizationScopes();

console.log(result);
```
1 change: 0 additions & 1 deletion docs/examples/documentsdb/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const documentsDB = new DocumentsDB(client);

const result = await documentsDB.list({
queries: [], // optional
search: '<SEARCH>', // optional
total: false // optional
});

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/domains/get-price.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Domains, RegistrationType } from "@appwrite.io/console";
import { Client, Domains, DomainRegistrationType } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -10,7 +10,7 @@ const domains = new Domains(client);
const result = await domains.getPrice({
domain: '',
periodYears: null, // optional
registrationType: RegistrationType.New // optional
registrationType: DomainRegistrationType.New // optional
});

console.log(result);
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/domains/list-suggestions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Domains, FilterType } from "@appwrite.io/console";
import { Client, Domains, DomainSuggestionType } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -11,7 +11,7 @@ const result = await domains.listSuggestions({
query: '<QUERY>',
tlds: [], // optional
limit: null, // optional
filterType: FilterType.Premium, // optional
filterType: DomainSuggestionType.Premium, // optional
priceMax: null, // optional
priceMin: null // optional
});
Expand Down
8 changes: 5 additions & 3 deletions docs/examples/functions/create.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Functions, Runtime, Scopes } from "@appwrite.io/console";
import { Client, Functions, FunctionRuntime, ProjectKeyScopes } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -10,7 +10,7 @@ const functions = new Functions(client);
const result = await functions.create({
functionId: '<FUNCTION_ID>',
name: '<NAME>',
runtime: Runtime.Node145,
runtime: FunctionRuntime.Node145,
execute: ["any"], // optional
events: [], // optional
schedule: '', // optional
Expand All @@ -19,12 +19,14 @@ const result = await functions.create({
logging: false, // optional
entrypoint: '<ENTRYPOINT>', // optional
commands: '<COMMANDS>', // optional
scopes: [Scopes.ProjectRead], // optional
scopes: [ProjectKeyScopes.ProjectRead], // optional
installationId: '<INSTALLATION_ID>', // optional
providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional
providerBranch: '<PROVIDER_BRANCH>', // optional
providerSilentMode: false, // optional
providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional
providerBranches: [], // optional
providerPaths: [], // optional
buildSpecification: '', // optional
runtimeSpecification: '', // optional
deploymentRetention: 0 // optional
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/functions/list-templates.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Functions, Runtimes, UseCases } from "@appwrite.io/console";
import { Client, Functions, FunctionRuntime, FunctionTemplateUseCase } from "@appwrite.io/console";

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

const result = await functions.listTemplates({
runtimes: [Runtimes.Node145], // optional
useCases: [UseCases.Starter], // optional
runtimes: [FunctionRuntime.Node145], // optional
useCases: [FunctionTemplateUseCase.Starter], // optional
limit: 1, // optional
offset: 0, // optional
total: false // optional
Expand Down
8 changes: 5 additions & 3 deletions docs/examples/functions/update.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Functions, Runtime, Scopes } from "@appwrite.io/console";
import { Client, Functions, FunctionRuntime, ProjectKeyScopes } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -10,7 +10,7 @@ const functions = new Functions(client);
const result = await functions.update({
functionId: '<FUNCTION_ID>',
name: '<NAME>',
runtime: Runtime.Node145, // optional
runtime: FunctionRuntime.Node145, // optional
execute: ["any"], // optional
events: [], // optional
schedule: '', // optional
Expand All @@ -19,12 +19,14 @@ const result = await functions.update({
logging: false, // optional
entrypoint: '<ENTRYPOINT>', // optional
commands: '<COMMANDS>', // optional
scopes: [Scopes.ProjectRead], // optional
scopes: [ProjectKeyScopes.ProjectRead], // optional
installationId: '<INSTALLATION_ID>', // optional
providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional
providerBranch: '<PROVIDER_BRANCH>', // optional
providerSilentMode: false, // optional
providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional
providerBranches: [], // optional
providerPaths: [], // optional
buildSpecification: '', // optional
runtimeSpecification: '', // optional
deploymentRetention: 0 // optional
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/health/get-failed-jobs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Health, Name } from "@appwrite.io/console";
import { Client, Health, HealthQueueName } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const client = new Client()
const health = new Health(client);

const result = await health.getFailedJobs({
name: Name.V1Database,
name: HealthQueueName.V1Database,
threshold: null // optional
});

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/manager/create-block.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Manager, ResourceType } from "@appwrite.io/console";
import { Client, Manager, BlockResourceType } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const manager = new Manager(client);

const result = await manager.createBlock({
projectId: '<PROJECT_ID>',
resourceType: ResourceType.Projects,
resourceType: BlockResourceType.Projects,
resourceId: '<RESOURCE_ID>', // optional
reason: '<REASON>', // optional
expiredAt: '2020-10-15T06:38:00.000+00:00' // optional
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/manager/delete-block.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Manager, ResourceType } from "@appwrite.io/console";
import { Client, Manager, BlockResourceType } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -8,7 +8,7 @@ const manager = new Manager(client);

const result = await manager.deleteBlock({
projectId: '<PROJECT_ID>',
resourceType: ResourceType.Projects,
resourceType: BlockResourceType.Projects,
resourceId: '<RESOURCE_ID>' // optional
});

Expand Down
20 changes: 20 additions & 0 deletions docs/examples/manager/delete-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```javascript
import { Client, Manager, Region, CacheTarget, CacheDatabase } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint

const manager = new Manager(client);

const result = await manager.deleteCache({
region: Region.Fra, // optional
cache: CacheTarget.Cache, // optional
all: false, // optional
database: CacheDatabase.Console, // optional
projectId: '<PROJECT_ID>', // optional
collectionId: '<COLLECTION_ID>', // optional
documentId: '<DOCUMENT_ID>' // optional
});

console.log(result);
```
4 changes: 2 additions & 2 deletions docs/examples/migrations/create-appwrite-migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, AppwriteMigrationResource, OnDuplicate } from "@appwrite.io/console";
import { Client, Migrations, AppwriteMigrationResource, MigrationOnDuplicate } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -12,7 +12,7 @@ const result = await migrations.createAppwriteMigration({
endpoint: 'https://example.com',
projectId: '<PROJECT_ID>',
apiKey: '<API_KEY>',
onDuplicate: OnDuplicate.Fail // optional
onDuplicate: MigrationOnDuplicate.Fail // optional
});

console.log(result);
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/create-csv-import.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, OnDuplicate } from "@appwrite.io/console";
import { Client, Migrations, MigrationOnDuplicate } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -12,7 +12,7 @@ const result = await migrations.createCSVImport({
fileId: '<FILE_ID>',
resourceId: '<ID1:ID2>',
internalFile: false, // optional
onDuplicate: OnDuplicate.Fail // optional
onDuplicate: MigrationOnDuplicate.Fail // optional
});

console.log(result);
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/migrations/create-json-import.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```javascript
import { Client, Migrations, OnDuplicate } from "@appwrite.io/console";
import { Client, Migrations, MigrationOnDuplicate } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand All @@ -12,7 +12,7 @@ const result = await migrations.createJSONImport({
fileId: '<FILE_ID>',
resourceId: '<ID1:ID2>',
internalFile: false, // optional
onDuplicate: OnDuplicate.Fail // optional
onDuplicate: MigrationOnDuplicate.Fail // optional
});

console.log(result);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
```javascript
import { Client, Organizations, Scopes } from "@appwrite.io/console";
import { Client, Organization, OrganizationKeyScopes } from "@appwrite.io/console";

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

const organizations = new Organizations(client);
const organization = new Organization(client);

const result = await organizations.createKey({
organizationId: '<ORGANIZATION_ID>',
const result = await organization.createKey({
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [Scopes.ProjectsRead],
scopes: [OrganizationKeyScopes.ProjectsRead],
expire: '2020-10-15T06:38:00.000+00:00' // optional
});

Expand Down
17 changes: 17 additions & 0 deletions docs/examples/organization/create-project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, Organization, Region } from "@appwrite.io/console";

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

const organization = new Organization(client);

const result = await organization.createProject({
projectId: '',
name: '<NAME>',
region: Region.Fra // optional
});

console.log(result);
```
Loading