Skip to content

Add inc/dec #65

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

Merged
merged 5 commits into from
Jul 24, 2025
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
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 }}
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change log

## 0.10.2

* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
* Add `sequence` support to `Document` model
* Fix autocompletion not working for `Document` model even when generic is passed

## 0.10.1

* Fix URL based methods like `getFileViewURL`, `getFilePreviewURL` etc. by adding the missing `projectId` to searchParams
Expand Down Expand Up @@ -28,4 +34,4 @@
## 0.7.4

* Upgrade dependencies to resolve PlatformConstants error with Expo 53
* Update doc examples to use new multi-region endpoint
* Update doc examples to use new multi-region endpoint
4 changes: 1 addition & 3 deletions docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { Client, Databases } from "react-native-appwrite";

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

const databases = new Databases(client);

Expand Down
18 changes: 18 additions & 0 deletions docs/examples/databases/decrement-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Client, Databases } from "react-native-appwrite";

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

const databases = new Databases(client);

const result = await databases.decrementDocumentAttribute(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
'', // attribute
null, // value (optional)
null // min (optional)
);

console.log(result);
18 changes: 18 additions & 0 deletions docs/examples/databases/increment-document-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Client, Databases } from "react-native-appwrite";

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

const databases = new Databases(client);

const result = await databases.incrementDocumentAttribute(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
'', // attribute
null, // value (optional)
null // max (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": "react-native-appwrite",
"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": "0.10.1",
"version": "0.11.0",
"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 @@ -115,7 +115,7 @@ class Client {
'x-sdk-name': 'React Native',
'x-sdk-platform': 'client',
'x-sdk-language': 'reactnative',
'x-sdk-version': '0.10.1',
'x-sdk-version': '0.11.0',
'X-Appwrite-Response-Format': '1.7.0',
};

Expand Down
12 changes: 8 additions & 4 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export namespace Models {
/**
* Documents List
*/
export type DocumentList<Document extends Models.Document> = {
export type DocumentList<Document extends Models.Document = Models.DefaultDocument> = {
/**
* Total number of documents documents that matched your query.
*/
Expand Down Expand Up @@ -67,7 +67,7 @@ export namespace Models {
/**
* Teams List
*/
export type TeamList<Preferences extends Models.Preferences> = {
export type TeamList<Preferences extends Models.Preferences = Models.DefaultPreferences> = {
/**
* Total number of teams documents that matched your query.
*/
Expand Down Expand Up @@ -189,6 +189,10 @@ export namespace Models {
* Document ID.
*/
$id: string;
/**
* Document automatically incrementing ID.
*/
$sequence: number;
/**
* Collection ID.
*/
Expand Down Expand Up @@ -303,7 +307,7 @@ export namespace Models {
/**
* User
*/
export type User<Preferences extends Models.Preferences> = {
export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = {
/**
* User ID.
*/
Expand Down Expand Up @@ -792,7 +796,7 @@ export namespace Models {
/**
* Team
*/
export type Team<Preferences extends Models.Preferences> = {
export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = {
/**
* Team ID.
*/
Expand Down
Loading