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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## 30.0.0-rc.2

* Added: OAuth2 provider `prompt` enums (`OAuth2Auth0Prompt`, `OAuth2GithubPrompt`, and project variants)
* Added: `Topic` and `ResolvedTopic` exports
* Added: `Models.Account` and `Models.OAuth2Webflow` types
* Added: `Webflow` to the `OAuthProvider` and `ProjectOAuthProviderId` enums
* Added: `avatars.updatePhoto()` and `avatars.deletePhoto()` methods
* Added: optional `total` param on locale and list endpoints; `duration` on email-password sessions
* Updated: `chunkedUpload` supports a `text` responseType and falls back without a file
* Updated: several model fields relaxed to optional; `RestorationStatus.options` is now an object

## 30.0.0

* Breaking: `account.listLogs`, `users.listLogs`, `Log` and `LogList` removed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![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 latest 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-node/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-node/releases) when APIs differ.

> This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web)
Expand Down
1 change: 1 addition & 0 deletions docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ const account = new sdk.Account(client);
const result = await account.createEmailPasswordSession({
email: 'email@example.com',
password: 'password',
duration: 60, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/account/delete-sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const account = new sdk.Account(client);

const result = await account.deleteSessions();
const result = await account.deleteSessions({
current: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/account/list-sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const account = new sdk.Account(client);

const result = await account.listSessions();
const result = await account.listSessions({
total: false, // optional
});
```
12 changes: 12 additions & 0 deletions docs/examples/avatars/delete-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with

const avatars = new sdk.Avatars(client);

const result = await avatars.deletePhoto();
```
3 changes: 1 addition & 2 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const avatars = new sdk.Avatars(client);
const result = await avatars.getScreenshot({
url: 'https://example.com',
headers: {
Authorization: 'Bearer token123',
'X-Custom-Header': 'value',
'Accept-Language': 'en-US,en;q=0.9',
}, // optional
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
Expand Down
15 changes: 15 additions & 0 deletions docs/examples/avatars/update-photo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');
const { InputFile } = require('node-appwrite/file');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setSession(''); // The user session to authenticate with

const avatars = new sdk.Avatars(client);

const result = await avatars.updatePhoto({
file: InputFile.fromPath('/path/to/file', 'filename'),
});
```
11 changes: 10 additions & 1 deletion docs/examples/databases/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ const databases = new sdk.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
});
```
2 changes: 1 addition & 1 deletion docs/examples/databases/create-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const result = await databases.createIndex({
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
type: sdk.DatabasesIndexType.Key,
attributes: [],
attributes: ['username'],
orders: [sdk.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 @@ -11,7 +11,9 @@ const databases = new sdk.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
});
```
1 change: 1 addition & 0 deletions docs/examples/databases/list-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ const databases = new sdk.Databases(client);

const result = await databases.listTransactions({
queries: [], // optional
total: false, // optional
});
```
11 changes: 10 additions & 1 deletion docs/examples/databases/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ const databases = new sdk.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
});
```
11 changes: 10 additions & 1 deletion docs/examples/documentsdb/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ const documentsDB = new sdk.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
});
```
2 changes: 1 addition & 1 deletion docs/examples/documentsdb/create-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const result = await documentsDB.createIndex({
collectionId: '<COLLECTION_ID>',
key: '<KEY>',
type: sdk.DocumentsDBIndexType.Key,
attributes: [],
attributes: ['username'],
orders: [sdk.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 @@ -11,7 +11,9 @@ const documentsDB = new sdk.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
});
```
1 change: 1 addition & 0 deletions docs/examples/documentsdb/list-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ const documentsDB = new sdk.DocumentsDB(client);

const result = await documentsDB.listTransactions({
queries: [], // optional
total: false, // optional
});
```
11 changes: 10 additions & 1 deletion docs/examples/documentsdb/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ const documentsDB = new sdk.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
});
```
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 @@ -9,7 +9,10 @@ const client = new sdk.Client()
const embeddings = new sdk.Embeddings(client);

const result = await embeddings.createTextEmbeddings({
texts: [],
texts: [
'Appwrite helps developers build applications.',
'Find documents with semantic search.',
],
model: sdk.EmbeddingModel.NomicEmbedText, // optional
});
```
2 changes: 1 addition & 1 deletion docs/examples/functions/create-deployment.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```javascript
const sdk = require('node-appwrite');
const fs = require('fs');
const { InputFile } = require('node-appwrite/file');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/functions/list-runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const functions = new sdk.Functions(client);

const result = await functions.listRuntimes();
const result = await functions.listRuntimes({
total: false, // optional
});
```
1 change: 1 addition & 0 deletions docs/examples/functions/list-specifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ const functions = new sdk.Functions(client);

const result = await functions.listSpecifications({
type: 'runtimes', // optional
total: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/graphql/mutation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const client = new sdk.Client()
const graphql = new sdk.Graphql(client);

const result = await graphql.mutation({
query: {},
query: {
query: 'mutation { accountUpdateName(name: "Walter") { name } }',
},
});
```
4 changes: 3 additions & 1 deletion docs/examples/graphql/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const client = new sdk.Client()
const graphql = new sdk.Graphql(client);

const result = await graphql.query({
query: {},
query: {
query: 'query { localeGet { ip } }',
},
});
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const locale = new sdk.Locale(client);

const result = await locale.listCodes();
const result = await locale.listCodes({
total: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-continents.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const locale = new sdk.Locale(client);

const result = await locale.listContinents();
const result = await locale.listContinents({
total: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-countries-eu.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const locale = new sdk.Locale(client);

const result = await locale.listCountriesEU();
const result = await locale.listCountriesEU({
total: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-countries-phones.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const locale = new sdk.Locale(client);

const result = await locale.listCountriesPhones();
const result = await locale.listCountriesPhones({
total: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-countries.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const locale = new sdk.Locale(client);

const result = await locale.listCountries();
const result = await locale.listCountries({
total: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-currencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const locale = new sdk.Locale(client);

const result = await locale.listCurrencies();
const result = await locale.listCurrencies({
total: false, // optional
});
```
4 changes: 3 additions & 1 deletion docs/examples/locale/list-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ const client = new sdk.Client()

const locale = new sdk.Locale(client);

const result = await locale.listLanguages();
const result = await locale.listLanguages({
total: false, // optional
});
```
1 change: 1 addition & 0 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ const result = await messaging.createPush({
contentAvailable: false, // optional
critical: false, // optional
priority: sdk.MessagePriority.Normal, // optional
channelId: '<CHANNEL_ID>', // optional
});
```
10 changes: 5 additions & 5 deletions docs/examples/messaging/update-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ const messaging = new sdk.Messaging(client);

const result = await messaging.updateEmail({
messageId: '<MESSAGE_ID>',
subject: '<SUBJECT>', // optional
content: '<CONTENT>', // optional
topics: [], // optional
users: [], // optional
targets: [], // optional
subject: '<SUBJECT>', // optional
content: '<CONTENT>', // optional
draft: false, // optional
html: false, // optional
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
attachments: [], // optional
});
```
5 changes: 3 additions & 2 deletions docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const messaging = new sdk.Messaging(client);

const result = await messaging.updatePush({
messageId: '<MESSAGE_ID>',
title: '<TITLE>', // optional
body: '<BODY>', // optional
topics: [], // optional
users: [], // optional
targets: [], // optional
title: '<TITLE>', // optional
body: '<BODY>', // optional
data: {}, // optional
action: '<ACTION>', // optional
image: '<ID1:ID2>', // optional
Expand All @@ -28,5 +28,6 @@ const result = await messaging.updatePush({
contentAvailable: false, // optional
critical: false, // optional
priority: sdk.MessagePriority.Normal, // optional
channelId: '<CHANNEL_ID>', // optional
});
```
2 changes: 1 addition & 1 deletion docs/examples/messaging/update-sms.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const messaging = new sdk.Messaging(client);

const result = await messaging.updateSMS({
messageId: '<MESSAGE_ID>',
content: '<CONTENT>', // optional
topics: [], // optional
users: [], // optional
targets: [], // optional
content: '<CONTENT>', // optional
draft: false, // optional
scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional
});
Expand Down
Loading