Skip to content

Commit 773784e

Browse files
committed
Add inc/dec
1 parent 75e6ea3 commit 773784e

File tree

16 files changed

+414
-21
lines changed

16 files changed

+414
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite PHP SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1)
4-
![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square&v=1)
4+
![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square&v=1)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

docs/databases.md

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection
623623
POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents
624624
```
625625

626-
** Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. **
626+
** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
627+
628+
Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. **
627629

628630
### Parameters
629631

@@ -638,23 +640,26 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection
638640
PUT https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents
639641
```
640642

641-
** Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
642-
**
643+
** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
644+
645+
Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. **
643646

644647
### Parameters
645648

646649
| Field Name | Type | Description | Default |
647650
| --- | --- | --- | --- |
648651
| databaseId | string | **Required** Database ID. | |
649652
| collectionId | string | **Required** Collection ID. | |
650-
| documents | array | Array of document data as JSON objects. May contain partial documents. | [] |
653+
| documents | array | Array of document data as JSON objects. May contain partial documents. | |
651654

652655

653656
```http request
654657
PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents
655658
```
656659

657-
** Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. **
660+
** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
661+
662+
Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. **
658663

659664
### Parameters
660665

@@ -670,7 +675,9 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio
670675
DELETE https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents
671676
```
672677

673-
** Bulk delete documents using queries, if no queries are passed then all documents are deleted. **
678+
** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
679+
680+
Bulk delete documents using queries, if no queries are passed then all documents are deleted. **
674681

675682
### Parameters
676683

@@ -697,6 +704,25 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI
697704
| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] |
698705

699706

707+
```http request
708+
PUT https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId}
709+
```
710+
711+
** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions.
712+
713+
Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. **
714+
715+
### Parameters
716+
717+
| Field Name | Type | Description | Default |
718+
| --- | --- | --- | --- |
719+
| databaseId | string | **Required** Database ID. | |
720+
| collectionId | string | **Required** Collection ID. | |
721+
| documentId | string | **Required** Document ID. | |
722+
| data | object | Document data as JSON object. Include all required attributes of the document to be created or updated. | {} |
723+
| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | |
724+
725+
700726
```http request
701727
PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId}
702728
```
@@ -729,6 +755,42 @@ DELETE https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collecti
729755
| documentId | string | **Required** Document ID. | |
730756

731757

758+
```http request
759+
PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement
760+
```
761+
762+
** Decrement a specific attribute of a document by a given value. **
763+
764+
### Parameters
765+
766+
| Field Name | Type | Description | Default |
767+
| --- | --- | --- | --- |
768+
| databaseId | string | **Required** Database ID. | |
769+
| collectionId | string | **Required** Collection ID. | |
770+
| documentId | string | **Required** Document ID. | |
771+
| attribute | string | **Required** Attribute key. | |
772+
| value | number | Value to decrement the attribute by. The value must be a number. | 1 |
773+
| min | number | Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. | |
774+
775+
776+
```http request
777+
PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment
778+
```
779+
780+
** Increment a specific attribute of a document by a given value. **
781+
782+
### Parameters
783+
784+
| Field Name | Type | Description | Default |
785+
| --- | --- | --- | --- |
786+
| databaseId | string | **Required** Database ID. | |
787+
| collectionId | string | **Required** Collection ID. | |
788+
| documentId | string | **Required** Document ID. | |
789+
| attribute | string | **Required** Attribute key. | |
790+
| value | number | Value to increment the attribute by. The value must be a number. | 1 |
791+
| max | number | Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. | |
792+
793+
732794
```http request
733795
GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/indexes
734796
```

docs/examples/databases/create-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use Appwrite\Services\Databases;
55
66
$client = (new Client())
77
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
8+
->setAdmin('') //
89
->setSession('') // The user session to authenticate with
910
->setKey('<YOUR_API_KEY>') // Your secret API key
1011
->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use Appwrite\Client;
4+
use Appwrite\Services\Databases;
5+
6+
$client = (new Client())
7+
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
8+
->setProject('<YOUR_PROJECT_ID>') // Your project ID
9+
->setKey('<YOUR_API_KEY>'); // Your secret API key
10+
11+
$databases = new Databases($client);
12+
13+
$result = $databases->decrementDocumentAttribute(
14+
databaseId: '<DATABASE_ID>',
15+
collectionId: '<COLLECTION_ID>',
16+
documentId: '<DOCUMENT_ID>',
17+
attribute: '',
18+
value: null, // optional
19+
min: null // optional
20+
);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use Appwrite\Client;
4+
use Appwrite\Services\Databases;
5+
6+
$client = (new Client())
7+
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
8+
->setProject('<YOUR_PROJECT_ID>') // Your project ID
9+
->setKey('<YOUR_API_KEY>'); // Your secret API key
10+
11+
$databases = new Databases($client);
12+
13+
$result = $databases->incrementDocumentAttribute(
14+
databaseId: '<DATABASE_ID>',
15+
collectionId: '<COLLECTION_ID>',
16+
documentId: '<DOCUMENT_ID>',
17+
attribute: '',
18+
value: null, // optional
19+
max: null // optional
20+
);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
use Appwrite\Client;
4+
use Appwrite\Services\Databases;
5+
6+
$client = (new Client())
7+
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
8+
->setProject('<YOUR_PROJECT_ID>') // Your project ID
9+
->setSession(''); // The user session to authenticate with
10+
11+
$databases = new Databases($client);
12+
13+
$result = $databases->upsertDocument(
14+
databaseId: '<DATABASE_ID>',
15+
collectionId: '<COLLECTION_ID>',
16+
documentId: '<DOCUMENT_ID>',
17+
data: [],
18+
permissions: ["read("any")"] // optional
19+
);

docs/examples/databases/upsert-documents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ $databases = new Databases($client);
1313
$result = $databases->upsertDocuments(
1414
databaseId: '<DATABASE_ID>',
1515
collectionId: '<COLLECTION_ID>',
16-
documents: [] // optional
16+
documents: []
1717
);

docs/tokens.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ GET https://cloud.appwrite.io/v1/tokens/buckets/{bucketId}/files/{fileId}
2020
POST https://cloud.appwrite.io/v1/tokens/buckets/{bucketId}/files/{fileId}
2121
```
2222

23-
** Create a new token. A token is linked to a file. Token can be passed as a header or request get parameter. **
23+
** Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. **
2424

2525
### Parameters
2626

docs/users.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/targets
509509
| Field Name | Type | Description | Default |
510510
| --- | --- | --- | --- |
511511
| userId | string | **Required** User ID. | |
512-
| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels | [] |
512+
| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType | [] |
513513

514514

515515
```http request

src/Appwrite/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class Client
3737
*/
3838
protected array $headers = [
3939
'content-type' => '',
40-
'user-agent' => 'AppwritePHPSDK/15.0.0 ()',
40+
'user-agent' => 'AppwritePHPSDK/15.1.0 ()',
4141
'x-sdk-name'=> 'PHP',
4242
'x-sdk-platform'=> 'server',
4343
'x-sdk-language'=> 'php',
44-
'x-sdk-version'=> '15.0.0',
44+
'x-sdk-version'=> '15.1.0',
4545
];
4646

4747
/**

0 commit comments

Comments
 (0)