From a8eb89c767ffdd7ee9248a41983fc656711a38d0 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 24 Mar 2026 13:07:03 +0000 Subject: [PATCH 1/8] feat: update PHP SDK to 20.2.0 * No user-facing SDK changes --- CHANGELOG.md | 6 - README.md | 2 +- docs/documentsdb.md | 498 +++++++ docs/examples/databases/create-index.md | 4 +- docs/examples/databases/upsert-documents.md | 2 +- .../examples/documentsdb/create-collection.md | 25 + docs/examples/documentsdb/create-document.md | 28 + docs/examples/documentsdb/create-documents.md | 18 + docs/examples/documentsdb/create-index.md | 24 + .../examples/documentsdb/create-operations.md | 27 + .../documentsdb/create-transaction.md | 16 + docs/examples/documentsdb/create.md | 18 + .../decrement-document-attribute.md | 22 + .../examples/documentsdb/delete-collection.md | 17 + docs/examples/documentsdb/delete-document.md | 19 + docs/examples/documentsdb/delete-documents.md | 19 + docs/examples/documentsdb/delete-index.md | 18 + .../documentsdb/delete-transaction.md | 16 + docs/examples/documentsdb/delete.md | 16 + docs/examples/documentsdb/get-collection.md | 17 + docs/examples/documentsdb/get-document.md | 20 + docs/examples/documentsdb/get-index.md | 18 + docs/examples/documentsdb/get-transaction.md | 16 + docs/examples/documentsdb/get.md | 16 + .../increment-document-attribute.md | 22 + docs/examples/documentsdb/list-collections.md | 19 + docs/examples/documentsdb/list-documents.md | 21 + docs/examples/documentsdb/list-indexes.md | 19 + .../examples/documentsdb/list-transactions.md | 16 + docs/examples/documentsdb/list.md | 18 + .../examples/documentsdb/update-collection.md | 23 + docs/examples/documentsdb/update-document.md | 23 + docs/examples/documentsdb/update-documents.md | 20 + .../documentsdb/update-transaction.md | 18 + docs/examples/documentsdb/update.md | 18 + docs/examples/documentsdb/upsert-document.md | 23 + docs/examples/documentsdb/upsert-documents.md | 19 + docs/examples/functions/create.md | 4 +- docs/examples/functions/update.md | 4 +- docs/examples/project/create-variable.md | 19 + docs/examples/project/delete-variable.md | 16 + docs/examples/project/get-variable.md | 16 + docs/examples/project/list-variables.md | 17 + docs/examples/project/update-variable.md | 19 + docs/examples/sites/create.md | 5 +- docs/examples/sites/update.md | 5 +- docs/examples/tablesdb/create-index.md | 4 +- docs/examples/users/update-impersonator.md | 17 + docs/examples/vectorsdb/create-collection.md | 24 + docs/examples/vectorsdb/create-document.md | 32 + docs/examples/vectorsdb/create-documents.md | 18 + docs/examples/vectorsdb/create-index.md | 24 + docs/examples/vectorsdb/create-operations.md | 27 + .../vectorsdb/create-text-embeddings.md | 18 + docs/examples/vectorsdb/create-transaction.md | 16 + docs/examples/vectorsdb/create.md | 18 + docs/examples/vectorsdb/delete-collection.md | 17 + docs/examples/vectorsdb/delete-document.md | 19 + docs/examples/vectorsdb/delete-documents.md | 19 + docs/examples/vectorsdb/delete-index.md | 18 + docs/examples/vectorsdb/delete-transaction.md | 16 + docs/examples/vectorsdb/delete.md | 16 + docs/examples/vectorsdb/get-collection.md | 17 + docs/examples/vectorsdb/get-document.md | 20 + docs/examples/vectorsdb/get-index.md | 18 + docs/examples/vectorsdb/get-transaction.md | 16 + docs/examples/vectorsdb/get.md | 16 + docs/examples/vectorsdb/list-collections.md | 19 + docs/examples/vectorsdb/list-documents.md | 21 + docs/examples/vectorsdb/list-indexes.md | 19 + docs/examples/vectorsdb/list-transactions.md | 16 + docs/examples/vectorsdb/list.md | 18 + docs/examples/vectorsdb/update-collection.md | 24 + docs/examples/vectorsdb/update-document.md | 23 + docs/examples/vectorsdb/update-documents.md | 20 + docs/examples/vectorsdb/update-transaction.md | 18 + docs/examples/vectorsdb/update.md | 18 + docs/examples/vectorsdb/upsert-document.md | 23 + docs/examples/vectorsdb/upsert-documents.md | 19 + docs/examples/webhooks/create.md | 23 + docs/examples/webhooks/delete.md | 16 + docs/examples/webhooks/get.md | 16 + docs/examples/webhooks/list.md | 17 + docs/examples/webhooks/update-signature.md | 16 + docs/examples/webhooks/update.md | 23 + docs/functions.md | 8 +- docs/project.md | 74 + docs/sites.md | 10 +- docs/users.md | 17 +- docs/vectorsdb.md | 421 ++++++ docs/webhooks.md | 95 ++ src/Appwrite/Client.php | 54 +- src/Appwrite/Enums/BackupServices.php | 24 + src/Appwrite/Enums/BuildRuntime.php | 688 +++++++++ src/Appwrite/Enums/DatabaseType.php | 16 + src/Appwrite/Enums/DatabasesIndexType.php | 59 + src/Appwrite/Enums/DocumentsDBIndexType.php | 59 + src/Appwrite/Enums/Model.php | 35 + src/Appwrite/Enums/Runtime.php | 688 +++++++++ src/Appwrite/Enums/Scopes.php | 32 + .../{IndexType.php => TablesDBIndexType.php} | 26 +- src/Appwrite/Enums/VectorsDBIndexType.php | 75 + src/Appwrite/Services/Databases.php | 6 +- src/Appwrite/Services/DocumentsDB.php | 1283 +++++++++++++++++ src/Appwrite/Services/Functions.php | 36 +- src/Appwrite/Services/Project.php | 183 +++ src/Appwrite/Services/Sites.php | 46 +- src/Appwrite/Services/TablesDB.php | 6 +- src/Appwrite/Services/Users.php | 36 + src/Appwrite/Services/VectorsDB.php | 1137 +++++++++++++++ src/Appwrite/Services/Webhooks.php | 255 ++++ tests/Appwrite/Services/DatabasesTest.php | 16 +- tests/Appwrite/Services/DocumentsDBTest.php | 701 +++++++++ tests/Appwrite/Services/FunctionsTest.php | 16 +- tests/Appwrite/Services/ProjectTest.php | 121 ++ tests/Appwrite/Services/SitesTest.php | 20 +- tests/Appwrite/Services/TablesDBTest.php | 16 +- tests/Appwrite/Services/UsersTest.php | 32 + tests/Appwrite/Services/VectorsDBTest.php | 673 +++++++++ tests/Appwrite/Services/WebhooksTest.php | 168 +++ 120 files changed, 9034 insertions(+), 83 deletions(-) create mode 100644 docs/documentsdb.md create mode 100644 docs/examples/documentsdb/create-collection.md create mode 100644 docs/examples/documentsdb/create-document.md create mode 100644 docs/examples/documentsdb/create-documents.md create mode 100644 docs/examples/documentsdb/create-index.md create mode 100644 docs/examples/documentsdb/create-operations.md create mode 100644 docs/examples/documentsdb/create-transaction.md create mode 100644 docs/examples/documentsdb/create.md create mode 100644 docs/examples/documentsdb/decrement-document-attribute.md create mode 100644 docs/examples/documentsdb/delete-collection.md create mode 100644 docs/examples/documentsdb/delete-document.md create mode 100644 docs/examples/documentsdb/delete-documents.md create mode 100644 docs/examples/documentsdb/delete-index.md create mode 100644 docs/examples/documentsdb/delete-transaction.md create mode 100644 docs/examples/documentsdb/delete.md create mode 100644 docs/examples/documentsdb/get-collection.md create mode 100644 docs/examples/documentsdb/get-document.md create mode 100644 docs/examples/documentsdb/get-index.md create mode 100644 docs/examples/documentsdb/get-transaction.md create mode 100644 docs/examples/documentsdb/get.md create mode 100644 docs/examples/documentsdb/increment-document-attribute.md create mode 100644 docs/examples/documentsdb/list-collections.md create mode 100644 docs/examples/documentsdb/list-documents.md create mode 100644 docs/examples/documentsdb/list-indexes.md create mode 100644 docs/examples/documentsdb/list-transactions.md create mode 100644 docs/examples/documentsdb/list.md create mode 100644 docs/examples/documentsdb/update-collection.md create mode 100644 docs/examples/documentsdb/update-document.md create mode 100644 docs/examples/documentsdb/update-documents.md create mode 100644 docs/examples/documentsdb/update-transaction.md create mode 100644 docs/examples/documentsdb/update.md create mode 100644 docs/examples/documentsdb/upsert-document.md create mode 100644 docs/examples/documentsdb/upsert-documents.md create mode 100644 docs/examples/project/create-variable.md create mode 100644 docs/examples/project/delete-variable.md create mode 100644 docs/examples/project/get-variable.md create mode 100644 docs/examples/project/list-variables.md create mode 100644 docs/examples/project/update-variable.md create mode 100644 docs/examples/users/update-impersonator.md create mode 100644 docs/examples/vectorsdb/create-collection.md create mode 100644 docs/examples/vectorsdb/create-document.md create mode 100644 docs/examples/vectorsdb/create-documents.md create mode 100644 docs/examples/vectorsdb/create-index.md create mode 100644 docs/examples/vectorsdb/create-operations.md create mode 100644 docs/examples/vectorsdb/create-text-embeddings.md create mode 100644 docs/examples/vectorsdb/create-transaction.md create mode 100644 docs/examples/vectorsdb/create.md create mode 100644 docs/examples/vectorsdb/delete-collection.md create mode 100644 docs/examples/vectorsdb/delete-document.md create mode 100644 docs/examples/vectorsdb/delete-documents.md create mode 100644 docs/examples/vectorsdb/delete-index.md create mode 100644 docs/examples/vectorsdb/delete-transaction.md create mode 100644 docs/examples/vectorsdb/delete.md create mode 100644 docs/examples/vectorsdb/get-collection.md create mode 100644 docs/examples/vectorsdb/get-document.md create mode 100644 docs/examples/vectorsdb/get-index.md create mode 100644 docs/examples/vectorsdb/get-transaction.md create mode 100644 docs/examples/vectorsdb/get.md create mode 100644 docs/examples/vectorsdb/list-collections.md create mode 100644 docs/examples/vectorsdb/list-documents.md create mode 100644 docs/examples/vectorsdb/list-indexes.md create mode 100644 docs/examples/vectorsdb/list-transactions.md create mode 100644 docs/examples/vectorsdb/list.md create mode 100644 docs/examples/vectorsdb/update-collection.md create mode 100644 docs/examples/vectorsdb/update-document.md create mode 100644 docs/examples/vectorsdb/update-documents.md create mode 100644 docs/examples/vectorsdb/update-transaction.md create mode 100644 docs/examples/vectorsdb/update.md create mode 100644 docs/examples/vectorsdb/upsert-document.md create mode 100644 docs/examples/vectorsdb/upsert-documents.md create mode 100644 docs/examples/webhooks/create.md create mode 100644 docs/examples/webhooks/delete.md create mode 100644 docs/examples/webhooks/get.md create mode 100644 docs/examples/webhooks/list.md create mode 100644 docs/examples/webhooks/update-signature.md create mode 100644 docs/examples/webhooks/update.md create mode 100644 docs/project.md create mode 100644 docs/vectorsdb.md create mode 100644 docs/webhooks.md create mode 100644 src/Appwrite/Enums/DatabasesIndexType.php create mode 100644 src/Appwrite/Enums/DocumentsDBIndexType.php create mode 100644 src/Appwrite/Enums/Model.php rename src/Appwrite/Enums/{IndexType.php => TablesDBIndexType.php} (50%) create mode 100644 src/Appwrite/Enums/VectorsDBIndexType.php create mode 100644 src/Appwrite/Services/DocumentsDB.php create mode 100644 src/Appwrite/Services/Project.php create mode 100644 src/Appwrite/Services/VectorsDB.php create mode 100644 src/Appwrite/Services/Webhooks.php create mode 100644 tests/Appwrite/Services/DocumentsDBTest.php create mode 100644 tests/Appwrite/Services/ProjectTest.php create mode 100644 tests/Appwrite/Services/VectorsDBTest.php create mode 100644 tests/Appwrite/Services/WebhooksTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 244095f..b8d0be4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,5 @@ # Change Log -## 21.0.0 - -* Breaking: Updated createDeployment signature and relationship attribute endpoint path -* Added TTL parameter support to listDocuments and listRows -* Added getConsolePausing health endpoint to Health service - ## 20.2.0 * Added optional encrypt parameter for database attributes (Text, Longtext, Mediumtext, Varchar) and corresponding column creation methods to enable encryption at rest. Encrypted attributes/columns cannot be queried. diff --git a/README.md b/README.md index 9713e5d..e4b7ad1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite PHP SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1) -![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square&v=1) +![Version](https://img.shields.io/badge/api%20version-1.9.0-blue.svg?style=flat-square&v=1) [![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) diff --git a/docs/documentsdb.md b/docs/documentsdb.md new file mode 100644 index 0000000..6bce76b --- /dev/null +++ b/docs/documentsdb.md @@ -0,0 +1,498 @@ +# DocumentsDB Service + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb +``` + +** Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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 columns: name | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb +``` + +** Create a new Database. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Database name. Max length: 128 chars. | | +| enabled | boolean | Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/transactions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). | [] | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/transactions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ttl | integer | Seconds before the transaction expires. | 300 | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| commit | boolean | Commit transaction? | | +| rollback | boolean | Rollback transaction? | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId}/operations +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| operations | array | Array of staged operations. | [] | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId} +``` + +** Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId} +``` + +** Update a database by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| name | string | Database name. Max length: 128 chars. | | +| enabled | boolean | Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId} +``` + +** Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections +``` + +** Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| 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, enabled, documentSecurity | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections +``` + +** Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Collection name. Max length: 128 chars. | | +| permissions | array | An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | +| attributes | array | Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. | [] | +| indexes | array | Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). | [] | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} +``` + +** Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} +``` + +** Update a collection by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| name | string | Collection name. Max length: 128 chars. | | +| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} +``` + +** Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Get a list of all the user's documents in a given collection. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +| ttl | integer | TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). | 0 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documentId | string | Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| data | object | Document data as JSON object. | {} | +| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** 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#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documents | array | Array of documents data as JSON objects. | [] | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** 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#documentsDBCreateCollection) API or directly from your database console. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documents | array | Array of document data as JSON objects. May contain partial documents. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** 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. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| data | object | Document data as JSON object. Include only attribute and value pairs to be updated. | {} | +| 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. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Bulk delete documents using queries, if no queries are passed then all documents are deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Get a document by its unique ID. This endpoint response returns a JSON object with the document data. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| 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. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** 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#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include all required fields of the document to be created or updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include only fields and value pairs to be updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Delete a document by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement +``` + +** Decrement a specific column of a row by a given value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| attribute | string | **Required** Attribute key. | | +| value | number | Value to decrement the attribute by. The value must be a number. | 1 | +| min | number | Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment +``` + +** Increment a specific column of a row by a given value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| attribute | string | **Required** Attribute key. | | +| value | number | Value to increment the attribute by. The value must be a number. | 1 | +| max | number | Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes +``` + +** List indexes in the collection. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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: key, type, status, attributes, error | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes +``` + +** Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. +Attributes can be `key`, `fulltext`, and `unique`. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Index Key. | | +| type | string | Index type. | | +| attributes | array | Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. | | +| orders | array | Array of index orders. Maximum of 100 orders are allowed. | [] | +| lengths | array | Length of index. Maximum of 100 | [] | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +** Get index by ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +** Delete an index. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 39b3722..9ecf25a 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\Databases; -use Appwrite\Enums\IndexType; +use Appwrite\Enums\DatabasesIndexType; use Appwrite\Enums\OrderBy; $client = (new Client()) @@ -17,7 +17,7 @@ $result = $databases->createIndex( databaseId: '', collectionId: '', key: '', - type: IndexType::KEY(), + type: DatabasesIndexType::KEY(), attributes: [], orders: [OrderBy::ASC()], // optional lengths: [] // optional diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 5bc04d7..4d989d5 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -7,7 +7,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID - ->setKey(''); // Your secret API key + ->setSession(''); // The user session to authenticate with $databases = new Databases($client); diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md new file mode 100644 index 0000000..3d9b94f --- /dev/null +++ b/docs/examples/documentsdb/create-collection.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createCollection( + databaseId: '', + collectionId: '', + name: '', + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + attributes: [], // optional + indexes: [] // optional +);``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md new file mode 100644 index 0000000..0470561 --- /dev/null +++ b/docs/examples/documentsdb/create-document.md @@ -0,0 +1,28 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 30, + 'isAdmin' => false + ], + permissions: [Permission::read(Role::any())] // optional +);``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md new file mode 100644 index 0000000..f6d2d05 --- /dev/null +++ b/docs/examples/documentsdb/create-documents.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createDocuments( + databaseId: '', + collectionId: '', + documents: [] +);``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md new file mode 100644 index 0000000..771038f --- /dev/null +++ b/docs/examples/documentsdb/create-index.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createIndex( + databaseId: '', + collectionId: '', + key: '', + type: DocumentsDBIndexType::KEY(), + attributes: [], + orders: [OrderBy::ASC()], // optional + lengths: [] // optional +);``` diff --git a/docs/examples/documentsdb/create-operations.md b/docs/examples/documentsdb/create-operations.md new file mode 100644 index 0000000..5dc16fb --- /dev/null +++ b/docs/examples/documentsdb/create-operations.md @@ -0,0 +1,27 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createOperations( + transactionId: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] // optional +);``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md new file mode 100644 index 0000000..c7714f8 --- /dev/null +++ b/docs/examples/documentsdb/create-transaction.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createTransaction( + ttl: 60 // optional +);``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md new file mode 100644 index 0000000..cf73683 --- /dev/null +++ b/docs/examples/documentsdb/create.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->create( + databaseId: '', + name: '', + enabled: false // optional +);``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md new file mode 100644 index 0000000..cacb75f --- /dev/null +++ b/docs/examples/documentsdb/decrement-document-attribute.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->decrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + value: null, // optional + min: null, // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md new file mode 100644 index 0000000..38745aa --- /dev/null +++ b/docs/examples/documentsdb/delete-collection.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteCollection( + databaseId: '', + collectionId: '' +);``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md new file mode 100644 index 0000000..62c2d2e --- /dev/null +++ b/docs/examples/documentsdb/delete-document.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md new file mode 100644 index 0000000..8222655 --- /dev/null +++ b/docs/examples/documentsdb/delete-documents.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md new file mode 100644 index 0000000..fd02645 --- /dev/null +++ b/docs/examples/documentsdb/delete-index.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteIndex( + databaseId: '', + collectionId: '', + key: '' +);``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md new file mode 100644 index 0000000..0c64a38 --- /dev/null +++ b/docs/examples/documentsdb/delete-transaction.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteTransaction( + transactionId: '' +);``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md new file mode 100644 index 0000000..a3ab19f --- /dev/null +++ b/docs/examples/documentsdb/delete.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->delete( + databaseId: '' +);``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md new file mode 100644 index 0000000..6ff15f9 --- /dev/null +++ b/docs/examples/documentsdb/get-collection.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getCollection( + databaseId: '', + collectionId: '' +);``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md new file mode 100644 index 0000000..e0df16b --- /dev/null +++ b/docs/examples/documentsdb/get-document.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getDocument( + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md new file mode 100644 index 0000000..212fd01 --- /dev/null +++ b/docs/examples/documentsdb/get-index.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getIndex( + databaseId: '', + collectionId: '', + key: '' +);``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md new file mode 100644 index 0000000..6bc2193 --- /dev/null +++ b/docs/examples/documentsdb/get-transaction.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getTransaction( + transactionId: '' +);``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md new file mode 100644 index 0000000..464d601 --- /dev/null +++ b/docs/examples/documentsdb/get.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->get( + databaseId: '' +);``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md new file mode 100644 index 0000000..5ed6fd3 --- /dev/null +++ b/docs/examples/documentsdb/increment-document-attribute.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->incrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + value: null, // optional + max: null, // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md new file mode 100644 index 0000000..2fe77dd --- /dev/null +++ b/docs/examples/documentsdb/list-collections.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listCollections( + databaseId: '', + queries: [], // optional + search: '', // optional + total: false // optional +);``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md new file mode 100644 index 0000000..76b9cbe --- /dev/null +++ b/docs/examples/documentsdb/list-documents.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0 // optional +);``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md new file mode 100644 index 0000000..c60aa83 --- /dev/null +++ b/docs/examples/documentsdb/list-indexes.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listIndexes( + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md new file mode 100644 index 0000000..971a642 --- /dev/null +++ b/docs/examples/documentsdb/list-transactions.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listTransactions( + queries: [] // optional +);``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md new file mode 100644 index 0000000..5efcd96 --- /dev/null +++ b/docs/examples/documentsdb/list.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->list( + queries: [], // optional + search: '', // optional + total: false // optional +);``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md new file mode 100644 index 0000000..15f9c4a --- /dev/null +++ b/docs/examples/documentsdb/update-collection.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateCollection( + databaseId: '', + collectionId: '', + name: '', + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false // optional +);``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md new file mode 100644 index 0000000..e2ee55d --- /dev/null +++ b/docs/examples/documentsdb/update-document.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md new file mode 100644 index 0000000..89c0e5d --- /dev/null +++ b/docs/examples/documentsdb/update-documents.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateDocuments( + databaseId: '', + collectionId: '', + data: [], // optional + queries: [], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md new file mode 100644 index 0000000..ae5f84a --- /dev/null +++ b/docs/examples/documentsdb/update-transaction.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateTransaction( + transactionId: '', + commit: false, // optional + rollback: false // optional +);``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md new file mode 100644 index 0000000..c656606 --- /dev/null +++ b/docs/examples/documentsdb/update.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->update( + databaseId: '', + name: '', + enabled: false // optional +);``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md new file mode 100644 index 0000000..a0c8b0d --- /dev/null +++ b/docs/examples/documentsdb/upsert-document.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->upsertDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md new file mode 100644 index 0000000..bbc577b --- /dev/null +++ b/docs/examples/documentsdb/upsert-documents.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->upsertDocuments( + databaseId: '', + collectionId: '', + documents: [], + transactionId: '' // optional +);``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index e921e99..958a4aa 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -31,5 +31,7 @@ $result = $functions->create( providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // optional - specification: '' // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional );``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index f9bdac1..56e66b5 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -31,5 +31,7 @@ $result = $functions->update( providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // optional - specification: '' // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional );``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md new file mode 100644 index 0000000..9f6d65e --- /dev/null +++ b/docs/examples/project/create-variable.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->createVariable( + variableId: '', + key: '', + value: '', + secret: false // optional +);``` diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md new file mode 100644 index 0000000..a6fb65a --- /dev/null +++ b/docs/examples/project/delete-variable.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->deleteVariable( + variableId: '' +);``` diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md new file mode 100644 index 0000000..f80cd3b --- /dev/null +++ b/docs/examples/project/get-variable.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->getVariable( + variableId: '' +);``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md new file mode 100644 index 0000000..f6a9bb4 --- /dev/null +++ b/docs/examples/project/list-variables.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->listVariables( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md new file mode 100644 index 0000000..3e44129 --- /dev/null +++ b/docs/examples/project/update-variable.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$project = new Project($client); + +$result = $project->updateVariable( + variableId: '', + key: '', // optional + value: '', // optional + secret: false // optional +);``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 9191261..866a89c 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -24,6 +24,7 @@ $result = $sites->create( timeout: 1, // optional installCommand: '', // optional buildCommand: '', // optional + startCommand: '', // optional outputDirectory: '', // optional adapter: Adapter::STATIC(), // optional installationId: '', // optional @@ -32,5 +33,7 @@ $result = $sites->create( providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // optional - specification: '' // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional );``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 42d24fb..b2de5a2 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -23,6 +23,7 @@ $result = $sites->update( timeout: 1, // optional installCommand: '', // optional buildCommand: '', // optional + startCommand: '', // optional outputDirectory: '', // optional buildRuntime: BuildRuntime::NODE145(), // optional adapter: Adapter::STATIC(), // optional @@ -32,5 +33,7 @@ $result = $sites->update( providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // optional - specification: '' // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional );``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index c91356f..3cd6b12 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -3,7 +3,7 @@ use Appwrite\Client; use Appwrite\Services\TablesDB; -use Appwrite\Enums\IndexType; +use Appwrite\Enums\TablesDBIndexType; use Appwrite\Enums\OrderBy; $client = (new Client()) @@ -17,7 +17,7 @@ $result = $tablesDB->createIndex( databaseId: '', tableId: '', key: '', - type: IndexType::KEY(), + type: TablesDBIndexType::KEY(), columns: [], orders: [OrderBy::ASC()], // optional lengths: [] // optional diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md new file mode 100644 index 0000000..202f0ed --- /dev/null +++ b/docs/examples/users/update-impersonator.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$users = new Users($client); + +$result = $users->updateImpersonator( + userId: '', + impersonator: false +);``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md new file mode 100644 index 0000000..52f3705 --- /dev/null +++ b/docs/examples/vectorsdb/create-collection.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createCollection( + databaseId: '', + collectionId: '', + name: '', + dimension: 1, + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false // optional +);``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md new file mode 100644 index 0000000..c5e6187 --- /dev/null +++ b/docs/examples/vectorsdb/create-document.md @@ -0,0 +1,32 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [ + 'embeddings' => [ + '0' => 0.12, + '1' => -0.55, + '2' => 0.88, + '3' => 1.02 + ], + 'metadata' => [ + 'key' => 'value' + ] + ], + permissions: [Permission::read(Role::any())] // optional +);``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md new file mode 100644 index 0000000..3c075bf --- /dev/null +++ b/docs/examples/vectorsdb/create-documents.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createDocuments( + databaseId: '', + collectionId: '', + documents: [] +);``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md new file mode 100644 index 0000000..f3a97b6 --- /dev/null +++ b/docs/examples/vectorsdb/create-index.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createIndex( + databaseId: '', + collectionId: '', + key: '', + type: VectorsDBIndexType::HNSWEUCLIDEAN(), + attributes: [], + orders: [OrderBy::ASC()], // optional + lengths: [] // optional +);``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md new file mode 100644 index 0000000..cbf4803 --- /dev/null +++ b/docs/examples/vectorsdb/create-operations.md @@ -0,0 +1,27 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createOperations( + transactionId: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] // optional +);``` diff --git a/docs/examples/vectorsdb/create-text-embeddings.md b/docs/examples/vectorsdb/create-text-embeddings.md new file mode 100644 index 0000000..9947ead --- /dev/null +++ b/docs/examples/vectorsdb/create-text-embeddings.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createTextEmbeddings( + texts: [], + model: Model::EMBEDDINGGEMMA() // optional +);``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md new file mode 100644 index 0000000..52d9914 --- /dev/null +++ b/docs/examples/vectorsdb/create-transaction.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createTransaction( + ttl: 60 // optional +);``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md new file mode 100644 index 0000000..ff277ce --- /dev/null +++ b/docs/examples/vectorsdb/create.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->create( + databaseId: '', + name: '', + enabled: false // optional +);``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md new file mode 100644 index 0000000..94db9f4 --- /dev/null +++ b/docs/examples/vectorsdb/delete-collection.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteCollection( + databaseId: '', + collectionId: '' +);``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md new file mode 100644 index 0000000..c0a7260 --- /dev/null +++ b/docs/examples/vectorsdb/delete-document.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', + transactionId: '' // optional +);``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md new file mode 100644 index 0000000..b64527f --- /dev/null +++ b/docs/examples/vectorsdb/delete-documents.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md new file mode 100644 index 0000000..d4335cc --- /dev/null +++ b/docs/examples/vectorsdb/delete-index.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteIndex( + databaseId: '', + collectionId: '', + key: '' +);``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md new file mode 100644 index 0000000..c45d7cb --- /dev/null +++ b/docs/examples/vectorsdb/delete-transaction.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteTransaction( + transactionId: '' +);``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md new file mode 100644 index 0000000..c801a0e --- /dev/null +++ b/docs/examples/vectorsdb/delete.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->delete( + databaseId: '' +);``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md new file mode 100644 index 0000000..3bcef2d --- /dev/null +++ b/docs/examples/vectorsdb/get-collection.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getCollection( + databaseId: '', + collectionId: '' +);``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md new file mode 100644 index 0000000..c9fe955 --- /dev/null +++ b/docs/examples/vectorsdb/get-document.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getDocument( + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md new file mode 100644 index 0000000..ece9759 --- /dev/null +++ b/docs/examples/vectorsdb/get-index.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getIndex( + databaseId: '', + collectionId: '', + key: '' +);``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md new file mode 100644 index 0000000..ef69fd8 --- /dev/null +++ b/docs/examples/vectorsdb/get-transaction.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getTransaction( + transactionId: '' +);``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md new file mode 100644 index 0000000..94b0f25 --- /dev/null +++ b/docs/examples/vectorsdb/get.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->get( + databaseId: '' +);``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md new file mode 100644 index 0000000..f1234b6 --- /dev/null +++ b/docs/examples/vectorsdb/list-collections.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listCollections( + databaseId: '', + queries: [], // optional + search: '', // optional + total: false // optional +);``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md new file mode 100644 index 0000000..54e7502 --- /dev/null +++ b/docs/examples/vectorsdb/list-documents.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0 // optional +);``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md new file mode 100644 index 0000000..d1e8624 --- /dev/null +++ b/docs/examples/vectorsdb/list-indexes.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listIndexes( + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md new file mode 100644 index 0000000..905773c --- /dev/null +++ b/docs/examples/vectorsdb/list-transactions.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listTransactions( + queries: [] // optional +);``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md new file mode 100644 index 0000000..9037a82 --- /dev/null +++ b/docs/examples/vectorsdb/list.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->list( + queries: [], // optional + search: '', // optional + total: false // optional +);``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md new file mode 100644 index 0000000..38a244a --- /dev/null +++ b/docs/examples/vectorsdb/update-collection.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateCollection( + databaseId: '', + collectionId: '', + name: '', + dimension: 1, // optional + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false // optional +);``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md new file mode 100644 index 0000000..e5061c1 --- /dev/null +++ b/docs/examples/vectorsdb/update-document.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md new file mode 100644 index 0000000..77c3e87 --- /dev/null +++ b/docs/examples/vectorsdb/update-documents.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateDocuments( + databaseId: '', + collectionId: '', + data: [], // optional + queries: [], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md new file mode 100644 index 0000000..986684e --- /dev/null +++ b/docs/examples/vectorsdb/update-transaction.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateTransaction( + transactionId: '', + commit: false, // optional + rollback: false // optional +);``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md new file mode 100644 index 0000000..ee79ddf --- /dev/null +++ b/docs/examples/vectorsdb/update.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->update( + databaseId: '', + name: '', + enabled: false // optional +);``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md new file mode 100644 index 0000000..ef7f550 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-document.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->upsertDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +);``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md new file mode 100644 index 0000000..b047462 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-documents.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->upsertDocuments( + databaseId: '', + collectionId: '', + documents: [], + transactionId: '' // optional +);``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md new file mode 100644 index 0000000..008a816 --- /dev/null +++ b/docs/examples/webhooks/create.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$webhooks = new Webhooks($client); + +$result = $webhooks->create( + webhookId: '', + url: '', + name: '', + events: [], + enabled: false, // optional + security: false, // optional + httpUser: '', // optional + httpPass: '' // optional +);``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md new file mode 100644 index 0000000..cab1063 --- /dev/null +++ b/docs/examples/webhooks/delete.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$webhooks = new Webhooks($client); + +$result = $webhooks->delete( + webhookId: '' +);``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md new file mode 100644 index 0000000..c8acae7 --- /dev/null +++ b/docs/examples/webhooks/get.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$webhooks = new Webhooks($client); + +$result = $webhooks->get( + webhookId: '' +);``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md new file mode 100644 index 0000000..7727c46 --- /dev/null +++ b/docs/examples/webhooks/list.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$webhooks = new Webhooks($client); + +$result = $webhooks->list( + queries: [], // optional + total: false // optional +);``` diff --git a/docs/examples/webhooks/update-signature.md b/docs/examples/webhooks/update-signature.md new file mode 100644 index 0000000..5101085 --- /dev/null +++ b/docs/examples/webhooks/update-signature.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$webhooks = new Webhooks($client); + +$result = $webhooks->updateSignature( + webhookId: '' +);``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md new file mode 100644 index 0000000..b253b1f --- /dev/null +++ b/docs/examples/webhooks/update.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$webhooks = new Webhooks($client); + +$result = $webhooks->update( + webhookId: '', + name: '', + url: '', + events: [], + enabled: false, // optional + security: false, // optional + httpUser: '', // optional + httpPass: '' // optional +);``` diff --git a/docs/functions.md b/docs/functions.md index fbcc10c..baaf38b 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -43,7 +43,9 @@ POST https://cloud.appwrite.io/v1/functions | providerBranch | string | Production branch for the repo linked to the function. | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to function code in the linked repo. | | -| specification | string | Runtime specification for the function and builds. | [] | +| buildSpecification | string | Build specification for the function deployments. | [] | +| runtimeSpecification | string | Runtime specification for the function executions. | [] | +| deploymentRetention | integer | Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | 0 | ```http request @@ -100,7 +102,9 @@ PUT https://cloud.appwrite.io/v1/functions/{functionId} | providerBranch | string | Production branch for the repo linked to the function | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to function code in the linked repo. | | -| specification | string | Runtime specification for the function and builds. | [] | +| buildSpecification | string | Build specification for the function deployments. | [] | +| runtimeSpecification | string | Runtime specification for the function executions. | [] | +| deploymentRetention | integer | Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | 0 | ```http request diff --git a/docs/project.md b/docs/project.md new file mode 100644 index 0000000..eb7e26a --- /dev/null +++ b/docs/project.md @@ -0,0 +1,74 @@ +# Project Service + + +```http request +GET https://cloud.appwrite.io/v1/project/variables +``` + +** Get a list of all project environment variables. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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: key, resourceType, resourceId, secret | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/project/variables +``` + +** Create a new project environment variable. These variables can be accessed by all functions and sites in the project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| variableId | string | Variable ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| key | string | Variable key. Max length: 255 chars. | | +| value | string | Variable value. Max length: 8192 chars. | | +| secret | boolean | Secret variables can be updated or deleted, but only projects can read them during build and runtime. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/project/variables/{variableId} +``` + +** Get a variable by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| variableId | string | **Required** Variable ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/project/variables/{variableId} +``` + +** Update variable by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| variableId | string | **Required** Variable ID. | | +| key | string | Variable key. Max length: 255 chars. | | +| value | string | Variable value. Max length: 8192 chars. | | +| secret | boolean | Secret variables can be updated or deleted, but only projects can read them during build and runtime. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/project/variables/{variableId} +``` + +** Delete a variable by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| variableId | string | **Required** Variable ID. | | + diff --git a/docs/sites.md b/docs/sites.md index e277092..a298449 100644 --- a/docs/sites.md +++ b/docs/sites.md @@ -34,6 +34,7 @@ POST https://cloud.appwrite.io/v1/sites | timeout | integer | Maximum request time in seconds. | 30 | | installCommand | string | Install Command. | | | buildCommand | string | Build Command. | | +| startCommand | string | Custom start command. Leave empty to use default. | | | outputDirectory | string | Output Directory for site. | | | buildRuntime | string | Runtime to use during build step. | | | adapter | string | Framework adapter defining rendering strategy. Allowed values are: static, ssr | | @@ -43,7 +44,9 @@ POST https://cloud.appwrite.io/v1/sites | providerBranch | string | Production branch for the repo linked to the site. | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to site code in the linked repo. | | -| specification | string | Framework specification for the site and builds. | [] | +| buildSpecification | string | Build specification for the site deployments. | [] | +| runtimeSpecification | string | Runtime specification for the SSR executions. | [] | +| deploymentRetention | integer | Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | 0 | ```http request @@ -91,6 +94,7 @@ PUT https://cloud.appwrite.io/v1/sites/{siteId} | timeout | integer | Maximum request time in seconds. | 30 | | installCommand | string | Install Command. | | | buildCommand | string | Build Command. | | +| startCommand | string | Custom start command. Leave empty to use default. | | | outputDirectory | string | Output Directory for site. | | | buildRuntime | string | Runtime to use during build step. | | | adapter | string | Framework adapter defining rendering strategy. Allowed values are: static, ssr | | @@ -100,7 +104,9 @@ PUT https://cloud.appwrite.io/v1/sites/{siteId} | providerBranch | string | Production branch for the repo linked to the site. | | | providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. | | | providerRootDirectory | string | Path to site code in the linked repo. | | -| specification | string | Framework specification for the site and builds. | [] | +| buildSpecification | string | Build specification for the site deployments. | [] | +| runtimeSpecification | string | Runtime specification for the SSR executions. | [] | +| deploymentRetention | integer | Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. | 0 | ```http request diff --git a/docs/users.md b/docs/users.md index 284239e..5c24626 100644 --- a/docs/users.md +++ b/docs/users.md @@ -11,7 +11,7 @@ GET https://cloud.appwrite.io/v1/users | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| 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 | [] | +| 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, impersonator | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | | total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | @@ -222,6 +222,21 @@ PATCH https://cloud.appwrite.io/v1/users/{userId}/email | email | string | User email. | | +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/impersonator +``` + +** Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| impersonator | boolean | Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. | | + + ```http request POST https://cloud.appwrite.io/v1/users/{userId}/jwts ``` diff --git a/docs/vectorsdb.md b/docs/vectorsdb.md new file mode 100644 index 0000000..59dc435 --- /dev/null +++ b/docs/vectorsdb.md @@ -0,0 +1,421 @@ +# VectorsDB Service + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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 columns: name | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Database name. Max length: 128 chars. | | +| enabled | boolean | Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/embeddings/text +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| texts | array | Array of text to generate embeddings. | | +| model | string | The embedding model to use for generating vector embeddings. | embeddinggemma | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/transactions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). | [] | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/transactions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ttl | integer | Seconds before the transaction expires. | 300 | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| commit | boolean | Commit transaction? | | +| rollback | boolean | Rollback transaction? | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId}/operations +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| operations | array | Array of staged operations. | [] | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| name | string | Database name. Max length: 128 chars. | | +| enabled | boolean | Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| 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, enabled, documentSecurity | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Collection name. Max length: 128 chars. | | +| dimension | integer | Embedding dimension. | | +| permissions | array | An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| name | string | Collection name. Max length: 128 chars. | | +| dimension | integer | Embedding dimensions. | | +| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +| ttl | integer | TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). | 0 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documentId | string | Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| data | object | Document data as JSON object. | {} | +| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documents | array | Array of documents data as JSON objects. | [] | + + +```http request +PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documents | array | Array of document data as JSON objects. May contain partial documents. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| data | object | Document data as JSON object. Include only attribute and value pairs to be updated. | {} | +| 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. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| 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. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | + + +```http request +PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include all required fields of the document to be created or updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include only fields and value pairs to be updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| 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: key, type, status, attributes, error | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Index Key. | | +| type | string | Index type. | | +| attributes | array | Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. | | +| orders | array | Array of index orders. Maximum of 100 orders are allowed. | [] | +| lengths | array | Length of index. Maximum of 100 | [] | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + diff --git a/docs/webhooks.md b/docs/webhooks.md new file mode 100644 index 0000000..685b5cb --- /dev/null +++ b/docs/webhooks.md @@ -0,0 +1,95 @@ +# Webhooks Service + + +```http request +GET https://cloud.appwrite.io/v1/webhooks +``` + +** Get a list of all webhooks belonging to the project. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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, url, httpUser, security, events, enabled, logs, attempts | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/webhooks +``` + +** Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| webhookId | string | Webhook ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| url | string | Webhook URL. | | +| name | string | Webhook name. Max length: 128 chars. | | +| events | array | Events list. Maximum of 100 events are allowed. | | +| enabled | boolean | Enable or disable a webhook. | 1 | +| security | boolean | Certificate verification, false for disabled or true for enabled. | | +| httpUser | string | Webhook HTTP user. Max length: 256 chars. | | +| httpPass | string | Webhook HTTP password. Max length: 256 chars. | | + + +```http request +GET https://cloud.appwrite.io/v1/webhooks/{webhookId} +``` + +** Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| webhookId | string | **Required** Webhook ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/webhooks/{webhookId} +``` + +** Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| webhookId | string | **Required** Webhook ID. | | +| name | string | Webhook name. Max length: 128 chars. | | +| url | string | Webhook URL. | | +| events | array | Events list. Maximum of 100 events are allowed. | | +| enabled | boolean | Enable or disable a webhook. | 1 | +| security | boolean | Certificate verification, false for disabled or true for enabled. | | +| httpUser | string | Webhook HTTP user. Max length: 256 chars. | | +| httpPass | string | Webhook HTTP password. Max length: 256 chars. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/webhooks/{webhookId} +``` + +** Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| webhookId | string | **Required** Webhook ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/webhooks/{webhookId}/signature +``` + +** Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| webhookId | string | **Required** Webhook ID. | | + diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 6bf10df..260fabf 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/20.2.1 ()', + 'user-agent' => 'AppwritePHPSDK/20.2.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '20.2.1', + 'x-sdk-version'=> '20.2.0', ]; /** @@ -63,7 +63,7 @@ class Client */ public function __construct() { - $this->headers['X-Appwrite-Response-Format'] = '1.8.0'; + $this->headers['X-Appwrite-Response-Format'] = '1.9.0'; } @@ -161,6 +161,54 @@ public function setForwardedUserAgent(string $value): Client return $this; } + /** + * Set ImpersonateUserId + * + * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param string $value + * + * @return Client + */ + public function setImpersonateUserId(string $value): Client + { + $this->addHeader('X-Appwrite-Impersonate-User-Id', $value); + + return $this; + } + + /** + * Set ImpersonateUserEmail + * + * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param string $value + * + * @return Client + */ + public function setImpersonateUserEmail(string $value): Client + { + $this->addHeader('X-Appwrite-Impersonate-User-Email', $value); + + return $this; + } + + /** + * Set ImpersonateUserPhone + * + * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param string $value + * + * @return Client + */ + public function setImpersonateUserPhone(string $value): Client + { + $this->addHeader('X-Appwrite-Impersonate-User-Phone', $value); + + return $this; + } + /*** * @param bool $status diff --git a/src/Appwrite/Enums/BackupServices.php b/src/Appwrite/Enums/BackupServices.php index 8eb096d..326d361 100644 --- a/src/Appwrite/Enums/BackupServices.php +++ b/src/Appwrite/Enums/BackupServices.php @@ -7,6 +7,9 @@ class BackupServices implements JsonSerializable { private static BackupServices $DATABASES; + private static BackupServices $TABLESDB; + private static BackupServices $DOCUMENTSDB; + private static BackupServices $VECTORSDB; private static BackupServices $FUNCTIONS; private static BackupServices $STORAGE; @@ -34,6 +37,27 @@ public static function DATABASES(): BackupServices } return self::$DATABASES; } + public static function TABLESDB(): BackupServices + { + if (!isset(self::$TABLESDB)) { + self::$TABLESDB = new BackupServices('tablesdb'); + } + return self::$TABLESDB; + } + public static function DOCUMENTSDB(): BackupServices + { + if (!isset(self::$DOCUMENTSDB)) { + self::$DOCUMENTSDB = new BackupServices('documentsdb'); + } + return self::$DOCUMENTSDB; + } + public static function VECTORSDB(): BackupServices + { + if (!isset(self::$VECTORSDB)) { + self::$VECTORSDB = new BackupServices('vectorsdb'); + } + return self::$VECTORSDB; + } public static function FUNCTIONS(): BackupServices { if (!isset(self::$FUNCTIONS)) { diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index f0d01a0..9bd1ad8 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -92,6 +92,92 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $FLUTTER332; private static BuildRuntime $FLUTTER335; private static BuildRuntime $FLUTTER338; + private static BuildRuntime $NODE145RC; + private static BuildRuntime $NODE160RC; + private static BuildRuntime $NODE180RC; + private static BuildRuntime $NODE190RC; + private static BuildRuntime $NODE200RC; + private static BuildRuntime $NODE210RC; + private static BuildRuntime $NODE22RC; + private static BuildRuntime $NODE23RC; + private static BuildRuntime $NODE24RC; + private static BuildRuntime $NODE25RC; + private static BuildRuntime $PHP80RC; + private static BuildRuntime $PHP81RC; + private static BuildRuntime $PHP82RC; + private static BuildRuntime $PHP83RC; + private static BuildRuntime $PHP84RC; + private static BuildRuntime $RUBY30RC; + private static BuildRuntime $RUBY31RC; + private static BuildRuntime $RUBY32RC; + private static BuildRuntime $RUBY33RC; + private static BuildRuntime $RUBY34RC; + private static BuildRuntime $RUBY40RC; + private static BuildRuntime $PYTHON38RC; + private static BuildRuntime $PYTHON39RC; + private static BuildRuntime $PYTHON310RC; + private static BuildRuntime $PYTHON311RC; + private static BuildRuntime $PYTHON312RC; + private static BuildRuntime $PYTHON313RC; + private static BuildRuntime $PYTHON314RC; + private static BuildRuntime $PYTHONML311RC; + private static BuildRuntime $PYTHONML312RC; + private static BuildRuntime $PYTHONML313RC; + private static BuildRuntime $DENO140RC; + private static BuildRuntime $DENO146RC; + private static BuildRuntime $DENO20RC; + private static BuildRuntime $DENO25RC; + private static BuildRuntime $DENO26RC; + private static BuildRuntime $DART215RC; + private static BuildRuntime $DART216RC; + private static BuildRuntime $DART217RC; + private static BuildRuntime $DART218RC; + private static BuildRuntime $DART219RC; + private static BuildRuntime $DART30RC; + private static BuildRuntime $DART31RC; + private static BuildRuntime $DART33RC; + private static BuildRuntime $DART35RC; + private static BuildRuntime $DART38RC; + private static BuildRuntime $DART39RC; + private static BuildRuntime $DART310RC; + private static BuildRuntime $DOTNET60RC; + private static BuildRuntime $DOTNET70RC; + private static BuildRuntime $DOTNET80RC; + private static BuildRuntime $DOTNET10RC; + private static BuildRuntime $JAVA80RC; + private static BuildRuntime $JAVA110RC; + private static BuildRuntime $JAVA170RC; + private static BuildRuntime $JAVA180RC; + private static BuildRuntime $JAVA210RC; + private static BuildRuntime $JAVA22RC; + private static BuildRuntime $JAVA25RC; + private static BuildRuntime $SWIFT55RC; + private static BuildRuntime $SWIFT58RC; + private static BuildRuntime $SWIFT59RC; + private static BuildRuntime $SWIFT510RC; + private static BuildRuntime $SWIFT62RC; + private static BuildRuntime $KOTLIN16RC; + private static BuildRuntime $KOTLIN18RC; + private static BuildRuntime $KOTLIN19RC; + private static BuildRuntime $KOTLIN20RC; + private static BuildRuntime $KOTLIN23RC; + private static BuildRuntime $CPP17RC; + private static BuildRuntime $CPP20RC; + private static BuildRuntime $BUN10RC; + private static BuildRuntime $BUN11RC; + private static BuildRuntime $BUN12RC; + private static BuildRuntime $BUN13RC; + private static BuildRuntime $GO123RC; + private static BuildRuntime $GO124RC; + private static BuildRuntime $GO125RC; + private static BuildRuntime $GO126RC; + private static BuildRuntime $STATIC1RC; + private static BuildRuntime $FLUTTER324RC; + private static BuildRuntime $FLUTTER327RC; + private static BuildRuntime $FLUTTER329RC; + private static BuildRuntime $FLUTTER332RC; + private static BuildRuntime $FLUTTER335RC; + private static BuildRuntime $FLUTTER338RC; private string $value; @@ -712,4 +798,606 @@ public static function FLUTTER338(): BuildRuntime } return self::$FLUTTER338; } + public static function NODE145RC(): BuildRuntime + { + if (!isset(self::$NODE145RC)) { + self::$NODE145RC = new BuildRuntime('node-14.5-rc'); + } + return self::$NODE145RC; + } + public static function NODE160RC(): BuildRuntime + { + if (!isset(self::$NODE160RC)) { + self::$NODE160RC = new BuildRuntime('node-16.0-rc'); + } + return self::$NODE160RC; + } + public static function NODE180RC(): BuildRuntime + { + if (!isset(self::$NODE180RC)) { + self::$NODE180RC = new BuildRuntime('node-18.0-rc'); + } + return self::$NODE180RC; + } + public static function NODE190RC(): BuildRuntime + { + if (!isset(self::$NODE190RC)) { + self::$NODE190RC = new BuildRuntime('node-19.0-rc'); + } + return self::$NODE190RC; + } + public static function NODE200RC(): BuildRuntime + { + if (!isset(self::$NODE200RC)) { + self::$NODE200RC = new BuildRuntime('node-20.0-rc'); + } + return self::$NODE200RC; + } + public static function NODE210RC(): BuildRuntime + { + if (!isset(self::$NODE210RC)) { + self::$NODE210RC = new BuildRuntime('node-21.0-rc'); + } + return self::$NODE210RC; + } + public static function NODE22RC(): BuildRuntime + { + if (!isset(self::$NODE22RC)) { + self::$NODE22RC = new BuildRuntime('node-22-rc'); + } + return self::$NODE22RC; + } + public static function NODE23RC(): BuildRuntime + { + if (!isset(self::$NODE23RC)) { + self::$NODE23RC = new BuildRuntime('node-23-rc'); + } + return self::$NODE23RC; + } + public static function NODE24RC(): BuildRuntime + { + if (!isset(self::$NODE24RC)) { + self::$NODE24RC = new BuildRuntime('node-24-rc'); + } + return self::$NODE24RC; + } + public static function NODE25RC(): BuildRuntime + { + if (!isset(self::$NODE25RC)) { + self::$NODE25RC = new BuildRuntime('node-25-rc'); + } + return self::$NODE25RC; + } + public static function PHP80RC(): BuildRuntime + { + if (!isset(self::$PHP80RC)) { + self::$PHP80RC = new BuildRuntime('php-8.0-rc'); + } + return self::$PHP80RC; + } + public static function PHP81RC(): BuildRuntime + { + if (!isset(self::$PHP81RC)) { + self::$PHP81RC = new BuildRuntime('php-8.1-rc'); + } + return self::$PHP81RC; + } + public static function PHP82RC(): BuildRuntime + { + if (!isset(self::$PHP82RC)) { + self::$PHP82RC = new BuildRuntime('php-8.2-rc'); + } + return self::$PHP82RC; + } + public static function PHP83RC(): BuildRuntime + { + if (!isset(self::$PHP83RC)) { + self::$PHP83RC = new BuildRuntime('php-8.3-rc'); + } + return self::$PHP83RC; + } + public static function PHP84RC(): BuildRuntime + { + if (!isset(self::$PHP84RC)) { + self::$PHP84RC = new BuildRuntime('php-8.4-rc'); + } + return self::$PHP84RC; + } + public static function RUBY30RC(): BuildRuntime + { + if (!isset(self::$RUBY30RC)) { + self::$RUBY30RC = new BuildRuntime('ruby-3.0-rc'); + } + return self::$RUBY30RC; + } + public static function RUBY31RC(): BuildRuntime + { + if (!isset(self::$RUBY31RC)) { + self::$RUBY31RC = new BuildRuntime('ruby-3.1-rc'); + } + return self::$RUBY31RC; + } + public static function RUBY32RC(): BuildRuntime + { + if (!isset(self::$RUBY32RC)) { + self::$RUBY32RC = new BuildRuntime('ruby-3.2-rc'); + } + return self::$RUBY32RC; + } + public static function RUBY33RC(): BuildRuntime + { + if (!isset(self::$RUBY33RC)) { + self::$RUBY33RC = new BuildRuntime('ruby-3.3-rc'); + } + return self::$RUBY33RC; + } + public static function RUBY34RC(): BuildRuntime + { + if (!isset(self::$RUBY34RC)) { + self::$RUBY34RC = new BuildRuntime('ruby-3.4-rc'); + } + return self::$RUBY34RC; + } + public static function RUBY40RC(): BuildRuntime + { + if (!isset(self::$RUBY40RC)) { + self::$RUBY40RC = new BuildRuntime('ruby-4.0-rc'); + } + return self::$RUBY40RC; + } + public static function PYTHON38RC(): BuildRuntime + { + if (!isset(self::$PYTHON38RC)) { + self::$PYTHON38RC = new BuildRuntime('python-3.8-rc'); + } + return self::$PYTHON38RC; + } + public static function PYTHON39RC(): BuildRuntime + { + if (!isset(self::$PYTHON39RC)) { + self::$PYTHON39RC = new BuildRuntime('python-3.9-rc'); + } + return self::$PYTHON39RC; + } + public static function PYTHON310RC(): BuildRuntime + { + if (!isset(self::$PYTHON310RC)) { + self::$PYTHON310RC = new BuildRuntime('python-3.10-rc'); + } + return self::$PYTHON310RC; + } + public static function PYTHON311RC(): BuildRuntime + { + if (!isset(self::$PYTHON311RC)) { + self::$PYTHON311RC = new BuildRuntime('python-3.11-rc'); + } + return self::$PYTHON311RC; + } + public static function PYTHON312RC(): BuildRuntime + { + if (!isset(self::$PYTHON312RC)) { + self::$PYTHON312RC = new BuildRuntime('python-3.12-rc'); + } + return self::$PYTHON312RC; + } + public static function PYTHON313RC(): BuildRuntime + { + if (!isset(self::$PYTHON313RC)) { + self::$PYTHON313RC = new BuildRuntime('python-3.13-rc'); + } + return self::$PYTHON313RC; + } + public static function PYTHON314RC(): BuildRuntime + { + if (!isset(self::$PYTHON314RC)) { + self::$PYTHON314RC = new BuildRuntime('python-3.14-rc'); + } + return self::$PYTHON314RC; + } + public static function PYTHONML311RC(): BuildRuntime + { + if (!isset(self::$PYTHONML311RC)) { + self::$PYTHONML311RC = new BuildRuntime('python-ml-3.11-rc'); + } + return self::$PYTHONML311RC; + } + public static function PYTHONML312RC(): BuildRuntime + { + if (!isset(self::$PYTHONML312RC)) { + self::$PYTHONML312RC = new BuildRuntime('python-ml-3.12-rc'); + } + return self::$PYTHONML312RC; + } + public static function PYTHONML313RC(): BuildRuntime + { + if (!isset(self::$PYTHONML313RC)) { + self::$PYTHONML313RC = new BuildRuntime('python-ml-3.13-rc'); + } + return self::$PYTHONML313RC; + } + public static function DENO140RC(): BuildRuntime + { + if (!isset(self::$DENO140RC)) { + self::$DENO140RC = new BuildRuntime('deno-1.40-rc'); + } + return self::$DENO140RC; + } + public static function DENO146RC(): BuildRuntime + { + if (!isset(self::$DENO146RC)) { + self::$DENO146RC = new BuildRuntime('deno-1.46-rc'); + } + return self::$DENO146RC; + } + public static function DENO20RC(): BuildRuntime + { + if (!isset(self::$DENO20RC)) { + self::$DENO20RC = new BuildRuntime('deno-2.0-rc'); + } + return self::$DENO20RC; + } + public static function DENO25RC(): BuildRuntime + { + if (!isset(self::$DENO25RC)) { + self::$DENO25RC = new BuildRuntime('deno-2.5-rc'); + } + return self::$DENO25RC; + } + public static function DENO26RC(): BuildRuntime + { + if (!isset(self::$DENO26RC)) { + self::$DENO26RC = new BuildRuntime('deno-2.6-rc'); + } + return self::$DENO26RC; + } + public static function DART215RC(): BuildRuntime + { + if (!isset(self::$DART215RC)) { + self::$DART215RC = new BuildRuntime('dart-2.15-rc'); + } + return self::$DART215RC; + } + public static function DART216RC(): BuildRuntime + { + if (!isset(self::$DART216RC)) { + self::$DART216RC = new BuildRuntime('dart-2.16-rc'); + } + return self::$DART216RC; + } + public static function DART217RC(): BuildRuntime + { + if (!isset(self::$DART217RC)) { + self::$DART217RC = new BuildRuntime('dart-2.17-rc'); + } + return self::$DART217RC; + } + public static function DART218RC(): BuildRuntime + { + if (!isset(self::$DART218RC)) { + self::$DART218RC = new BuildRuntime('dart-2.18-rc'); + } + return self::$DART218RC; + } + public static function DART219RC(): BuildRuntime + { + if (!isset(self::$DART219RC)) { + self::$DART219RC = new BuildRuntime('dart-2.19-rc'); + } + return self::$DART219RC; + } + public static function DART30RC(): BuildRuntime + { + if (!isset(self::$DART30RC)) { + self::$DART30RC = new BuildRuntime('dart-3.0-rc'); + } + return self::$DART30RC; + } + public static function DART31RC(): BuildRuntime + { + if (!isset(self::$DART31RC)) { + self::$DART31RC = new BuildRuntime('dart-3.1-rc'); + } + return self::$DART31RC; + } + public static function DART33RC(): BuildRuntime + { + if (!isset(self::$DART33RC)) { + self::$DART33RC = new BuildRuntime('dart-3.3-rc'); + } + return self::$DART33RC; + } + public static function DART35RC(): BuildRuntime + { + if (!isset(self::$DART35RC)) { + self::$DART35RC = new BuildRuntime('dart-3.5-rc'); + } + return self::$DART35RC; + } + public static function DART38RC(): BuildRuntime + { + if (!isset(self::$DART38RC)) { + self::$DART38RC = new BuildRuntime('dart-3.8-rc'); + } + return self::$DART38RC; + } + public static function DART39RC(): BuildRuntime + { + if (!isset(self::$DART39RC)) { + self::$DART39RC = new BuildRuntime('dart-3.9-rc'); + } + return self::$DART39RC; + } + public static function DART310RC(): BuildRuntime + { + if (!isset(self::$DART310RC)) { + self::$DART310RC = new BuildRuntime('dart-3.10-rc'); + } + return self::$DART310RC; + } + public static function DOTNET60RC(): BuildRuntime + { + if (!isset(self::$DOTNET60RC)) { + self::$DOTNET60RC = new BuildRuntime('dotnet-6.0-rc'); + } + return self::$DOTNET60RC; + } + public static function DOTNET70RC(): BuildRuntime + { + if (!isset(self::$DOTNET70RC)) { + self::$DOTNET70RC = new BuildRuntime('dotnet-7.0-rc'); + } + return self::$DOTNET70RC; + } + public static function DOTNET80RC(): BuildRuntime + { + if (!isset(self::$DOTNET80RC)) { + self::$DOTNET80RC = new BuildRuntime('dotnet-8.0-rc'); + } + return self::$DOTNET80RC; + } + public static function DOTNET10RC(): BuildRuntime + { + if (!isset(self::$DOTNET10RC)) { + self::$DOTNET10RC = new BuildRuntime('dotnet-10-rc'); + } + return self::$DOTNET10RC; + } + public static function JAVA80RC(): BuildRuntime + { + if (!isset(self::$JAVA80RC)) { + self::$JAVA80RC = new BuildRuntime('java-8.0-rc'); + } + return self::$JAVA80RC; + } + public static function JAVA110RC(): BuildRuntime + { + if (!isset(self::$JAVA110RC)) { + self::$JAVA110RC = new BuildRuntime('java-11.0-rc'); + } + return self::$JAVA110RC; + } + public static function JAVA170RC(): BuildRuntime + { + if (!isset(self::$JAVA170RC)) { + self::$JAVA170RC = new BuildRuntime('java-17.0-rc'); + } + return self::$JAVA170RC; + } + public static function JAVA180RC(): BuildRuntime + { + if (!isset(self::$JAVA180RC)) { + self::$JAVA180RC = new BuildRuntime('java-18.0-rc'); + } + return self::$JAVA180RC; + } + public static function JAVA210RC(): BuildRuntime + { + if (!isset(self::$JAVA210RC)) { + self::$JAVA210RC = new BuildRuntime('java-21.0-rc'); + } + return self::$JAVA210RC; + } + public static function JAVA22RC(): BuildRuntime + { + if (!isset(self::$JAVA22RC)) { + self::$JAVA22RC = new BuildRuntime('java-22-rc'); + } + return self::$JAVA22RC; + } + public static function JAVA25RC(): BuildRuntime + { + if (!isset(self::$JAVA25RC)) { + self::$JAVA25RC = new BuildRuntime('java-25-rc'); + } + return self::$JAVA25RC; + } + public static function SWIFT55RC(): BuildRuntime + { + if (!isset(self::$SWIFT55RC)) { + self::$SWIFT55RC = new BuildRuntime('swift-5.5-rc'); + } + return self::$SWIFT55RC; + } + public static function SWIFT58RC(): BuildRuntime + { + if (!isset(self::$SWIFT58RC)) { + self::$SWIFT58RC = new BuildRuntime('swift-5.8-rc'); + } + return self::$SWIFT58RC; + } + public static function SWIFT59RC(): BuildRuntime + { + if (!isset(self::$SWIFT59RC)) { + self::$SWIFT59RC = new BuildRuntime('swift-5.9-rc'); + } + return self::$SWIFT59RC; + } + public static function SWIFT510RC(): BuildRuntime + { + if (!isset(self::$SWIFT510RC)) { + self::$SWIFT510RC = new BuildRuntime('swift-5.10-rc'); + } + return self::$SWIFT510RC; + } + public static function SWIFT62RC(): BuildRuntime + { + if (!isset(self::$SWIFT62RC)) { + self::$SWIFT62RC = new BuildRuntime('swift-6.2-rc'); + } + return self::$SWIFT62RC; + } + public static function KOTLIN16RC(): BuildRuntime + { + if (!isset(self::$KOTLIN16RC)) { + self::$KOTLIN16RC = new BuildRuntime('kotlin-1.6-rc'); + } + return self::$KOTLIN16RC; + } + public static function KOTLIN18RC(): BuildRuntime + { + if (!isset(self::$KOTLIN18RC)) { + self::$KOTLIN18RC = new BuildRuntime('kotlin-1.8-rc'); + } + return self::$KOTLIN18RC; + } + public static function KOTLIN19RC(): BuildRuntime + { + if (!isset(self::$KOTLIN19RC)) { + self::$KOTLIN19RC = new BuildRuntime('kotlin-1.9-rc'); + } + return self::$KOTLIN19RC; + } + public static function KOTLIN20RC(): BuildRuntime + { + if (!isset(self::$KOTLIN20RC)) { + self::$KOTLIN20RC = new BuildRuntime('kotlin-2.0-rc'); + } + return self::$KOTLIN20RC; + } + public static function KOTLIN23RC(): BuildRuntime + { + if (!isset(self::$KOTLIN23RC)) { + self::$KOTLIN23RC = new BuildRuntime('kotlin-2.3-rc'); + } + return self::$KOTLIN23RC; + } + public static function CPP17RC(): BuildRuntime + { + if (!isset(self::$CPP17RC)) { + self::$CPP17RC = new BuildRuntime('cpp-17-rc'); + } + return self::$CPP17RC; + } + public static function CPP20RC(): BuildRuntime + { + if (!isset(self::$CPP20RC)) { + self::$CPP20RC = new BuildRuntime('cpp-20-rc'); + } + return self::$CPP20RC; + } + public static function BUN10RC(): BuildRuntime + { + if (!isset(self::$BUN10RC)) { + self::$BUN10RC = new BuildRuntime('bun-1.0-rc'); + } + return self::$BUN10RC; + } + public static function BUN11RC(): BuildRuntime + { + if (!isset(self::$BUN11RC)) { + self::$BUN11RC = new BuildRuntime('bun-1.1-rc'); + } + return self::$BUN11RC; + } + public static function BUN12RC(): BuildRuntime + { + if (!isset(self::$BUN12RC)) { + self::$BUN12RC = new BuildRuntime('bun-1.2-rc'); + } + return self::$BUN12RC; + } + public static function BUN13RC(): BuildRuntime + { + if (!isset(self::$BUN13RC)) { + self::$BUN13RC = new BuildRuntime('bun-1.3-rc'); + } + return self::$BUN13RC; + } + public static function GO123RC(): BuildRuntime + { + if (!isset(self::$GO123RC)) { + self::$GO123RC = new BuildRuntime('go-1.23-rc'); + } + return self::$GO123RC; + } + public static function GO124RC(): BuildRuntime + { + if (!isset(self::$GO124RC)) { + self::$GO124RC = new BuildRuntime('go-1.24-rc'); + } + return self::$GO124RC; + } + public static function GO125RC(): BuildRuntime + { + if (!isset(self::$GO125RC)) { + self::$GO125RC = new BuildRuntime('go-1.25-rc'); + } + return self::$GO125RC; + } + public static function GO126RC(): BuildRuntime + { + if (!isset(self::$GO126RC)) { + self::$GO126RC = new BuildRuntime('go-1.26-rc'); + } + return self::$GO126RC; + } + public static function STATIC1RC(): BuildRuntime + { + if (!isset(self::$STATIC1RC)) { + self::$STATIC1RC = new BuildRuntime('static-1-rc'); + } + return self::$STATIC1RC; + } + public static function FLUTTER324RC(): BuildRuntime + { + if (!isset(self::$FLUTTER324RC)) { + self::$FLUTTER324RC = new BuildRuntime('flutter-3.24-rc'); + } + return self::$FLUTTER324RC; + } + public static function FLUTTER327RC(): BuildRuntime + { + if (!isset(self::$FLUTTER327RC)) { + self::$FLUTTER327RC = new BuildRuntime('flutter-3.27-rc'); + } + return self::$FLUTTER327RC; + } + public static function FLUTTER329RC(): BuildRuntime + { + if (!isset(self::$FLUTTER329RC)) { + self::$FLUTTER329RC = new BuildRuntime('flutter-3.29-rc'); + } + return self::$FLUTTER329RC; + } + public static function FLUTTER332RC(): BuildRuntime + { + if (!isset(self::$FLUTTER332RC)) { + self::$FLUTTER332RC = new BuildRuntime('flutter-3.32-rc'); + } + return self::$FLUTTER332RC; + } + public static function FLUTTER335RC(): BuildRuntime + { + if (!isset(self::$FLUTTER335RC)) { + self::$FLUTTER335RC = new BuildRuntime('flutter-3.35-rc'); + } + return self::$FLUTTER335RC; + } + public static function FLUTTER338RC(): BuildRuntime + { + if (!isset(self::$FLUTTER338RC)) { + self::$FLUTTER338RC = new BuildRuntime('flutter-3.38-rc'); + } + return self::$FLUTTER338RC; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/DatabaseType.php b/src/Appwrite/Enums/DatabaseType.php index 7fcf5ac..ccbc5c0 100644 --- a/src/Appwrite/Enums/DatabaseType.php +++ b/src/Appwrite/Enums/DatabaseType.php @@ -8,6 +8,8 @@ class DatabaseType implements JsonSerializable { private static DatabaseType $LEGACY; private static DatabaseType $TABLESDB; + private static DatabaseType $DOCUMENTSDB; + private static DatabaseType $VECTORSDB; private string $value; @@ -40,4 +42,18 @@ public static function TABLESDB(): DatabaseType } return self::$TABLESDB; } + public static function DOCUMENTSDB(): DatabaseType + { + if (!isset(self::$DOCUMENTSDB)) { + self::$DOCUMENTSDB = new DatabaseType('documentsdb'); + } + return self::$DOCUMENTSDB; + } + public static function VECTORSDB(): DatabaseType + { + if (!isset(self::$VECTORSDB)) { + self::$VECTORSDB = new DatabaseType('vectorsdb'); + } + return self::$VECTORSDB; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/DatabasesIndexType.php b/src/Appwrite/Enums/DatabasesIndexType.php new file mode 100644 index 0000000..e4b061d --- /dev/null +++ b/src/Appwrite/Enums/DatabasesIndexType.php @@ -0,0 +1,59 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function KEY(): DatabasesIndexType + { + if (!isset(self::$KEY)) { + self::$KEY = new DatabasesIndexType('key'); + } + return self::$KEY; + } + public static function FULLTEXT(): DatabasesIndexType + { + if (!isset(self::$FULLTEXT)) { + self::$FULLTEXT = new DatabasesIndexType('fulltext'); + } + return self::$FULLTEXT; + } + public static function UNIQUE(): DatabasesIndexType + { + if (!isset(self::$UNIQUE)) { + self::$UNIQUE = new DatabasesIndexType('unique'); + } + return self::$UNIQUE; + } + public static function SPATIAL(): DatabasesIndexType + { + if (!isset(self::$SPATIAL)) { + self::$SPATIAL = new DatabasesIndexType('spatial'); + } + return self::$SPATIAL; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/DocumentsDBIndexType.php b/src/Appwrite/Enums/DocumentsDBIndexType.php new file mode 100644 index 0000000..c467daa --- /dev/null +++ b/src/Appwrite/Enums/DocumentsDBIndexType.php @@ -0,0 +1,59 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function KEY(): DocumentsDBIndexType + { + if (!isset(self::$KEY)) { + self::$KEY = new DocumentsDBIndexType('key'); + } + return self::$KEY; + } + public static function FULLTEXT(): DocumentsDBIndexType + { + if (!isset(self::$FULLTEXT)) { + self::$FULLTEXT = new DocumentsDBIndexType('fulltext'); + } + return self::$FULLTEXT; + } + public static function UNIQUE(): DocumentsDBIndexType + { + if (!isset(self::$UNIQUE)) { + self::$UNIQUE = new DocumentsDBIndexType('unique'); + } + return self::$UNIQUE; + } + public static function SPATIAL(): DocumentsDBIndexType + { + if (!isset(self::$SPATIAL)) { + self::$SPATIAL = new DocumentsDBIndexType('spatial'); + } + return self::$SPATIAL; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Model.php b/src/Appwrite/Enums/Model.php new file mode 100644 index 0000000..b572876 --- /dev/null +++ b/src/Appwrite/Enums/Model.php @@ -0,0 +1,35 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function EMBEDDINGGEMMA(): Model + { + if (!isset(self::$EMBEDDINGGEMMA)) { + self::$EMBEDDINGGEMMA = new Model('embeddinggemma'); + } + return self::$EMBEDDINGGEMMA; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 2388a96..21f8b61 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -92,6 +92,92 @@ class Runtime implements JsonSerializable private static Runtime $FLUTTER332; private static Runtime $FLUTTER335; private static Runtime $FLUTTER338; + private static Runtime $NODE145RC; + private static Runtime $NODE160RC; + private static Runtime $NODE180RC; + private static Runtime $NODE190RC; + private static Runtime $NODE200RC; + private static Runtime $NODE210RC; + private static Runtime $NODE22RC; + private static Runtime $NODE23RC; + private static Runtime $NODE24RC; + private static Runtime $NODE25RC; + private static Runtime $PHP80RC; + private static Runtime $PHP81RC; + private static Runtime $PHP82RC; + private static Runtime $PHP83RC; + private static Runtime $PHP84RC; + private static Runtime $RUBY30RC; + private static Runtime $RUBY31RC; + private static Runtime $RUBY32RC; + private static Runtime $RUBY33RC; + private static Runtime $RUBY34RC; + private static Runtime $RUBY40RC; + private static Runtime $PYTHON38RC; + private static Runtime $PYTHON39RC; + private static Runtime $PYTHON310RC; + private static Runtime $PYTHON311RC; + private static Runtime $PYTHON312RC; + private static Runtime $PYTHON313RC; + private static Runtime $PYTHON314RC; + private static Runtime $PYTHONML311RC; + private static Runtime $PYTHONML312RC; + private static Runtime $PYTHONML313RC; + private static Runtime $DENO140RC; + private static Runtime $DENO146RC; + private static Runtime $DENO20RC; + private static Runtime $DENO25RC; + private static Runtime $DENO26RC; + private static Runtime $DART215RC; + private static Runtime $DART216RC; + private static Runtime $DART217RC; + private static Runtime $DART218RC; + private static Runtime $DART219RC; + private static Runtime $DART30RC; + private static Runtime $DART31RC; + private static Runtime $DART33RC; + private static Runtime $DART35RC; + private static Runtime $DART38RC; + private static Runtime $DART39RC; + private static Runtime $DART310RC; + private static Runtime $DOTNET60RC; + private static Runtime $DOTNET70RC; + private static Runtime $DOTNET80RC; + private static Runtime $DOTNET10RC; + private static Runtime $JAVA80RC; + private static Runtime $JAVA110RC; + private static Runtime $JAVA170RC; + private static Runtime $JAVA180RC; + private static Runtime $JAVA210RC; + private static Runtime $JAVA22RC; + private static Runtime $JAVA25RC; + private static Runtime $SWIFT55RC; + private static Runtime $SWIFT58RC; + private static Runtime $SWIFT59RC; + private static Runtime $SWIFT510RC; + private static Runtime $SWIFT62RC; + private static Runtime $KOTLIN16RC; + private static Runtime $KOTLIN18RC; + private static Runtime $KOTLIN19RC; + private static Runtime $KOTLIN20RC; + private static Runtime $KOTLIN23RC; + private static Runtime $CPP17RC; + private static Runtime $CPP20RC; + private static Runtime $BUN10RC; + private static Runtime $BUN11RC; + private static Runtime $BUN12RC; + private static Runtime $BUN13RC; + private static Runtime $GO123RC; + private static Runtime $GO124RC; + private static Runtime $GO125RC; + private static Runtime $GO126RC; + private static Runtime $STATIC1RC; + private static Runtime $FLUTTER324RC; + private static Runtime $FLUTTER327RC; + private static Runtime $FLUTTER329RC; + private static Runtime $FLUTTER332RC; + private static Runtime $FLUTTER335RC; + private static Runtime $FLUTTER338RC; private string $value; @@ -712,4 +798,606 @@ public static function FLUTTER338(): Runtime } return self::$FLUTTER338; } + public static function NODE145RC(): Runtime + { + if (!isset(self::$NODE145RC)) { + self::$NODE145RC = new Runtime('node-14.5-rc'); + } + return self::$NODE145RC; + } + public static function NODE160RC(): Runtime + { + if (!isset(self::$NODE160RC)) { + self::$NODE160RC = new Runtime('node-16.0-rc'); + } + return self::$NODE160RC; + } + public static function NODE180RC(): Runtime + { + if (!isset(self::$NODE180RC)) { + self::$NODE180RC = new Runtime('node-18.0-rc'); + } + return self::$NODE180RC; + } + public static function NODE190RC(): Runtime + { + if (!isset(self::$NODE190RC)) { + self::$NODE190RC = new Runtime('node-19.0-rc'); + } + return self::$NODE190RC; + } + public static function NODE200RC(): Runtime + { + if (!isset(self::$NODE200RC)) { + self::$NODE200RC = new Runtime('node-20.0-rc'); + } + return self::$NODE200RC; + } + public static function NODE210RC(): Runtime + { + if (!isset(self::$NODE210RC)) { + self::$NODE210RC = new Runtime('node-21.0-rc'); + } + return self::$NODE210RC; + } + public static function NODE22RC(): Runtime + { + if (!isset(self::$NODE22RC)) { + self::$NODE22RC = new Runtime('node-22-rc'); + } + return self::$NODE22RC; + } + public static function NODE23RC(): Runtime + { + if (!isset(self::$NODE23RC)) { + self::$NODE23RC = new Runtime('node-23-rc'); + } + return self::$NODE23RC; + } + public static function NODE24RC(): Runtime + { + if (!isset(self::$NODE24RC)) { + self::$NODE24RC = new Runtime('node-24-rc'); + } + return self::$NODE24RC; + } + public static function NODE25RC(): Runtime + { + if (!isset(self::$NODE25RC)) { + self::$NODE25RC = new Runtime('node-25-rc'); + } + return self::$NODE25RC; + } + public static function PHP80RC(): Runtime + { + if (!isset(self::$PHP80RC)) { + self::$PHP80RC = new Runtime('php-8.0-rc'); + } + return self::$PHP80RC; + } + public static function PHP81RC(): Runtime + { + if (!isset(self::$PHP81RC)) { + self::$PHP81RC = new Runtime('php-8.1-rc'); + } + return self::$PHP81RC; + } + public static function PHP82RC(): Runtime + { + if (!isset(self::$PHP82RC)) { + self::$PHP82RC = new Runtime('php-8.2-rc'); + } + return self::$PHP82RC; + } + public static function PHP83RC(): Runtime + { + if (!isset(self::$PHP83RC)) { + self::$PHP83RC = new Runtime('php-8.3-rc'); + } + return self::$PHP83RC; + } + public static function PHP84RC(): Runtime + { + if (!isset(self::$PHP84RC)) { + self::$PHP84RC = new Runtime('php-8.4-rc'); + } + return self::$PHP84RC; + } + public static function RUBY30RC(): Runtime + { + if (!isset(self::$RUBY30RC)) { + self::$RUBY30RC = new Runtime('ruby-3.0-rc'); + } + return self::$RUBY30RC; + } + public static function RUBY31RC(): Runtime + { + if (!isset(self::$RUBY31RC)) { + self::$RUBY31RC = new Runtime('ruby-3.1-rc'); + } + return self::$RUBY31RC; + } + public static function RUBY32RC(): Runtime + { + if (!isset(self::$RUBY32RC)) { + self::$RUBY32RC = new Runtime('ruby-3.2-rc'); + } + return self::$RUBY32RC; + } + public static function RUBY33RC(): Runtime + { + if (!isset(self::$RUBY33RC)) { + self::$RUBY33RC = new Runtime('ruby-3.3-rc'); + } + return self::$RUBY33RC; + } + public static function RUBY34RC(): Runtime + { + if (!isset(self::$RUBY34RC)) { + self::$RUBY34RC = new Runtime('ruby-3.4-rc'); + } + return self::$RUBY34RC; + } + public static function RUBY40RC(): Runtime + { + if (!isset(self::$RUBY40RC)) { + self::$RUBY40RC = new Runtime('ruby-4.0-rc'); + } + return self::$RUBY40RC; + } + public static function PYTHON38RC(): Runtime + { + if (!isset(self::$PYTHON38RC)) { + self::$PYTHON38RC = new Runtime('python-3.8-rc'); + } + return self::$PYTHON38RC; + } + public static function PYTHON39RC(): Runtime + { + if (!isset(self::$PYTHON39RC)) { + self::$PYTHON39RC = new Runtime('python-3.9-rc'); + } + return self::$PYTHON39RC; + } + public static function PYTHON310RC(): Runtime + { + if (!isset(self::$PYTHON310RC)) { + self::$PYTHON310RC = new Runtime('python-3.10-rc'); + } + return self::$PYTHON310RC; + } + public static function PYTHON311RC(): Runtime + { + if (!isset(self::$PYTHON311RC)) { + self::$PYTHON311RC = new Runtime('python-3.11-rc'); + } + return self::$PYTHON311RC; + } + public static function PYTHON312RC(): Runtime + { + if (!isset(self::$PYTHON312RC)) { + self::$PYTHON312RC = new Runtime('python-3.12-rc'); + } + return self::$PYTHON312RC; + } + public static function PYTHON313RC(): Runtime + { + if (!isset(self::$PYTHON313RC)) { + self::$PYTHON313RC = new Runtime('python-3.13-rc'); + } + return self::$PYTHON313RC; + } + public static function PYTHON314RC(): Runtime + { + if (!isset(self::$PYTHON314RC)) { + self::$PYTHON314RC = new Runtime('python-3.14-rc'); + } + return self::$PYTHON314RC; + } + public static function PYTHONML311RC(): Runtime + { + if (!isset(self::$PYTHONML311RC)) { + self::$PYTHONML311RC = new Runtime('python-ml-3.11-rc'); + } + return self::$PYTHONML311RC; + } + public static function PYTHONML312RC(): Runtime + { + if (!isset(self::$PYTHONML312RC)) { + self::$PYTHONML312RC = new Runtime('python-ml-3.12-rc'); + } + return self::$PYTHONML312RC; + } + public static function PYTHONML313RC(): Runtime + { + if (!isset(self::$PYTHONML313RC)) { + self::$PYTHONML313RC = new Runtime('python-ml-3.13-rc'); + } + return self::$PYTHONML313RC; + } + public static function DENO140RC(): Runtime + { + if (!isset(self::$DENO140RC)) { + self::$DENO140RC = new Runtime('deno-1.40-rc'); + } + return self::$DENO140RC; + } + public static function DENO146RC(): Runtime + { + if (!isset(self::$DENO146RC)) { + self::$DENO146RC = new Runtime('deno-1.46-rc'); + } + return self::$DENO146RC; + } + public static function DENO20RC(): Runtime + { + if (!isset(self::$DENO20RC)) { + self::$DENO20RC = new Runtime('deno-2.0-rc'); + } + return self::$DENO20RC; + } + public static function DENO25RC(): Runtime + { + if (!isset(self::$DENO25RC)) { + self::$DENO25RC = new Runtime('deno-2.5-rc'); + } + return self::$DENO25RC; + } + public static function DENO26RC(): Runtime + { + if (!isset(self::$DENO26RC)) { + self::$DENO26RC = new Runtime('deno-2.6-rc'); + } + return self::$DENO26RC; + } + public static function DART215RC(): Runtime + { + if (!isset(self::$DART215RC)) { + self::$DART215RC = new Runtime('dart-2.15-rc'); + } + return self::$DART215RC; + } + public static function DART216RC(): Runtime + { + if (!isset(self::$DART216RC)) { + self::$DART216RC = new Runtime('dart-2.16-rc'); + } + return self::$DART216RC; + } + public static function DART217RC(): Runtime + { + if (!isset(self::$DART217RC)) { + self::$DART217RC = new Runtime('dart-2.17-rc'); + } + return self::$DART217RC; + } + public static function DART218RC(): Runtime + { + if (!isset(self::$DART218RC)) { + self::$DART218RC = new Runtime('dart-2.18-rc'); + } + return self::$DART218RC; + } + public static function DART219RC(): Runtime + { + if (!isset(self::$DART219RC)) { + self::$DART219RC = new Runtime('dart-2.19-rc'); + } + return self::$DART219RC; + } + public static function DART30RC(): Runtime + { + if (!isset(self::$DART30RC)) { + self::$DART30RC = new Runtime('dart-3.0-rc'); + } + return self::$DART30RC; + } + public static function DART31RC(): Runtime + { + if (!isset(self::$DART31RC)) { + self::$DART31RC = new Runtime('dart-3.1-rc'); + } + return self::$DART31RC; + } + public static function DART33RC(): Runtime + { + if (!isset(self::$DART33RC)) { + self::$DART33RC = new Runtime('dart-3.3-rc'); + } + return self::$DART33RC; + } + public static function DART35RC(): Runtime + { + if (!isset(self::$DART35RC)) { + self::$DART35RC = new Runtime('dart-3.5-rc'); + } + return self::$DART35RC; + } + public static function DART38RC(): Runtime + { + if (!isset(self::$DART38RC)) { + self::$DART38RC = new Runtime('dart-3.8-rc'); + } + return self::$DART38RC; + } + public static function DART39RC(): Runtime + { + if (!isset(self::$DART39RC)) { + self::$DART39RC = new Runtime('dart-3.9-rc'); + } + return self::$DART39RC; + } + public static function DART310RC(): Runtime + { + if (!isset(self::$DART310RC)) { + self::$DART310RC = new Runtime('dart-3.10-rc'); + } + return self::$DART310RC; + } + public static function DOTNET60RC(): Runtime + { + if (!isset(self::$DOTNET60RC)) { + self::$DOTNET60RC = new Runtime('dotnet-6.0-rc'); + } + return self::$DOTNET60RC; + } + public static function DOTNET70RC(): Runtime + { + if (!isset(self::$DOTNET70RC)) { + self::$DOTNET70RC = new Runtime('dotnet-7.0-rc'); + } + return self::$DOTNET70RC; + } + public static function DOTNET80RC(): Runtime + { + if (!isset(self::$DOTNET80RC)) { + self::$DOTNET80RC = new Runtime('dotnet-8.0-rc'); + } + return self::$DOTNET80RC; + } + public static function DOTNET10RC(): Runtime + { + if (!isset(self::$DOTNET10RC)) { + self::$DOTNET10RC = new Runtime('dotnet-10-rc'); + } + return self::$DOTNET10RC; + } + public static function JAVA80RC(): Runtime + { + if (!isset(self::$JAVA80RC)) { + self::$JAVA80RC = new Runtime('java-8.0-rc'); + } + return self::$JAVA80RC; + } + public static function JAVA110RC(): Runtime + { + if (!isset(self::$JAVA110RC)) { + self::$JAVA110RC = new Runtime('java-11.0-rc'); + } + return self::$JAVA110RC; + } + public static function JAVA170RC(): Runtime + { + if (!isset(self::$JAVA170RC)) { + self::$JAVA170RC = new Runtime('java-17.0-rc'); + } + return self::$JAVA170RC; + } + public static function JAVA180RC(): Runtime + { + if (!isset(self::$JAVA180RC)) { + self::$JAVA180RC = new Runtime('java-18.0-rc'); + } + return self::$JAVA180RC; + } + public static function JAVA210RC(): Runtime + { + if (!isset(self::$JAVA210RC)) { + self::$JAVA210RC = new Runtime('java-21.0-rc'); + } + return self::$JAVA210RC; + } + public static function JAVA22RC(): Runtime + { + if (!isset(self::$JAVA22RC)) { + self::$JAVA22RC = new Runtime('java-22-rc'); + } + return self::$JAVA22RC; + } + public static function JAVA25RC(): Runtime + { + if (!isset(self::$JAVA25RC)) { + self::$JAVA25RC = new Runtime('java-25-rc'); + } + return self::$JAVA25RC; + } + public static function SWIFT55RC(): Runtime + { + if (!isset(self::$SWIFT55RC)) { + self::$SWIFT55RC = new Runtime('swift-5.5-rc'); + } + return self::$SWIFT55RC; + } + public static function SWIFT58RC(): Runtime + { + if (!isset(self::$SWIFT58RC)) { + self::$SWIFT58RC = new Runtime('swift-5.8-rc'); + } + return self::$SWIFT58RC; + } + public static function SWIFT59RC(): Runtime + { + if (!isset(self::$SWIFT59RC)) { + self::$SWIFT59RC = new Runtime('swift-5.9-rc'); + } + return self::$SWIFT59RC; + } + public static function SWIFT510RC(): Runtime + { + if (!isset(self::$SWIFT510RC)) { + self::$SWIFT510RC = new Runtime('swift-5.10-rc'); + } + return self::$SWIFT510RC; + } + public static function SWIFT62RC(): Runtime + { + if (!isset(self::$SWIFT62RC)) { + self::$SWIFT62RC = new Runtime('swift-6.2-rc'); + } + return self::$SWIFT62RC; + } + public static function KOTLIN16RC(): Runtime + { + if (!isset(self::$KOTLIN16RC)) { + self::$KOTLIN16RC = new Runtime('kotlin-1.6-rc'); + } + return self::$KOTLIN16RC; + } + public static function KOTLIN18RC(): Runtime + { + if (!isset(self::$KOTLIN18RC)) { + self::$KOTLIN18RC = new Runtime('kotlin-1.8-rc'); + } + return self::$KOTLIN18RC; + } + public static function KOTLIN19RC(): Runtime + { + if (!isset(self::$KOTLIN19RC)) { + self::$KOTLIN19RC = new Runtime('kotlin-1.9-rc'); + } + return self::$KOTLIN19RC; + } + public static function KOTLIN20RC(): Runtime + { + if (!isset(self::$KOTLIN20RC)) { + self::$KOTLIN20RC = new Runtime('kotlin-2.0-rc'); + } + return self::$KOTLIN20RC; + } + public static function KOTLIN23RC(): Runtime + { + if (!isset(self::$KOTLIN23RC)) { + self::$KOTLIN23RC = new Runtime('kotlin-2.3-rc'); + } + return self::$KOTLIN23RC; + } + public static function CPP17RC(): Runtime + { + if (!isset(self::$CPP17RC)) { + self::$CPP17RC = new Runtime('cpp-17-rc'); + } + return self::$CPP17RC; + } + public static function CPP20RC(): Runtime + { + if (!isset(self::$CPP20RC)) { + self::$CPP20RC = new Runtime('cpp-20-rc'); + } + return self::$CPP20RC; + } + public static function BUN10RC(): Runtime + { + if (!isset(self::$BUN10RC)) { + self::$BUN10RC = new Runtime('bun-1.0-rc'); + } + return self::$BUN10RC; + } + public static function BUN11RC(): Runtime + { + if (!isset(self::$BUN11RC)) { + self::$BUN11RC = new Runtime('bun-1.1-rc'); + } + return self::$BUN11RC; + } + public static function BUN12RC(): Runtime + { + if (!isset(self::$BUN12RC)) { + self::$BUN12RC = new Runtime('bun-1.2-rc'); + } + return self::$BUN12RC; + } + public static function BUN13RC(): Runtime + { + if (!isset(self::$BUN13RC)) { + self::$BUN13RC = new Runtime('bun-1.3-rc'); + } + return self::$BUN13RC; + } + public static function GO123RC(): Runtime + { + if (!isset(self::$GO123RC)) { + self::$GO123RC = new Runtime('go-1.23-rc'); + } + return self::$GO123RC; + } + public static function GO124RC(): Runtime + { + if (!isset(self::$GO124RC)) { + self::$GO124RC = new Runtime('go-1.24-rc'); + } + return self::$GO124RC; + } + public static function GO125RC(): Runtime + { + if (!isset(self::$GO125RC)) { + self::$GO125RC = new Runtime('go-1.25-rc'); + } + return self::$GO125RC; + } + public static function GO126RC(): Runtime + { + if (!isset(self::$GO126RC)) { + self::$GO126RC = new Runtime('go-1.26-rc'); + } + return self::$GO126RC; + } + public static function STATIC1RC(): Runtime + { + if (!isset(self::$STATIC1RC)) { + self::$STATIC1RC = new Runtime('static-1-rc'); + } + return self::$STATIC1RC; + } + public static function FLUTTER324RC(): Runtime + { + if (!isset(self::$FLUTTER324RC)) { + self::$FLUTTER324RC = new Runtime('flutter-3.24-rc'); + } + return self::$FLUTTER324RC; + } + public static function FLUTTER327RC(): Runtime + { + if (!isset(self::$FLUTTER327RC)) { + self::$FLUTTER327RC = new Runtime('flutter-3.27-rc'); + } + return self::$FLUTTER327RC; + } + public static function FLUTTER329RC(): Runtime + { + if (!isset(self::$FLUTTER329RC)) { + self::$FLUTTER329RC = new Runtime('flutter-3.29-rc'); + } + return self::$FLUTTER329RC; + } + public static function FLUTTER332RC(): Runtime + { + if (!isset(self::$FLUTTER332RC)) { + self::$FLUTTER332RC = new Runtime('flutter-3.32-rc'); + } + return self::$FLUTTER332RC; + } + public static function FLUTTER335RC(): Runtime + { + if (!isset(self::$FLUTTER335RC)) { + self::$FLUTTER335RC = new Runtime('flutter-3.35-rc'); + } + return self::$FLUTTER335RC; + } + public static function FLUTTER338RC(): Runtime + { + if (!isset(self::$FLUTTER338RC)) { + self::$FLUTTER338RC = new Runtime('flutter-3.38-rc'); + } + return self::$FLUTTER338RC; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/Scopes.php b/src/Appwrite/Enums/Scopes.php index e9478f1..1f2165e 100644 --- a/src/Appwrite/Enums/Scopes.php +++ b/src/Appwrite/Enums/Scopes.php @@ -63,6 +63,10 @@ class Scopes implements JsonSerializable private static Scopes $ASSISTANTREAD; private static Scopes $TOKENSREAD; private static Scopes $TOKENSWRITE; + private static Scopes $WEBHOOKSREAD; + private static Scopes $WEBHOOKSWRITE; + private static Scopes $PROJECTREAD; + private static Scopes $PROJECTWRITE; private static Scopes $POLICIESWRITE; private static Scopes $POLICIESREAD; private static Scopes $ARCHIVESREAD; @@ -489,6 +493,34 @@ public static function TOKENSWRITE(): Scopes } return self::$TOKENSWRITE; } + public static function WEBHOOKSREAD(): Scopes + { + if (!isset(self::$WEBHOOKSREAD)) { + self::$WEBHOOKSREAD = new Scopes('webhooks.read'); + } + return self::$WEBHOOKSREAD; + } + public static function WEBHOOKSWRITE(): Scopes + { + if (!isset(self::$WEBHOOKSWRITE)) { + self::$WEBHOOKSWRITE = new Scopes('webhooks.write'); + } + return self::$WEBHOOKSWRITE; + } + public static function PROJECTREAD(): Scopes + { + if (!isset(self::$PROJECTREAD)) { + self::$PROJECTREAD = new Scopes('project.read'); + } + return self::$PROJECTREAD; + } + public static function PROJECTWRITE(): Scopes + { + if (!isset(self::$PROJECTWRITE)) { + self::$PROJECTWRITE = new Scopes('project.write'); + } + return self::$PROJECTWRITE; + } public static function POLICIESWRITE(): Scopes { if (!isset(self::$POLICIESWRITE)) { diff --git a/src/Appwrite/Enums/IndexType.php b/src/Appwrite/Enums/TablesDBIndexType.php similarity index 50% rename from src/Appwrite/Enums/IndexType.php rename to src/Appwrite/Enums/TablesDBIndexType.php index 16d0433..f82b337 100644 --- a/src/Appwrite/Enums/IndexType.php +++ b/src/Appwrite/Enums/TablesDBIndexType.php @@ -4,12 +4,12 @@ use JsonSerializable; -class IndexType implements JsonSerializable +class TablesDBIndexType implements JsonSerializable { - private static IndexType $KEY; - private static IndexType $FULLTEXT; - private static IndexType $UNIQUE; - private static IndexType $SPATIAL; + private static TablesDBIndexType $KEY; + private static TablesDBIndexType $FULLTEXT; + private static TablesDBIndexType $UNIQUE; + private static TablesDBIndexType $SPATIAL; private string $value; @@ -28,31 +28,31 @@ public function jsonSerialize(): string return $this->value; } - public static function KEY(): IndexType + public static function KEY(): TablesDBIndexType { if (!isset(self::$KEY)) { - self::$KEY = new IndexType('key'); + self::$KEY = new TablesDBIndexType('key'); } return self::$KEY; } - public static function FULLTEXT(): IndexType + public static function FULLTEXT(): TablesDBIndexType { if (!isset(self::$FULLTEXT)) { - self::$FULLTEXT = new IndexType('fulltext'); + self::$FULLTEXT = new TablesDBIndexType('fulltext'); } return self::$FULLTEXT; } - public static function UNIQUE(): IndexType + public static function UNIQUE(): TablesDBIndexType { if (!isset(self::$UNIQUE)) { - self::$UNIQUE = new IndexType('unique'); + self::$UNIQUE = new TablesDBIndexType('unique'); } return self::$UNIQUE; } - public static function SPATIAL(): IndexType + public static function SPATIAL(): TablesDBIndexType { if (!isset(self::$SPATIAL)) { - self::$SPATIAL = new IndexType('spatial'); + self::$SPATIAL = new TablesDBIndexType('spatial'); } return self::$SPATIAL; } diff --git a/src/Appwrite/Enums/VectorsDBIndexType.php b/src/Appwrite/Enums/VectorsDBIndexType.php new file mode 100644 index 0000000..03bdf05 --- /dev/null +++ b/src/Appwrite/Enums/VectorsDBIndexType.php @@ -0,0 +1,75 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function HNSWEUCLIDEAN(): VectorsDBIndexType + { + if (!isset(self::$HNSWEUCLIDEAN)) { + self::$HNSWEUCLIDEAN = new VectorsDBIndexType('hnsw_euclidean'); + } + return self::$HNSWEUCLIDEAN; + } + public static function HNSWDOT(): VectorsDBIndexType + { + if (!isset(self::$HNSWDOT)) { + self::$HNSWDOT = new VectorsDBIndexType('hnsw_dot'); + } + return self::$HNSWDOT; + } + public static function HNSWCOSINE(): VectorsDBIndexType + { + if (!isset(self::$HNSWCOSINE)) { + self::$HNSWCOSINE = new VectorsDBIndexType('hnsw_cosine'); + } + return self::$HNSWCOSINE; + } + public static function OBJECT(): VectorsDBIndexType + { + if (!isset(self::$OBJECT)) { + self::$OBJECT = new VectorsDBIndexType('object'); + } + return self::$OBJECT; + } + public static function KEY(): VectorsDBIndexType + { + if (!isset(self::$KEY)) { + self::$KEY = new VectorsDBIndexType('key'); + } + return self::$KEY; + } + public static function UNIQUE(): VectorsDBIndexType + { + if (!isset(self::$UNIQUE)) { + self::$UNIQUE = new VectorsDBIndexType('unique'); + } + return self::$UNIQUE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 4fcf0cc..0f40c03 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -8,7 +8,7 @@ use Appwrite\InputFile; use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; -use Appwrite\Enums\IndexType; +use Appwrite\Enums\DatabasesIndexType; use Appwrite\Enums\OrderBy; class Databases extends Service @@ -2887,7 +2887,7 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu * @param string $databaseId * @param string $collectionId * @param string $key - * @param IndexType $type + * @param DatabasesIndexType $type * @param array $attributes * @param ?array $orders * @param ?array $lengths @@ -2897,7 +2897,7 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu * @deprecated This API has been deprecated since 1.8.0. Please use `createIndex` instead. * @see TablesDB::createIndex */ - public function createIndex(string $databaseId, string $collectionId, string $key, IndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array + public function createIndex(string $databaseId, string $collectionId, string $key, DatabasesIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], diff --git a/src/Appwrite/Services/DocumentsDB.php b/src/Appwrite/Services/DocumentsDB.php new file mode 100644 index 0000000..06fe036 --- /dev/null +++ b/src/Appwrite/Services/DocumentsDB.php @@ -0,0 +1,1283 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new Database. + * + * + * @param string $databaseId + * @param string $name + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function create(string $databaseId, string $name, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/documentsdb' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listTransactions(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/documentsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param ?int $ttl + * @throws AppwriteException + * @return array + */ + public function createTransaction(?int $ttl = null): array + { + $apiPath = str_replace( + [], + [], + '/documentsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @throws AppwriteException + * @return array + */ + public function getTransaction(string $transactionId): array + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @param ?bool $commit + * @param ?bool $rollback + * @throws AppwriteException + * @return array + */ + public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): array + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($commit)) { + $apiParams['commit'] = $commit; + } + + if (!is_null($rollback)) { + $apiParams['rollback'] = $rollback; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @throws AppwriteException + * @return string + */ + public function deleteTransaction(string $transactionId): string + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @param ?array $operations + * @throws AppwriteException + * @return array + */ + public function createOperations(string $transactionId, ?array $operations = null): array + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}/operations' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($operations)) { + $apiParams['operations'] = $operations; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a database by its unique ID. This endpoint response returns a JSON + * object with the database metadata. + * + * @param string $databaseId + * @throws AppwriteException + * @return array + */ + public function get(string $databaseId): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a database by its unique ID. + * + * @param string $databaseId + * @param string $name + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function update(string $databaseId, string $name, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write + * scope can delete a database. + * + * @param string $databaseId + * @throws AppwriteException + * @return string + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all collections that belong to the provided databaseId. You + * can use the search parameter to filter your results. + * + * @param string $databaseId + * @param ?array $queries + * @param ?string $search + * @param ?bool $total + * @throws AppwriteException + * @return array + */ + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new Collection. Before using this route, you should create a new + * database resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $collectionId + * @param string $name + * @param ?array $permissions + * @param ?bool $documentSecurity + * @param ?bool $enabled + * @param ?array $attributes + * @param ?array $indexes + * @throws AppwriteException + * @return array + */ + public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null, ?array $attributes = null, ?array $indexes = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + $apiParams['permissions'] = $permissions; + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($attributes)) { + $apiParams['attributes'] = $attributes; + } + + if (!is_null($indexes)) { + $apiParams['indexes'] = $indexes; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string $databaseId + * @param string $collectionId + * @throws AppwriteException + * @return array + */ + public function getCollection(string $databaseId, string $collectionId): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a collection by its unique ID. + * + * @param string $databaseId + * @param string $collectionId + * @param string $name + * @param ?array $permissions + * @param ?bool $documentSecurity + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updateCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string $databaseId + * @param string $collectionId + * @throws AppwriteException + * @return string + */ + public function deleteCollection(string $databaseId, string $collectionId): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all the user's documents in a given collection. You can use + * the query params to filter your results. + * + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @param ?string $transactionId + * @param ?bool $total + * @param ?int $ttl + * @throws AppwriteException + * @return array + */ + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param array $data + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['data'] = $data; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * 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#documentsDBCreateCollection) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $collectionId + * @param array $documents + * @throws AppwriteException + * @return array + */ + public function createDocuments(string $databaseId, string $collectionId, array $documents): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * 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#documentsDBCreateCollection) + * API or directly from your database console. + * + * + * @param string $databaseId + * @param string $collectionId + * @param array $documents + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * 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. + * + * @param string $databaseId + * @param string $collectionId + * @param ?array $data + * @param ?array $queries + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Bulk delete documents using queries, if no queries are passed then all + * documents are deleted. + * + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a document by its unique ID. This endpoint response returns a JSON + * object with the document data. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $queries + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * 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#documentsDBCreateCollection) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $data + * @param ?array $permissions + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a document by its unique ID. Using the patch method you can pass + * only specific fields that will get updated. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $data + * @param ?array $permissions + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a document by its unique ID. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?string $transactionId + * @throws AppwriteException + * @return string + */ + public function deleteDocument(string $databaseId, string $collectionId, string $documentId, ?string $transactionId = null): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Decrement a specific column of a row by a given value. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param string $attribute + * @param ?float $value + * @param ?float $min + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function decrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $min = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], + [$databaseId, $collectionId, $documentId, $attribute], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['attribute'] = $attribute; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Increment a specific column of a row by a given value. + * + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param string $attribute + * @param ?float $value + * @param ?float $max + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function incrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $max = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], + [$databaseId, $collectionId, $documentId, $attribute], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['attribute'] = $attribute; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List indexes in the collection. + * + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @param ?bool $total + * @throws AppwriteException + * @return array + */ + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Creates an index on the attributes listed. Your index should include all + * the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param DocumentsDBIndexType $type + * @param array $attributes + * @param ?array $orders + * @param ?array $lengths + * @throws AppwriteException + * @return array + */ + public function createIndex(string $databaseId, string $collectionId, string $key, DocumentsDBIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['type'] = $type; + $apiParams['attributes'] = $attributes; + + if (!is_null($orders)) { + $apiParams['orders'] = $orders; + } + + if (!is_null($lengths)) { + $apiParams['lengths'] = $lengths; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get index by ID. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return array + */ + public function getIndex(string $databaseId, string $collectionId, string $key): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete an index. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return string + */ + public function deleteIndex(string $databaseId, string $collectionId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 561adab..7eaab39 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -85,11 +85,13 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param ?string $providerBranch * @param ?bool $providerSilentMode * @param ?string $providerRootDirectory - * @param ?string $specification + * @param ?string $buildSpecification + * @param ?string $runtimeSpecification + * @param ?int $deploymentRetention * @throws AppwriteException * @return array */ - public function create(string $functionId, string $name, Runtime $runtime, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $specification = null): array + public function create(string $functionId, string $name, Runtime $runtime, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array { $apiPath = str_replace( [], @@ -158,8 +160,16 @@ public function create(string $functionId, string $name, Runtime $runtime, ?arra $apiParams['providerRootDirectory'] = $providerRootDirectory; } - if (!is_null($specification)) { - $apiParams['specification'] = $specification; + if (!is_null($buildSpecification)) { + $apiParams['buildSpecification'] = $buildSpecification; + } + + if (!is_null($runtimeSpecification)) { + $apiParams['runtimeSpecification'] = $runtimeSpecification; + } + + if (!is_null($deploymentRetention)) { + $apiParams['deploymentRetention'] = $deploymentRetention; } $apiHeaders = []; @@ -273,11 +283,13 @@ public function get(string $functionId): array * @param ?string $providerBranch * @param ?bool $providerSilentMode * @param ?string $providerRootDirectory - * @param ?string $specification + * @param ?string $buildSpecification + * @param ?string $runtimeSpecification + * @param ?int $deploymentRetention * @throws AppwriteException * @return array */ - public function update(string $functionId, string $name, ?Runtime $runtime = null, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $specification = null): array + public function update(string $functionId, string $name, ?Runtime $runtime = null, ?array $execute = null, ?array $events = null, ?string $schedule = null, ?int $timeout = null, ?bool $enabled = null, ?bool $logging = null, ?string $entrypoint = null, ?string $commands = null, ?array $scopes = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array { $apiPath = str_replace( ['{functionId}'], @@ -346,8 +358,16 @@ public function update(string $functionId, string $name, ?Runtime $runtime = nul $apiParams['providerRootDirectory'] = $providerRootDirectory; } - if (!is_null($specification)) { - $apiParams['specification'] = $specification; + if (!is_null($buildSpecification)) { + $apiParams['buildSpecification'] = $buildSpecification; + } + + if (!is_null($runtimeSpecification)) { + $apiParams['runtimeSpecification'] = $runtimeSpecification; + } + + if (!is_null($deploymentRetention)) { + $apiParams['deploymentRetention'] = $deploymentRetention; } $apiHeaders = []; diff --git a/src/Appwrite/Services/Project.php b/src/Appwrite/Services/Project.php new file mode 100644 index 0000000..881a397 --- /dev/null +++ b/src/Appwrite/Services/Project.php @@ -0,0 +1,183 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new project environment variable. These variables can be accessed + * by all functions and sites in the project. + * + * @param string $variableId + * @param string $key + * @param string $value + * @param ?bool $secret + * @throws AppwriteException + * @return array + */ + public function createVariable(string $variableId, string $key, string $value, ?bool $secret = null): array + { + $apiPath = str_replace( + [], + [], + '/project/variables' + ); + + $apiParams = []; + $apiParams['variableId'] = $variableId; + $apiParams['key'] = $key; + $apiParams['value'] = $value; + + if (!is_null($secret)) { + $apiParams['secret'] = $secret; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a variable by its unique ID. + * + * @param string $variableId + * @throws AppwriteException + * @return array + */ + public function getVariable(string $variableId): array + { + $apiPath = str_replace( + ['{variableId}'], + [$variableId], + '/project/variables/{variableId}' + ); + + $apiParams = []; + $apiParams['variableId'] = $variableId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update variable by its unique ID. + * + * @param string $variableId + * @param ?string $key + * @param ?string $value + * @param ?bool $secret + * @throws AppwriteException + * @return array + */ + public function updateVariable(string $variableId, ?string $key = null, ?string $value = null, ?bool $secret = null): array + { + $apiPath = str_replace( + ['{variableId}'], + [$variableId], + '/project/variables/{variableId}' + ); + + $apiParams = []; + $apiParams['variableId'] = $variableId; + $apiParams['key'] = $key; + $apiParams['value'] = $value; + $apiParams['secret'] = $secret; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a variable by its unique ID. + * + * @param string $variableId + * @throws AppwriteException + * @return string + */ + public function deleteVariable(string $variableId): string + { + $apiPath = str_replace( + ['{variableId}'], + [$variableId], + '/project/variables/{variableId}' + ); + + $apiParams = []; + $apiParams['variableId'] = $variableId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index 3dcdc1f..a0930b9 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -74,6 +74,7 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param ?int $timeout * @param ?string $installCommand * @param ?string $buildCommand + * @param ?string $startCommand * @param ?string $outputDirectory * @param ?Adapter $adapter * @param ?string $installationId @@ -82,11 +83,13 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param ?string $providerBranch * @param ?bool $providerSilentMode * @param ?string $providerRootDirectory - * @param ?string $specification + * @param ?string $buildSpecification + * @param ?string $runtimeSpecification + * @param ?int $deploymentRetention * @throws AppwriteException * @return array */ - public function create(string $siteId, string $name, Framework $framework, BuildRuntime $buildRuntime, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, ?Adapter $adapter = null, ?string $installationId = null, ?string $fallbackFile = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $specification = null): array + public function create(string $siteId, string $name, Framework $framework, BuildRuntime $buildRuntime, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $startCommand = null, ?string $outputDirectory = null, ?Adapter $adapter = null, ?string $installationId = null, ?string $fallbackFile = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array { $apiPath = str_replace( [], @@ -120,6 +123,10 @@ public function create(string $siteId, string $name, Framework $framework, Build $apiParams['buildCommand'] = $buildCommand; } + if (!is_null($startCommand)) { + $apiParams['startCommand'] = $startCommand; + } + if (!is_null($outputDirectory)) { $apiParams['outputDirectory'] = $outputDirectory; } @@ -152,8 +159,16 @@ public function create(string $siteId, string $name, Framework $framework, Build $apiParams['providerRootDirectory'] = $providerRootDirectory; } - if (!is_null($specification)) { - $apiParams['specification'] = $specification; + if (!is_null($buildSpecification)) { + $apiParams['buildSpecification'] = $buildSpecification; + } + + if (!is_null($runtimeSpecification)) { + $apiParams['runtimeSpecification'] = $runtimeSpecification; + } + + if (!is_null($deploymentRetention)) { + $apiParams['deploymentRetention'] = $deploymentRetention; } $apiHeaders = []; @@ -259,6 +274,7 @@ public function get(string $siteId): array * @param ?int $timeout * @param ?string $installCommand * @param ?string $buildCommand + * @param ?string $startCommand * @param ?string $outputDirectory * @param ?BuildRuntime $buildRuntime * @param ?Adapter $adapter @@ -268,11 +284,13 @@ public function get(string $siteId): array * @param ?string $providerBranch * @param ?bool $providerSilentMode * @param ?string $providerRootDirectory - * @param ?string $specification + * @param ?string $buildSpecification + * @param ?string $runtimeSpecification + * @param ?int $deploymentRetention * @throws AppwriteException * @return array */ - public function update(string $siteId, string $name, Framework $framework, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, ?BuildRuntime $buildRuntime = null, ?Adapter $adapter = null, ?string $fallbackFile = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $specification = null): array + public function update(string $siteId, string $name, Framework $framework, ?bool $enabled = null, ?bool $logging = null, ?int $timeout = null, ?string $installCommand = null, ?string $buildCommand = null, ?string $startCommand = null, ?string $outputDirectory = null, ?BuildRuntime $buildRuntime = null, ?Adapter $adapter = null, ?string $fallbackFile = null, ?string $installationId = null, ?string $providerRepositoryId = null, ?string $providerBranch = null, ?bool $providerSilentMode = null, ?string $providerRootDirectory = null, ?string $buildSpecification = null, ?string $runtimeSpecification = null, ?int $deploymentRetention = null): array { $apiPath = str_replace( ['{siteId}'], @@ -305,6 +323,10 @@ public function update(string $siteId, string $name, Framework $framework, ?bool $apiParams['buildCommand'] = $buildCommand; } + if (!is_null($startCommand)) { + $apiParams['startCommand'] = $startCommand; + } + if (!is_null($outputDirectory)) { $apiParams['outputDirectory'] = $outputDirectory; } @@ -341,8 +363,16 @@ public function update(string $siteId, string $name, Framework $framework, ?bool $apiParams['providerRootDirectory'] = $providerRootDirectory; } - if (!is_null($specification)) { - $apiParams['specification'] = $specification; + if (!is_null($buildSpecification)) { + $apiParams['buildSpecification'] = $buildSpecification; + } + + if (!is_null($runtimeSpecification)) { + $apiParams['runtimeSpecification'] = $runtimeSpecification; + } + + if (!is_null($deploymentRetention)) { + $apiParams['deploymentRetention'] = $deploymentRetention; } $apiHeaders = []; diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index c8edce6..e52fdf8 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -8,7 +8,7 @@ use Appwrite\InputFile; use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; -use Appwrite\Enums\IndexType; +use Appwrite\Enums\TablesDBIndexType; use Appwrite\Enums\OrderBy; class TablesDB extends Service @@ -2225,14 +2225,14 @@ public function listIndexes(string $databaseId, string $tableId, ?array $queries * @param string $databaseId * @param string $tableId * @param string $key - * @param IndexType $type + * @param TablesDBIndexType $type * @param array $columns * @param ?array $orders * @param ?array $lengths * @throws AppwriteException * @return array */ - public function createIndex(string $databaseId, string $tableId, string $key, IndexType $type, array $columns, ?array $orders = null, ?array $lengths = null): array + public function createIndex(string $databaseId, string $tableId, string $key, TablesDBIndexType $type, array $columns, ?array $orders = null, ?array $lengths = null): array { $apiPath = str_replace( ['{databaseId}', '{tableId}'], diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index 992bb0e..da07936 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -574,6 +574,42 @@ public function updateEmail(string $userId, string $email): array ); } + /** + * Enable or disable whether a user can impersonate other users. When + * impersonation headers are used, the request runs as the target user for API + * behavior, while internal audit logs still attribute the action to the + * original impersonator and store the impersonated target details only in + * internal audit payload data. + * + * + * @param string $userId + * @param bool $impersonator + * @throws AppwriteException + * @return array + */ + public function updateImpersonator(string $userId, bool $impersonator): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/impersonator' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['impersonator'] = $impersonator; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Use this endpoint to create a JSON Web Token for user by its unique ID. You * can use the resulting JWT to authenticate on behalf of the user. The JWT diff --git a/src/Appwrite/Services/VectorsDB.php b/src/Appwrite/Services/VectorsDB.php new file mode 100644 index 0000000..c9f33d5 --- /dev/null +++ b/src/Appwrite/Services/VectorsDB.php @@ -0,0 +1,1137 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $name + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function create(string $databaseId, string $name, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/vectorsdb' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param array $texts + * @param ?Model $model + * @throws AppwriteException + * @return array + */ + public function createTextEmbeddings(array $texts, ?Model $model = null): array + { + $apiPath = str_replace( + [], + [], + '/vectorsdb/embeddings/text' + ); + + $apiParams = []; + $apiParams['texts'] = $texts; + + if (!is_null($model)) { + $apiParams['model'] = $model; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listTransactions(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/vectorsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param ?int $ttl + * @throws AppwriteException + * @return array + */ + public function createTransaction(?int $ttl = null): array + { + $apiPath = str_replace( + [], + [], + '/vectorsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @throws AppwriteException + * @return array + */ + public function getTransaction(string $transactionId): array + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @param ?bool $commit + * @param ?bool $rollback + * @throws AppwriteException + * @return array + */ + public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): array + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($commit)) { + $apiParams['commit'] = $commit; + } + + if (!is_null($rollback)) { + $apiParams['rollback'] = $rollback; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @throws AppwriteException + * @return string + */ + public function deleteTransaction(string $transactionId): string + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $transactionId + * @param ?array $operations + * @throws AppwriteException + * @return array + */ + public function createOperations(string $transactionId, ?array $operations = null): array + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}/operations' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($operations)) { + $apiParams['operations'] = $operations; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @throws AppwriteException + * @return array + */ + public function get(string $databaseId): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $name + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function update(string $databaseId, string $name, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @throws AppwriteException + * @return string + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param ?array $queries + * @param ?string $search + * @param ?bool $total + * @throws AppwriteException + * @return array + */ + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $name + * @param int $dimension + * @param ?array $permissions + * @param ?bool $documentSecurity + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createCollection(string $databaseId, string $collectionId, string $name, int $dimension, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + $apiParams['dimension'] = $dimension; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @throws AppwriteException + * @return array + */ + public function getCollection(string $databaseId, string $collectionId): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $name + * @param ?int $dimension + * @param ?array $permissions + * @param ?bool $documentSecurity + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updateCollection(string $databaseId, string $collectionId, string $name, ?int $dimension = null, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + + if (!is_null($dimension)) { + $apiParams['dimension'] = $dimension; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @throws AppwriteException + * @return string + */ + public function deleteCollection(string $databaseId, string $collectionId): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @param ?string $transactionId + * @param ?bool $total + * @param ?int $ttl + * @throws AppwriteException + * @return array + */ + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param array $data + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['data'] = $data; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param array $documents + * @throws AppwriteException + * @return array + */ + public function createDocuments(string $databaseId, string $collectionId, array $documents): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param array $documents + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param ?array $data + * @param ?array $queries + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $queries + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $data + * @param ?array $permissions + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?array $data + * @param ?array $permissions + * @param ?string $transactionId + * @throws AppwriteException + * @return array + */ + public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $documentId + * @param ?string $transactionId + * @throws AppwriteException + * @return string + */ + public function deleteDocument(string $databaseId, string $collectionId, string $documentId, ?string $transactionId = null): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param ?array $queries + * @param ?bool $total + * @throws AppwriteException + * @return array + */ + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param VectorsDBIndexType $type + * @param array $attributes + * @param ?array $orders + * @param ?array $lengths + * @throws AppwriteException + * @return array + */ + public function createIndex(string $databaseId, string $collectionId, string $key, VectorsDBIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['type'] = $type; + $apiParams['attributes'] = $attributes; + + if (!is_null($orders)) { + $apiParams['orders'] = $orders; + } + + if (!is_null($lengths)) { + $apiParams['lengths'] = $lengths; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return array + */ + public function getIndex(string $databaseId, string $collectionId, string $key): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @throws AppwriteException + * @return string + */ + public function deleteIndex(string $databaseId, string $collectionId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Webhooks.php b/src/Appwrite/Services/Webhooks.php new file mode 100644 index 0000000..9a00db1 --- /dev/null +++ b/src/Appwrite/Services/Webhooks.php @@ -0,0 +1,255 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new webhook. Use this endpoint to configure a URL that will + * receive events from Appwrite when specific events occur. + * + * @param string $webhookId + * @param string $url + * @param string $name + * @param array $events + * @param ?bool $enabled + * @param ?bool $security + * @param ?string $httpUser + * @param ?string $httpPass + * @throws AppwriteException + * @return array + */ + public function create(string $webhookId, string $url, string $name, array $events, ?bool $enabled = null, ?bool $security = null, ?string $httpUser = null, ?string $httpPass = null): array + { + $apiPath = str_replace( + [], + [], + '/webhooks' + ); + + $apiParams = []; + $apiParams['webhookId'] = $webhookId; + $apiParams['url'] = $url; + $apiParams['name'] = $name; + $apiParams['events'] = $events; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($security)) { + $apiParams['security'] = $security; + } + + if (!is_null($httpUser)) { + $apiParams['httpUser'] = $httpUser; + } + + if (!is_null($httpPass)) { + $apiParams['httpPass'] = $httpPass; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a webhook by its unique ID. This endpoint returns details about a + * specific webhook configured for a project. + * + * @param string $webhookId + * @throws AppwriteException + * @return array + */ + public function get(string $webhookId): array + { + $apiPath = str_replace( + ['{webhookId}'], + [$webhookId], + '/webhooks/{webhookId}' + ); + + $apiParams = []; + $apiParams['webhookId'] = $webhookId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a webhook by its unique ID. Use this endpoint to update the URL, + * events, or status of an existing webhook. + * + * @param string $webhookId + * @param string $name + * @param string $url + * @param array $events + * @param ?bool $enabled + * @param ?bool $security + * @param ?string $httpUser + * @param ?string $httpPass + * @throws AppwriteException + * @return array + */ + public function update(string $webhookId, string $name, string $url, array $events, ?bool $enabled = null, ?bool $security = null, ?string $httpUser = null, ?string $httpPass = null): array + { + $apiPath = str_replace( + ['{webhookId}'], + [$webhookId], + '/webhooks/{webhookId}' + ); + + $apiParams = []; + $apiParams['webhookId'] = $webhookId; + $apiParams['name'] = $name; + $apiParams['url'] = $url; + $apiParams['events'] = $events; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($security)) { + $apiParams['security'] = $security; + } + + if (!is_null($httpUser)) { + $apiParams['httpUser'] = $httpUser; + } + + if (!is_null($httpPass)) { + $apiParams['httpPass'] = $httpPass; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer + * receive project events. + * + * @param string $webhookId + * @throws AppwriteException + * @return string + */ + public function delete(string $webhookId): string + { + $apiPath = str_replace( + ['{webhookId}'], + [$webhookId], + '/webhooks/{webhookId}' + ); + + $apiParams = []; + $apiParams['webhookId'] = $webhookId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update the webhook signature key. This endpoint can be used to regenerate + * the signature key used to sign and validate payload deliveries for a + * specific webhook. + * + * @param string $webhookId + * @throws AppwriteException + * @return array + */ + public function updateSignature(string $webhookId): array + { + $apiPath = str_replace( + ['{webhookId}'], + [$webhookId], + '/webhooks/{webhookId}/signature' + ); + + $apiParams = []; + $apiParams['webhookId'] = $webhookId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index fb065df..7c7098d 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; -use Appwrite\Enums\IndexType; +use Appwrite\Enums\DatabasesIndexType; use Appwrite\Enums\OrderBy; final class DatabasesTest extends TestCase { @@ -1328,7 +1328,7 @@ public function testMethodCreateDocument(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$collectionId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1427,7 +1427,7 @@ public function testMethodGetDocument(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$collectionId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1451,7 +1451,7 @@ public function testMethodUpsertDocument(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$collectionId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1475,7 +1475,7 @@ public function testMethodUpdateDocument(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$collectionId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1516,7 +1516,7 @@ public function testMethodDecrementDocumentAttribute(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$collectionId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1541,7 +1541,7 @@ public function testMethodIncrementDocumentAttribute(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$collectionId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1601,7 +1601,7 @@ public function testMethodCreateIndex(): void { "", "", "", - IndexType::KEY(), + DatabasesIndexType::KEY(), array() ); diff --git a/tests/Appwrite/Services/DocumentsDBTest.php b/tests/Appwrite/Services/DocumentsDBTest.php new file mode 100644 index 0000000..34fb7a4 --- /dev/null +++ b/tests/Appwrite/Services/DocumentsDBTest.php @@ -0,0 +1,701 @@ +client = Mockery::mock(Client::class); + $this->documentsDB = new DocumentsDB($this->client); + } + + public function testMethodList(): void { + + $data = array( + "total" => 5, + "databases" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->list( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array(), + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->create( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTransactions(): void { + + $data = array( + "total" => 5, + "transactions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->listTransactions( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTransaction(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->createTransaction( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetTransaction(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->getTransaction( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTransaction(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->updateTransaction( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteTransaction(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->deleteTransaction( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateOperations(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->createOperations( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array(), + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->get( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array(), + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->update( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->delete( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCollections(): void { + + $data = array( + "total" => 5, + "collections" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->listCollections( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->createCollection( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->getCollection( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->updateCollection( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteCollection(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->deleteCollection( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->listDocuments( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->createDocument( + "", + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->createDocuments( + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpsertDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->upsertDocuments( + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->updateDocuments( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->deleteDocuments( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->getDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpsertDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->upsertDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->updateDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteDocument(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->deleteDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDecrementDocumentAttribute(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->decrementDocumentAttribute( + "", + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodIncrementDocumentAttribute(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->incrementDocumentAttribute( + "", + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListIndexes(): void { + + $data = array( + "total" => 5, + "indexes" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->listIndexes( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateIndex(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->createIndex( + "", + "", + "", + DocumentsDBIndexType::KEY(), + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetIndex(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->getIndex( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteIndex(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->documentsDB->deleteIndex( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 9d468cd..5d15b59 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -50,6 +50,7 @@ public function testMethodCreate(): void { "live" => true, "logging" => true, "runtime" => "python-3.8", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "latestDeploymentId" => "5e5ea5c16897e", @@ -68,7 +69,8 @@ public function testMethodCreate(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb"); + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -127,6 +129,7 @@ public function testMethodGet(): void { "live" => true, "logging" => true, "runtime" => "python-3.8", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "latestDeploymentId" => "5e5ea5c16897e", @@ -145,7 +148,8 @@ public function testMethodGet(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb"); + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -170,6 +174,7 @@ public function testMethodUpdate(): void { "live" => true, "logging" => true, "runtime" => "python-3.8", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "latestDeploymentId" => "5e5ea5c16897e", @@ -188,7 +193,8 @@ public function testMethodUpdate(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb"); + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -229,6 +235,7 @@ public function testMethodUpdateFunctionDeployment(): void { "live" => true, "logging" => true, "runtime" => "python-3.8", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "latestDeploymentId" => "5e5ea5c16897e", @@ -247,7 +254,8 @@ public function testMethodUpdateFunctionDeployment(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb"); + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php new file mode 100644 index 0000000..2562a52 --- /dev/null +++ b/tests/Appwrite/Services/ProjectTest.php @@ -0,0 +1,121 @@ +client = Mockery::mock(Client::class); + $this->project = new Project($this->client); + } + + public function testMethodListVariables(): void { + + $data = array( + "total" => 5, + "variables" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->listVariables( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateVariable(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->createVariable( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetVariable(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->getVariable( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVariable(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "API_KEY", + "value" => "myPa\$\$word1", + "secret" => true, + "resourceType" => "function", + "resourceId" => "myAwesomeFunction"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->updateVariable( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteVariable(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->project->deleteVariable( + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index 6408740..5d67fd3 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -49,6 +49,7 @@ public function testMethodCreate(): void { "live" => true, "logging" => true, "framework" => "react", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "deploymentScreenshotLight" => "5e5ea5c16897e", @@ -60,13 +61,15 @@ public function testMethodCreate(): void { "timeout" => 300, "installCommand" => "npm install", "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", "outputDirectory" => "build", "installationId" => "6m40at4ejk5h2u9s1hboo", "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "sites/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb", + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", "fallbackFile" => "index.html"); @@ -128,6 +131,7 @@ public function testMethodGet(): void { "live" => true, "logging" => true, "framework" => "react", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "deploymentScreenshotLight" => "5e5ea5c16897e", @@ -139,13 +143,15 @@ public function testMethodGet(): void { "timeout" => 300, "installCommand" => "npm install", "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", "outputDirectory" => "build", "installationId" => "6m40at4ejk5h2u9s1hboo", "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "sites/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb", + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", "fallbackFile" => "index.html"); @@ -172,6 +178,7 @@ public function testMethodUpdate(): void { "live" => true, "logging" => true, "framework" => "react", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "deploymentScreenshotLight" => "5e5ea5c16897e", @@ -183,13 +190,15 @@ public function testMethodUpdate(): void { "timeout" => 300, "installCommand" => "npm install", "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", "outputDirectory" => "build", "installationId" => "6m40at4ejk5h2u9s1hboo", "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "sites/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb", + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", "fallbackFile" => "index.html"); @@ -233,6 +242,7 @@ public function testMethodUpdateSiteDeployment(): void { "live" => true, "logging" => true, "framework" => "react", + "deploymentRetention" => 7, "deploymentId" => "5e5ea5c16897e", "deploymentCreatedAt" => "2020-10-15T06:38:00.000+00:00", "deploymentScreenshotLight" => "5e5ea5c16897e", @@ -244,13 +254,15 @@ public function testMethodUpdateSiteDeployment(): void { "timeout" => 300, "installCommand" => "npm install", "buildCommand" => "npm run build", + "startCommand" => "node custom-server.mjs", "outputDirectory" => "build", "installationId" => "6m40at4ejk5h2u9s1hboo", "providerRepositoryId" => "appwrite", "providerBranch" => "main", "providerRootDirectory" => "sites/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb", + "buildSpecification" => "s-1vcpu-512mb", + "runtimeSpecification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", "fallbackFile" => "index.html"); diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index fb91185..faa8129 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; -use Appwrite\Enums\IndexType; +use Appwrite\Enums\TablesDBIndexType; use Appwrite\Enums\OrderBy; final class TablesDBTest extends TestCase { @@ -1345,7 +1345,7 @@ public function testMethodCreateIndex(): void { "", "", "", - IndexType::KEY(), + TablesDBIndexType::KEY(), array() ); @@ -1417,7 +1417,7 @@ public function testMethodCreateRow(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$tableId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1516,7 +1516,7 @@ public function testMethodGetRow(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$tableId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1540,7 +1540,7 @@ public function testMethodUpsertRow(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$tableId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1564,7 +1564,7 @@ public function testMethodUpdateRow(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$tableId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1605,7 +1605,7 @@ public function testMethodDecrementRowColumn(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$tableId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", @@ -1630,7 +1630,7 @@ public function testMethodIncrementRowColumn(): void { $data = array( "\$id" => "5e5ea5c16897e", - "\$sequence" => 1, + "\$sequence" => "1", "\$tableId" => "5e5ea5c15117e", "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index 83d2bbc..a6a34ae 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -414,6 +414,38 @@ public function testMethodUpdateEmail(): void { $this->assertSame($data, $response); } + public function testMethodUpdateImpersonator(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "John Doe", + "registration" => "2020-10-15T06:38:00.000+00:00", + "status" => true, + "labels" => array(), + "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", + "email" => "john@appwrite.io", + "phone" => "+4930901820", + "emailVerification" => true, + "phoneVerification" => true, + "mfa" => true, + "prefs" => array(), + "targets" => array(), + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateImpersonator( + "", + true + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateJWT(): void { $data = array( diff --git a/tests/Appwrite/Services/VectorsDBTest.php b/tests/Appwrite/Services/VectorsDBTest.php new file mode 100644 index 0000000..bc362e0 --- /dev/null +++ b/tests/Appwrite/Services/VectorsDBTest.php @@ -0,0 +1,673 @@ +client = Mockery::mock(Client::class); + $this->vectorsDB = new VectorsDB($this->client); + } + + public function testMethodList(): void { + + $data = array( + "total" => 5, + "databases" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->list( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array(), + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->create( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTextEmbeddings(): void { + + $data = array( + "total" => 5, + "embeddings" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->createTextEmbeddings( + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTransactions(): void { + + $data = array( + "total" => 5, + "transactions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->listTransactions( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTransaction(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->createTransaction( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetTransaction(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->getTransaction( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTransaction(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->updateTransaction( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteTransaction(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->deleteTransaction( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateOperations(): void { + + $data = array( + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->createOperations( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array(), + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->get( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "My Database", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "enabled" => true, + "type" => "legacy", + "policies" => array(), + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->update( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->delete( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListCollections(): void { + + $data = array( + "total" => 5, + "collections" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->listCollections( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500, + "dimension" => 1536); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->createCollection( + "", + "", + "", + 1 + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500, + "dimension" => 1536); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->getCollection( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateCollection(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array(), + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => array(), + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500, + "dimension" => 1536); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->updateCollection( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteCollection(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->deleteCollection( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->listDocuments( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->createDocument( + "", + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->createDocuments( + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpsertDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->upsertDocuments( + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->updateDocuments( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteDocuments(): void { + + $data = array( + "total" => 5, + "documents" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->deleteDocuments( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->getDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpsertDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->upsertDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDocument(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->updateDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteDocument(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->deleteDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListIndexes(): void { + + $data = array( + "total" => 5, + "indexes" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->listIndexes( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateIndex(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->createIndex( + "", + "", + "", + VectorsDBIndexType::HNSWEUCLIDEAN(), + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetIndex(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "key" => "index1", + "type" => "primary", + "status" => "available", + "error" => "string", + "attributes" => array(), + "lengths" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->getIndex( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteIndex(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->vectorsDB->deleteIndex( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/WebhooksTest.php b/tests/Appwrite/Services/WebhooksTest.php new file mode 100644 index 0000000..095a902 --- /dev/null +++ b/tests/Appwrite/Services/WebhooksTest.php @@ -0,0 +1,168 @@ +client = Mockery::mock(Client::class); + $this->webhooks = new Webhooks($this->client); + } + + public function testMethodList(): void { + + $data = array( + "total" => 5, + "webhooks" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->webhooks->list( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->webhooks->create( + "", + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodGet(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->webhooks->get( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdate(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->webhooks->update( + "", + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodDelete(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->webhooks->delete( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateSignature(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My Webhook", + "url" => "https://example.com/webhook", + "events" => array(), + "security" => true, + "httpUser" => "username", + "httpPass" => "password", + "signatureKey" => "ad3d581ca230e2b7059c545e5a", + "enabled" => true, + "logs" => "Failed to connect to remote server.", + "attempts" => 10); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->webhooks->updateSignature( + "" + ); + + $this->assertSame($data, $response); + } + +} From 3393997f20955093c47f7883dd8ff0582e0c1c77 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 04:25:15 +0000 Subject: [PATCH 2/8] chore: update PHP SDK to 21.0.0 --- CHANGELOG.md | 4 ++++ README.md | 2 +- src/Appwrite/Client.php | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d0be4..8feda41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 21.0.0 + +* [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents + ## 20.2.0 * Added optional encrypt parameter for database attributes (Text, Longtext, Mediumtext, Varchar) and corresponding column creation methods to enable encryption at rest. Encrypted attributes/columns cannot be queried. diff --git a/README.md b/README.md index e4b7ad1..685f6e8 100644 --- a/README.md +++ b/README.md @@ -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 is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** +**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** 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 PHP 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) diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 260fabf..db61a29 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/20.2.0 ()', + 'user-agent' => 'AppwritePHPSDK/21.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '20.2.0', + 'x-sdk-version'=> '21.0.0', ]; /** From eaa1c3aa0df3dbf9bd733d36f3f364b2e1ac7328 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 05:27:09 +0000 Subject: [PATCH 3/8] chore: update PHP SDK to 21.0.0 --- docs/documentsdb.md | 498 ------- .../examples/documentsdb/create-collection.md | 25 - docs/examples/documentsdb/create-document.md | 28 - docs/examples/documentsdb/create-documents.md | 18 - docs/examples/documentsdb/create-index.md | 24 - .../examples/documentsdb/create-operations.md | 27 - .../documentsdb/create-transaction.md | 16 - docs/examples/documentsdb/create.md | 18 - .../decrement-document-attribute.md | 22 - .../examples/documentsdb/delete-collection.md | 17 - docs/examples/documentsdb/delete-document.md | 19 - docs/examples/documentsdb/delete-documents.md | 19 - docs/examples/documentsdb/delete-index.md | 18 - .../documentsdb/delete-transaction.md | 16 - docs/examples/documentsdb/delete.md | 16 - docs/examples/documentsdb/get-collection.md | 17 - docs/examples/documentsdb/get-document.md | 20 - docs/examples/documentsdb/get-index.md | 18 - docs/examples/documentsdb/get-transaction.md | 16 - docs/examples/documentsdb/get.md | 16 - .../increment-document-attribute.md | 22 - docs/examples/documentsdb/list-collections.md | 19 - docs/examples/documentsdb/list-documents.md | 21 - docs/examples/documentsdb/list-indexes.md | 19 - .../examples/documentsdb/list-transactions.md | 16 - docs/examples/documentsdb/list.md | 18 - .../examples/documentsdb/update-collection.md | 23 - docs/examples/documentsdb/update-document.md | 23 - docs/examples/documentsdb/update-documents.md | 20 - .../documentsdb/update-transaction.md | 18 - docs/examples/documentsdb/update.md | 18 - docs/examples/documentsdb/upsert-document.md | 23 - docs/examples/documentsdb/upsert-documents.md | 19 - docs/examples/vectorsdb/create-collection.md | 24 - docs/examples/vectorsdb/create-document.md | 32 - docs/examples/vectorsdb/create-documents.md | 18 - docs/examples/vectorsdb/create-index.md | 24 - docs/examples/vectorsdb/create-operations.md | 27 - .../vectorsdb/create-text-embeddings.md | 18 - docs/examples/vectorsdb/create-transaction.md | 16 - docs/examples/vectorsdb/create.md | 18 - docs/examples/vectorsdb/delete-collection.md | 17 - docs/examples/vectorsdb/delete-document.md | 19 - docs/examples/vectorsdb/delete-documents.md | 19 - docs/examples/vectorsdb/delete-index.md | 18 - docs/examples/vectorsdb/delete-transaction.md | 16 - docs/examples/vectorsdb/delete.md | 16 - docs/examples/vectorsdb/get-collection.md | 17 - docs/examples/vectorsdb/get-document.md | 20 - docs/examples/vectorsdb/get-index.md | 18 - docs/examples/vectorsdb/get-transaction.md | 16 - docs/examples/vectorsdb/get.md | 16 - docs/examples/vectorsdb/list-collections.md | 19 - docs/examples/vectorsdb/list-documents.md | 21 - docs/examples/vectorsdb/list-indexes.md | 19 - docs/examples/vectorsdb/list-transactions.md | 16 - docs/examples/vectorsdb/list.md | 18 - docs/examples/vectorsdb/update-collection.md | 24 - docs/examples/vectorsdb/update-document.md | 23 - docs/examples/vectorsdb/update-documents.md | 20 - docs/examples/vectorsdb/update-transaction.md | 18 - docs/examples/vectorsdb/update.md | 18 - docs/examples/vectorsdb/upsert-document.md | 23 - docs/examples/vectorsdb/upsert-documents.md | 19 - docs/vectorsdb.md | 421 ------ src/Appwrite/Services/DocumentsDB.php | 1283 ----------------- src/Appwrite/Services/VectorsDB.php | 1137 --------------- tests/Appwrite/Services/DocumentsDBTest.php | 701 --------- tests/Appwrite/Services/VectorsDBTest.php | 673 --------- 69 files changed, 5949 deletions(-) delete mode 100644 docs/documentsdb.md delete mode 100644 docs/examples/documentsdb/create-collection.md delete mode 100644 docs/examples/documentsdb/create-document.md delete mode 100644 docs/examples/documentsdb/create-documents.md delete mode 100644 docs/examples/documentsdb/create-index.md delete mode 100644 docs/examples/documentsdb/create-operations.md delete mode 100644 docs/examples/documentsdb/create-transaction.md delete mode 100644 docs/examples/documentsdb/create.md delete mode 100644 docs/examples/documentsdb/decrement-document-attribute.md delete mode 100644 docs/examples/documentsdb/delete-collection.md delete mode 100644 docs/examples/documentsdb/delete-document.md delete mode 100644 docs/examples/documentsdb/delete-documents.md delete mode 100644 docs/examples/documentsdb/delete-index.md delete mode 100644 docs/examples/documentsdb/delete-transaction.md delete mode 100644 docs/examples/documentsdb/delete.md delete mode 100644 docs/examples/documentsdb/get-collection.md delete mode 100644 docs/examples/documentsdb/get-document.md delete mode 100644 docs/examples/documentsdb/get-index.md delete mode 100644 docs/examples/documentsdb/get-transaction.md delete mode 100644 docs/examples/documentsdb/get.md delete mode 100644 docs/examples/documentsdb/increment-document-attribute.md delete mode 100644 docs/examples/documentsdb/list-collections.md delete mode 100644 docs/examples/documentsdb/list-documents.md delete mode 100644 docs/examples/documentsdb/list-indexes.md delete mode 100644 docs/examples/documentsdb/list-transactions.md delete mode 100644 docs/examples/documentsdb/list.md delete mode 100644 docs/examples/documentsdb/update-collection.md delete mode 100644 docs/examples/documentsdb/update-document.md delete mode 100644 docs/examples/documentsdb/update-documents.md delete mode 100644 docs/examples/documentsdb/update-transaction.md delete mode 100644 docs/examples/documentsdb/update.md delete mode 100644 docs/examples/documentsdb/upsert-document.md delete mode 100644 docs/examples/documentsdb/upsert-documents.md delete mode 100644 docs/examples/vectorsdb/create-collection.md delete mode 100644 docs/examples/vectorsdb/create-document.md delete mode 100644 docs/examples/vectorsdb/create-documents.md delete mode 100644 docs/examples/vectorsdb/create-index.md delete mode 100644 docs/examples/vectorsdb/create-operations.md delete mode 100644 docs/examples/vectorsdb/create-text-embeddings.md delete mode 100644 docs/examples/vectorsdb/create-transaction.md delete mode 100644 docs/examples/vectorsdb/create.md delete mode 100644 docs/examples/vectorsdb/delete-collection.md delete mode 100644 docs/examples/vectorsdb/delete-document.md delete mode 100644 docs/examples/vectorsdb/delete-documents.md delete mode 100644 docs/examples/vectorsdb/delete-index.md delete mode 100644 docs/examples/vectorsdb/delete-transaction.md delete mode 100644 docs/examples/vectorsdb/delete.md delete mode 100644 docs/examples/vectorsdb/get-collection.md delete mode 100644 docs/examples/vectorsdb/get-document.md delete mode 100644 docs/examples/vectorsdb/get-index.md delete mode 100644 docs/examples/vectorsdb/get-transaction.md delete mode 100644 docs/examples/vectorsdb/get.md delete mode 100644 docs/examples/vectorsdb/list-collections.md delete mode 100644 docs/examples/vectorsdb/list-documents.md delete mode 100644 docs/examples/vectorsdb/list-indexes.md delete mode 100644 docs/examples/vectorsdb/list-transactions.md delete mode 100644 docs/examples/vectorsdb/list.md delete mode 100644 docs/examples/vectorsdb/update-collection.md delete mode 100644 docs/examples/vectorsdb/update-document.md delete mode 100644 docs/examples/vectorsdb/update-documents.md delete mode 100644 docs/examples/vectorsdb/update-transaction.md delete mode 100644 docs/examples/vectorsdb/update.md delete mode 100644 docs/examples/vectorsdb/upsert-document.md delete mode 100644 docs/examples/vectorsdb/upsert-documents.md delete mode 100644 docs/vectorsdb.md delete mode 100644 src/Appwrite/Services/DocumentsDB.php delete mode 100644 src/Appwrite/Services/VectorsDB.php delete mode 100644 tests/Appwrite/Services/DocumentsDBTest.php delete mode 100644 tests/Appwrite/Services/VectorsDBTest.php diff --git a/docs/documentsdb.md b/docs/documentsdb.md deleted file mode 100644 index 6bce76b..0000000 --- a/docs/documentsdb.md +++ /dev/null @@ -1,498 +0,0 @@ -# DocumentsDB Service - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb -``` - -** Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| 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 columns: name | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | - - -```http request -POST https://cloud.appwrite.io/v1/documentsdb -``` - -** Create a new Database. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| name | string | Database name. Max length: 128 chars. | | -| enabled | boolean | Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/transactions -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). | [] | - - -```http request -POST https://cloud.appwrite.io/v1/documentsdb/transactions -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| ttl | integer | Seconds before the transaction expires. | 300 | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | -| commit | boolean | Commit transaction? | | -| rollback | boolean | Rollback transaction? | | - - -```http request -DELETE https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | - - -```http request -POST https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId}/operations -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | -| operations | array | Array of staged operations. | [] | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/{databaseId} -``` - -** Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | - - -```http request -PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId} -``` - -** Update a database by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| name | string | Database name. Max length: 128 chars. | | -| enabled | boolean | Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | - - -```http request -DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId} -``` - -** Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections -``` - -** Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| 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, enabled, documentSecurity | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | - - -```http request -POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections -``` - -** Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| name | string | Collection name. Max length: 128 chars. | | -| permissions | array | An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | -| attributes | array | Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. | [] | -| indexes | array | Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). | [] | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} -``` - -** Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | - - -```http request -PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} -``` - -** Update a collection by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| name | string | Collection name. Max length: 128 chars. | | -| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | - - -```http request -DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} -``` - -** Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents -``` - -** Get a list of all the user's documents in a given collection. You can use the query params to filter your results. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| 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. | [] | -| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | -| ttl | integer | TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). | 0 | - - -```http request -POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents -``` - -** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | -| documentId | string | Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| data | object | Document data as JSON object. | {} | -| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | - - -```http request -POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents -``` - -** 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#documentsDBCreateCollection) API or directly from your database console. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | -| documents | array | Array of documents data as JSON objects. | [] | - - -```http request -PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents -``` - -** 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#documentsDBCreateCollection) API or directly from your database console. - ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documents | array | Array of document data as JSON objects. May contain partial documents. | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents -``` - -** 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. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| data | object | Document data as JSON object. Include only attribute and value pairs to be updated. | {} | -| 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. | [] | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents -``` - -** Bulk delete documents using queries, if no queries are passed then all documents are deleted. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| 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. | [] | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -** Get a document by its unique ID. This endpoint response returns a JSON object with the document data. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| documentId | string | **Required** Document ID. | | -| 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. | [] | -| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | - - -```http request -PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -** 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#documentsDBCreateCollection) API or directly from your database console. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documentId | string | **Required** Document ID. | | -| data | object | Document data as JSON object. Include all required fields of the document to be created or updated. | {} | -| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -** Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documentId | string | **Required** Document ID. | | -| data | object | Document data as JSON object. Include only fields and value pairs to be updated. | {} | -| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -** Delete a document by its unique ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| documentId | string | **Required** Document ID. | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement -``` - -** Decrement a specific column of a row by a given value. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documentId | string | **Required** Document ID. | | -| attribute | string | **Required** Attribute key. | | -| value | number | Value to decrement the attribute by. The value must be a number. | 1 | -| min | number | Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment -``` - -** Increment a specific column of a row by a given value. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documentId | string | **Required** Document ID. | | -| attribute | string | **Required** Attribute key. | | -| value | number | Value to increment the attribute by. The value must be a number. | 1 | -| max | number | Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes -``` - -** List indexes in the collection. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| 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: key, type, status, attributes, error | [] | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | - - -```http request -POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes -``` - -** Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. -Attributes can be `key`, `fulltext`, and `unique`. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| key | string | Index Key. | | -| type | string | Index type. | | -| attributes | array | Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. | | -| orders | array | Array of index orders. Maximum of 100 orders are allowed. | [] | -| lengths | array | Length of index. Maximum of 100 | [] | - - -```http request -GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key} -``` - -** Get index by ID. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| key | string | **Required** Index Key. | | - - -```http request -DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key} -``` - -** Delete an index. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| key | string | **Required** Index Key. | | - diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md deleted file mode 100644 index 3d9b94f..0000000 --- a/docs/examples/documentsdb/create-collection.md +++ /dev/null @@ -1,25 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->createCollection( - databaseId: '', - collectionId: '', - name: '', - permissions: [Permission::read(Role::any())], // optional - documentSecurity: false, // optional - enabled: false, // optional - attributes: [], // optional - indexes: [] // optional -);``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md deleted file mode 100644 index 0470561..0000000 --- a/docs/examples/documentsdb/create-document.md +++ /dev/null @@ -1,28 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->createDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [ - 'username' => 'walter.obrien', - 'email' => 'walter.obrien@example.com', - 'fullName' => 'Walter O'Brien', - 'age' => 30, - 'isAdmin' => false - ], - permissions: [Permission::read(Role::any())] // optional -);``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md deleted file mode 100644 index f6d2d05..0000000 --- a/docs/examples/documentsdb/create-documents.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->createDocuments( - databaseId: '', - collectionId: '', - documents: [] -);``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md deleted file mode 100644 index 771038f..0000000 --- a/docs/examples/documentsdb/create-index.md +++ /dev/null @@ -1,24 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->createIndex( - databaseId: '', - collectionId: '', - key: '', - type: DocumentsDBIndexType::KEY(), - attributes: [], - orders: [OrderBy::ASC()], // optional - lengths: [] // optional -);``` diff --git a/docs/examples/documentsdb/create-operations.md b/docs/examples/documentsdb/create-operations.md deleted file mode 100644 index 5dc16fb..0000000 --- a/docs/examples/documentsdb/create-operations.md +++ /dev/null @@ -1,27 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->createOperations( - transactionId: '', - operations: [ - { - "action": "create", - "databaseId": "", - "collectionId": "", - "documentId": "", - "data": { - "name": "Walter O'Brien" - } - } - ] // optional -);``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md deleted file mode 100644 index c7714f8..0000000 --- a/docs/examples/documentsdb/create-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->createTransaction( - ttl: 60 // optional -);``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md deleted file mode 100644 index cf73683..0000000 --- a/docs/examples/documentsdb/create.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->create( - databaseId: '', - name: '', - enabled: false // optional -);``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md deleted file mode 100644 index cacb75f..0000000 --- a/docs/examples/documentsdb/decrement-document-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->decrementDocumentAttribute( - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - value: null, // optional - min: null, // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md deleted file mode 100644 index 38745aa..0000000 --- a/docs/examples/documentsdb/delete-collection.md +++ /dev/null @@ -1,17 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->deleteCollection( - databaseId: '', - collectionId: '' -);``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md deleted file mode 100644 index 62c2d2e..0000000 --- a/docs/examples/documentsdb/delete-document.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->deleteDocument( - databaseId: '', - collectionId: '', - documentId: '', - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md deleted file mode 100644 index 8222655..0000000 --- a/docs/examples/documentsdb/delete-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->deleteDocuments( - databaseId: '', - collectionId: '', - queries: [], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md deleted file mode 100644 index fd02645..0000000 --- a/docs/examples/documentsdb/delete-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->deleteIndex( - databaseId: '', - collectionId: '', - key: '' -);``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md deleted file mode 100644 index 0c64a38..0000000 --- a/docs/examples/documentsdb/delete-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->deleteTransaction( - transactionId: '' -);``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md deleted file mode 100644 index a3ab19f..0000000 --- a/docs/examples/documentsdb/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->delete( - databaseId: '' -);``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md deleted file mode 100644 index 6ff15f9..0000000 --- a/docs/examples/documentsdb/get-collection.md +++ /dev/null @@ -1,17 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->getCollection( - databaseId: '', - collectionId: '' -);``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md deleted file mode 100644 index e0df16b..0000000 --- a/docs/examples/documentsdb/get-document.md +++ /dev/null @@ -1,20 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->getDocument( - databaseId: '', - collectionId: '', - documentId: '', - queries: [], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md deleted file mode 100644 index 212fd01..0000000 --- a/docs/examples/documentsdb/get-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->getIndex( - databaseId: '', - collectionId: '', - key: '' -);``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md deleted file mode 100644 index 6bc2193..0000000 --- a/docs/examples/documentsdb/get-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->getTransaction( - transactionId: '' -);``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md deleted file mode 100644 index 464d601..0000000 --- a/docs/examples/documentsdb/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->get( - databaseId: '' -);``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md deleted file mode 100644 index 5ed6fd3..0000000 --- a/docs/examples/documentsdb/increment-document-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->incrementDocumentAttribute( - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - value: null, // optional - max: null, // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md deleted file mode 100644 index 2fe77dd..0000000 --- a/docs/examples/documentsdb/list-collections.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->listCollections( - databaseId: '', - queries: [], // optional - search: '', // optional - total: false // optional -);``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md deleted file mode 100644 index 76b9cbe..0000000 --- a/docs/examples/documentsdb/list-documents.md +++ /dev/null @@ -1,21 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->listDocuments( - databaseId: '', - collectionId: '', - queries: [], // optional - transactionId: '', // optional - total: false, // optional - ttl: 0 // optional -);``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md deleted file mode 100644 index c60aa83..0000000 --- a/docs/examples/documentsdb/list-indexes.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->listIndexes( - databaseId: '', - collectionId: '', - queries: [], // optional - total: false // optional -);``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md deleted file mode 100644 index 971a642..0000000 --- a/docs/examples/documentsdb/list-transactions.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->listTransactions( - queries: [] // optional -);``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md deleted file mode 100644 index 5efcd96..0000000 --- a/docs/examples/documentsdb/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->list( - queries: [], // optional - search: '', // optional - total: false // optional -);``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md deleted file mode 100644 index 15f9c4a..0000000 --- a/docs/examples/documentsdb/update-collection.md +++ /dev/null @@ -1,23 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->updateCollection( - databaseId: '', - collectionId: '', - name: '', - permissions: [Permission::read(Role::any())], // optional - documentSecurity: false, // optional - enabled: false // optional -);``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md deleted file mode 100644 index e2ee55d..0000000 --- a/docs/examples/documentsdb/update-document.md +++ /dev/null @@ -1,23 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->updateDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [], // optional - permissions: [Permission::read(Role::any())], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md deleted file mode 100644 index 89c0e5d..0000000 --- a/docs/examples/documentsdb/update-documents.md +++ /dev/null @@ -1,20 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->updateDocuments( - databaseId: '', - collectionId: '', - data: [], // optional - queries: [], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md deleted file mode 100644 index ae5f84a..0000000 --- a/docs/examples/documentsdb/update-transaction.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->updateTransaction( - transactionId: '', - commit: false, // optional - rollback: false // optional -);``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md deleted file mode 100644 index c656606..0000000 --- a/docs/examples/documentsdb/update.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->update( - databaseId: '', - name: '', - enabled: false // optional -);``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md deleted file mode 100644 index a0c8b0d..0000000 --- a/docs/examples/documentsdb/upsert-document.md +++ /dev/null @@ -1,23 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->upsertDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [], // optional - permissions: [Permission::read(Role::any())], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md deleted file mode 100644 index bbc577b..0000000 --- a/docs/examples/documentsdb/upsert-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$documentsDB = new DocumentsDB($client); - -$result = $documentsDB->upsertDocuments( - databaseId: '', - collectionId: '', - documents: [], - transactionId: '' // optional -);``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md deleted file mode 100644 index 52f3705..0000000 --- a/docs/examples/vectorsdb/create-collection.md +++ /dev/null @@ -1,24 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->createCollection( - databaseId: '', - collectionId: '', - name: '', - dimension: 1, - permissions: [Permission::read(Role::any())], // optional - documentSecurity: false, // optional - enabled: false // optional -);``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md deleted file mode 100644 index c5e6187..0000000 --- a/docs/examples/vectorsdb/create-document.md +++ /dev/null @@ -1,32 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->createDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [ - 'embeddings' => [ - '0' => 0.12, - '1' => -0.55, - '2' => 0.88, - '3' => 1.02 - ], - 'metadata' => [ - 'key' => 'value' - ] - ], - permissions: [Permission::read(Role::any())] // optional -);``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md deleted file mode 100644 index 3c075bf..0000000 --- a/docs/examples/vectorsdb/create-documents.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->createDocuments( - databaseId: '', - collectionId: '', - documents: [] -);``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md deleted file mode 100644 index f3a97b6..0000000 --- a/docs/examples/vectorsdb/create-index.md +++ /dev/null @@ -1,24 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->createIndex( - databaseId: '', - collectionId: '', - key: '', - type: VectorsDBIndexType::HNSWEUCLIDEAN(), - attributes: [], - orders: [OrderBy::ASC()], // optional - lengths: [] // optional -);``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md deleted file mode 100644 index cbf4803..0000000 --- a/docs/examples/vectorsdb/create-operations.md +++ /dev/null @@ -1,27 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->createOperations( - transactionId: '', - operations: [ - { - "action": "create", - "databaseId": "", - "collectionId": "", - "documentId": "", - "data": { - "name": "Walter O'Brien" - } - } - ] // optional -);``` diff --git a/docs/examples/vectorsdb/create-text-embeddings.md b/docs/examples/vectorsdb/create-text-embeddings.md deleted file mode 100644 index 9947ead..0000000 --- a/docs/examples/vectorsdb/create-text-embeddings.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->createTextEmbeddings( - texts: [], - model: Model::EMBEDDINGGEMMA() // optional -);``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md deleted file mode 100644 index 52d9914..0000000 --- a/docs/examples/vectorsdb/create-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->createTransaction( - ttl: 60 // optional -);``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md deleted file mode 100644 index ff277ce..0000000 --- a/docs/examples/vectorsdb/create.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->create( - databaseId: '', - name: '', - enabled: false // optional -);``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md deleted file mode 100644 index 94db9f4..0000000 --- a/docs/examples/vectorsdb/delete-collection.md +++ /dev/null @@ -1,17 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->deleteCollection( - databaseId: '', - collectionId: '' -);``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md deleted file mode 100644 index c0a7260..0000000 --- a/docs/examples/vectorsdb/delete-document.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->deleteDocument( - databaseId: '', - collectionId: '', - documentId: '', - transactionId: '' // optional -);``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md deleted file mode 100644 index b64527f..0000000 --- a/docs/examples/vectorsdb/delete-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->deleteDocuments( - databaseId: '', - collectionId: '', - queries: [], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md deleted file mode 100644 index d4335cc..0000000 --- a/docs/examples/vectorsdb/delete-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->deleteIndex( - databaseId: '', - collectionId: '', - key: '' -);``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md deleted file mode 100644 index c45d7cb..0000000 --- a/docs/examples/vectorsdb/delete-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->deleteTransaction( - transactionId: '' -);``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md deleted file mode 100644 index c801a0e..0000000 --- a/docs/examples/vectorsdb/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->delete( - databaseId: '' -);``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md deleted file mode 100644 index 3bcef2d..0000000 --- a/docs/examples/vectorsdb/get-collection.md +++ /dev/null @@ -1,17 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->getCollection( - databaseId: '', - collectionId: '' -);``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md deleted file mode 100644 index c9fe955..0000000 --- a/docs/examples/vectorsdb/get-document.md +++ /dev/null @@ -1,20 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->getDocument( - databaseId: '', - collectionId: '', - documentId: '', - queries: [], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md deleted file mode 100644 index ece9759..0000000 --- a/docs/examples/vectorsdb/get-index.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->getIndex( - databaseId: '', - collectionId: '', - key: '' -);``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md deleted file mode 100644 index ef69fd8..0000000 --- a/docs/examples/vectorsdb/get-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->getTransaction( - transactionId: '' -);``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md deleted file mode 100644 index 94b0f25..0000000 --- a/docs/examples/vectorsdb/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->get( - databaseId: '' -);``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md deleted file mode 100644 index f1234b6..0000000 --- a/docs/examples/vectorsdb/list-collections.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->listCollections( - databaseId: '', - queries: [], // optional - search: '', // optional - total: false // optional -);``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md deleted file mode 100644 index 54e7502..0000000 --- a/docs/examples/vectorsdb/list-documents.md +++ /dev/null @@ -1,21 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->listDocuments( - databaseId: '', - collectionId: '', - queries: [], // optional - transactionId: '', // optional - total: false, // optional - ttl: 0 // optional -);``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md deleted file mode 100644 index d1e8624..0000000 --- a/docs/examples/vectorsdb/list-indexes.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->listIndexes( - databaseId: '', - collectionId: '', - queries: [], // optional - total: false // optional -);``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md deleted file mode 100644 index 905773c..0000000 --- a/docs/examples/vectorsdb/list-transactions.md +++ /dev/null @@ -1,16 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->listTransactions( - queries: [] // optional -);``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md deleted file mode 100644 index 9037a82..0000000 --- a/docs/examples/vectorsdb/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->list( - queries: [], // optional - search: '', // optional - total: false // optional -);``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md deleted file mode 100644 index 38a244a..0000000 --- a/docs/examples/vectorsdb/update-collection.md +++ /dev/null @@ -1,24 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->updateCollection( - databaseId: '', - collectionId: '', - name: '', - dimension: 1, // optional - permissions: [Permission::read(Role::any())], // optional - documentSecurity: false, // optional - enabled: false // optional -);``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md deleted file mode 100644 index e5061c1..0000000 --- a/docs/examples/vectorsdb/update-document.md +++ /dev/null @@ -1,23 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->updateDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [], // optional - permissions: [Permission::read(Role::any())], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md deleted file mode 100644 index 77c3e87..0000000 --- a/docs/examples/vectorsdb/update-documents.md +++ /dev/null @@ -1,20 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->updateDocuments( - databaseId: '', - collectionId: '', - data: [], // optional - queries: [], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md deleted file mode 100644 index 986684e..0000000 --- a/docs/examples/vectorsdb/update-transaction.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->updateTransaction( - transactionId: '', - commit: false, // optional - rollback: false // optional -);``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md deleted file mode 100644 index ee79ddf..0000000 --- a/docs/examples/vectorsdb/update.md +++ /dev/null @@ -1,18 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->update( - databaseId: '', - name: '', - enabled: false // optional -);``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md deleted file mode 100644 index ef7f550..0000000 --- a/docs/examples/vectorsdb/upsert-document.md +++ /dev/null @@ -1,23 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->upsertDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: [], // optional - permissions: [Permission::read(Role::any())], // optional - transactionId: '' // optional -);``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md deleted file mode 100644 index b047462..0000000 --- a/docs/examples/vectorsdb/upsert-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```php -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$vectorsDB = new VectorsDB($client); - -$result = $vectorsDB->upsertDocuments( - databaseId: '', - collectionId: '', - documents: [], - transactionId: '' // optional -);``` diff --git a/docs/vectorsdb.md b/docs/vectorsdb.md deleted file mode 100644 index 59dc435..0000000 --- a/docs/vectorsdb.md +++ /dev/null @@ -1,421 +0,0 @@ -# VectorsDB Service - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| 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 columns: name | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| name | string | Database name. Max length: 128 chars. | | -| enabled | boolean | Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb/embeddings/text -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| texts | array | Array of text to generate embeddings. | | -| model | string | The embedding model to use for generating vector embeddings. | embeddinggemma | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/transactions -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). | [] | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb/transactions -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| ttl | integer | Seconds before the transaction expires. | 300 | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | -| commit | boolean | Commit transaction? | | -| rollback | boolean | Rollback transaction? | | - - -```http request -DELETE https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId}/operations -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| transactionId | string | **Required** Transaction ID. | | -| operations | array | Array of staged operations. | [] | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | - - -```http request -PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| name | string | Database name. Max length: 128 chars. | | -| enabled | boolean | Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | - - -```http request -DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| 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, enabled, documentSecurity | [] | -| search | string | Search term to filter your list results. Max length: 256 chars. | | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| name | string | Collection name. Max length: 128 chars. | | -| dimension | integer | Embedding dimension. | | -| permissions | array | An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | - - -```http request -PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| name | string | Collection name. Max length: 128 chars. | | -| dimension | integer | Embedding dimensions. | | -| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | - - -```http request -DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| 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. | [] | -| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | -| ttl | integer | TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). | 0 | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | -| documentId | string | Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | -| data | object | Document data as JSON object. | {} | -| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | -| documents | array | Array of documents data as JSON objects. | [] | - - -```http request -PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documents | array | Array of document data as JSON objects. May contain partial documents. | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| data | object | Document data as JSON object. Include only attribute and value pairs to be updated. | {} | -| 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. | [] | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| 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. | [] | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| documentId | string | **Required** Document ID. | | -| 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. | [] | -| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | - - -```http request -PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documentId | string | **Required** Document ID. | | -| data | object | Document data as JSON object. Include all required fields of the document to be created or updated. | {} | -| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -PATCH https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. | | -| documentId | string | **Required** Document ID. | | -| data | object | Document data as JSON object. Include only fields and value pairs to be updated. | {} | -| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| documentId | string | **Required** Document ID. | | -| transactionId | string | Transaction ID for staging the operation. | | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| 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: key, type, status, attributes, error | [] | -| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | - - -```http request -POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| key | string | Index Key. | | -| type | string | Index type. | | -| attributes | array | Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. | | -| orders | array | Array of index orders. Maximum of 100 orders are allowed. | [] | -| lengths | array | Length of index. Maximum of 100 | [] | - - -```http request -GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| key | string | **Required** Index Key. | | - - -```http request -DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key} -``` - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| databaseId | string | **Required** Database ID. | | -| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | -| key | string | **Required** Index Key. | | - diff --git a/src/Appwrite/Services/DocumentsDB.php b/src/Appwrite/Services/DocumentsDB.php deleted file mode 100644 index 06fe036..0000000 --- a/src/Appwrite/Services/DocumentsDB.php +++ /dev/null @@ -1,1283 +0,0 @@ -client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Create a new Database. - * - * - * @param string $databaseId - * @param string $name - * @param ?bool $enabled - * @throws AppwriteException - * @return array - */ - public function create(string $databaseId, string $name, ?bool $enabled = null): array - { - $apiPath = str_replace( - [], - [], - '/documentsdb' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param ?array $queries - * @throws AppwriteException - * @return array - */ - public function listTransactions(?array $queries = null): array - { - $apiPath = str_replace( - [], - [], - '/documentsdb/transactions' - ); - - $apiParams = []; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param ?int $ttl - * @throws AppwriteException - * @return array - */ - public function createTransaction(?int $ttl = null): array - { - $apiPath = str_replace( - [], - [], - '/documentsdb/transactions' - ); - - $apiParams = []; - - if (!is_null($ttl)) { - $apiParams['ttl'] = $ttl; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @throws AppwriteException - * @return array - */ - public function getTransaction(string $transactionId): array - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/documentsdb/transactions/{transactionId}' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @param ?bool $commit - * @param ?bool $rollback - * @throws AppwriteException - * @return array - */ - public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): array - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/documentsdb/transactions/{transactionId}' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - if (!is_null($commit)) { - $apiParams['commit'] = $commit; - } - - if (!is_null($rollback)) { - $apiParams['rollback'] = $rollback; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @throws AppwriteException - * @return string - */ - public function deleteTransaction(string $transactionId): string - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/documentsdb/transactions/{transactionId}' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @param ?array $operations - * @throws AppwriteException - * @return array - */ - public function createOperations(string $transactionId, ?array $operations = null): array - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/documentsdb/transactions/{transactionId}/operations' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - if (!is_null($operations)) { - $apiParams['operations'] = $operations; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get a database by its unique ID. This endpoint response returns a JSON - * object with the database metadata. - * - * @param string $databaseId - * @throws AppwriteException - * @return array - */ - public function get(string $databaseId): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/documentsdb/{databaseId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Update a database by its unique ID. - * - * @param string $databaseId - * @param string $name - * @param ?bool $enabled - * @throws AppwriteException - * @return array - */ - public function update(string $databaseId, string $name, ?bool $enabled = null): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/documentsdb/{databaseId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Delete a database by its unique ID. Only API keys with with databases.write - * scope can delete a database. - * - * @param string $databaseId - * @throws AppwriteException - * @return string - */ - public function delete(string $databaseId): string - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/documentsdb/{databaseId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get a list of all collections that belong to the provided databaseId. You - * can use the search parameter to filter your results. - * - * @param string $databaseId - * @param ?array $queries - * @param ?string $search - * @param ?bool $total - * @throws AppwriteException - * @return array - */ - public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/documentsdb/{databaseId}/collections' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($search)) { - $apiParams['search'] = $search; - } - - if (!is_null($total)) { - $apiParams['total'] = $total; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Create a new Collection. Before using this route, you should create a new - * database resource using either a [server - * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) - * API or directly from your database console. - * - * @param string $databaseId - * @param string $collectionId - * @param string $name - * @param ?array $permissions - * @param ?bool $documentSecurity - * @param ?bool $enabled - * @param ?array $attributes - * @param ?array $indexes - * @throws AppwriteException - * @return array - */ - public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null, ?array $attributes = null, ?array $indexes = null): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/documentsdb/{databaseId}/collections' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['name'] = $name; - $apiParams['permissions'] = $permissions; - - if (!is_null($documentSecurity)) { - $apiParams['documentSecurity'] = $documentSecurity; - } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - if (!is_null($attributes)) { - $apiParams['attributes'] = $attributes; - } - - if (!is_null($indexes)) { - $apiParams['indexes'] = $indexes; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get a collection by its unique ID. This endpoint response returns a JSON - * object with the collection metadata. - * - * @param string $databaseId - * @param string $collectionId - * @throws AppwriteException - * @return array - */ - public function getCollection(string $databaseId, string $collectionId): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Update a collection by its unique ID. - * - * @param string $databaseId - * @param string $collectionId - * @param string $name - * @param ?array $permissions - * @param ?bool $documentSecurity - * @param ?bool $enabled - * @throws AppwriteException - * @return array - */ - public function updateCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['name'] = $name; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($documentSecurity)) { - $apiParams['documentSecurity'] = $documentSecurity; - } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Delete a collection by its unique ID. Only users with write permissions - * have access to delete this resource. - * - * @param string $databaseId - * @param string $collectionId - * @throws AppwriteException - * @return string - */ - public function deleteCollection(string $databaseId, string $collectionId): string - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get a list of all the user's documents in a given collection. You can use - * the query params to filter your results. - * - * @param string $databaseId - * @param string $collectionId - * @param ?array $queries - * @param ?string $transactionId - * @param ?bool $total - * @param ?int $ttl - * @throws AppwriteException - * @return array - */ - public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - if (!is_null($total)) { - $apiParams['total'] = $total; - } - - if (!is_null($ttl)) { - $apiParams['ttl'] = $ttl; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Create a new Document. Before using this route, you should create a new - * collection resource using either a [server - * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) - * API or directly from your database console. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param array $data - * @param ?array $permissions - * @throws AppwriteException - * @return array - */ - public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - $apiParams['data'] = $data; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * 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#documentsDBCreateCollection) - * API or directly from your database console. - * - * @param string $databaseId - * @param string $collectionId - * @param array $documents - * @throws AppwriteException - * @return array - */ - public function createDocuments(string $databaseId, string $collectionId, array $documents): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documents'] = $documents; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * 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#documentsDBCreateCollection) - * API or directly from your database console. - * - * - * @param string $databaseId - * @param string $collectionId - * @param array $documents - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documents'] = $documents; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * 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. - * - * @param string $databaseId - * @param string $collectionId - * @param ?array $data - * @param ?array $queries - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($data)) { - $apiParams['data'] = $data; - } - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Bulk delete documents using queries, if no queries are passed then all - * documents are deleted. - * - * @param string $databaseId - * @param string $collectionId - * @param ?array $queries - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get a document by its unique ID. This endpoint response returns a JSON - * object with the document data. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?array $queries - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * 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#documentsDBCreateCollection) - * API or directly from your database console. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?array $data - * @param ?array $permissions - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($data)) { - $apiParams['data'] = $data; - } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Update a document by its unique ID. Using the patch method you can pass - * only specific fields that will get updated. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?array $data - * @param ?array $permissions - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($data)) { - $apiParams['data'] = $data; - } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Delete a document by its unique ID. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?string $transactionId - * @throws AppwriteException - * @return string - */ - public function deleteDocument(string $databaseId, string $collectionId, string $documentId, ?string $transactionId = null): string - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Decrement a specific column of a row by a given value. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param string $attribute - * @param ?float $value - * @param ?float $min - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function decrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $min = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], - [$databaseId, $collectionId, $documentId, $attribute], - '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - $apiParams['attribute'] = $attribute; - - if (!is_null($value)) { - $apiParams['value'] = $value; - } - - if (!is_null($min)) { - $apiParams['min'] = $min; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Increment a specific column of a row by a given value. - * - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param string $attribute - * @param ?float $value - * @param ?float $max - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function incrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $max = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], - [$databaseId, $collectionId, $documentId, $attribute], - '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - $apiParams['attribute'] = $attribute; - - if (!is_null($value)) { - $apiParams['value'] = $value; - } - - if (!is_null($max)) { - $apiParams['max'] = $max; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * List indexes in the collection. - * - * @param string $databaseId - * @param string $collectionId - * @param ?array $queries - * @param ?bool $total - * @throws AppwriteException - * @return array - */ - public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/indexes' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($total)) { - $apiParams['total'] = $total; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Creates an index on the attributes listed. Your index should include all - * the attributes you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param DocumentsDBIndexType $type - * @param array $attributes - * @param ?array $orders - * @param ?array $lengths - * @throws AppwriteException - * @return array - */ - public function createIndex(string $databaseId, string $collectionId, string $key, DocumentsDBIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/documentsdb/{databaseId}/collections/{collectionId}/indexes' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['key'] = $key; - $apiParams['type'] = $type; - $apiParams['attributes'] = $attributes; - - if (!is_null($orders)) { - $apiParams['orders'] = $orders; - } - - if (!is_null($lengths)) { - $apiParams['lengths'] = $lengths; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get index by ID. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return array - */ - public function getIndex(string $databaseId, string $collectionId, string $key): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{key}'], - [$databaseId, $collectionId, $key], - '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['key'] = $key; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Delete an index. - * - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return string - */ - public function deleteIndex(string $databaseId, string $collectionId, string $key): string - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{key}'], - [$databaseId, $collectionId, $key], - '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['key'] = $key; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } -} \ No newline at end of file diff --git a/src/Appwrite/Services/VectorsDB.php b/src/Appwrite/Services/VectorsDB.php deleted file mode 100644 index c9f33d5..0000000 --- a/src/Appwrite/Services/VectorsDB.php +++ /dev/null @@ -1,1137 +0,0 @@ -client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $name - * @param ?bool $enabled - * @throws AppwriteException - * @return array - */ - public function create(string $databaseId, string $name, ?bool $enabled = null): array - { - $apiPath = str_replace( - [], - [], - '/vectorsdb' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param array $texts - * @param ?Model $model - * @throws AppwriteException - * @return array - */ - public function createTextEmbeddings(array $texts, ?Model $model = null): array - { - $apiPath = str_replace( - [], - [], - '/vectorsdb/embeddings/text' - ); - - $apiParams = []; - $apiParams['texts'] = $texts; - - if (!is_null($model)) { - $apiParams['model'] = $model; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param ?array $queries - * @throws AppwriteException - * @return array - */ - public function listTransactions(?array $queries = null): array - { - $apiPath = str_replace( - [], - [], - '/vectorsdb/transactions' - ); - - $apiParams = []; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param ?int $ttl - * @throws AppwriteException - * @return array - */ - public function createTransaction(?int $ttl = null): array - { - $apiPath = str_replace( - [], - [], - '/vectorsdb/transactions' - ); - - $apiParams = []; - - if (!is_null($ttl)) { - $apiParams['ttl'] = $ttl; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @throws AppwriteException - * @return array - */ - public function getTransaction(string $transactionId): array - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/vectorsdb/transactions/{transactionId}' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @param ?bool $commit - * @param ?bool $rollback - * @throws AppwriteException - * @return array - */ - public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): array - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/vectorsdb/transactions/{transactionId}' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - if (!is_null($commit)) { - $apiParams['commit'] = $commit; - } - - if (!is_null($rollback)) { - $apiParams['rollback'] = $rollback; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @throws AppwriteException - * @return string - */ - public function deleteTransaction(string $transactionId): string - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/vectorsdb/transactions/{transactionId}' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $transactionId - * @param ?array $operations - * @throws AppwriteException - * @return array - */ - public function createOperations(string $transactionId, ?array $operations = null): array - { - $apiPath = str_replace( - ['{transactionId}'], - [$transactionId], - '/vectorsdb/transactions/{transactionId}/operations' - ); - - $apiParams = []; - $apiParams['transactionId'] = $transactionId; - - if (!is_null($operations)) { - $apiParams['operations'] = $operations; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @throws AppwriteException - * @return array - */ - public function get(string $databaseId): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/vectorsdb/{databaseId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $name - * @param ?bool $enabled - * @throws AppwriteException - * @return array - */ - public function update(string $databaseId, string $name, ?bool $enabled = null): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/vectorsdb/{databaseId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @throws AppwriteException - * @return string - */ - public function delete(string $databaseId): string - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/vectorsdb/{databaseId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param ?array $queries - * @param ?string $search - * @param ?bool $total - * @throws AppwriteException - * @return array - */ - public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/vectorsdb/{databaseId}/collections' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($search)) { - $apiParams['search'] = $search; - } - - if (!is_null($total)) { - $apiParams['total'] = $total; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $name - * @param int $dimension - * @param ?array $permissions - * @param ?bool $documentSecurity - * @param ?bool $enabled - * @throws AppwriteException - * @return array - */ - public function createCollection(string $databaseId, string $collectionId, string $name, int $dimension, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array - { - $apiPath = str_replace( - ['{databaseId}'], - [$databaseId], - '/vectorsdb/{databaseId}/collections' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['name'] = $name; - $apiParams['dimension'] = $dimension; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($documentSecurity)) { - $apiParams['documentSecurity'] = $documentSecurity; - } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @throws AppwriteException - * @return array - */ - public function getCollection(string $databaseId, string $collectionId): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $name - * @param ?int $dimension - * @param ?array $permissions - * @param ?bool $documentSecurity - * @param ?bool $enabled - * @throws AppwriteException - * @return array - */ - public function updateCollection(string $databaseId, string $collectionId, string $name, ?int $dimension = null, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['name'] = $name; - - if (!is_null($dimension)) { - $apiParams['dimension'] = $dimension; - } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($documentSecurity)) { - $apiParams['documentSecurity'] = $documentSecurity; - } - - if (!is_null($enabled)) { - $apiParams['enabled'] = $enabled; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @throws AppwriteException - * @return string - */ - public function deleteCollection(string $databaseId, string $collectionId): string - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param ?array $queries - * @param ?string $transactionId - * @param ?bool $total - * @param ?int $ttl - * @throws AppwriteException - * @return array - */ - public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - if (!is_null($total)) { - $apiParams['total'] = $total; - } - - if (!is_null($ttl)) { - $apiParams['ttl'] = $ttl; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param array $data - * @param ?array $permissions - * @throws AppwriteException - * @return array - */ - public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - $apiParams['data'] = $data; - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param array $documents - * @throws AppwriteException - * @return array - */ - public function createDocuments(string $databaseId, string $collectionId, array $documents): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documents'] = $documents; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param array $documents - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documents'] = $documents; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param ?array $data - * @param ?array $queries - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($data)) { - $apiParams['data'] = $data; - } - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param ?array $queries - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?array $queries - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?array $data - * @param ?array $permissions - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($data)) { - $apiParams['data'] = $data; - } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PUT, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?array $data - * @param ?array $permissions - * @param ?string $transactionId - * @throws AppwriteException - * @return array - */ - public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($data)) { - $apiParams['data'] = $data; - } - - if (!is_null($permissions)) { - $apiParams['permissions'] = $permissions; - } - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_PATCH, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $documentId - * @param ?string $transactionId - * @throws AppwriteException - * @return string - */ - public function deleteDocument(string $databaseId, string $collectionId, string $documentId, ?string $transactionId = null): string - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{documentId}'], - [$databaseId, $collectionId, $documentId], - '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['documentId'] = $documentId; - - if (!is_null($transactionId)) { - $apiParams['transactionId'] = $transactionId; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param ?array $queries - * @param ?bool $total - * @throws AppwriteException - * @return array - */ - public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - - if (!is_null($queries)) { - $apiParams['queries'] = $queries; - } - - if (!is_null($total)) { - $apiParams['total'] = $total; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @param VectorsDBIndexType $type - * @param array $attributes - * @param ?array $orders - * @param ?array $lengths - * @throws AppwriteException - * @return array - */ - public function createIndex(string $databaseId, string $collectionId, string $key, VectorsDBIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}'], - [$databaseId, $collectionId], - '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['key'] = $key; - $apiParams['type'] = $type; - $apiParams['attributes'] = $attributes; - - if (!is_null($orders)) { - $apiParams['orders'] = $orders; - } - - if (!is_null($lengths)) { - $apiParams['lengths'] = $lengths; - } - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_POST, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return array - */ - public function getIndex(string $databaseId, string $collectionId, string $key): array - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{key}'], - [$databaseId, $collectionId, $key], - '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['key'] = $key; - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * @param string $databaseId - * @param string $collectionId - * @param string $key - * @throws AppwriteException - * @return string - */ - public function deleteIndex(string $databaseId, string $collectionId, string $key): string - { - $apiPath = str_replace( - ['{databaseId}', '{collectionId}', '{key}'], - [$databaseId, $collectionId, $key], - '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' - ); - - $apiParams = []; - $apiParams['databaseId'] = $databaseId; - $apiParams['collectionId'] = $collectionId; - $apiParams['key'] = $key; - - $apiHeaders = []; - $apiHeaders['content-type'] = 'application/json'; - - return $this->client->call( - Client::METHOD_DELETE, - $apiPath, - $apiHeaders, - $apiParams - ); - } -} \ No newline at end of file diff --git a/tests/Appwrite/Services/DocumentsDBTest.php b/tests/Appwrite/Services/DocumentsDBTest.php deleted file mode 100644 index 34fb7a4..0000000 --- a/tests/Appwrite/Services/DocumentsDBTest.php +++ /dev/null @@ -1,701 +0,0 @@ -client = Mockery::mock(Client::class); - $this->documentsDB = new DocumentsDB($this->client); - } - - public function testMethodList(): void { - - $data = array( - "total" => 5, - "databases" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->list( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->create( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListTransactions(): void { - - $data = array( - "total" => 5, - "transactions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->listTransactions( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->createTransaction( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->getTransaction( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->updateTransaction( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteTransaction(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->deleteTransaction( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateOperations(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->createOperations( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->get( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->update( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDelete(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->delete( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCollections(): void { - - $data = array( - "total" => 5, - "collections" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->listCollections( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->createCollection( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->getCollection( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->updateCollection( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteCollection(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->deleteCollection( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->listDocuments( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->createDocument( - "", - "", - "", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->createDocuments( - "", - "", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpsertDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->upsertDocuments( - "", - "", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->updateDocuments( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->deleteDocuments( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->getDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpsertDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->upsertDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->updateDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteDocument(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->deleteDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDecrementDocumentAttribute(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->decrementDocumentAttribute( - "", - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodIncrementDocumentAttribute(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->incrementDocumentAttribute( - "", - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListIndexes(): void { - - $data = array( - "total" => 5, - "indexes" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->listIndexes( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->createIndex( - "", - "", - "", - DocumentsDBIndexType::KEY(), - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->getIndex( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteIndex(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->documentsDB->deleteIndex( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - -} diff --git a/tests/Appwrite/Services/VectorsDBTest.php b/tests/Appwrite/Services/VectorsDBTest.php deleted file mode 100644 index bc362e0..0000000 --- a/tests/Appwrite/Services/VectorsDBTest.php +++ /dev/null @@ -1,673 +0,0 @@ -client = Mockery::mock(Client::class); - $this->vectorsDB = new VectorsDB($this->client); - } - - public function testMethodList(): void { - - $data = array( - "total" => 5, - "databases" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->list( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->create( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTextEmbeddings(): void { - - $data = array( - "total" => 5, - "embeddings" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->createTextEmbeddings( - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodListTransactions(): void { - - $data = array( - "total" => 5, - "transactions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->listTransactions( - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->createTransaction( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->getTransaction( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateTransaction(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->updateTransaction( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteTransaction(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->deleteTransaction( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateOperations(): void { - - $data = array( - "\$id" => "259125845563242502", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "status" => "pending", - "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00"); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->createOperations( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGet(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->get( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdate(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "name" => "My Database", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true, - "type" => "legacy", - "policies" => array(), - "archives" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->update( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDelete(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->delete( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListCollections(): void { - - $data = array( - "total" => 5, - "collections" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->listCollections( - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500, - "dimension" => 1536); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->createCollection( - "", - "", - "", - 1 - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500, - "dimension" => 1536); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->getCollection( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateCollection(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(), - "databaseId" => "5e5ea5c16897e", - "name" => "My Collection", - "enabled" => true, - "documentSecurity" => true, - "attributes" => array(), - "indexes" => array(), - "bytesMax" => 65535, - "bytesUsed" => 1500, - "dimension" => 1536); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->updateCollection( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteCollection(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->deleteCollection( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->listDocuments( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->createDocument( - "", - "", - "", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->createDocuments( - "", - "", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpsertDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->upsertDocuments( - "", - "", - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->updateDocuments( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteDocuments(): void { - - $data = array( - "total" => 5, - "documents" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->deleteDocuments( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->getDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpsertDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->upsertDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodUpdateDocument(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$sequence" => "1", - "\$collectionId" => "5e5ea5c15117e", - "\$databaseId" => "5e5ea5c15117e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->updateDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteDocument(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->deleteDocument( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodListIndexes(): void { - - $data = array( - "total" => 5, - "indexes" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->listIndexes( - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodCreateIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->createIndex( - "", - "", - "", - VectorsDBIndexType::HNSWEUCLIDEAN(), - array() - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetIndex(): void { - - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "key" => "index1", - "type" => "primary", - "status" => "available", - "error" => "string", - "attributes" => array(), - "lengths" => array()); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->getIndex( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - - public function testMethodDeleteIndex(): void { - - $data = ''; - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->vectorsDB->deleteIndex( - "", - "", - "" - ); - - $this->assertSame($data, $response); - } - -} From 6bf7b0db34859ba02d169fa8894be9aa2711073f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 06:43:10 +0000 Subject: [PATCH 4/8] chore: update PHP SDK to 21.0.0 --- docs/health.md | 65 -------- src/Appwrite/Enums/DocumentsDBIndexType.php | 59 ------- src/Appwrite/Enums/Model.php | 35 ----- src/Appwrite/Enums/TemplateReferenceType.php | 16 +- src/Appwrite/Enums/VCSReferenceType.php | 8 - src/Appwrite/Enums/VectorsDBIndexType.php | 75 --------- src/Appwrite/Services/Health.php | 155 ------------------- tests/Appwrite/Services/HealthTest.php | 75 --------- 8 files changed, 8 insertions(+), 480 deletions(-) delete mode 100644 src/Appwrite/Enums/DocumentsDBIndexType.php delete mode 100644 src/Appwrite/Enums/Model.php delete mode 100644 src/Appwrite/Enums/VectorsDBIndexType.php diff --git a/docs/health.md b/docs/health.md index fedaa15..ead6d70 100644 --- a/docs/health.md +++ b/docs/health.md @@ -77,32 +77,6 @@ GET https://cloud.appwrite.io/v1/health/queue/audits | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | -```http request -GET https://cloud.appwrite.io/v1/health/queue/billing-project-aggregation -``` - -** Get billing project aggregation queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | - - -```http request -GET https://cloud.appwrite.io/v1/health/queue/billing-team-aggregation -``` - -** Get billing team aggregation queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/builds ``` @@ -116,19 +90,6 @@ GET https://cloud.appwrite.io/v1/health/queue/builds | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | -```http request -GET https://cloud.appwrite.io/v1/health/queue/builds-priority -``` - -** Get the priority builds queue size. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. | 500 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/certificates ``` @@ -249,19 +210,6 @@ GET https://cloud.appwrite.io/v1/health/queue/migrations | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | -```http request -GET https://cloud.appwrite.io/v1/health/queue/region-manager -``` - -** Get region manager queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/stats-resources ``` @@ -288,19 +236,6 @@ GET https://cloud.appwrite.io/v1/health/queue/stats-usage | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | -```http request -GET https://cloud.appwrite.io/v1/health/queue/threats -``` - -** Get threats queue. ** - -### Parameters - -| Field Name | Type | Description | Default | -| --- | --- | --- | --- | -| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | - - ```http request GET https://cloud.appwrite.io/v1/health/queue/webhooks ``` diff --git a/src/Appwrite/Enums/DocumentsDBIndexType.php b/src/Appwrite/Enums/DocumentsDBIndexType.php deleted file mode 100644 index c467daa..0000000 --- a/src/Appwrite/Enums/DocumentsDBIndexType.php +++ /dev/null @@ -1,59 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function KEY(): DocumentsDBIndexType - { - if (!isset(self::$KEY)) { - self::$KEY = new DocumentsDBIndexType('key'); - } - return self::$KEY; - } - public static function FULLTEXT(): DocumentsDBIndexType - { - if (!isset(self::$FULLTEXT)) { - self::$FULLTEXT = new DocumentsDBIndexType('fulltext'); - } - return self::$FULLTEXT; - } - public static function UNIQUE(): DocumentsDBIndexType - { - if (!isset(self::$UNIQUE)) { - self::$UNIQUE = new DocumentsDBIndexType('unique'); - } - return self::$UNIQUE; - } - public static function SPATIAL(): DocumentsDBIndexType - { - if (!isset(self::$SPATIAL)) { - self::$SPATIAL = new DocumentsDBIndexType('spatial'); - } - return self::$SPATIAL; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Model.php b/src/Appwrite/Enums/Model.php deleted file mode 100644 index b572876..0000000 --- a/src/Appwrite/Enums/Model.php +++ /dev/null @@ -1,35 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function EMBEDDINGGEMMA(): Model - { - if (!isset(self::$EMBEDDINGGEMMA)) { - self::$EMBEDDINGGEMMA = new Model('embeddinggemma'); - } - return self::$EMBEDDINGGEMMA; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/TemplateReferenceType.php b/src/Appwrite/Enums/TemplateReferenceType.php index 7d3e22f..605fc3a 100644 --- a/src/Appwrite/Enums/TemplateReferenceType.php +++ b/src/Appwrite/Enums/TemplateReferenceType.php @@ -6,8 +6,8 @@ class TemplateReferenceType implements JsonSerializable { - private static TemplateReferenceType $BRANCH; private static TemplateReferenceType $COMMIT; + private static TemplateReferenceType $BRANCH; private static TemplateReferenceType $TAG; private string $value; @@ -27,13 +27,6 @@ public function jsonSerialize(): string return $this->value; } - public static function BRANCH(): TemplateReferenceType - { - if (!isset(self::$BRANCH)) { - self::$BRANCH = new TemplateReferenceType('branch'); - } - return self::$BRANCH; - } public static function COMMIT(): TemplateReferenceType { if (!isset(self::$COMMIT)) { @@ -41,6 +34,13 @@ public static function COMMIT(): TemplateReferenceType } return self::$COMMIT; } + public static function BRANCH(): TemplateReferenceType + { + if (!isset(self::$BRANCH)) { + self::$BRANCH = new TemplateReferenceType('branch'); + } + return self::$BRANCH; + } public static function TAG(): TemplateReferenceType { if (!isset(self::$TAG)) { diff --git a/src/Appwrite/Enums/VCSReferenceType.php b/src/Appwrite/Enums/VCSReferenceType.php index adeb723..f5ba3f0 100644 --- a/src/Appwrite/Enums/VCSReferenceType.php +++ b/src/Appwrite/Enums/VCSReferenceType.php @@ -8,7 +8,6 @@ class VCSReferenceType implements JsonSerializable { private static VCSReferenceType $BRANCH; private static VCSReferenceType $COMMIT; - private static VCSReferenceType $TAG; private string $value; @@ -41,11 +40,4 @@ public static function COMMIT(): VCSReferenceType } return self::$COMMIT; } - public static function TAG(): VCSReferenceType - { - if (!isset(self::$TAG)) { - self::$TAG = new VCSReferenceType('tag'); - } - return self::$TAG; - } } \ No newline at end of file diff --git a/src/Appwrite/Enums/VectorsDBIndexType.php b/src/Appwrite/Enums/VectorsDBIndexType.php deleted file mode 100644 index 03bdf05..0000000 --- a/src/Appwrite/Enums/VectorsDBIndexType.php +++ /dev/null @@ -1,75 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function HNSWEUCLIDEAN(): VectorsDBIndexType - { - if (!isset(self::$HNSWEUCLIDEAN)) { - self::$HNSWEUCLIDEAN = new VectorsDBIndexType('hnsw_euclidean'); - } - return self::$HNSWEUCLIDEAN; - } - public static function HNSWDOT(): VectorsDBIndexType - { - if (!isset(self::$HNSWDOT)) { - self::$HNSWDOT = new VectorsDBIndexType('hnsw_dot'); - } - return self::$HNSWDOT; - } - public static function HNSWCOSINE(): VectorsDBIndexType - { - if (!isset(self::$HNSWCOSINE)) { - self::$HNSWCOSINE = new VectorsDBIndexType('hnsw_cosine'); - } - return self::$HNSWCOSINE; - } - public static function OBJECT(): VectorsDBIndexType - { - if (!isset(self::$OBJECT)) { - self::$OBJECT = new VectorsDBIndexType('object'); - } - return self::$OBJECT; - } - public static function KEY(): VectorsDBIndexType - { - if (!isset(self::$KEY)) { - self::$KEY = new VectorsDBIndexType('key'); - } - return self::$KEY; - } - public static function UNIQUE(): VectorsDBIndexType - { - if (!isset(self::$UNIQUE)) { - self::$UNIQUE = new VectorsDBIndexType('unique'); - } - return self::$UNIQUE; - } -} \ No newline at end of file diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 06407e9..966e1ae 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -247,68 +247,6 @@ public function getQueueAudits(?int $threshold = null): array ); } - /** - * Get billing project aggregation queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueBillingProjectAggregation(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/billing-project-aggregation' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - - /** - * Get billing team aggregation queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueBillingTeamAggregation(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/billing-team-aggregation' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of builds that are waiting to be processed in the Appwrite * internal queue server. @@ -341,37 +279,6 @@ public function getQueueBuilds(?int $threshold = null): array ); } - /** - * Get the priority builds queue size. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueuePriorityBuilds(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/builds-priority' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of certificates that are waiting to be issued against * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue @@ -668,37 +575,6 @@ public function getQueueMigrations(?int $threshold = null): array ); } - /** - * Get region manager queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueRegionManager(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/region-manager' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of metrics that are waiting to be processed in the Appwrite * stats resources queue. @@ -763,37 +639,6 @@ public function getQueueUsage(?int $threshold = null): array ); } - /** - * Get threats queue. - * - * @param ?int $threshold - * @throws AppwriteException - * @return array - */ - public function getQueueThreats(?int $threshold = null): array - { - $apiPath = str_replace( - [], - [], - '/health/queue/threats' - ); - - $apiParams = []; - - if (!is_null($threshold)) { - $apiParams['threshold'] = $threshold; - } - - $apiHeaders = []; - - return $this->client->call( - Client::METHOD_GET, - $apiPath, - $apiHeaders, - $apiParams - ); - } - /** * Get the number of webhooks that are waiting to be processed in the Appwrite * internal queue server. diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php index 2fddf3a..e8ec1c1 100644 --- a/tests/Appwrite/Services/HealthTest.php +++ b/tests/Appwrite/Services/HealthTest.php @@ -150,36 +150,6 @@ public function testMethodGetQueueAudits(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueBillingProjectAggregation(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueBillingProjectAggregation( - ); - - $this->assertSame($data, $response); - } - - public function testMethodGetQueueBillingTeamAggregation(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueBillingTeamAggregation( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueBuilds(): void { $data = array( @@ -195,21 +165,6 @@ public function testMethodGetQueueBuilds(): void { $this->assertSame($data, $response); } - public function testMethodGetQueuePriorityBuilds(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueuePriorityBuilds( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueCertificates(): void { $data = array( @@ -346,21 +301,6 @@ public function testMethodGetQueueMigrations(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueRegionManager(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueRegionManager( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueStatsResources(): void { $data = array( @@ -391,21 +331,6 @@ public function testMethodGetQueueUsage(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueThreats(): void { - - $data = array( - "size" => 8); - - $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) - ->andReturn($data); - - $response = $this->health->getQueueThreats( - ); - - $this->assertSame($data, $response); - } - public function testMethodGetQueueWebhooks(): void { $data = array( From cf4c49608846bfacf18e291a6d1c668e896772c5 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Mar 2026 07:19:29 +0000 Subject: [PATCH 5/8] chore: update PHP SDK to 21.0.0 --- src/Appwrite/Enums/VCSReferenceType.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Appwrite/Enums/VCSReferenceType.php b/src/Appwrite/Enums/VCSReferenceType.php index f5ba3f0..adeb723 100644 --- a/src/Appwrite/Enums/VCSReferenceType.php +++ b/src/Appwrite/Enums/VCSReferenceType.php @@ -8,6 +8,7 @@ class VCSReferenceType implements JsonSerializable { private static VCSReferenceType $BRANCH; private static VCSReferenceType $COMMIT; + private static VCSReferenceType $TAG; private string $value; @@ -40,4 +41,11 @@ public static function COMMIT(): VCSReferenceType } return self::$COMMIT; } + public static function TAG(): VCSReferenceType + { + if (!isset(self::$TAG)) { + self::$TAG = new VCSReferenceType('tag'); + } + return self::$TAG; + } } \ No newline at end of file From 883f475e5199edf2030643fb28352a8823835a0a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Mar 2026 04:22:00 +0000 Subject: [PATCH 6/8] chore: update PHP SDK to 21.0.0 --- src/Appwrite/Enums/BuildRuntime.php | 688 ---------------------------- src/Appwrite/Enums/Runtime.php | 688 ---------------------------- 2 files changed, 1376 deletions(-) diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index 9bd1ad8..f0d01a0 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -92,92 +92,6 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $FLUTTER332; private static BuildRuntime $FLUTTER335; private static BuildRuntime $FLUTTER338; - private static BuildRuntime $NODE145RC; - private static BuildRuntime $NODE160RC; - private static BuildRuntime $NODE180RC; - private static BuildRuntime $NODE190RC; - private static BuildRuntime $NODE200RC; - private static BuildRuntime $NODE210RC; - private static BuildRuntime $NODE22RC; - private static BuildRuntime $NODE23RC; - private static BuildRuntime $NODE24RC; - private static BuildRuntime $NODE25RC; - private static BuildRuntime $PHP80RC; - private static BuildRuntime $PHP81RC; - private static BuildRuntime $PHP82RC; - private static BuildRuntime $PHP83RC; - private static BuildRuntime $PHP84RC; - private static BuildRuntime $RUBY30RC; - private static BuildRuntime $RUBY31RC; - private static BuildRuntime $RUBY32RC; - private static BuildRuntime $RUBY33RC; - private static BuildRuntime $RUBY34RC; - private static BuildRuntime $RUBY40RC; - private static BuildRuntime $PYTHON38RC; - private static BuildRuntime $PYTHON39RC; - private static BuildRuntime $PYTHON310RC; - private static BuildRuntime $PYTHON311RC; - private static BuildRuntime $PYTHON312RC; - private static BuildRuntime $PYTHON313RC; - private static BuildRuntime $PYTHON314RC; - private static BuildRuntime $PYTHONML311RC; - private static BuildRuntime $PYTHONML312RC; - private static BuildRuntime $PYTHONML313RC; - private static BuildRuntime $DENO140RC; - private static BuildRuntime $DENO146RC; - private static BuildRuntime $DENO20RC; - private static BuildRuntime $DENO25RC; - private static BuildRuntime $DENO26RC; - private static BuildRuntime $DART215RC; - private static BuildRuntime $DART216RC; - private static BuildRuntime $DART217RC; - private static BuildRuntime $DART218RC; - private static BuildRuntime $DART219RC; - private static BuildRuntime $DART30RC; - private static BuildRuntime $DART31RC; - private static BuildRuntime $DART33RC; - private static BuildRuntime $DART35RC; - private static BuildRuntime $DART38RC; - private static BuildRuntime $DART39RC; - private static BuildRuntime $DART310RC; - private static BuildRuntime $DOTNET60RC; - private static BuildRuntime $DOTNET70RC; - private static BuildRuntime $DOTNET80RC; - private static BuildRuntime $DOTNET10RC; - private static BuildRuntime $JAVA80RC; - private static BuildRuntime $JAVA110RC; - private static BuildRuntime $JAVA170RC; - private static BuildRuntime $JAVA180RC; - private static BuildRuntime $JAVA210RC; - private static BuildRuntime $JAVA22RC; - private static BuildRuntime $JAVA25RC; - private static BuildRuntime $SWIFT55RC; - private static BuildRuntime $SWIFT58RC; - private static BuildRuntime $SWIFT59RC; - private static BuildRuntime $SWIFT510RC; - private static BuildRuntime $SWIFT62RC; - private static BuildRuntime $KOTLIN16RC; - private static BuildRuntime $KOTLIN18RC; - private static BuildRuntime $KOTLIN19RC; - private static BuildRuntime $KOTLIN20RC; - private static BuildRuntime $KOTLIN23RC; - private static BuildRuntime $CPP17RC; - private static BuildRuntime $CPP20RC; - private static BuildRuntime $BUN10RC; - private static BuildRuntime $BUN11RC; - private static BuildRuntime $BUN12RC; - private static BuildRuntime $BUN13RC; - private static BuildRuntime $GO123RC; - private static BuildRuntime $GO124RC; - private static BuildRuntime $GO125RC; - private static BuildRuntime $GO126RC; - private static BuildRuntime $STATIC1RC; - private static BuildRuntime $FLUTTER324RC; - private static BuildRuntime $FLUTTER327RC; - private static BuildRuntime $FLUTTER329RC; - private static BuildRuntime $FLUTTER332RC; - private static BuildRuntime $FLUTTER335RC; - private static BuildRuntime $FLUTTER338RC; private string $value; @@ -798,606 +712,4 @@ public static function FLUTTER338(): BuildRuntime } return self::$FLUTTER338; } - public static function NODE145RC(): BuildRuntime - { - if (!isset(self::$NODE145RC)) { - self::$NODE145RC = new BuildRuntime('node-14.5-rc'); - } - return self::$NODE145RC; - } - public static function NODE160RC(): BuildRuntime - { - if (!isset(self::$NODE160RC)) { - self::$NODE160RC = new BuildRuntime('node-16.0-rc'); - } - return self::$NODE160RC; - } - public static function NODE180RC(): BuildRuntime - { - if (!isset(self::$NODE180RC)) { - self::$NODE180RC = new BuildRuntime('node-18.0-rc'); - } - return self::$NODE180RC; - } - public static function NODE190RC(): BuildRuntime - { - if (!isset(self::$NODE190RC)) { - self::$NODE190RC = new BuildRuntime('node-19.0-rc'); - } - return self::$NODE190RC; - } - public static function NODE200RC(): BuildRuntime - { - if (!isset(self::$NODE200RC)) { - self::$NODE200RC = new BuildRuntime('node-20.0-rc'); - } - return self::$NODE200RC; - } - public static function NODE210RC(): BuildRuntime - { - if (!isset(self::$NODE210RC)) { - self::$NODE210RC = new BuildRuntime('node-21.0-rc'); - } - return self::$NODE210RC; - } - public static function NODE22RC(): BuildRuntime - { - if (!isset(self::$NODE22RC)) { - self::$NODE22RC = new BuildRuntime('node-22-rc'); - } - return self::$NODE22RC; - } - public static function NODE23RC(): BuildRuntime - { - if (!isset(self::$NODE23RC)) { - self::$NODE23RC = new BuildRuntime('node-23-rc'); - } - return self::$NODE23RC; - } - public static function NODE24RC(): BuildRuntime - { - if (!isset(self::$NODE24RC)) { - self::$NODE24RC = new BuildRuntime('node-24-rc'); - } - return self::$NODE24RC; - } - public static function NODE25RC(): BuildRuntime - { - if (!isset(self::$NODE25RC)) { - self::$NODE25RC = new BuildRuntime('node-25-rc'); - } - return self::$NODE25RC; - } - public static function PHP80RC(): BuildRuntime - { - if (!isset(self::$PHP80RC)) { - self::$PHP80RC = new BuildRuntime('php-8.0-rc'); - } - return self::$PHP80RC; - } - public static function PHP81RC(): BuildRuntime - { - if (!isset(self::$PHP81RC)) { - self::$PHP81RC = new BuildRuntime('php-8.1-rc'); - } - return self::$PHP81RC; - } - public static function PHP82RC(): BuildRuntime - { - if (!isset(self::$PHP82RC)) { - self::$PHP82RC = new BuildRuntime('php-8.2-rc'); - } - return self::$PHP82RC; - } - public static function PHP83RC(): BuildRuntime - { - if (!isset(self::$PHP83RC)) { - self::$PHP83RC = new BuildRuntime('php-8.3-rc'); - } - return self::$PHP83RC; - } - public static function PHP84RC(): BuildRuntime - { - if (!isset(self::$PHP84RC)) { - self::$PHP84RC = new BuildRuntime('php-8.4-rc'); - } - return self::$PHP84RC; - } - public static function RUBY30RC(): BuildRuntime - { - if (!isset(self::$RUBY30RC)) { - self::$RUBY30RC = new BuildRuntime('ruby-3.0-rc'); - } - return self::$RUBY30RC; - } - public static function RUBY31RC(): BuildRuntime - { - if (!isset(self::$RUBY31RC)) { - self::$RUBY31RC = new BuildRuntime('ruby-3.1-rc'); - } - return self::$RUBY31RC; - } - public static function RUBY32RC(): BuildRuntime - { - if (!isset(self::$RUBY32RC)) { - self::$RUBY32RC = new BuildRuntime('ruby-3.2-rc'); - } - return self::$RUBY32RC; - } - public static function RUBY33RC(): BuildRuntime - { - if (!isset(self::$RUBY33RC)) { - self::$RUBY33RC = new BuildRuntime('ruby-3.3-rc'); - } - return self::$RUBY33RC; - } - public static function RUBY34RC(): BuildRuntime - { - if (!isset(self::$RUBY34RC)) { - self::$RUBY34RC = new BuildRuntime('ruby-3.4-rc'); - } - return self::$RUBY34RC; - } - public static function RUBY40RC(): BuildRuntime - { - if (!isset(self::$RUBY40RC)) { - self::$RUBY40RC = new BuildRuntime('ruby-4.0-rc'); - } - return self::$RUBY40RC; - } - public static function PYTHON38RC(): BuildRuntime - { - if (!isset(self::$PYTHON38RC)) { - self::$PYTHON38RC = new BuildRuntime('python-3.8-rc'); - } - return self::$PYTHON38RC; - } - public static function PYTHON39RC(): BuildRuntime - { - if (!isset(self::$PYTHON39RC)) { - self::$PYTHON39RC = new BuildRuntime('python-3.9-rc'); - } - return self::$PYTHON39RC; - } - public static function PYTHON310RC(): BuildRuntime - { - if (!isset(self::$PYTHON310RC)) { - self::$PYTHON310RC = new BuildRuntime('python-3.10-rc'); - } - return self::$PYTHON310RC; - } - public static function PYTHON311RC(): BuildRuntime - { - if (!isset(self::$PYTHON311RC)) { - self::$PYTHON311RC = new BuildRuntime('python-3.11-rc'); - } - return self::$PYTHON311RC; - } - public static function PYTHON312RC(): BuildRuntime - { - if (!isset(self::$PYTHON312RC)) { - self::$PYTHON312RC = new BuildRuntime('python-3.12-rc'); - } - return self::$PYTHON312RC; - } - public static function PYTHON313RC(): BuildRuntime - { - if (!isset(self::$PYTHON313RC)) { - self::$PYTHON313RC = new BuildRuntime('python-3.13-rc'); - } - return self::$PYTHON313RC; - } - public static function PYTHON314RC(): BuildRuntime - { - if (!isset(self::$PYTHON314RC)) { - self::$PYTHON314RC = new BuildRuntime('python-3.14-rc'); - } - return self::$PYTHON314RC; - } - public static function PYTHONML311RC(): BuildRuntime - { - if (!isset(self::$PYTHONML311RC)) { - self::$PYTHONML311RC = new BuildRuntime('python-ml-3.11-rc'); - } - return self::$PYTHONML311RC; - } - public static function PYTHONML312RC(): BuildRuntime - { - if (!isset(self::$PYTHONML312RC)) { - self::$PYTHONML312RC = new BuildRuntime('python-ml-3.12-rc'); - } - return self::$PYTHONML312RC; - } - public static function PYTHONML313RC(): BuildRuntime - { - if (!isset(self::$PYTHONML313RC)) { - self::$PYTHONML313RC = new BuildRuntime('python-ml-3.13-rc'); - } - return self::$PYTHONML313RC; - } - public static function DENO140RC(): BuildRuntime - { - if (!isset(self::$DENO140RC)) { - self::$DENO140RC = new BuildRuntime('deno-1.40-rc'); - } - return self::$DENO140RC; - } - public static function DENO146RC(): BuildRuntime - { - if (!isset(self::$DENO146RC)) { - self::$DENO146RC = new BuildRuntime('deno-1.46-rc'); - } - return self::$DENO146RC; - } - public static function DENO20RC(): BuildRuntime - { - if (!isset(self::$DENO20RC)) { - self::$DENO20RC = new BuildRuntime('deno-2.0-rc'); - } - return self::$DENO20RC; - } - public static function DENO25RC(): BuildRuntime - { - if (!isset(self::$DENO25RC)) { - self::$DENO25RC = new BuildRuntime('deno-2.5-rc'); - } - return self::$DENO25RC; - } - public static function DENO26RC(): BuildRuntime - { - if (!isset(self::$DENO26RC)) { - self::$DENO26RC = new BuildRuntime('deno-2.6-rc'); - } - return self::$DENO26RC; - } - public static function DART215RC(): BuildRuntime - { - if (!isset(self::$DART215RC)) { - self::$DART215RC = new BuildRuntime('dart-2.15-rc'); - } - return self::$DART215RC; - } - public static function DART216RC(): BuildRuntime - { - if (!isset(self::$DART216RC)) { - self::$DART216RC = new BuildRuntime('dart-2.16-rc'); - } - return self::$DART216RC; - } - public static function DART217RC(): BuildRuntime - { - if (!isset(self::$DART217RC)) { - self::$DART217RC = new BuildRuntime('dart-2.17-rc'); - } - return self::$DART217RC; - } - public static function DART218RC(): BuildRuntime - { - if (!isset(self::$DART218RC)) { - self::$DART218RC = new BuildRuntime('dart-2.18-rc'); - } - return self::$DART218RC; - } - public static function DART219RC(): BuildRuntime - { - if (!isset(self::$DART219RC)) { - self::$DART219RC = new BuildRuntime('dart-2.19-rc'); - } - return self::$DART219RC; - } - public static function DART30RC(): BuildRuntime - { - if (!isset(self::$DART30RC)) { - self::$DART30RC = new BuildRuntime('dart-3.0-rc'); - } - return self::$DART30RC; - } - public static function DART31RC(): BuildRuntime - { - if (!isset(self::$DART31RC)) { - self::$DART31RC = new BuildRuntime('dart-3.1-rc'); - } - return self::$DART31RC; - } - public static function DART33RC(): BuildRuntime - { - if (!isset(self::$DART33RC)) { - self::$DART33RC = new BuildRuntime('dart-3.3-rc'); - } - return self::$DART33RC; - } - public static function DART35RC(): BuildRuntime - { - if (!isset(self::$DART35RC)) { - self::$DART35RC = new BuildRuntime('dart-3.5-rc'); - } - return self::$DART35RC; - } - public static function DART38RC(): BuildRuntime - { - if (!isset(self::$DART38RC)) { - self::$DART38RC = new BuildRuntime('dart-3.8-rc'); - } - return self::$DART38RC; - } - public static function DART39RC(): BuildRuntime - { - if (!isset(self::$DART39RC)) { - self::$DART39RC = new BuildRuntime('dart-3.9-rc'); - } - return self::$DART39RC; - } - public static function DART310RC(): BuildRuntime - { - if (!isset(self::$DART310RC)) { - self::$DART310RC = new BuildRuntime('dart-3.10-rc'); - } - return self::$DART310RC; - } - public static function DOTNET60RC(): BuildRuntime - { - if (!isset(self::$DOTNET60RC)) { - self::$DOTNET60RC = new BuildRuntime('dotnet-6.0-rc'); - } - return self::$DOTNET60RC; - } - public static function DOTNET70RC(): BuildRuntime - { - if (!isset(self::$DOTNET70RC)) { - self::$DOTNET70RC = new BuildRuntime('dotnet-7.0-rc'); - } - return self::$DOTNET70RC; - } - public static function DOTNET80RC(): BuildRuntime - { - if (!isset(self::$DOTNET80RC)) { - self::$DOTNET80RC = new BuildRuntime('dotnet-8.0-rc'); - } - return self::$DOTNET80RC; - } - public static function DOTNET10RC(): BuildRuntime - { - if (!isset(self::$DOTNET10RC)) { - self::$DOTNET10RC = new BuildRuntime('dotnet-10-rc'); - } - return self::$DOTNET10RC; - } - public static function JAVA80RC(): BuildRuntime - { - if (!isset(self::$JAVA80RC)) { - self::$JAVA80RC = new BuildRuntime('java-8.0-rc'); - } - return self::$JAVA80RC; - } - public static function JAVA110RC(): BuildRuntime - { - if (!isset(self::$JAVA110RC)) { - self::$JAVA110RC = new BuildRuntime('java-11.0-rc'); - } - return self::$JAVA110RC; - } - public static function JAVA170RC(): BuildRuntime - { - if (!isset(self::$JAVA170RC)) { - self::$JAVA170RC = new BuildRuntime('java-17.0-rc'); - } - return self::$JAVA170RC; - } - public static function JAVA180RC(): BuildRuntime - { - if (!isset(self::$JAVA180RC)) { - self::$JAVA180RC = new BuildRuntime('java-18.0-rc'); - } - return self::$JAVA180RC; - } - public static function JAVA210RC(): BuildRuntime - { - if (!isset(self::$JAVA210RC)) { - self::$JAVA210RC = new BuildRuntime('java-21.0-rc'); - } - return self::$JAVA210RC; - } - public static function JAVA22RC(): BuildRuntime - { - if (!isset(self::$JAVA22RC)) { - self::$JAVA22RC = new BuildRuntime('java-22-rc'); - } - return self::$JAVA22RC; - } - public static function JAVA25RC(): BuildRuntime - { - if (!isset(self::$JAVA25RC)) { - self::$JAVA25RC = new BuildRuntime('java-25-rc'); - } - return self::$JAVA25RC; - } - public static function SWIFT55RC(): BuildRuntime - { - if (!isset(self::$SWIFT55RC)) { - self::$SWIFT55RC = new BuildRuntime('swift-5.5-rc'); - } - return self::$SWIFT55RC; - } - public static function SWIFT58RC(): BuildRuntime - { - if (!isset(self::$SWIFT58RC)) { - self::$SWIFT58RC = new BuildRuntime('swift-5.8-rc'); - } - return self::$SWIFT58RC; - } - public static function SWIFT59RC(): BuildRuntime - { - if (!isset(self::$SWIFT59RC)) { - self::$SWIFT59RC = new BuildRuntime('swift-5.9-rc'); - } - return self::$SWIFT59RC; - } - public static function SWIFT510RC(): BuildRuntime - { - if (!isset(self::$SWIFT510RC)) { - self::$SWIFT510RC = new BuildRuntime('swift-5.10-rc'); - } - return self::$SWIFT510RC; - } - public static function SWIFT62RC(): BuildRuntime - { - if (!isset(self::$SWIFT62RC)) { - self::$SWIFT62RC = new BuildRuntime('swift-6.2-rc'); - } - return self::$SWIFT62RC; - } - public static function KOTLIN16RC(): BuildRuntime - { - if (!isset(self::$KOTLIN16RC)) { - self::$KOTLIN16RC = new BuildRuntime('kotlin-1.6-rc'); - } - return self::$KOTLIN16RC; - } - public static function KOTLIN18RC(): BuildRuntime - { - if (!isset(self::$KOTLIN18RC)) { - self::$KOTLIN18RC = new BuildRuntime('kotlin-1.8-rc'); - } - return self::$KOTLIN18RC; - } - public static function KOTLIN19RC(): BuildRuntime - { - if (!isset(self::$KOTLIN19RC)) { - self::$KOTLIN19RC = new BuildRuntime('kotlin-1.9-rc'); - } - return self::$KOTLIN19RC; - } - public static function KOTLIN20RC(): BuildRuntime - { - if (!isset(self::$KOTLIN20RC)) { - self::$KOTLIN20RC = new BuildRuntime('kotlin-2.0-rc'); - } - return self::$KOTLIN20RC; - } - public static function KOTLIN23RC(): BuildRuntime - { - if (!isset(self::$KOTLIN23RC)) { - self::$KOTLIN23RC = new BuildRuntime('kotlin-2.3-rc'); - } - return self::$KOTLIN23RC; - } - public static function CPP17RC(): BuildRuntime - { - if (!isset(self::$CPP17RC)) { - self::$CPP17RC = new BuildRuntime('cpp-17-rc'); - } - return self::$CPP17RC; - } - public static function CPP20RC(): BuildRuntime - { - if (!isset(self::$CPP20RC)) { - self::$CPP20RC = new BuildRuntime('cpp-20-rc'); - } - return self::$CPP20RC; - } - public static function BUN10RC(): BuildRuntime - { - if (!isset(self::$BUN10RC)) { - self::$BUN10RC = new BuildRuntime('bun-1.0-rc'); - } - return self::$BUN10RC; - } - public static function BUN11RC(): BuildRuntime - { - if (!isset(self::$BUN11RC)) { - self::$BUN11RC = new BuildRuntime('bun-1.1-rc'); - } - return self::$BUN11RC; - } - public static function BUN12RC(): BuildRuntime - { - if (!isset(self::$BUN12RC)) { - self::$BUN12RC = new BuildRuntime('bun-1.2-rc'); - } - return self::$BUN12RC; - } - public static function BUN13RC(): BuildRuntime - { - if (!isset(self::$BUN13RC)) { - self::$BUN13RC = new BuildRuntime('bun-1.3-rc'); - } - return self::$BUN13RC; - } - public static function GO123RC(): BuildRuntime - { - if (!isset(self::$GO123RC)) { - self::$GO123RC = new BuildRuntime('go-1.23-rc'); - } - return self::$GO123RC; - } - public static function GO124RC(): BuildRuntime - { - if (!isset(self::$GO124RC)) { - self::$GO124RC = new BuildRuntime('go-1.24-rc'); - } - return self::$GO124RC; - } - public static function GO125RC(): BuildRuntime - { - if (!isset(self::$GO125RC)) { - self::$GO125RC = new BuildRuntime('go-1.25-rc'); - } - return self::$GO125RC; - } - public static function GO126RC(): BuildRuntime - { - if (!isset(self::$GO126RC)) { - self::$GO126RC = new BuildRuntime('go-1.26-rc'); - } - return self::$GO126RC; - } - public static function STATIC1RC(): BuildRuntime - { - if (!isset(self::$STATIC1RC)) { - self::$STATIC1RC = new BuildRuntime('static-1-rc'); - } - return self::$STATIC1RC; - } - public static function FLUTTER324RC(): BuildRuntime - { - if (!isset(self::$FLUTTER324RC)) { - self::$FLUTTER324RC = new BuildRuntime('flutter-3.24-rc'); - } - return self::$FLUTTER324RC; - } - public static function FLUTTER327RC(): BuildRuntime - { - if (!isset(self::$FLUTTER327RC)) { - self::$FLUTTER327RC = new BuildRuntime('flutter-3.27-rc'); - } - return self::$FLUTTER327RC; - } - public static function FLUTTER329RC(): BuildRuntime - { - if (!isset(self::$FLUTTER329RC)) { - self::$FLUTTER329RC = new BuildRuntime('flutter-3.29-rc'); - } - return self::$FLUTTER329RC; - } - public static function FLUTTER332RC(): BuildRuntime - { - if (!isset(self::$FLUTTER332RC)) { - self::$FLUTTER332RC = new BuildRuntime('flutter-3.32-rc'); - } - return self::$FLUTTER332RC; - } - public static function FLUTTER335RC(): BuildRuntime - { - if (!isset(self::$FLUTTER335RC)) { - self::$FLUTTER335RC = new BuildRuntime('flutter-3.35-rc'); - } - return self::$FLUTTER335RC; - } - public static function FLUTTER338RC(): BuildRuntime - { - if (!isset(self::$FLUTTER338RC)) { - self::$FLUTTER338RC = new BuildRuntime('flutter-3.38-rc'); - } - return self::$FLUTTER338RC; - } } \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 21f8b61..2388a96 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -92,92 +92,6 @@ class Runtime implements JsonSerializable private static Runtime $FLUTTER332; private static Runtime $FLUTTER335; private static Runtime $FLUTTER338; - private static Runtime $NODE145RC; - private static Runtime $NODE160RC; - private static Runtime $NODE180RC; - private static Runtime $NODE190RC; - private static Runtime $NODE200RC; - private static Runtime $NODE210RC; - private static Runtime $NODE22RC; - private static Runtime $NODE23RC; - private static Runtime $NODE24RC; - private static Runtime $NODE25RC; - private static Runtime $PHP80RC; - private static Runtime $PHP81RC; - private static Runtime $PHP82RC; - private static Runtime $PHP83RC; - private static Runtime $PHP84RC; - private static Runtime $RUBY30RC; - private static Runtime $RUBY31RC; - private static Runtime $RUBY32RC; - private static Runtime $RUBY33RC; - private static Runtime $RUBY34RC; - private static Runtime $RUBY40RC; - private static Runtime $PYTHON38RC; - private static Runtime $PYTHON39RC; - private static Runtime $PYTHON310RC; - private static Runtime $PYTHON311RC; - private static Runtime $PYTHON312RC; - private static Runtime $PYTHON313RC; - private static Runtime $PYTHON314RC; - private static Runtime $PYTHONML311RC; - private static Runtime $PYTHONML312RC; - private static Runtime $PYTHONML313RC; - private static Runtime $DENO140RC; - private static Runtime $DENO146RC; - private static Runtime $DENO20RC; - private static Runtime $DENO25RC; - private static Runtime $DENO26RC; - private static Runtime $DART215RC; - private static Runtime $DART216RC; - private static Runtime $DART217RC; - private static Runtime $DART218RC; - private static Runtime $DART219RC; - private static Runtime $DART30RC; - private static Runtime $DART31RC; - private static Runtime $DART33RC; - private static Runtime $DART35RC; - private static Runtime $DART38RC; - private static Runtime $DART39RC; - private static Runtime $DART310RC; - private static Runtime $DOTNET60RC; - private static Runtime $DOTNET70RC; - private static Runtime $DOTNET80RC; - private static Runtime $DOTNET10RC; - private static Runtime $JAVA80RC; - private static Runtime $JAVA110RC; - private static Runtime $JAVA170RC; - private static Runtime $JAVA180RC; - private static Runtime $JAVA210RC; - private static Runtime $JAVA22RC; - private static Runtime $JAVA25RC; - private static Runtime $SWIFT55RC; - private static Runtime $SWIFT58RC; - private static Runtime $SWIFT59RC; - private static Runtime $SWIFT510RC; - private static Runtime $SWIFT62RC; - private static Runtime $KOTLIN16RC; - private static Runtime $KOTLIN18RC; - private static Runtime $KOTLIN19RC; - private static Runtime $KOTLIN20RC; - private static Runtime $KOTLIN23RC; - private static Runtime $CPP17RC; - private static Runtime $CPP20RC; - private static Runtime $BUN10RC; - private static Runtime $BUN11RC; - private static Runtime $BUN12RC; - private static Runtime $BUN13RC; - private static Runtime $GO123RC; - private static Runtime $GO124RC; - private static Runtime $GO125RC; - private static Runtime $GO126RC; - private static Runtime $STATIC1RC; - private static Runtime $FLUTTER324RC; - private static Runtime $FLUTTER327RC; - private static Runtime $FLUTTER329RC; - private static Runtime $FLUTTER332RC; - private static Runtime $FLUTTER335RC; - private static Runtime $FLUTTER338RC; private string $value; @@ -798,606 +712,4 @@ public static function FLUTTER338(): Runtime } return self::$FLUTTER338; } - public static function NODE145RC(): Runtime - { - if (!isset(self::$NODE145RC)) { - self::$NODE145RC = new Runtime('node-14.5-rc'); - } - return self::$NODE145RC; - } - public static function NODE160RC(): Runtime - { - if (!isset(self::$NODE160RC)) { - self::$NODE160RC = new Runtime('node-16.0-rc'); - } - return self::$NODE160RC; - } - public static function NODE180RC(): Runtime - { - if (!isset(self::$NODE180RC)) { - self::$NODE180RC = new Runtime('node-18.0-rc'); - } - return self::$NODE180RC; - } - public static function NODE190RC(): Runtime - { - if (!isset(self::$NODE190RC)) { - self::$NODE190RC = new Runtime('node-19.0-rc'); - } - return self::$NODE190RC; - } - public static function NODE200RC(): Runtime - { - if (!isset(self::$NODE200RC)) { - self::$NODE200RC = new Runtime('node-20.0-rc'); - } - return self::$NODE200RC; - } - public static function NODE210RC(): Runtime - { - if (!isset(self::$NODE210RC)) { - self::$NODE210RC = new Runtime('node-21.0-rc'); - } - return self::$NODE210RC; - } - public static function NODE22RC(): Runtime - { - if (!isset(self::$NODE22RC)) { - self::$NODE22RC = new Runtime('node-22-rc'); - } - return self::$NODE22RC; - } - public static function NODE23RC(): Runtime - { - if (!isset(self::$NODE23RC)) { - self::$NODE23RC = new Runtime('node-23-rc'); - } - return self::$NODE23RC; - } - public static function NODE24RC(): Runtime - { - if (!isset(self::$NODE24RC)) { - self::$NODE24RC = new Runtime('node-24-rc'); - } - return self::$NODE24RC; - } - public static function NODE25RC(): Runtime - { - if (!isset(self::$NODE25RC)) { - self::$NODE25RC = new Runtime('node-25-rc'); - } - return self::$NODE25RC; - } - public static function PHP80RC(): Runtime - { - if (!isset(self::$PHP80RC)) { - self::$PHP80RC = new Runtime('php-8.0-rc'); - } - return self::$PHP80RC; - } - public static function PHP81RC(): Runtime - { - if (!isset(self::$PHP81RC)) { - self::$PHP81RC = new Runtime('php-8.1-rc'); - } - return self::$PHP81RC; - } - public static function PHP82RC(): Runtime - { - if (!isset(self::$PHP82RC)) { - self::$PHP82RC = new Runtime('php-8.2-rc'); - } - return self::$PHP82RC; - } - public static function PHP83RC(): Runtime - { - if (!isset(self::$PHP83RC)) { - self::$PHP83RC = new Runtime('php-8.3-rc'); - } - return self::$PHP83RC; - } - public static function PHP84RC(): Runtime - { - if (!isset(self::$PHP84RC)) { - self::$PHP84RC = new Runtime('php-8.4-rc'); - } - return self::$PHP84RC; - } - public static function RUBY30RC(): Runtime - { - if (!isset(self::$RUBY30RC)) { - self::$RUBY30RC = new Runtime('ruby-3.0-rc'); - } - return self::$RUBY30RC; - } - public static function RUBY31RC(): Runtime - { - if (!isset(self::$RUBY31RC)) { - self::$RUBY31RC = new Runtime('ruby-3.1-rc'); - } - return self::$RUBY31RC; - } - public static function RUBY32RC(): Runtime - { - if (!isset(self::$RUBY32RC)) { - self::$RUBY32RC = new Runtime('ruby-3.2-rc'); - } - return self::$RUBY32RC; - } - public static function RUBY33RC(): Runtime - { - if (!isset(self::$RUBY33RC)) { - self::$RUBY33RC = new Runtime('ruby-3.3-rc'); - } - return self::$RUBY33RC; - } - public static function RUBY34RC(): Runtime - { - if (!isset(self::$RUBY34RC)) { - self::$RUBY34RC = new Runtime('ruby-3.4-rc'); - } - return self::$RUBY34RC; - } - public static function RUBY40RC(): Runtime - { - if (!isset(self::$RUBY40RC)) { - self::$RUBY40RC = new Runtime('ruby-4.0-rc'); - } - return self::$RUBY40RC; - } - public static function PYTHON38RC(): Runtime - { - if (!isset(self::$PYTHON38RC)) { - self::$PYTHON38RC = new Runtime('python-3.8-rc'); - } - return self::$PYTHON38RC; - } - public static function PYTHON39RC(): Runtime - { - if (!isset(self::$PYTHON39RC)) { - self::$PYTHON39RC = new Runtime('python-3.9-rc'); - } - return self::$PYTHON39RC; - } - public static function PYTHON310RC(): Runtime - { - if (!isset(self::$PYTHON310RC)) { - self::$PYTHON310RC = new Runtime('python-3.10-rc'); - } - return self::$PYTHON310RC; - } - public static function PYTHON311RC(): Runtime - { - if (!isset(self::$PYTHON311RC)) { - self::$PYTHON311RC = new Runtime('python-3.11-rc'); - } - return self::$PYTHON311RC; - } - public static function PYTHON312RC(): Runtime - { - if (!isset(self::$PYTHON312RC)) { - self::$PYTHON312RC = new Runtime('python-3.12-rc'); - } - return self::$PYTHON312RC; - } - public static function PYTHON313RC(): Runtime - { - if (!isset(self::$PYTHON313RC)) { - self::$PYTHON313RC = new Runtime('python-3.13-rc'); - } - return self::$PYTHON313RC; - } - public static function PYTHON314RC(): Runtime - { - if (!isset(self::$PYTHON314RC)) { - self::$PYTHON314RC = new Runtime('python-3.14-rc'); - } - return self::$PYTHON314RC; - } - public static function PYTHONML311RC(): Runtime - { - if (!isset(self::$PYTHONML311RC)) { - self::$PYTHONML311RC = new Runtime('python-ml-3.11-rc'); - } - return self::$PYTHONML311RC; - } - public static function PYTHONML312RC(): Runtime - { - if (!isset(self::$PYTHONML312RC)) { - self::$PYTHONML312RC = new Runtime('python-ml-3.12-rc'); - } - return self::$PYTHONML312RC; - } - public static function PYTHONML313RC(): Runtime - { - if (!isset(self::$PYTHONML313RC)) { - self::$PYTHONML313RC = new Runtime('python-ml-3.13-rc'); - } - return self::$PYTHONML313RC; - } - public static function DENO140RC(): Runtime - { - if (!isset(self::$DENO140RC)) { - self::$DENO140RC = new Runtime('deno-1.40-rc'); - } - return self::$DENO140RC; - } - public static function DENO146RC(): Runtime - { - if (!isset(self::$DENO146RC)) { - self::$DENO146RC = new Runtime('deno-1.46-rc'); - } - return self::$DENO146RC; - } - public static function DENO20RC(): Runtime - { - if (!isset(self::$DENO20RC)) { - self::$DENO20RC = new Runtime('deno-2.0-rc'); - } - return self::$DENO20RC; - } - public static function DENO25RC(): Runtime - { - if (!isset(self::$DENO25RC)) { - self::$DENO25RC = new Runtime('deno-2.5-rc'); - } - return self::$DENO25RC; - } - public static function DENO26RC(): Runtime - { - if (!isset(self::$DENO26RC)) { - self::$DENO26RC = new Runtime('deno-2.6-rc'); - } - return self::$DENO26RC; - } - public static function DART215RC(): Runtime - { - if (!isset(self::$DART215RC)) { - self::$DART215RC = new Runtime('dart-2.15-rc'); - } - return self::$DART215RC; - } - public static function DART216RC(): Runtime - { - if (!isset(self::$DART216RC)) { - self::$DART216RC = new Runtime('dart-2.16-rc'); - } - return self::$DART216RC; - } - public static function DART217RC(): Runtime - { - if (!isset(self::$DART217RC)) { - self::$DART217RC = new Runtime('dart-2.17-rc'); - } - return self::$DART217RC; - } - public static function DART218RC(): Runtime - { - if (!isset(self::$DART218RC)) { - self::$DART218RC = new Runtime('dart-2.18-rc'); - } - return self::$DART218RC; - } - public static function DART219RC(): Runtime - { - if (!isset(self::$DART219RC)) { - self::$DART219RC = new Runtime('dart-2.19-rc'); - } - return self::$DART219RC; - } - public static function DART30RC(): Runtime - { - if (!isset(self::$DART30RC)) { - self::$DART30RC = new Runtime('dart-3.0-rc'); - } - return self::$DART30RC; - } - public static function DART31RC(): Runtime - { - if (!isset(self::$DART31RC)) { - self::$DART31RC = new Runtime('dart-3.1-rc'); - } - return self::$DART31RC; - } - public static function DART33RC(): Runtime - { - if (!isset(self::$DART33RC)) { - self::$DART33RC = new Runtime('dart-3.3-rc'); - } - return self::$DART33RC; - } - public static function DART35RC(): Runtime - { - if (!isset(self::$DART35RC)) { - self::$DART35RC = new Runtime('dart-3.5-rc'); - } - return self::$DART35RC; - } - public static function DART38RC(): Runtime - { - if (!isset(self::$DART38RC)) { - self::$DART38RC = new Runtime('dart-3.8-rc'); - } - return self::$DART38RC; - } - public static function DART39RC(): Runtime - { - if (!isset(self::$DART39RC)) { - self::$DART39RC = new Runtime('dart-3.9-rc'); - } - return self::$DART39RC; - } - public static function DART310RC(): Runtime - { - if (!isset(self::$DART310RC)) { - self::$DART310RC = new Runtime('dart-3.10-rc'); - } - return self::$DART310RC; - } - public static function DOTNET60RC(): Runtime - { - if (!isset(self::$DOTNET60RC)) { - self::$DOTNET60RC = new Runtime('dotnet-6.0-rc'); - } - return self::$DOTNET60RC; - } - public static function DOTNET70RC(): Runtime - { - if (!isset(self::$DOTNET70RC)) { - self::$DOTNET70RC = new Runtime('dotnet-7.0-rc'); - } - return self::$DOTNET70RC; - } - public static function DOTNET80RC(): Runtime - { - if (!isset(self::$DOTNET80RC)) { - self::$DOTNET80RC = new Runtime('dotnet-8.0-rc'); - } - return self::$DOTNET80RC; - } - public static function DOTNET10RC(): Runtime - { - if (!isset(self::$DOTNET10RC)) { - self::$DOTNET10RC = new Runtime('dotnet-10-rc'); - } - return self::$DOTNET10RC; - } - public static function JAVA80RC(): Runtime - { - if (!isset(self::$JAVA80RC)) { - self::$JAVA80RC = new Runtime('java-8.0-rc'); - } - return self::$JAVA80RC; - } - public static function JAVA110RC(): Runtime - { - if (!isset(self::$JAVA110RC)) { - self::$JAVA110RC = new Runtime('java-11.0-rc'); - } - return self::$JAVA110RC; - } - public static function JAVA170RC(): Runtime - { - if (!isset(self::$JAVA170RC)) { - self::$JAVA170RC = new Runtime('java-17.0-rc'); - } - return self::$JAVA170RC; - } - public static function JAVA180RC(): Runtime - { - if (!isset(self::$JAVA180RC)) { - self::$JAVA180RC = new Runtime('java-18.0-rc'); - } - return self::$JAVA180RC; - } - public static function JAVA210RC(): Runtime - { - if (!isset(self::$JAVA210RC)) { - self::$JAVA210RC = new Runtime('java-21.0-rc'); - } - return self::$JAVA210RC; - } - public static function JAVA22RC(): Runtime - { - if (!isset(self::$JAVA22RC)) { - self::$JAVA22RC = new Runtime('java-22-rc'); - } - return self::$JAVA22RC; - } - public static function JAVA25RC(): Runtime - { - if (!isset(self::$JAVA25RC)) { - self::$JAVA25RC = new Runtime('java-25-rc'); - } - return self::$JAVA25RC; - } - public static function SWIFT55RC(): Runtime - { - if (!isset(self::$SWIFT55RC)) { - self::$SWIFT55RC = new Runtime('swift-5.5-rc'); - } - return self::$SWIFT55RC; - } - public static function SWIFT58RC(): Runtime - { - if (!isset(self::$SWIFT58RC)) { - self::$SWIFT58RC = new Runtime('swift-5.8-rc'); - } - return self::$SWIFT58RC; - } - public static function SWIFT59RC(): Runtime - { - if (!isset(self::$SWIFT59RC)) { - self::$SWIFT59RC = new Runtime('swift-5.9-rc'); - } - return self::$SWIFT59RC; - } - public static function SWIFT510RC(): Runtime - { - if (!isset(self::$SWIFT510RC)) { - self::$SWIFT510RC = new Runtime('swift-5.10-rc'); - } - return self::$SWIFT510RC; - } - public static function SWIFT62RC(): Runtime - { - if (!isset(self::$SWIFT62RC)) { - self::$SWIFT62RC = new Runtime('swift-6.2-rc'); - } - return self::$SWIFT62RC; - } - public static function KOTLIN16RC(): Runtime - { - if (!isset(self::$KOTLIN16RC)) { - self::$KOTLIN16RC = new Runtime('kotlin-1.6-rc'); - } - return self::$KOTLIN16RC; - } - public static function KOTLIN18RC(): Runtime - { - if (!isset(self::$KOTLIN18RC)) { - self::$KOTLIN18RC = new Runtime('kotlin-1.8-rc'); - } - return self::$KOTLIN18RC; - } - public static function KOTLIN19RC(): Runtime - { - if (!isset(self::$KOTLIN19RC)) { - self::$KOTLIN19RC = new Runtime('kotlin-1.9-rc'); - } - return self::$KOTLIN19RC; - } - public static function KOTLIN20RC(): Runtime - { - if (!isset(self::$KOTLIN20RC)) { - self::$KOTLIN20RC = new Runtime('kotlin-2.0-rc'); - } - return self::$KOTLIN20RC; - } - public static function KOTLIN23RC(): Runtime - { - if (!isset(self::$KOTLIN23RC)) { - self::$KOTLIN23RC = new Runtime('kotlin-2.3-rc'); - } - return self::$KOTLIN23RC; - } - public static function CPP17RC(): Runtime - { - if (!isset(self::$CPP17RC)) { - self::$CPP17RC = new Runtime('cpp-17-rc'); - } - return self::$CPP17RC; - } - public static function CPP20RC(): Runtime - { - if (!isset(self::$CPP20RC)) { - self::$CPP20RC = new Runtime('cpp-20-rc'); - } - return self::$CPP20RC; - } - public static function BUN10RC(): Runtime - { - if (!isset(self::$BUN10RC)) { - self::$BUN10RC = new Runtime('bun-1.0-rc'); - } - return self::$BUN10RC; - } - public static function BUN11RC(): Runtime - { - if (!isset(self::$BUN11RC)) { - self::$BUN11RC = new Runtime('bun-1.1-rc'); - } - return self::$BUN11RC; - } - public static function BUN12RC(): Runtime - { - if (!isset(self::$BUN12RC)) { - self::$BUN12RC = new Runtime('bun-1.2-rc'); - } - return self::$BUN12RC; - } - public static function BUN13RC(): Runtime - { - if (!isset(self::$BUN13RC)) { - self::$BUN13RC = new Runtime('bun-1.3-rc'); - } - return self::$BUN13RC; - } - public static function GO123RC(): Runtime - { - if (!isset(self::$GO123RC)) { - self::$GO123RC = new Runtime('go-1.23-rc'); - } - return self::$GO123RC; - } - public static function GO124RC(): Runtime - { - if (!isset(self::$GO124RC)) { - self::$GO124RC = new Runtime('go-1.24-rc'); - } - return self::$GO124RC; - } - public static function GO125RC(): Runtime - { - if (!isset(self::$GO125RC)) { - self::$GO125RC = new Runtime('go-1.25-rc'); - } - return self::$GO125RC; - } - public static function GO126RC(): Runtime - { - if (!isset(self::$GO126RC)) { - self::$GO126RC = new Runtime('go-1.26-rc'); - } - return self::$GO126RC; - } - public static function STATIC1RC(): Runtime - { - if (!isset(self::$STATIC1RC)) { - self::$STATIC1RC = new Runtime('static-1-rc'); - } - return self::$STATIC1RC; - } - public static function FLUTTER324RC(): Runtime - { - if (!isset(self::$FLUTTER324RC)) { - self::$FLUTTER324RC = new Runtime('flutter-3.24-rc'); - } - return self::$FLUTTER324RC; - } - public static function FLUTTER327RC(): Runtime - { - if (!isset(self::$FLUTTER327RC)) { - self::$FLUTTER327RC = new Runtime('flutter-3.27-rc'); - } - return self::$FLUTTER327RC; - } - public static function FLUTTER329RC(): Runtime - { - if (!isset(self::$FLUTTER329RC)) { - self::$FLUTTER329RC = new Runtime('flutter-3.29-rc'); - } - return self::$FLUTTER329RC; - } - public static function FLUTTER332RC(): Runtime - { - if (!isset(self::$FLUTTER332RC)) { - self::$FLUTTER332RC = new Runtime('flutter-3.32-rc'); - } - return self::$FLUTTER332RC; - } - public static function FLUTTER335RC(): Runtime - { - if (!isset(self::$FLUTTER335RC)) { - self::$FLUTTER335RC = new Runtime('flutter-3.35-rc'); - } - return self::$FLUTTER335RC; - } - public static function FLUTTER338RC(): Runtime - { - if (!isset(self::$FLUTTER338RC)) { - self::$FLUTTER338RC = new Runtime('flutter-3.38-rc'); - } - return self::$FLUTTER338RC; - } } \ No newline at end of file From ba45e54c8d633aea2ba1e7133444095d9e980211 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Mar 2026 05:06:15 +0000 Subject: [PATCH 7/8] chore: update PHP SDK to 21.0.0 --- docs/examples/databases/upsert-documents.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 4d989d5..5bc04d7 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -7,7 +7,7 @@ use Appwrite\Services\Databases; $client = (new Client()) ->setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with + ->setKey(''); // Your secret API key $databases = new Databases($client); From 954a2edcce66e4c88fe636eb86b193cc22c7c146 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Mar 2026 05:18:05 +0000 Subject: [PATCH 8/8] chore: update PHP SDK to 21.0.0 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8feda41..d4c557f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ ## 21.0.0 * [BREAKING] Changed `$sequence` type from `int` to `string` for rows and documents +* [BREAKING] Renamed `IndexType` enum: split into `DatabasesIndexType` (for Databases) and `TablesDBIndexType` (for TablesDB) +* [BREAKING] Replaced `specification` parameter with `buildSpecification` and `runtimeSpecification` in `Functions::create()`, `Functions::update()`, `Sites::create()`, `Sites::update()` +* Added new `Project` service with full CRUD for project-level environment variables +* Added new `Webhooks` service with full CRUD for project webhooks (including `updateSignature`) +* Added `Users::updateImpersonator()` method for enabling/disabling user impersonation +* Added impersonation support: `setImpersonateUserId()`, `setImpersonateUserEmail()`, `setImpersonateUserPhone()` on `Client` +* Added `deploymentRetention` parameter to Functions and Sites create/update +* Added `startCommand` parameter to Sites create/update +* Added `Documentsdb`, `Vectorsdb` values to `BackupServices` and `DatabaseType` enums +* Added `WebhooksRead`, `WebhooksWrite`, `ProjectRead`, `ProjectWrite` scopes +* Removed `getQueueBillingProjectAggregation`, `getQueueBillingTeamAggregation`, `getQueuePriorityBuilds`, `getQueueRegionManager`, `getQueueThreats` from `Health` service +* Updated `Log` model field descriptions to clarify impersonation behavior +* Updated `X-Appwrite-Response-Format` header to `1.9.0` ## 20.2.0