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
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change Log

## 18.0.0

* Breaking: SDK now targets Appwrite 2.3 (`X-Appwrite-Response-Format: 2.3.0`)
* Breaking: removed `Organizations.getEstimation`
* Breaking: `QuerySuggestionResource.AppwritePushLedger` renamed to `PushLedger`
* Added: `Manager.updateOrganizationStatus` to block and unblock an organization
* Added: `Push` service over MQTT with `Topic`, plus `Client.setPushEndpoint` and `Client.setPushClientId`
* Added: `Growth` service with `createConversation`, `createInstallation`, `ConversationType` enum and `GrowthConversation` model
* Added: `Account.createRecoveryOTP` and `Account.updateRecoveryOTP` for code-based password recovery
* Added: `prompt` parameter on `Project.updateOAuth2*` for Auth0, Discord, GitHub, Kakao, Microsoft, Okta, Salesforce, Zoho
* Added: matching `prompt` fields and enums on the `OAuth2*` provider models
* Added: `replyToName` and `replyToEmail` on `Messaging.createEmail` and `Messaging.updateEmail`
* Added: `organizationUrl` on the `Installation` model
* Added: `ProjectEmailTemplateId.OtpRecovery` and Deno 1.21, 1.24, 1.35 in `Runtime` and `BuildRuntime`
* Updated: `Databases.getAttribute` return type now includes bigint, spatial, varchar and text attributes
* Updated: added `mqtt` and `buffer` dependencies and browser Node polyfills for `Push`
* Fixed: chunked uploads without a file in the payload now send a regular request

## 17.0.0

* Breaking: SDK now targets Appwrite 2.2 (`X-Appwrite-Response-Format: 2.2.0`)
Expand All @@ -17,7 +35,6 @@
* Added: `Account.createIdTokenSession` for native Apple and Google sign-in with `IdTokenProvider` enum
* Added: `Account.createEmailVerificationOTP` and `Account.updateEmailVerificationOTP`
* Added: `Messaging.createAppwriteProvider` and `Messaging.updateAppwriteProvider` for Appwrite push, with `qos` and `expiry` on `Topic`
* Added: `Organizations.getEstimation` for the current billing cycle charge estimate
* Added: `Project.updatePasswordPwnedPolicy` with `PolicyPasswordPwned` model and `ProjectPolicyId.Passwordpwned`
* Added: `nativeEnabled`, `nativeClientIds` parameters on `Project.updateOAuth2Apple` and `Project.updateOAuth2Google` and matching fields on `OAuth2Apple`, `OAuth2Google`
* Added: `Framework.Jaspr`, `ProjectEmailTemplateId.OtpVerification`, `ProjectKeyScopes.DedicatedDatabasesExecute`, `QuerySuggestionResource.AppwritePushLedger`
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Console SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-2.2.0-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-2.3.0-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK targets Appwrite server version 2.0.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-console/releases) when APIs differ.
**This SDK targets Appwrite server version 2.3.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-console/releases) when APIs differ.

Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

Expand All @@ -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@17.0.0"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@18.0.0"></script>
```

## Getting Started
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
```javascript
import { Client, Organizations } from '@appwrite.io/console';
import { Client, Account } 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 account = new Account(client);

