Skip to content

Add inc/dec #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
- name: Publish
run: npm publish --tag ${{ steps.release_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_NO_ORG }}
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
## 15.0.1

* Remove titles from all function descriptions
* Fix typing for collection "attribute" key
* Fix typing for collection "attribute" key
* Remove unnecessary awaits and asyncs
* Ensure `AppwriteException` response is always string

## 15.0.0

* Fix: pong response & chunked upload
* Fix: pong response & chunked upload

## 14.2.0

Expand Down Expand Up @@ -65,4 +65,4 @@
* Rename `templateBranch` to `templateVersion` in `createFunction()`.
* Rename `downloadDeployment()` to `getDeploymentDownload()`

> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`.
> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Node.js SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.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 is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).**
**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).**

> 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/databases/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setAdmin('') //
.setKey('<YOUR_API_KEY>'); // Your secret API key

const databases = new sdk.Databases(client);
Expand Down
17 changes: 17 additions & 0 deletions docs/examples/databases/decrement-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const databases = new sdk.Databases(client);

const result = await databases.decrementDocumentAttribute(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
'', // attribute
null, // value (optional)
null // min (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/databases/increment-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const databases = new sdk.Databases(client);

const result = await databases.incrementDocumentAttribute(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
'', // attribute
null, // value (optional)
null // max (optional)
);
9 changes: 4 additions & 5 deletions docs/examples/databases/upsert-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ 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
.setSession('') // The user session to authenticate with
.setKey('<YOUR_API_KEY>') // Your secret API key
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token

const databases = new sdk.Databases(client);

const result = await databases.upsertDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
{}, // data
["read("any")"] // permissions (optional)
'<DOCUMENT_ID>' // documentId
);
5 changes: 2 additions & 3 deletions docs/examples/databases/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ 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
.setAdmin('') //
.setKey('<YOUR_API_KEY>'); // Your secret API key

const databases = new sdk.Databases(client);

const result = await databases.upsertDocuments(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
[] // documents
'<COLLECTION_ID>' // collectionId
);
17 changes: 17 additions & 0 deletions docs/examples/tables/create-boolean-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createBooleanColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
false, // required
false, // default (optional)
false // array (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tables/create-datetime-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createDatetimeColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
false, // required
'', // default (optional)
false // array (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tables/create-email-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createEmailColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
false, // required
'email@example.com', // default (optional)
false // array (optional)
);
18 changes: 18 additions & 0 deletions docs/examples/tables/create-enum-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createEnumColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
[], // elements
false, // required
'<DEFAULT>', // default (optional)
false // array (optional)
);
19 changes: 19 additions & 0 deletions docs/examples/tables/create-float-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createFloatColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
false, // required
null, // min (optional)
null, // max (optional)
null, // default (optional)
false // array (optional)
);
18 changes: 18 additions & 0 deletions docs/examples/tables/create-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createIndex(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
sdk.IndexType.Key, // type
[], // columns
[], // orders (optional)
[] // lengths (optional)
);
19 changes: 19 additions & 0 deletions docs/examples/tables/create-integer-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createIntegerColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
false, // required
null, // min (optional)
null, // max (optional)
null, // default (optional)
false // array (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tables/create-ip-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createIpColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
false, // required
'', // default (optional)
false // array (optional)
);
19 changes: 19 additions & 0 deletions docs/examples/tables/create-relationship-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createRelationshipColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<RELATED_TABLE_ID>', // relatedTableId
sdk.RelationshipType.OneToOne, // type
false, // twoWay (optional)
'', // key (optional)
'', // twoWayKey (optional)
sdk.RelationMutate.Cascade // onDelete (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tables/create-row.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setSession('') // The user session to authenticate with
.setKey('<YOUR_API_KEY>') // Your secret API key
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token

const tables = new sdk.Tables(client);

const result = await tables.createRow(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<ROW_ID>', // rowId
{}, // data
["read("any")"] // permissions (optional)
);
14 changes: 14 additions & 0 deletions docs/examples/tables/create-rows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const sdk = require('node-appwrite');

const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setAdmin('') //
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createRows(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
[] // rows
);
19 changes: 19 additions & 0 deletions docs/examples/tables/create-string-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createStringColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
1, // size
false, // required
'<DEFAULT>', // default (optional)
false, // array (optional)
false // encrypt (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tables/create-url-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.createUrlColumn(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'', // key
false, // required
'https://example.com', // default (optional)
false // array (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tables/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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
.setKey('<YOUR_API_KEY>'); // Your secret API key

const tables = new sdk.Tables(client);

const result = await tables.create(
'<DATABASE_ID>', // databaseId
'<TABLE_ID>', // tableId
'<NAME>', // name
["read("any")"], // permissions (optional)
false, // rowSecurity (optional)
false // enabled (optional)
);
Loading