const result = await organizations.getEstimation({
organizationId: '<ORGANIZATION_ID>',
const result = await account.createRecoveryOTP({
email: 'email@example.com',
phrase: false, // optional
});

console.log(result);
Expand Down
17 changes: 17 additions & 0 deletions docs/examples/account/update-recovery-otp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, Account } 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 account = new Account(client);

const result = await account.updateRecoveryOTP({
userId: '<USER_ID>',
secret: '<SECRET>',
password: 'password',
});

console.log(result);
```
11 changes: 10 additions & 1 deletion docs/examples/databases/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ const databases = new Databases(client);
const result = await databases.createDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
documents: [
{
$id: 'example1',
username: 'walter.obrien',
email: 'walter.obrien@example.com',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
],
transactionId: '<TRANSACTION_ID>', // optional
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/databases/create-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const result = await databases.createIndex({
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
type: DatabasesIndexType.Key,
attributes: [],
attributes: ['username'],
orders: [OrderBy.Asc], // optional
lengths: [], // optional
});
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/databases/delete-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const databases = new Databases(client);
const result = await databases.deleteDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
queries: [
'{"method":"equal", "attribute":"$id", "values":["<DOCUMENT_ID>"]}',
], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Expand Down
11 changes: 10 additions & 1 deletion docs/examples/databases/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ const databases = new Databases(client);
const result = await databases.upsertDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
documents: [
{
$id: 'example1',
username: 'walter.obrien',
email: 'walter.obrien@example.com',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
],
transactionId: '<TRANSACTION_ID>', // optional
});

Expand Down
11 changes: 10 additions & 1 deletion docs/examples/documentsdb/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ const documentsDB = new DocumentsDB(client);
const result = await documentsDB.createDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
documents: [
{
$id: 'example1',
username: 'walter.obrien',
email: 'walter.obrien@example.com',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
],
transactionId: '<TRANSACTION_ID>', // optional
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/documentsdb/create-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const result = await documentsDB.createIndex({
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
type: DocumentsDBIndexType.Key,
attributes: [],
attributes: ['username'],
orders: [OrderBy.Asc], // optional
lengths: [], // optional
});
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/documentsdb/delete-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const documentsDB = new DocumentsDB(client);
const result = await documentsDB.deleteDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
queries: [
'{"method":"equal", "attribute":"$id", "values":["<DOCUMENT_ID>"]}',
], // optional
transactionId: '<TRANSACTION_ID>', // optional
});

Expand Down
11 changes: 10 additions & 1 deletion docs/examples/documentsdb/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ const documentsDB = new DocumentsDB(client);
const result = await documentsDB.upsertDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
documents: [
{
$id: 'example1',
username: 'walter.obrien',
email: 'walter.obrien@example.com',
fullName: "Walter O'Brien",
age: 30,
isAdmin: false,
},
],
transactionId: '<TRANSACTION_ID>', // optional
});

Expand Down
5 changes: 4 additions & 1 deletion docs/examples/embeddings/create-text-embeddings.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const client = new Client()
const embeddings = new Embeddings(client);

const result = await embeddings.createTextEmbeddings({
texts: [],
texts: [
'Appwrite helps developers build applications.',
'Find documents with semantic search.',
],
model: EmbeddingModel.NomicEmbedText, // optional
});

Expand Down
4 changes: 3 additions & 1 deletion docs/examples/graphql/mutation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const client = new Client()
const graphql = new Graphql(client);

const result = await graphql.mutation({
query: {},
query: {
query: 'mutation { accountUpdateName(name: "Walter") { name } }',
},
});

console.log(result);
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/graphql/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const client = new Client()
const graphql = new Graphql(client);

const result = await graphql.query({
query: {},
query: {
query: 'query { localeGet { ip } }',
},
});

console.log(result);
Expand Down
23 changes: 23 additions & 0 deletions docs/examples/growth/create-conversation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```javascript
import { Client, Growth, ConversationType } 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 growth = new Growth(client);

const result = await growth.createConversation({
type: ConversationType.Support,
email: 'email@example.com', // optional
name: '<NAME>', // optional
subject: '<SUBJECT>', // optional
message: '<MESSAGE>', // optional
organizationId: '<ORGANIZATION_ID>', // optional
projectId: '<PROJECT_ID>', // optional
attributes: {}, // optional
attachment: document.getElementById('uploader').files[0], // optional
});

console.log(result);
```
25 changes: 25 additions & 0 deletions docs/examples/growth/create-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```javascript
import { Client, Growth } 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 growth = new Growth(client);

const result = await growth.createInstallation({
email: 'email@example.com', // optional
name: '<NAME>', // optional
version: '<VERSION>', // optional
domain: '<DOMAIN>', // optional
database: '<DATABASE>', // optional
hostIp: '<HOST_IP>', // optional
userAgent: '<USER_AGENT>', // optional
os: '<OS>', // optional
arch: '<ARCH>', // optional
cpus: null, // optional
ram: null, // optional
});

console.log(result);
```
17 changes: 17 additions & 0 deletions docs/examples/manager/update-organization-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, Manager } 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.updateOrganizationStatus({
teamId: '<TEAM_ID>',
status: false,
reason: '<REASON>', // optional
});

console.log(result);
```
2 changes: 2 additions & 0 deletions docs/examples/messaging/create-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const result = await messaging.createEmail({
cc: [], // optional
bcc: [], // optional
attachments: [], // optional
replyToEmail: 'email@example.com', // optional
replyToName: '<REPLY_TO_NAME>', // optional
draft: false, // optional
html: false, // optional
scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/messaging/update-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const result = await messaging.updateEmail({
html: false, // optional
cc: [], // optional
bcc: [], // optional
replyToEmail: 'email@example.com', // optional
replyToName: '<REPLY_TO_NAME>', // optional
scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional
attachments: [], // optional
});
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/organization/create-ephemeral-project-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const organization = new Organization(client);

const result = await organization.createEphemeralProjectKey({
projectId: '<PROJECT_ID>',
scopes: [ProjectKeyScopes.ProjectRead],
scopes: [ProjectKeyScopes.UsersRead],
duration: 600,
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/organization/create-project-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const result = await organization.createProjectKey({
projectId: '<PROJECT_ID>',
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [ProjectKeyScopes.ProjectRead],
scopes: [ProjectKeyScopes.UsersRead],
expire: '2020-10-15T06:38:00.000+00:00', // optional
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/organization/update-project-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const result = await organization.updateProjectKey({
projectId: '<PROJECT_ID>',
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [ProjectKeyScopes.ProjectRead],
scopes: [ProjectKeyScopes.UsersRead],
expire: '2020-10-15T06:38:00.000+00:00', // optional
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/project/create-ephemeral-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const client = new Client()
const project = new Project(client);

const result = await project.createEphemeralKey({
scopes: [ProjectKeyScopes.ProjectRead],
scopes: [ProjectKeyScopes.UsersRead],
duration: 600,
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/project/create-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const project = new Project(client);
const result = await project.createKey({
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [ProjectKeyScopes.ProjectRead],
scopes: [ProjectKeyScopes.UsersRead],
expire: '2020-10-15T06:38:00.000+00:00', // optional
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/project/create-smtp-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const client = new Client()
const project = new Project(client);

const result = await project.createSMTPTest({
emails: [],
emails: ['recipient@example.com'],
});

console.log(result);
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/project/update-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const project = new Project(client);
const result = await project.updateKey({
keyId: '<KEY_ID>',
name: '<NAME>',
scopes: [ProjectKeyScopes.ProjectRead],
scopes: [ProjectKeyScopes.UsersRead],
expire: '2020-10-15T06:38:00.000+00:00', // optional
});

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/project/update-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const client = new Client()
const project = new Project(client);

const result = await project.updateLabels({
labels: [],
labels: ['production'],
});

console.log(result);
Expand Down
Loading