From efcbe593db46e33ae82f338c4e0614a2af2213e8 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 03:11:23 +1200 Subject: [PATCH 1/7] Add 1.8.x support --- README.md | 4 +- docs/databases.md | 121 +- docs/examples/databases/create.md | 3 +- docs/examples/functions/create-execution.md | 2 +- .../tablesdb/create-boolean-column.md | 20 + .../tablesdb/create-datetime-column.md | 20 + docs/examples/tablesdb/create-email-column.md | 20 + docs/examples/tablesdb/create-enum-column.md | 21 + docs/examples/tablesdb/create-float-column.md | 22 + docs/examples/tablesdb/create-index.md | 22 + .../tablesdb/create-integer-column.md | 22 + docs/examples/tablesdb/create-ip-column.md | 20 + .../tablesdb/create-relationship-column.md | 23 + docs/examples/tablesdb/create-row.md | 19 + docs/examples/tablesdb/create-rows.md | 17 + .../examples/tablesdb/create-string-column.md | 22 + docs/examples/tablesdb/create-table.md | 20 + docs/examples/tablesdb/create-url-column.md | 20 + docs/examples/tablesdb/create.md | 18 + .../examples/tablesdb/decrement-row-column.md | 20 + docs/examples/tablesdb/delete-column.md | 17 + docs/examples/tablesdb/delete-index.md | 17 + docs/examples/tablesdb/delete-row.md | 17 + docs/examples/tablesdb/delete-rows.md | 17 + docs/examples/tablesdb/delete-table.md | 16 + docs/examples/tablesdb/delete.md | 15 + docs/examples/tablesdb/get-column.md | 17 + docs/examples/tablesdb/get-index.md | 17 + docs/examples/tablesdb/get-row.md | 18 + docs/examples/tablesdb/get-table.md | 16 + docs/examples/tablesdb/get.md | 15 + .../examples/tablesdb/increment-row-column.md | 20 + docs/examples/tablesdb/list-columns.md | 17 + docs/examples/tablesdb/list-indexes.md | 17 + docs/examples/tablesdb/list-rows.md | 17 + docs/examples/tablesdb/list-tables.md | 17 + docs/examples/tablesdb/list.md | 16 + .../tablesdb/update-boolean-column.md | 20 + .../tablesdb/update-datetime-column.md | 20 + docs/examples/tablesdb/update-email-column.md | 20 + docs/examples/tablesdb/update-enum-column.md | 21 + docs/examples/tablesdb/update-float-column.md | 22 + .../tablesdb/update-integer-column.md | 22 + docs/examples/tablesdb/update-ip-column.md | 20 + .../tablesdb/update-relationship-column.md | 19 + docs/examples/tablesdb/update-row.md | 19 + docs/examples/tablesdb/update-rows.md | 18 + .../examples/tablesdb/update-string-column.md | 21 + docs/examples/tablesdb/update-table.md | 20 + docs/examples/tablesdb/update-url-column.md | 20 + docs/examples/tablesdb/update.md | 17 + docs/examples/tablesdb/upsert-row.md | 19 + docs/examples/tablesdb/upsert-rows.md | 17 + docs/tablesdb.md | 848 +++++++ src/Appwrite/Client.php | 6 +- src/Appwrite/Enums/Type.php | 43 + src/Appwrite/Query.php | 105 + src/Appwrite/Services/Account.php | 4 + src/Appwrite/Services/Databases.php | 179 +- src/Appwrite/Services/TablesDb.php | 2093 +++++++++++++++++ tests/Appwrite/QueryTest.php | 44 + tests/Appwrite/Services/DatabasesTest.php | 23 +- tests/Appwrite/Services/TablesDbTest.php | 1211 ++++++++++ 63 files changed, 5509 insertions(+), 104 deletions(-) create mode 100644 docs/examples/tablesdb/create-boolean-column.md create mode 100644 docs/examples/tablesdb/create-datetime-column.md create mode 100644 docs/examples/tablesdb/create-email-column.md create mode 100644 docs/examples/tablesdb/create-enum-column.md create mode 100644 docs/examples/tablesdb/create-float-column.md create mode 100644 docs/examples/tablesdb/create-index.md create mode 100644 docs/examples/tablesdb/create-integer-column.md create mode 100644 docs/examples/tablesdb/create-ip-column.md create mode 100644 docs/examples/tablesdb/create-relationship-column.md create mode 100644 docs/examples/tablesdb/create-row.md create mode 100644 docs/examples/tablesdb/create-rows.md create mode 100644 docs/examples/tablesdb/create-string-column.md create mode 100644 docs/examples/tablesdb/create-table.md create mode 100644 docs/examples/tablesdb/create-url-column.md create mode 100644 docs/examples/tablesdb/create.md create mode 100644 docs/examples/tablesdb/decrement-row-column.md create mode 100644 docs/examples/tablesdb/delete-column.md create mode 100644 docs/examples/tablesdb/delete-index.md create mode 100644 docs/examples/tablesdb/delete-row.md create mode 100644 docs/examples/tablesdb/delete-rows.md create mode 100644 docs/examples/tablesdb/delete-table.md create mode 100644 docs/examples/tablesdb/delete.md create mode 100644 docs/examples/tablesdb/get-column.md create mode 100644 docs/examples/tablesdb/get-index.md create mode 100644 docs/examples/tablesdb/get-row.md create mode 100644 docs/examples/tablesdb/get-table.md create mode 100644 docs/examples/tablesdb/get.md create mode 100644 docs/examples/tablesdb/increment-row-column.md create mode 100644 docs/examples/tablesdb/list-columns.md create mode 100644 docs/examples/tablesdb/list-indexes.md create mode 100644 docs/examples/tablesdb/list-rows.md create mode 100644 docs/examples/tablesdb/list-tables.md create mode 100644 docs/examples/tablesdb/list.md create mode 100644 docs/examples/tablesdb/update-boolean-column.md create mode 100644 docs/examples/tablesdb/update-datetime-column.md create mode 100644 docs/examples/tablesdb/update-email-column.md create mode 100644 docs/examples/tablesdb/update-enum-column.md create mode 100644 docs/examples/tablesdb/update-float-column.md create mode 100644 docs/examples/tablesdb/update-integer-column.md create mode 100644 docs/examples/tablesdb/update-ip-column.md create mode 100644 docs/examples/tablesdb/update-relationship-column.md create mode 100644 docs/examples/tablesdb/update-row.md create mode 100644 docs/examples/tablesdb/update-rows.md create mode 100644 docs/examples/tablesdb/update-string-column.md create mode 100644 docs/examples/tablesdb/update-table.md create mode 100644 docs/examples/tablesdb/update-url-column.md create mode 100644 docs/examples/tablesdb/update.md create mode 100644 docs/examples/tablesdb/upsert-row.md create mode 100644 docs/examples/tablesdb/upsert-rows.md create mode 100644 docs/tablesdb.md create mode 100644 src/Appwrite/Enums/Type.php create mode 100644 src/Appwrite/Services/TablesDb.php create mode 100644 tests/Appwrite/Services/TablesDbTest.php diff --git a/README.md b/README.md index 382a055..3fc6168 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # 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.7.4-blue.svg?style=flat-square&v=1) +![Version](https://img.shields.io/badge/api%20version-1.8.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) -**This SDK is compatible with Appwrite server version 1.7.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.8.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 abstract and simplify 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/docs/databases.md b/docs/databases.md index acca9fc..e9c7dac 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -29,6 +29,7 @@ POST https://cloud.appwrite.io/v1/databases | 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 | +| type | string | Database type. | tablesdb | ```http request @@ -162,7 +163,7 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI | 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). | | +| collectionId | string | **Required** Collection 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: key, type, size, required, array, status, error | [] | @@ -178,7 +179,7 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | | key | string | Attribute Key. | | | required | boolean | Is attribute required? | | | default | boolean | Default value for attribute when not provided. Cannot be set when attribute is required. | | @@ -196,7 +197,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | boolean | Default value for attribute when not provided. Cannot be set when attribute is required. | | @@ -214,7 +215,7 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). | | | key | string | Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. | | @@ -232,7 +233,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | @@ -251,7 +252,7 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | @@ -270,18 +271,18 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | -| newKey | string | New attribute key. | | +| newKey | string | New Attribute Key. | | ```http request POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/enum ``` -** Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. +** Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. ** ### Parameters @@ -289,9 +290,9 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | Attribute Key. | | -| elements | array | Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. | | +| elements | array | Array of enum values. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | | array | boolean | Is attribute an array? | | @@ -309,12 +310,12 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | -| elements | array | Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. | | +| elements | array | Updated list of enum values. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | -| newKey | string | New attribute key. | | +| newKey | string | New Attribute Key. | | ```http request @@ -329,12 +330,12 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | Attribute Key. | | | required | boolean | Is attribute required? | | -| min | number | Minimum value to enforce on new documents | | -| max | number | Maximum value to enforce on new documents | | -| default | number | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| min | number | Minimum value. | | +| max | number | Maximum value. | | +| default | number | Default value. Cannot be set when required. | | | array | boolean | Is attribute an array? | | @@ -350,13 +351,13 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | -| min | number | Minimum value to enforce on new documents | | -| max | number | Maximum value to enforce on new documents | | -| default | number | Default value for attribute when not provided. Cannot be set when attribute is required. | | -| newKey | string | New attribute key. | | +| min | number | Minimum value. | | +| max | number | Maximum value. | | +| default | number | Default value. Cannot be set when required. | | +| newKey | string | New Attribute Key. | | ```http request @@ -371,12 +372,12 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | Attribute Key. | | | required | boolean | Is attribute required? | | -| min | integer | Minimum value to enforce on new documents | | -| max | integer | Maximum value to enforce on new documents | | -| default | integer | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when attribute is required. | | | array | boolean | Is attribute an array? | | @@ -392,13 +393,13 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | -| min | integer | Minimum value to enforce on new documents | | -| max | integer | Maximum value to enforce on new documents | | -| default | integer | Default value for attribute when not provided. Cannot be set when attribute is required. | | -| newKey | string | New attribute key. | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when attribute is required. | | +| newKey | string | New Attribute Key. | | ```http request @@ -413,10 +414,10 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | Attribute Key. | | | required | boolean | Is attribute required? | | -| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| default | string | Default value. Cannot be set when attribute is required. | | | array | boolean | Is attribute an array? | | @@ -432,11 +433,11 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | -| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | -| newKey | string | New attribute key. | | +| default | string | Default value. Cannot be set when attribute is required. | | +| newKey | string | New Attribute Key. | | ```http request @@ -451,8 +452,8 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | -| relatedCollectionId | string | Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| collectionId | string | **Required** Collection ID. | | +| relatedCollectionId | string | Related Collection ID. | | | type | string | Relation type | | | twoWay | boolean | Is Two Way? | | | key | string | Attribute Key. | | @@ -472,7 +473,7 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | | key | string | Attribute Key. | | | size | integer | Attribute size for text attributes, in number of characters. | | | required | boolean | Is attribute required? | | @@ -493,12 +494,12 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | | size | integer | Maximum size of the string attribute. | | -| newKey | string | New attribute key. | | +| newKey | string | New Attribute Key. | | ```http request @@ -513,7 +514,7 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | @@ -532,11 +533,11 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | | required | boolean | Is attribute required? | | | default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | -| newKey | string | New attribute key. | | +| newKey | string | New Attribute Key. | | ```http request @@ -550,7 +551,7 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | @@ -565,7 +566,7 @@ DELETE https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collecti | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | @@ -581,10 +582,10 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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). | | +| collectionId | string | **Required** Collection ID. | | | key | string | **Required** Attribute Key. | | | onDelete | string | Constraints option | | -| newKey | string | New attribute key. | | +| newKey | string | New Attribute Key. | | ```http request @@ -623,9 +624,7 @@ POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collection POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents ``` -** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. ** +** Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. ** ### Parameters @@ -640,9 +639,7 @@ Create new Documents. Before using this route, you should create a new collectio PUT https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents ``` -** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. +** Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. ** ### Parameters @@ -658,9 +655,7 @@ Create or update Documents. Before using this route, you should create a new col PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents ``` -** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -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. ** +** 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 @@ -676,9 +671,7 @@ Update all documents that match your queries, if no queries are submitted then a DELETE https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents ``` -** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Bulk delete documents using queries, if no queries are passed then all documents are deleted. ** +** Bulk delete documents using queries, if no queries are passed then all documents are deleted. ** ### Parameters @@ -709,9 +702,7 @@ GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionI PUT https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} ``` -** **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. - -Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. ** +** Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. ** ### Parameters @@ -770,7 +761,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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 | +| value | number | Value to increment 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. | | diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 73c6188..c1b4fb5 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -13,5 +13,6 @@ $databases = new Databases($client); $result = $databases->create( databaseId: '', name: '', - enabled: false // optional + enabled: false, // optional + type: ::TABLESDB() // optional ); \ No newline at end of file diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 9aeb976..cd11b5e 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -17,5 +17,5 @@ $result = $functions->createExecution( path: '', // optional method: ExecutionMethod::GET(), // optional headers: [], // optional - scheduledAt: '' // optional + scheduledAt: '' // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md new file mode 100644 index 0000000..5a609b6 --- /dev/null +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createBooleanColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: false, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md new file mode 100644 index 0000000..9ac6470 --- /dev/null +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md new file mode 100644 index 0000000..c0102f2 --- /dev/null +++ b/docs/examples/tablesdb/create-email-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createEmailColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: 'email@example.com', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md new file mode 100644 index 0000000..eb299bb --- /dev/null +++ b/docs/examples/tablesdb/create-enum-column.md @@ -0,0 +1,21 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + required: false, + default: '', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md new file mode 100644 index 0000000..3fad526 --- /dev/null +++ b/docs/examples/tablesdb/create-float-column.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createFloatColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md new file mode 100644 index 0000000..ecb9cf8 --- /dev/null +++ b/docs/examples/tablesdb/create-index.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createIndex( + databaseId: '', + tableId: '', + key: '', + type: IndexType::KEY(), + columns: [], + orders: [], // optional + lengths: [] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md new file mode 100644 index 0000000..f6ef4b2 --- /dev/null +++ b/docs/examples/tablesdb/create-integer-column.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createIntegerColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md new file mode 100644 index 0000000..3b993a1 --- /dev/null +++ b/docs/examples/tablesdb/create-ip-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createIpColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md new file mode 100644 index 0000000..713541c --- /dev/null +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -0,0 +1,23 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createRelationshipColumn( + databaseId: '', + tableId: '', + relatedTableId: '', + type: RelationshipType::ONETOONE(), + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: RelationMutate::CASCADE() // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md new file mode 100644 index 0000000..bfdd395 --- /dev/null +++ b/docs/examples/tablesdb/create-row.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createRow( + databaseId: '', + tableId: '', + rowId: '', + data: [], + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md new file mode 100644 index 0000000..8b5868a --- /dev/null +++ b/docs/examples/tablesdb/create-rows.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createRows( + databaseId: '', + tableId: '', + rows: [] +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md new file mode 100644 index 0000000..8534713 --- /dev/null +++ b/docs/examples/tablesdb/create-string-column.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createStringColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + required: false, + default: '', // optional + array: false, // optional + encrypt: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md new file mode 100644 index 0000000..d72fa62 --- /dev/null +++ b/docs/examples/tablesdb/create-table.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createTable( + databaseId: '', + tableId: '', + name: '', + permissions: ["read("any")"], // optional + rowSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md new file mode 100644 index 0000000..e180b08 --- /dev/null +++ b/docs/examples/tablesdb/create-url-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->createUrlColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: 'https://example.com', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md new file mode 100644 index 0000000..f16a317 --- /dev/null +++ b/docs/examples/tablesdb/create.md @@ -0,0 +1,18 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->create( + databaseId: '', + name: '', + enabled: false, // optional + type: ::TABLESDB() // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md new file mode 100644 index 0000000..ccaf9b4 --- /dev/null +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->decrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + value: null, // optional + min: null // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md new file mode 100644 index 0000000..84f665c --- /dev/null +++ b/docs/examples/tablesdb/delete-column.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->deleteColumn( + databaseId: '', + tableId: '', + key: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md new file mode 100644 index 0000000..f979e89 --- /dev/null +++ b/docs/examples/tablesdb/delete-index.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->deleteIndex( + databaseId: '', + tableId: '', + key: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md new file mode 100644 index 0000000..f71cd58 --- /dev/null +++ b/docs/examples/tablesdb/delete-row.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->deleteRow( + databaseId: '', + tableId: '', + rowId: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md new file mode 100644 index 0000000..81056ed --- /dev/null +++ b/docs/examples/tablesdb/delete-rows.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->deleteRows( + databaseId: '', + tableId: '', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md new file mode 100644 index 0000000..3df53e5 --- /dev/null +++ b/docs/examples/tablesdb/delete-table.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->deleteTable( + databaseId: '', + tableId: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md new file mode 100644 index 0000000..1013108 --- /dev/null +++ b/docs/examples/tablesdb/delete.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->delete( + databaseId: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md new file mode 100644 index 0000000..9a3af22 --- /dev/null +++ b/docs/examples/tablesdb/get-column.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->getColumn( + databaseId: '', + tableId: '', + key: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md new file mode 100644 index 0000000..9847d6a --- /dev/null +++ b/docs/examples/tablesdb/get-index.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->getIndex( + databaseId: '', + tableId: '', + key: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md new file mode 100644 index 0000000..40487b6 --- /dev/null +++ b/docs/examples/tablesdb/get-row.md @@ -0,0 +1,18 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->getRow( + databaseId: '', + tableId: '', + rowId: '', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md new file mode 100644 index 0000000..6e85066 --- /dev/null +++ b/docs/examples/tablesdb/get-table.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->getTable( + databaseId: '', + tableId: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md new file mode 100644 index 0000000..8e79508 --- /dev/null +++ b/docs/examples/tablesdb/get.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->get( + databaseId: '' +); \ No newline at end of file diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md new file mode 100644 index 0000000..a76d74a --- /dev/null +++ b/docs/examples/tablesdb/increment-row-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->incrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + value: null, // optional + max: null // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md new file mode 100644 index 0000000..4e3631e --- /dev/null +++ b/docs/examples/tablesdb/list-columns.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->listColumns( + databaseId: '', + tableId: '', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md new file mode 100644 index 0000000..5a777e9 --- /dev/null +++ b/docs/examples/tablesdb/list-indexes.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->listIndexes( + databaseId: '', + tableId: '', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md new file mode 100644 index 0000000..7674a4b --- /dev/null +++ b/docs/examples/tablesdb/list-rows.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->listRows( + databaseId: '', + tableId: '', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md new file mode 100644 index 0000000..a46fdaf --- /dev/null +++ b/docs/examples/tablesdb/list-tables.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->listTables( + databaseId: '', + queries: [], // optional + search: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md new file mode 100644 index 0000000..d03a68b --- /dev/null +++ b/docs/examples/tablesdb/list.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->list( + queries: [], // optional + search: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md new file mode 100644 index 0000000..ed043ae --- /dev/null +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateBooleanColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: false, + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md new file mode 100644 index 0000000..3b7aa77 --- /dev/null +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md new file mode 100644 index 0000000..9833589 --- /dev/null +++ b/docs/examples/tablesdb/update-email-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateEmailColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: 'email@example.com', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md new file mode 100644 index 0000000..dbbadba --- /dev/null +++ b/docs/examples/tablesdb/update-enum-column.md @@ -0,0 +1,21 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + required: false, + default: '', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md new file mode 100644 index 0000000..2ac1708 --- /dev/null +++ b/docs/examples/tablesdb/update-float-column.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateFloatColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md new file mode 100644 index 0000000..b81911f --- /dev/null +++ b/docs/examples/tablesdb/update-integer-column.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateIntegerColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md new file mode 100644 index 0000000..2eddf86 --- /dev/null +++ b/docs/examples/tablesdb/update-ip-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateIpColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md new file mode 100644 index 0000000..c36e79a --- /dev/null +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateRelationshipColumn( + databaseId: '', + tableId: '', + key: '', + onDelete: RelationMutate::CASCADE(), // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md new file mode 100644 index 0000000..c6df2e0 --- /dev/null +++ b/docs/examples/tablesdb/update-row.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateRow( + databaseId: '', + tableId: '', + rowId: '', + data: [], // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md new file mode 100644 index 0000000..8349727 --- /dev/null +++ b/docs/examples/tablesdb/update-rows.md @@ -0,0 +1,18 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateRows( + databaseId: '', + tableId: '', + data: [], // optional + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md new file mode 100644 index 0000000..457c4ba --- /dev/null +++ b/docs/examples/tablesdb/update-string-column.md @@ -0,0 +1,21 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateStringColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + size: 1, // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md new file mode 100644 index 0000000..6cd7f0f --- /dev/null +++ b/docs/examples/tablesdb/update-table.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateTable( + databaseId: '', + tableId: '', + name: '', + permissions: ["read("any")"], // optional + rowSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md new file mode 100644 index 0000000..43a3e45 --- /dev/null +++ b/docs/examples/tablesdb/update-url-column.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->updateUrlColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: 'https://example.com', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md new file mode 100644 index 0000000..fe6764e --- /dev/null +++ b/docs/examples/tablesdb/update.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->update( + databaseId: '', + name: '', + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md new file mode 100644 index 0000000..db02dc2 --- /dev/null +++ b/docs/examples/tablesdb/upsert-row.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->upsertRow( + databaseId: '', + tableId: '', + rowId: '', + data: [], // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md new file mode 100644 index 0000000..77d321a --- /dev/null +++ b/docs/examples/tablesdb/upsert-rows.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDb = new TablesDb($client); + +$result = $tablesDb->upsertRows( + databaseId: '', + tableId: '', + rows: [] +); \ No newline at end of file diff --git a/docs/tablesdb.md b/docs/tablesdb.md new file mode 100644 index 0000000..6e00860 --- /dev/null +++ b/docs/tablesdb.md @@ -0,0 +1,848 @@ +# TablesDb Service + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb +``` + +** 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 attributes: name | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb +``` + +** 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 | +| type | string | Database type. | tablesdb | + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb/{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/tablesdb/{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/tablesdb/{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/tablesdb/{databaseId}/tables +``` + +** Get a list of all tables 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, rowSecurity | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables +``` + +** Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | 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 | Table 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). | | +| rowSecurity | boolean | Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId} +``` + +** Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId} +``` + +** Update a table by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| name | string | Table 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). | | +| rowSecurity | boolean | Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. | 1 | + + +```http request +DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId} +``` + +** Delete a table 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. | | +| tableId | string | **Required** Table ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns +``` + +** List columns in the table. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table 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: key, type, size, required, array, status, error | [] | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/boolean +``` + +** Create a boolean column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | boolean | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key} +``` + +** Update a boolean column. Changing the `default` value will not update already existing rows. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | boolean | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/datetime +``` + +** Create a date time column according to the ISO 8601 standard. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key} +``` + +** Update a date time column. Changing the `default` value will not update already existing rows. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/email +``` + +** Create an email column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key} +``` + +** Update an email column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/enum +``` + +** Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| elements | array | Array of enum values. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key} +``` + +** Update an enum column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| elements | array | Updated list of enum values. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/float +``` + +** Create a float column. Optionally, minimum and maximum values can be provided. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| min | number | Minimum value | | +| max | number | Maximum value | | +| default | number | Default value. Cannot be set when required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key} +``` + +** Update a float column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| min | number | Minimum value | | +| max | number | Maximum value | | +| default | number | Default value. Cannot be set when required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/integer +``` + +** Create an integer column. Optionally, minimum and maximum values can be provided. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key} +``` + +** Update an integer column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| min | integer | Minimum value | | +| max | integer | Maximum value | | +| default | integer | Default value. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/ip +``` + +** Create IP address column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key} +``` + +** Update an ip column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/relationship +``` + +** Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| relatedTableId | string | Related Table ID. | | +| type | string | Relation type | | +| twoWay | boolean | Is Two Way? | | +| key | string | Column Key. | | +| twoWayKey | string | Two Way Column Key. | | +| onDelete | string | Constraints option | restrict | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/string +``` + +** Create a string column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| key | string | Column Key. | | +| size | integer | Attribute size for text attributes, in number of characters. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | +| encrypt | boolean | Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key} +``` + +** Update a string column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| size | integer | Maximum size of the string column. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/url +``` + +** Create a URL column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key} +``` + +** Update an url column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/{key} +``` + +** Get column by ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/{key} +``` + +** Deletes a column. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship +``` + +** Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| key | string | **Required** Column Key. | | +| onDelete | string | Constraints option | | +| newKey | string | New Column Key. | | + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes +``` + +** List indexes in the collection. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| 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 | [] | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes +``` + +** Creates an index on the columns listed. Your index should include all the columns 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. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| key | string | Index Key. | | +| type | string | Index type. | | +| columns | array | Array of columns to index. Maximum of 100 columns 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/tablesdb/{databaseId}/tables/{tableId}/indexes/{key} +``` + +** Get index by ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| key | string | **Required** Index Key. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes/{key} +``` + +** Delete an index. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| key | string | **Required** Index Key. | | + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows +``` + +** Get a list of all the user's rows in a given table. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| 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. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows +``` + +** Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. | | +| rowId | string | Row 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 | Row 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/tablesdb/{databaseId}/tables/{tableId}/rows +``` + +** Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. | | +| rows | array | Array of documents data as JSON objects. | [] | + + +```http request +PUT https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows +``` + +** Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| rows | array | Array of row data as JSON objects. May contain partial rows. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows +``` + +** Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| data | object | Row data as JSON object. Include only column 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. | [] | + + +```http request +DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows +``` + +** Bulk delete rows using queries, if no queries are passed then all rows are deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| 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. | [] | + + +```http request +GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId} +``` + +** Get a row by its unique ID. This endpoint response returns a JSON object with the row data. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| rowId | string | **Required** Row 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. | [] | + + +```http request +PUT https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId} +``` + +** Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| rowId | string | **Required** Row ID. | | +| data | object | Row data as JSON object. Include all required columns of the row 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). | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId} +``` + +** Update a row 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. | | +| tableId | string | **Required** Table ID. | | +| rowId | string | **Required** Row ID. | | +| data | object | Row data as JSON object. Include only columns 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). | | + + +```http request +DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId} +``` + +** Delete a row by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| rowId | string | **Required** Row ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement +``` + +** Decrement a specific column of a row by a given value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| rowId | string | **Required** Row ID. | | +| column | string | **Required** Column key. | | +| value | number | Value to increment the column by. The value must be a number. | 1 | +| min | number | Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment +``` + +** Increment a specific column of a row by a given value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. | | +| rowId | string | **Required** Row ID. | | +| column | string | **Required** Column key. | | +| value | number | Value to increment the column by. The value must be a number. | 1 | +| max | number | Maximum value for the column. If the current value is greater than this value, an error will be thrown. | | + diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 4288210..5c1c208 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/15.1.0 ()', + 'user-agent' => 'AppwritePHPSDK/16.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '15.1.0', + 'x-sdk-version'=> '16.0.0', ]; /** @@ -49,7 +49,7 @@ class Client */ public function __construct() { - $this->headers['X-Appwrite-Response-Format'] = '1.7.0'; + $this->headers['X-Appwrite-Response-Format'] = '1.8.0'; } diff --git a/src/Appwrite/Enums/Type.php b/src/Appwrite/Enums/Type.php new file mode 100644 index 0000000..984e370 --- /dev/null +++ b/src/Appwrite/Enums/Type.php @@ -0,0 +1,43 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function TABLESDB(): Type + { + if (!isset(self::$TABLESDB)) { + self::$TABLESDB = new Type('tablesdb'); + } + return self::$TABLESDB; + } + public static function LEGACY(): Type + { + if (!isset(self::$LEGACY)) { + self::$LEGACY = new Type('legacy'); + } + return self::$LEGACY; + } +} \ No newline at end of file diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php index a27235a..ab717fd 100644 --- a/src/Appwrite/Query.php +++ b/src/Appwrite/Query.php @@ -267,6 +267,111 @@ public static function contains(string $attribute, $value): string return (new Query('contains', $attribute, $value))->__toString(); } + /** + * Not Contains + * + * @param string $attribute + * @param mixed $value + * @return string + */ + public static function notContains(string $attribute, $value): string + { + return (new Query('notContains', $attribute, $value))->__toString(); + } + + /** + * Not Search + * + * @param string $attribute + * @param string $value + * @return string + */ + public static function notSearch(string $attribute, string $value): string + { + return (new Query('notSearch', $attribute, $value))->__toString(); + } + + /** + * Not Between + * + * @param string $attribute + * @param string|int|float $start + * @param string|int|float $end + * @return string + */ + public static function notBetween(string $attribute, mixed $start, mixed $end): string + { + return (new Query('notBetween', $attribute, [$start, $end]))->__toString(); + } + + /** + * Not Starts With + * + * @param string $attribute + * @param string $value + * @return string + */ + public static function notStartsWith(string $attribute, string $value): string + { + return (new Query('notStartsWith', $attribute, $value))->__toString(); + } + + /** + * Not Ends With + * + * @param string $attribute + * @param string $value + * @return string + */ + public static function notEndsWith(string $attribute, string $value): string + { + return (new Query('notEndsWith', $attribute, $value))->__toString(); + } + + /** + * Created Before + * + * @param string $value + * @return string + */ + public static function createdBefore(string $value): string + { + return (new Query('createdBefore', null, $value))->__toString(); + } + + /** + * Created After + * + * @param string $value + * @return string + */ + public static function createdAfter(string $value): string + { + return (new Query('createdAfter', null, $value))->__toString(); + } + + /** + * Updated Before + * + * @param string $value + * @return string + */ + public static function updatedBefore(string $value): string + { + return (new Query('updatedBefore', null, $value))->__toString(); + } + + /** + * Updated After + * + * @param string $value + * @return string + */ + public static function updatedAfter(string $value): string + { + return (new Query('updatedAfter', null, $value))->__toString(); + } + /** * Or * diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 13c7d7f..92257b8 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -923,6 +923,8 @@ public function createEmailPasswordSession(string $email, string $password): arr * @param string $secret * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated. */ public function updateMagicURLSession(string $userId, string $secret): array { @@ -956,6 +958,8 @@ public function updateMagicURLSession(string $userId, string $secret): array * @param string $secret * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated. */ public function updatePhoneSession(string $userId, string $secret): array { diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 19cfdbd..6da5409 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -6,6 +6,7 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; +use Appwrite\Enums\Type; use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; @@ -25,6 +26,9 @@ public function __construct(Client $client) * @param ?string $search * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `list` instead. + * @see TablesDb::list */ public function list(?array $queries = null, ?string $search = null): array { @@ -61,10 +65,14 @@ public function list(?array $queries = null, ?string $search = null): array * @param string $databaseId * @param string $name * @param ?bool $enabled + * @param ?Type $type * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createDatabase` instead. + * @see TablesDb::createDatabase */ - public function create(string $databaseId, string $name, ?bool $enabled = null): array + public function create(string $databaseId, string $name, ?bool $enabled = null, ?Type $type = null): array { $apiPath = str_replace( [], @@ -80,6 +88,10 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): $apiParams['enabled'] = $enabled; } + if (!is_null($type)) { + $apiParams['type'] = $type; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -98,6 +110,9 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): * @param string $databaseId * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `get` instead. + * @see TablesDb::get */ public function get(string $databaseId): array { @@ -128,6 +143,9 @@ public function get(string $databaseId): array * @param ?bool $enabled * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `update` instead. + * @see TablesDb::update */ public function update(string $databaseId, string $name, ?bool $enabled = null): array { @@ -163,6 +181,9 @@ public function update(string $databaseId, string $name, ?bool $enabled = null): * @param string $databaseId * @throws AppwriteException * @return string + * + * @deprecated This API has been deprecated since 1.8.0. Please use `delete` instead. + * @see TablesDb::delete */ public function delete(string $databaseId): string { @@ -195,6 +216,9 @@ public function delete(string $databaseId): string * @param ?string $search * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `listTables` instead. + * @see TablesDb::listTables */ public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null): array { @@ -239,6 +263,9 @@ public function listCollections(string $databaseId, ?array $queries = null, ?str * @param ?bool $enabled * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createTable` instead. + * @see TablesDb::createTable */ public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array { @@ -284,6 +311,9 @@ public function createCollection(string $databaseId, string $collectionId, strin * @param string $collectionId * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `getTable` instead. + * @see TablesDb::getTable */ public function getCollection(string $databaseId, string $collectionId): array { @@ -318,6 +348,9 @@ public function getCollection(string $databaseId, string $collectionId): array * @param ?bool $enabled * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateTable` instead. + * @see TablesDb::updateTable */ public function updateCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array { @@ -363,6 +396,9 @@ public function updateCollection(string $databaseId, string $collectionId, strin * @param string $collectionId * @throws AppwriteException * @return string + * + * @deprecated This API has been deprecated since 1.8.0. Please use `deleteTable` instead. + * @see TablesDb::deleteTable */ public function deleteCollection(string $databaseId, string $collectionId): string { @@ -395,6 +431,9 @@ public function deleteCollection(string $databaseId, string $collectionId): stri * @param ?array $queries * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `listColumns` instead. + * @see TablesDb::listColumns */ public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -434,6 +473,9 @@ public function listAttributes(string $databaseId, string $collectionId, ?array * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createBooleanColumn` instead. + * @see TablesDb::createBooleanColumn */ public function createBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): array { @@ -480,6 +522,9 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateBooleanColumn` instead. + * @see TablesDb::updateBooleanColumn */ public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): array { @@ -522,6 +567,9 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createDatetimeColumn` instead. + * @see TablesDb::createDatetimeColumn */ public function createDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -568,6 +616,9 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateDatetimeColumn` instead. + * @see TablesDb::updateDatetimeColumn */ public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -611,6 +662,9 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createEmailColumn` instead. + * @see TablesDb::createEmailColumn */ public function createEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -658,6 +712,9 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateEmailColumn` instead. + * @see TablesDb::updateEmailColumn */ public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -690,8 +747,8 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s } /** - * Create an enumeration attribute. The `elements` param acts as a white-list - * of accepted values for this attribute. + * Create an enum attribute. The `elements` param acts as a white-list of + * accepted values for this attribute. * * * @param string $databaseId @@ -703,6 +760,9 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createEnumColumn` instead. + * @see TablesDb::createEnumColumn */ public function createEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -752,6 +812,9 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateEnumColumn` instead. + * @see TablesDb::updateEnumColumn */ public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -799,6 +862,9 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createFloatColumn` instead. + * @see TablesDb::createFloatColumn */ public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): array { @@ -856,6 +922,9 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateFloatColumn` instead. + * @see TablesDb::updateFloatColumn */ public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $xdefault, ?float $min = null, ?float $max = null, ?string $newKey = null): array { @@ -910,6 +979,9 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createIntegerColumn` instead. + * @see TablesDb::createIntegerColumn */ public function createIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): array { @@ -967,6 +1039,9 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateIntegerColumn` instead. + * @see TablesDb::updateIntegerColumn */ public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): array { @@ -1018,6 +1093,9 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createIpColumn` instead. + * @see TablesDb::createIpColumn */ public function createIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -1065,6 +1143,9 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateIpColumn` instead. + * @see TablesDb::updateIpColumn */ public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -1111,6 +1192,9 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri * @param ?RelationMutate $onDelete * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createRelationshipColumn` instead. + * @see TablesDb::createRelationshipColumn */ public function createRelationshipAttribute(string $databaseId, string $collectionId, string $relatedCollectionId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): array { @@ -1167,6 +1251,9 @@ public function createRelationshipAttribute(string $databaseId, string $collecti * @param ?bool $encrypt * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createStringColumn` instead. + * @see TablesDb::createStringColumn */ public function createStringAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array { @@ -1220,6 +1307,9 @@ public function createStringAttribute(string $databaseId, string $collectionId, * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateStringColumn` instead. + * @see TablesDb::updateStringColumn */ public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array { @@ -1267,6 +1357,9 @@ public function updateStringAttribute(string $databaseId, string $collectionId, * @param ?bool $xarray * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createUrlColumn` instead. + * @see TablesDb::createUrlColumn */ public function createUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -1314,6 +1407,9 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateUrlColumn` instead. + * @see TablesDb::updateUrlColumn */ public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -1353,6 +1449,9 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str * @param string $key * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `getColumn` instead. + * @see TablesDb::getColumn */ public function getAttribute(string $databaseId, string $collectionId, string $key): array { @@ -1385,6 +1484,9 @@ public function getAttribute(string $databaseId, string $collectionId, string $k * @param string $key * @throws AppwriteException * @return string + * + * @deprecated This API has been deprecated since 1.8.0. Please use `deleteColumn` instead. + * @see TablesDb::deleteColumn */ public function deleteAttribute(string $databaseId, string $collectionId, string $key): string { @@ -1422,6 +1524,9 @@ public function deleteAttribute(string $databaseId, string $collectionId, string * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateRelationshipColumn` instead. + * @see TablesDb::updateRelationshipColumn */ public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): array { @@ -1464,6 +1569,9 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti * @param ?array $queries * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `listRows` instead. + * @see TablesDb::listRows */ public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -1504,6 +1612,9 @@ public function listDocuments(string $databaseId, string $collectionId, ?array $ * @param ?array $permissions * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createRow` instead. + * @see TablesDb::createRow */ public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array { @@ -1535,10 +1646,6 @@ public function createDocument(string $databaseId, string $collectionId, string } /** - * **WARNING: Experimental Feature** - This endpoint is experimental and not - * yet officially supported. It may be subject to breaking changes or removal - * in future versions. - * * Create new Documents. Before using this route, you should create a new * collection resource using either a [server * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) @@ -1549,6 +1656,9 @@ public function createDocument(string $databaseId, string $collectionId, string * @param array $documents * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createRows` instead. + * @see TablesDb::createRows */ public function createDocuments(string $databaseId, string $collectionId, array $documents): array { @@ -1575,10 +1685,6 @@ public function createDocuments(string $databaseId, string $collectionId, array } /** - * **WARNING: Experimental Feature** - This endpoint is experimental and not - * yet officially supported. It may be subject to breaking changes or removal - * in future versions. - * * Create or update Documents. Before using this route, you should create a * new collection resource using either a [server * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) @@ -1590,6 +1696,9 @@ public function createDocuments(string $databaseId, string $collectionId, array * @param array $documents * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRows` instead. + * @see TablesDb::upsertRows */ public function upsertDocuments(string $databaseId, string $collectionId, array $documents): array { @@ -1616,10 +1725,6 @@ public function upsertDocuments(string $databaseId, string $collectionId, array } /** - * **WARNING: Experimental Feature** - This endpoint is experimental and not - * yet officially supported. It may be subject to breaking changes or removal - * in future versions. - * * 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. @@ -1630,6 +1735,9 @@ public function upsertDocuments(string $databaseId, string $collectionId, array * @param ?array $queries * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateRows` instead. + * @see TablesDb::updateRows */ public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null): array { @@ -1663,10 +1771,6 @@ public function updateDocuments(string $databaseId, string $collectionId, ?array } /** - * **WARNING: Experimental Feature** - This endpoint is experimental and not - * yet officially supported. It may be subject to breaking changes or removal - * in future versions. - * * Bulk delete documents using queries, if no queries are passed then all * documents are deleted. * @@ -1675,6 +1779,9 @@ public function updateDocuments(string $databaseId, string $collectionId, ?array * @param ?array $queries * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `deleteRows` instead. + * @see TablesDb::deleteRows */ public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -1713,6 +1820,9 @@ public function deleteDocuments(string $databaseId, string $collectionId, ?array * @param ?array $queries * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `getRow` instead. + * @see TablesDb::getRow */ public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null): array { @@ -1742,10 +1852,6 @@ public function getDocument(string $databaseId, string $collectionId, string $do } /** - * **WARNING: Experimental Feature** - This endpoint is experimental and not - * yet officially supported. It may be subject to breaking changes or removal - * in future versions. - * * Create or update a Document. Before using this route, you should create a * new collection resource using either a [server * integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) @@ -1758,6 +1864,9 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @param ?array $permissions * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRow` instead. + * @see TablesDb::upsertRow */ public function upsertDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array { @@ -1799,6 +1908,9 @@ public function upsertDocument(string $databaseId, string $collectionId, string * @param ?array $permissions * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateRow` instead. + * @see TablesDb::updateRow */ public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null): array { @@ -1840,6 +1952,9 @@ public function updateDocument(string $databaseId, string $collectionId, string * @param string $documentId * @throws AppwriteException * @return string + * + * @deprecated This API has been deprecated since 1.8.0. Please use `deleteRow` instead. + * @see TablesDb::deleteRow */ public function deleteDocument(string $databaseId, string $collectionId, string $documentId): string { @@ -1876,6 +1991,9 @@ public function deleteDocument(string $databaseId, string $collectionId, string * @param ?float $min * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `decrementRowColumn` instead. + * @see TablesDb::decrementRowColumn */ public function decrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $min = null): array { @@ -1921,6 +2039,9 @@ public function decrementDocumentAttribute(string $databaseId, string $collectio * @param ?float $max * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `incrementRowColumn` instead. + * @see TablesDb::incrementRowColumn */ public function incrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $max = null): array { @@ -1963,6 +2084,9 @@ public function incrementDocumentAttribute(string $databaseId, string $collectio * @param ?array $queries * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `listIndexes` instead. + * @see TablesDb::listIndexes */ public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -2004,6 +2128,9 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu * @param ?array $lengths * @throws AppwriteException * @return array + * + * @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 { @@ -2047,6 +2174,9 @@ public function createIndex(string $databaseId, string $collectionId, string $ke * @param string $key * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `getIndex` instead. + * @see TablesDb::getIndex */ public function getIndex(string $databaseId, string $collectionId, string $key): array { @@ -2079,6 +2209,9 @@ public function getIndex(string $databaseId, string $collectionId, string $key): * @param string $key * @throws AppwriteException * @return string + * + * @deprecated This API has been deprecated since 1.8.0. Please use `deleteIndex` instead. + * @see TablesDb::deleteIndex */ public function deleteIndex(string $databaseId, string $collectionId, string $key): string { diff --git a/src/Appwrite/Services/TablesDb.php b/src/Appwrite/Services/TablesDb.php new file mode 100644 index 0000000..5f31fc7 --- /dev/null +++ b/src/Appwrite/Services/TablesDb.php @@ -0,0 +1,2093 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new Database. + * + * + * @param string $databaseId + * @param string $name + * @param ?bool $enabled + * @param ?Type $type + * @throws AppwriteException + * @return array + */ + public function create(string $databaseId, string $name, ?bool $enabled = null, ?Type $type = null): array + { + $apiPath = str_replace( + [], + [], + '/tablesdb' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + $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], + '/tablesdb/{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], + '/tablesdb/{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], + '/tablesdb/{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 tables 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 + * @throws AppwriteException + * @return array + */ + public function listTables(string $databaseId, ?array $queries = null, ?string $search = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/tablesdb/{databaseId}/tables' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new Table. Before using this route, you should create a new + * database resource using either a [server + * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $tableId + * @param string $name + * @param ?array $permissions + * @param ?bool $rowSecurity + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createTable(string $databaseId, string $tableId, string $name, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/tablesdb/{databaseId}/tables' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($rowSecurity)) { + $apiParams['rowSecurity'] = $rowSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a table by its unique ID. This endpoint response returns a JSON object + * with the table metadata. + * + * @param string $databaseId + * @param string $tableId + * @throws AppwriteException + * @return array + */ + public function getTable(string $databaseId, string $tableId): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a table by its unique ID. + * + * @param string $databaseId + * @param string $tableId + * @param string $name + * @param ?array $permissions + * @param ?bool $rowSecurity + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updateTable(string $databaseId, string $tableId, string $name, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($rowSecurity)) { + $apiParams['rowSecurity'] = $rowSecurity; + } + + 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 table by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string $databaseId + * @param string $tableId + * @throws AppwriteException + * @return string + */ + public function deleteTable(string $databaseId, string $tableId): string + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List columns in the table. + * + * @param string $databaseId + * @param string $tableId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listColumns(string $databaseId, string $tableId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a boolean column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?bool $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createBooleanColumn(string $databaseId, string $tableId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a boolean column. Changing the `default` value will not update + * already existing rows. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?bool $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateBooleanColumn(string $databaseId, string $tableId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a date time column according to the ISO 8601 standard. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createDatetimeColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a date time column. Changing the `default` value will not update + * already existing rows. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateDatetimeColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create an email column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createEmailColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/email' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update an email column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateEmailColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create an enumeration column. The `elements` param acts as a white-list of + * accepted values for this column. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param array $elements + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createEnumColumn(string $databaseId, string $tableId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/enum' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['elements'] = $elements; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update an enum column. Changing the `default` value will not update already + * existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param array $elements + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateEnumColumn(string $databaseId, string $tableId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['elements'] = $elements; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a float column. Optionally, minimum and maximum values can be + * provided. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?float $min + * @param ?float $max + * @param ?float $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createFloatColumn(string $databaseId, string $tableId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/float' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a float column. Changing the `default` value will not update already + * existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?float $xdefault + * @param ?float $min + * @param ?float $max + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateFloatColumn(string $databaseId, string $tableId, string $key, bool $required, ?float $xdefault, ?float $min = null, ?float $max = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create an integer column. Optionally, minimum and maximum values can be + * provided. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?int $min + * @param ?int $max + * @param ?int $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createIntegerColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/integer' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update an integer column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?int $xdefault + * @param ?int $min + * @param ?int $max + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateIntegerColumn(string $databaseId, string $tableId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create IP address column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createIpColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/ip' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update an ip column. Changing the `default` value will not update already + * existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateIpColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create relationship column. [Learn more about relationship + * columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param string $databaseId + * @param string $tableId + * @param string $relatedTableId + * @param RelationshipType $type + * @param ?bool $twoWay + * @param ?string $key + * @param ?string $twoWayKey + * @param ?RelationMutate $onDelete + * @throws AppwriteException + * @return array + */ + public function createRelationshipColumn(string $databaseId, string $tableId, string $relatedTableId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['relatedTableId'] = $relatedTableId; + $apiParams['type'] = $type; + + if (!is_null($twoWay)) { + $apiParams['twoWay'] = $twoWay; + } + + if (!is_null($key)) { + $apiParams['key'] = $key; + } + + if (!is_null($twoWayKey)) { + $apiParams['twoWayKey'] = $twoWayKey; + } + + if (!is_null($onDelete)) { + $apiParams['onDelete'] = $onDelete; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a string column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param int $size + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @param ?bool $encrypt + * @throws AppwriteException + * @return array + */ + public function createStringColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/string' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['size'] = $size; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + if (!is_null($encrypt)) { + $apiParams['encrypt'] = $encrypt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a string column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?int $size + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateStringColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($size)) { + $apiParams['size'] = $size; + } + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a URL column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createUrlColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/url' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + + if (!is_null($xdefault)) { + $apiParams['default'] = $xdefault; + } + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update an url column. Changing the `default` value will not update already + * existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateUrlColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get column by ID. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @throws AppwriteException + * @return array + */ + public function getColumn(string $databaseId, string $tableId, string $key): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Deletes a column. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @throws AppwriteException + * @return string + */ + public function deleteColumn(string $databaseId, string $tableId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update relationship column. [Learn more about relationship + * columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param ?RelationMutate $onDelete + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateRelationshipColumn(string $databaseId, string $tableId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + + if (!is_null($onDelete)) { + $apiParams['onDelete'] = $onDelete; + } + + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + + $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 $tableId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listIndexes(string $databaseId, string $tableId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Creates an index on the columns listed. Your index should include all the + * columns you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param IndexType $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 + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['type'] = $type; + $apiParams['columns'] = $columns; + + 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 $tableId + * @param string $key + * @throws AppwriteException + * @return array + */ + public function getIndex(string $databaseId, string $tableId, string $key): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete an index. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @throws AppwriteException + * @return string + */ + public function deleteIndex(string $databaseId, string $tableId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all the user's rows in a given table. You can use the query + * params to filter your results. + * + * @param string $databaseId + * @param string $tableId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listRows(string $databaseId, string $tableId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/rows' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new Row. Before using this route, you should create a new table + * resource using either a [server + * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $tableId + * @param string $rowId + * @param array $data + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function createRow(string $databaseId, string $tableId, string $rowId, array $data, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/rows' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rowId'] = $rowId; + $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 Rows. Before using this route, you should create a new table + * resource using either a [server + * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $tableId + * @param array $rows + * @throws AppwriteException + * @return array + */ + public function createRows(string $databaseId, string $tableId, array $rows): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/rows' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rows'] = $rows; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create or update Rows. Before using this route, you should create a new + * table resource using either a [server + * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * API or directly from your database console. + * + * + * @param string $databaseId + * @param string $tableId + * @param array $rows + * @throws AppwriteException + * @return array + */ + public function upsertRows(string $databaseId, string $tableId, array $rows): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/rows' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rows'] = $rows; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update all rows that match your queries, if no queries are submitted then + * all rows are updated. You can pass only specific fields to be updated. + * + * @param string $databaseId + * @param string $tableId + * @param ?array $data + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function updateRows(string $databaseId, string $tableId, ?array $data = null, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/rows' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Bulk delete rows using queries, if no queries are passed then all rows are + * deleted. + * + * @param string $databaseId + * @param string $tableId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function deleteRows(string $databaseId, string $tableId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/rows' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a row by its unique ID. This endpoint response returns a JSON object + * with the row data. + * + * @param string $databaseId + * @param string $tableId + * @param string $rowId + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function getRow(string $databaseId, string $tableId, string $rowId, ?array $queries = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{rowId}'], + [$databaseId, $tableId, $rowId], + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rowId'] = $rowId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create or update a Row. Before using this route, you should create a new + * table resource using either a [server + * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * API or directly from your database console. + * + * @param string $databaseId + * @param string $tableId + * @param string $rowId + * @param ?array $data + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function upsertRow(string $databaseId, string $tableId, string $rowId, ?array $data = null, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{rowId}'], + [$databaseId, $tableId, $rowId], + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rowId'] = $rowId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a row by its unique ID. Using the patch method you can pass only + * specific fields that will get updated. + * + * @param string $databaseId + * @param string $tableId + * @param string $rowId + * @param ?array $data + * @param ?array $permissions + * @throws AppwriteException + * @return array + */ + public function updateRow(string $databaseId, string $tableId, string $rowId, ?array $data = null, ?array $permissions = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{rowId}'], + [$databaseId, $tableId, $rowId], + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rowId'] = $rowId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a row by its unique ID. + * + * @param string $databaseId + * @param string $tableId + * @param string $rowId + * @throws AppwriteException + * @return string + */ + public function deleteRow(string $databaseId, string $tableId, string $rowId): string + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{rowId}'], + [$databaseId, $tableId, $rowId], + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rowId'] = $rowId; + + $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 $tableId + * @param string $rowId + * @param string $column + * @param ?float $value + * @param ?float $min + * @throws AppwriteException + * @return array + */ + public function decrementRowColumn(string $databaseId, string $tableId, string $rowId, string $column, ?float $value = null, ?float $min = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{rowId}', '{column}'], + [$databaseId, $tableId, $rowId, $column], + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rowId'] = $rowId; + $apiParams['column'] = $column; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + $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 $tableId + * @param string $rowId + * @param string $column + * @param ?float $value + * @param ?float $max + * @throws AppwriteException + * @return array + */ + public function incrementRowColumn(string $databaseId, string $tableId, string $rowId, string $column, ?float $value = null, ?float $max = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{rowId}', '{column}'], + [$databaseId, $tableId, $rowId, $column], + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['rowId'] = $rowId; + $apiParams['column'] = $column; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + $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/QueryTest.php b/tests/Appwrite/QueryTest.php index bd54d13..a9ac2c3 100644 --- a/tests/Appwrite/QueryTest.php +++ b/tests/Appwrite/QueryTest.php @@ -146,4 +146,48 @@ public function testLimit(): void { public function testOffset(): void { $this->assertSame('offset(1)', Query::offset(1)); } + + public function testNotContains(): void { + $this->assertSame('notContains("attr", ["value"])', Query::notContains('attr', 'value')); + } + + public function testNotSearch(): void { + $this->assertSame('notSearch("attr", ["keyword1 keyword2"])', Query::notSearch('attr', 'keyword1 keyword2')); + } + + public function testNotBetweenWithIntegers(): void { + $this->assertSame('notBetween("attr", 1, 2)', Query::notBetween('attr', 1, 2)); + } + + public function testNotBetweenWithDoubles(): void { + $this->assertSame('notBetween("attr", 1, 2)', Query::notBetween('attr', 1.0, 2.0)); + } + + public function testNotBetweenWithStrings(): void { + $this->assertSame('notBetween("attr", "a", "z")', Query::notBetween('attr', 'a', 'z')); + } + + public function testNotStartsWith(): void { + $this->assertSame('notStartsWith("attr", ["prefix"])', Query::notStartsWith('attr', 'prefix')); + } + + public function testNotEndsWith(): void { + $this->assertSame('notEndsWith("attr", ["suffix"])', Query::notEndsWith('attr', 'suffix')); + } + + public function testCreatedBefore(): void { + $this->assertSame('createdBefore("2023-01-01")', Query::createdBefore('2023-01-01')); + } + + public function testCreatedAfter(): void { + $this->assertSame('createdAfter("2023-01-01")', Query::createdAfter('2023-01-01')); + } + + public function testUpdatedBefore(): void { + $this->assertSame('updatedBefore("2023-01-01")', Query::updatedBefore('2023-01-01')); + } + + public function testUpdatedAfter(): void { + $this->assertSame('updatedAfter("2023-01-01")', Query::updatedAfter('2023-01-01')); + } } diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index e870542..b11271f 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -40,7 +40,8 @@ public function testMethodCreate(): void { "name" => "My Database", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true,); + "enabled" => true, + "type" => "legacy",); $this->client @@ -62,7 +63,8 @@ public function testMethodGet(): void { "name" => "My Database", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true,); + "enabled" => true, + "type" => "legacy",); $this->client @@ -83,7 +85,8 @@ public function testMethodUpdate(): void { "name" => "My Database", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "enabled" => true,); + "enabled" => true, + "type" => "legacy",); $this->client @@ -1135,14 +1138,15 @@ public function testMethodListIndexes(): void { 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(), - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + "lengths" => array(),); $this->client @@ -1163,14 +1167,15 @@ public function testMethodCreateIndex(): void { 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(), - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + "lengths" => array(),); $this->client diff --git a/tests/Appwrite/Services/TablesDbTest.php b/tests/Appwrite/Services/TablesDbTest.php new file mode 100644 index 0000000..3e10d75 --- /dev/null +++ b/tests/Appwrite/Services/TablesDbTest.php @@ -0,0 +1,1211 @@ +client = Mockery::mock(Client::class); + $this->tablesDb = new TablesDb($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->tablesDb->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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->create( + "", + "" + ); + + $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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->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->tablesDb->delete( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListTables(): void { + + $data = array( + "total" => 5, + "tables" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->listTables( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateTable(): 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 Table", + "enabled" => true, + "rowSecurity" => true, + "columns" => array(), + "indexes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createTable( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetTable(): 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 Table", + "enabled" => true, + "rowSecurity" => true, + "columns" => array(), + "indexes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->getTable( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTable(): 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 Table", + "enabled" => true, + "rowSecurity" => true, + "columns" => array(), + "indexes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateTable( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteTable(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->deleteTable( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListColumns(): void { + + $data = array( + "total" => 5, + "columns" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->listColumns( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateBooleanColumn(): void { + + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createBooleanColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateBooleanColumn(): void { + + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateBooleanColumn( + "", + "", + "", + true, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateDatetimeColumn(): void { + + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "datetime",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createDatetimeColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateDatetimeColumn(): void { + + $data = array( + "key" => "birthDay", + "type" => "datetime", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "datetime",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateDatetimeColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateEmailColumn(): void { + + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "email",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createEmailColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEmailColumn(): void { + + $data = array( + "key" => "userEmail", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "email",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateEmailColumn( + "", + "", + "", + true, + "email@example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateEnumColumn(): void { + + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "elements" => array(), + "format" => "enum",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createEnumColumn( + "", + "", + "", + array(), + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateEnumColumn(): void { + + $data = array( + "key" => "status", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "elements" => array(), + "format" => "enum",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateEnumColumn( + "", + "", + "", + array(), + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateFloatColumn(): void { + + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createFloatColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateFloatColumn(): void { + + $data = array( + "key" => "percentageCompleted", + "type" => "double", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateFloatColumn( + "", + "", + "", + true, + 1.0 + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateIntegerColumn(): void { + + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createIntegerColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateIntegerColumn(): void { + + $data = array( + "key" => "count", + "type" => "integer", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateIntegerColumn( + "", + "", + "", + true, + 1 + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateIpColumn(): void { + + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "ip",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createIpColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateIpColumn(): void { + + $data = array( + "key" => "ipAddress", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "ip",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateIpColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateRelationshipColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "relatedTable" => "table", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createRelationshipColumn( + "", + "", + "", + "oneToOne" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateStringColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createStringColumn( + "", + "", + "", + 1, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateStringColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateStringColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateUrlColumn(): void { + + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "url",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createUrlColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateUrlColumn(): void { + + $data = array( + "key" => "githubUrl", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "format" => "url",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateUrlColumn( + "", + "", + "", + true, + "https://example.com" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetColumn(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->getColumn( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteColumn(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->deleteColumn( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateRelationshipColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "relatedTable" => "table", + "relationType" => "oneToOne|oneToMany|manyToOne|manyToMany", + "twoWay" => true, + "twoWayKey" => "string", + "onDelete" => "restrict|cascade|setNull", + "side" => "parent|child",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateRelationshipColumn( + "", + "", + "" + ); + + $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->tablesDb->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", + "columns" => array(), + "lengths" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createIndex( + "", + "", + "", + "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", + "columns" => array(), + "lengths" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->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->tablesDb->deleteIndex( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListRows(): void { + + $data = array( + "total" => 5, + "rows" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->listRows( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateRow(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => 1, + "\$tableId" => "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->tablesDb->createRow( + "", + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateRows(): void { + + $data = array( + "total" => 5, + "rows" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->createRows( + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpsertRows(): void { + + $data = array( + "total" => 5, + "rows" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->upsertRows( + "", + "", + array() + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateRows(): void { + + $data = array( + "total" => 5, + "rows" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->updateRows( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteRows(): void { + + $data = array( + "total" => 5, + "rows" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->deleteRows( + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetRow(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => 1, + "\$tableId" => "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->tablesDb->getRow( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpsertRow(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => 1, + "\$tableId" => "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->tablesDb->upsertRow( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateRow(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => 1, + "\$tableId" => "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->tablesDb->updateRow( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteRow(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDb->deleteRow( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDecrementRowColumn(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => 1, + "\$tableId" => "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->tablesDb->decrementRowColumn( + "", + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodIncrementRowColumn(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$sequence" => 1, + "\$tableId" => "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->tablesDb->incrementRowColumn( + "", + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + +} From 1b5072ffda2e6c68298daa22db1da055a89bfc93 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 18:24:41 +1200 Subject: [PATCH 2/7] Add 1.8.x support --- docs/databases.md | 1 - docs/examples/databases/create.md | 3 +- docs/examples/tablesdb/create.md | 3 +- docs/tablesdb.md | 5 ++-- src/Appwrite/Enums/Type.php | 43 ----------------------------- src/Appwrite/Services/Databases.php | 8 +----- src/Appwrite/Services/TablesDb.php | 12 ++------ 7 files changed, 8 insertions(+), 67 deletions(-) delete mode 100644 src/Appwrite/Enums/Type.php diff --git a/docs/databases.md b/docs/databases.md index e9c7dac..998532a 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -29,7 +29,6 @@ POST https://cloud.appwrite.io/v1/databases | 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 | -| type | string | Database type. | tablesdb | ```http request diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index c1b4fb5..73c6188 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -13,6 +13,5 @@ $databases = new Databases($client); $result = $databases->create( databaseId: '', name: '', - enabled: false, // optional - type: ::TABLESDB() // optional + enabled: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index f16a317..2c82e73 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -13,6 +13,5 @@ $tablesDb = new TablesDb($client); $result = $tablesDb->create( databaseId: '', name: '', - enabled: false, // optional - type: ::TABLESDB() // optional + enabled: false // optional ); \ No newline at end of file diff --git a/docs/tablesdb.md b/docs/tablesdb.md index 6e00860..f03d5b3 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -29,7 +29,6 @@ POST https://cloud.appwrite.io/v1/tablesdb | 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 | -| type | string | Database type. | tablesdb | ```http request @@ -591,7 +590,7 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes ``` -** List indexes in the collection. ** +** List indexes on the table. ** ### Parameters @@ -607,7 +606,7 @@ POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes ``` ** Creates an index on the columns listed. Your index should include all the columns you will query in a single request. -Attributes can be `key`, `fulltext`, and `unique`. ** +Type can be `key`, `fulltext`, or `unique`. ** ### Parameters diff --git a/src/Appwrite/Enums/Type.php b/src/Appwrite/Enums/Type.php deleted file mode 100644 index 984e370..0000000 --- a/src/Appwrite/Enums/Type.php +++ /dev/null @@ -1,43 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function TABLESDB(): Type - { - if (!isset(self::$TABLESDB)) { - self::$TABLESDB = new Type('tablesdb'); - } - return self::$TABLESDB; - } - public static function LEGACY(): Type - { - if (!isset(self::$LEGACY)) { - self::$LEGACY = new Type('legacy'); - } - return self::$LEGACY; - } -} \ No newline at end of file diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 6da5409..211a520 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -6,7 +6,6 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; -use Appwrite\Enums\Type; use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; @@ -65,14 +64,13 @@ public function list(?array $queries = null, ?string $search = null): array * @param string $databaseId * @param string $name * @param ?bool $enabled - * @param ?Type $type * @throws AppwriteException * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createDatabase` instead. * @see TablesDb::createDatabase */ - public function create(string $databaseId, string $name, ?bool $enabled = null, ?Type $type = null): array + public function create(string $databaseId, string $name, ?bool $enabled = null): array { $apiPath = str_replace( [], @@ -88,10 +86,6 @@ public function create(string $databaseId, string $name, ?bool $enabled = null, $apiParams['enabled'] = $enabled; } - if (!is_null($type)) { - $apiParams['type'] = $type; - } - $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; diff --git a/src/Appwrite/Services/TablesDb.php b/src/Appwrite/Services/TablesDb.php index 5f31fc7..dcb1e2c 100644 --- a/src/Appwrite/Services/TablesDb.php +++ b/src/Appwrite/Services/TablesDb.php @@ -6,7 +6,6 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; -use Appwrite\Enums\Type; use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; @@ -62,11 +61,10 @@ public function list(?array $queries = null, ?string $search = null): array * @param string $databaseId * @param string $name * @param ?bool $enabled - * @param ?Type $type * @throws AppwriteException * @return array */ - public function create(string $databaseId, string $name, ?bool $enabled = null, ?Type $type = null): array + public function create(string $databaseId, string $name, ?bool $enabled = null): array { $apiPath = str_replace( [], @@ -82,10 +80,6 @@ public function create(string $databaseId, string $name, ?bool $enabled = null, $apiParams['enabled'] = $enabled; } - if (!is_null($type)) { - $apiParams['type'] = $type; - } - $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1461,7 +1455,7 @@ public function updateRelationshipColumn(string $databaseId, string $tableId, st } /** - * List indexes in the collection. + * List indexes on the table. * * @param string $databaseId * @param string $tableId @@ -1498,7 +1492,7 @@ public function listIndexes(string $databaseId, string $tableId, ?array $queries /** * Creates an index on the columns listed. Your index should include all the * columns you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. + * Type can be `key`, `fulltext`, or `unique`. * * @param string $databaseId * @param string $tableId From e422a1b26d34e2ff83dc9b770bc54603654fa270 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 19:19:19 +1200 Subject: [PATCH 3/7] Add 1.8.x support --- docs/examples/databases/decrement-document-attribute.md | 2 +- docs/examples/databases/increment-document-attribute.md | 2 +- docs/examples/tablesdb/decrement-row-column.md | 2 +- docs/examples/tablesdb/increment-row-column.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index 40e14af..6464a26 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -6,7 +6,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/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index fb61d87..9ad4bdf 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -6,7 +6,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/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index ccaf9b4..c4c7c63 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -6,7 +6,7 @@ use Appwrite\Services\TablesDb; $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 $tablesDb = new TablesDb($client); diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index a76d74a..bf986b6 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -6,7 +6,7 @@ use Appwrite\Services\TablesDb; $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 $tablesDb = new TablesDb($client); From 8f0dd23936fa0aaf185df5411db210ca60afc994 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 21 Aug 2025 22:17:57 +1200 Subject: [PATCH 4/7] Fix casing --- docs/account.md | 95 ++++ .../account/create-m-f-a-authenticator.md | 16 + .../account/create-m-f-a-challenge.md | 15 + .../account/create-m-f-a-recovery-codes.md | 13 + .../account/delete-m-f-a-authenticator.md | 16 + .../account/get-m-f-a-recovery-codes.md | 13 + docs/examples/account/list-m-f-a-factors.md | 13 + .../account/update-m-f-a-authenticator.md | 17 + .../account/update-m-f-a-challenge.md | 16 + .../account/update-m-f-a-recovery-codes.md | 13 + .../messaging/create-a-p-n-s-provider.md | 22 + .../messaging/create-f-c-m-provider.md | 18 + docs/examples/messaging/create-s-m-s.md | 21 + .../messaging/create-s-m-t-p-provider.md | 28 + .../messaging/update-a-p-n-s-provider.md | 22 + .../messaging/update-f-c-m-provider.md | 18 + docs/examples/messaging/update-s-m-s.md | 21 + .../messaging/update-s-m-t-p-provider.md | 28 + .../tablesdb/create-boolean-column.md | 6 +- .../tablesdb/create-datetime-column.md | 6 +- docs/examples/tablesdb/create-email-column.md | 6 +- docs/examples/tablesdb/create-enum-column.md | 6 +- docs/examples/tablesdb/create-float-column.md | 6 +- docs/examples/tablesdb/create-index.md | 6 +- .../tablesdb/create-integer-column.md | 6 +- docs/examples/tablesdb/create-ip-column.md | 6 +- .../tablesdb/create-relationship-column.md | 6 +- docs/examples/tablesdb/create-row.md | 6 +- docs/examples/tablesdb/create-rows.md | 6 +- .../examples/tablesdb/create-string-column.md | 6 +- docs/examples/tablesdb/create-table.md | 6 +- docs/examples/tablesdb/create-url-column.md | 6 +- docs/examples/tablesdb/create.md | 6 +- .../examples/tablesdb/decrement-row-column.md | 6 +- docs/examples/tablesdb/delete-column.md | 6 +- docs/examples/tablesdb/delete-index.md | 6 +- docs/examples/tablesdb/delete-row.md | 6 +- docs/examples/tablesdb/delete-rows.md | 6 +- docs/examples/tablesdb/delete-table.md | 6 +- docs/examples/tablesdb/delete.md | 6 +- docs/examples/tablesdb/get-column.md | 6 +- docs/examples/tablesdb/get-index.md | 6 +- docs/examples/tablesdb/get-row.md | 6 +- docs/examples/tablesdb/get-table.md | 6 +- docs/examples/tablesdb/get.md | 6 +- .../examples/tablesdb/increment-row-column.md | 6 +- docs/examples/tablesdb/list-columns.md | 6 +- docs/examples/tablesdb/list-indexes.md | 6 +- docs/examples/tablesdb/list-rows.md | 6 +- docs/examples/tablesdb/list-tables.md | 6 +- docs/examples/tablesdb/list.md | 6 +- .../tablesdb/update-boolean-column.md | 6 +- .../tablesdb/update-datetime-column.md | 6 +- docs/examples/tablesdb/update-email-column.md | 6 +- docs/examples/tablesdb/update-enum-column.md | 6 +- docs/examples/tablesdb/update-float-column.md | 6 +- .../tablesdb/update-integer-column.md | 6 +- docs/examples/tablesdb/update-ip-column.md | 6 +- .../tablesdb/update-relationship-column.md | 6 +- docs/examples/tablesdb/update-row.md | 6 +- docs/examples/tablesdb/update-rows.md | 6 +- .../examples/tablesdb/update-string-column.md | 6 +- docs/examples/tablesdb/update-table.md | 6 +- docs/examples/tablesdb/update-url-column.md | 6 +- docs/examples/tablesdb/update.md | 6 +- docs/examples/tablesdb/upsert-row.md | 6 +- docs/examples/tablesdb/upsert-rows.md | 6 +- .../users/create-m-f-a-recovery-codes.md | 15 + .../users/delete-m-f-a-authenticator.md | 17 + .../users/get-m-f-a-recovery-codes.md | 15 + docs/examples/users/list-m-f-a-factors.md | 15 + .../users/update-m-f-a-recovery-codes.md | 15 + docs/examples/users/update-m-f-a.md | 16 + docs/messaging.md | 163 ++++++ docs/tablesdb.md | 40 +- docs/users.md | 80 +++ src/Appwrite/Services/Account.php | 303 ++++++++++ src/Appwrite/Services/Databases.php | 98 ++-- src/Appwrite/Services/Messaging.php | 534 ++++++++++++++++++ src/Appwrite/Services/TablesDb.php | 12 +- src/Appwrite/Services/Users.php | 203 +++++++ tests/Appwrite/Services/AccountTest.php | 200 +++++++ tests/Appwrite/Services/MessagingTest.php | 201 +++++++ tests/Appwrite/Services/TablesDbTest.php | 104 ++-- tests/Appwrite/Services/UsersTest.php | 121 ++++ 85 files changed, 2577 insertions(+), 274 deletions(-) create mode 100644 docs/examples/account/create-m-f-a-authenticator.md create mode 100644 docs/examples/account/create-m-f-a-challenge.md create mode 100644 docs/examples/account/create-m-f-a-recovery-codes.md create mode 100644 docs/examples/account/delete-m-f-a-authenticator.md create mode 100644 docs/examples/account/get-m-f-a-recovery-codes.md create mode 100644 docs/examples/account/list-m-f-a-factors.md create mode 100644 docs/examples/account/update-m-f-a-authenticator.md create mode 100644 docs/examples/account/update-m-f-a-challenge.md create mode 100644 docs/examples/account/update-m-f-a-recovery-codes.md create mode 100644 docs/examples/messaging/create-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/create-f-c-m-provider.md create mode 100644 docs/examples/messaging/create-s-m-s.md create mode 100644 docs/examples/messaging/create-s-m-t-p-provider.md create mode 100644 docs/examples/messaging/update-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/update-f-c-m-provider.md create mode 100644 docs/examples/messaging/update-s-m-s.md create mode 100644 docs/examples/messaging/update-s-m-t-p-provider.md create mode 100644 docs/examples/users/create-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/delete-m-f-a-authenticator.md create mode 100644 docs/examples/users/get-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/list-m-f-a-factors.md create mode 100644 docs/examples/users/update-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/update-m-f-a.md diff --git a/docs/account.md b/docs/account.md index 3383003..4ba4c4d 100644 --- a/docs/account.md +++ b/docs/account.md @@ -112,6 +112,33 @@ POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} | type | string | **Required** Type of authenticator. Must be `totp` | | +```http request +POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} +``` + +** Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| type | string | **Required** Type of authenticator. Must be `totp` | | + + +```http request +PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} +``` + +** Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| type | string | **Required** Type of authenticator. | | +| otp | string | Valid verification token. | | + + ```http request PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} ``` @@ -139,6 +166,19 @@ DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} | type | string | **Required** Type of authenticator. | | +```http request +DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} +``` + +** Delete an authenticator for a user by ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| type | string | **Required** Type of authenticator. | | + + ```http request POST https://cloud.appwrite.io/v1/account/mfa/challenge ``` @@ -152,6 +192,33 @@ POST https://cloud.appwrite.io/v1/account/mfa/challenge | factor | string | Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. | | +```http request +POST https://cloud.appwrite.io/v1/account/mfa/challenge +``` + +** Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| factor | string | Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. | | + + +```http request +PUT https://cloud.appwrite.io/v1/account/mfa/challenge +``` + +** Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| challengeId | string | ID of the challenge. | | +| otp | string | Valid verification token. | | + + ```http request PUT https://cloud.appwrite.io/v1/account/mfa/challenge ``` @@ -173,6 +240,20 @@ GET https://cloud.appwrite.io/v1/account/mfa/factors ** List the factors available on the account to be used as a MFA challange. ** +```http request +GET https://cloud.appwrite.io/v1/account/mfa/factors +``` + +** List the factors available on the account to be used as a MFA challange. ** + + +```http request +GET https://cloud.appwrite.io/v1/account/mfa/recovery-codes +``` + +** Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. ** + + ```http request GET https://cloud.appwrite.io/v1/account/mfa/recovery-codes ``` @@ -187,6 +268,20 @@ POST https://cloud.appwrite.io/v1/account/mfa/recovery-codes ** Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. ** +```http request +POST https://cloud.appwrite.io/v1/account/mfa/recovery-codes +``` + +** Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. ** + + +```http request +PATCH https://cloud.appwrite.io/v1/account/mfa/recovery-codes +``` + +** Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. ** + + ```http request PATCH https://cloud.appwrite.io/v1/account/mfa/recovery-codes ``` diff --git a/docs/examples/account/create-m-f-a-authenticator.md b/docs/examples/account/create-m-f-a-authenticator.md new file mode 100644 index 0000000..2eb50c3 --- /dev/null +++ b/docs/examples/account/create-m-f-a-authenticator.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createMFAAuthenticator( + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/account/create-m-f-a-challenge.md b/docs/examples/account/create-m-f-a-challenge.md new file mode 100644 index 0000000..64471ef --- /dev/null +++ b/docs/examples/account/create-m-f-a-challenge.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject(''); // Your project ID + +$account = new Account($client); + +$result = $account->createMFAChallenge( + factor: AuthenticationFactor::EMAIL() +); \ No newline at end of file diff --git a/docs/examples/account/create-m-f-a-recovery-codes.md b/docs/examples/account/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..031bc4d --- /dev/null +++ b/docs/examples/account/create-m-f-a-recovery-codes.md @@ -0,0 +1,13 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createMFARecoveryCodes(); diff --git a/docs/examples/account/delete-m-f-a-authenticator.md b/docs/examples/account/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..524b9b3 --- /dev/null +++ b/docs/examples/account/delete-m-f-a-authenticator.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteMFAAuthenticator( + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/account/get-m-f-a-recovery-codes.md b/docs/examples/account/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..fc5aef2 --- /dev/null +++ b/docs/examples/account/get-m-f-a-recovery-codes.md @@ -0,0 +1,13 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getMFARecoveryCodes(); diff --git a/docs/examples/account/list-m-f-a-factors.md b/docs/examples/account/list-m-f-a-factors.md new file mode 100644 index 0000000..f7b6e26 --- /dev/null +++ b/docs/examples/account/list-m-f-a-factors.md @@ -0,0 +1,13 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listMFAFactors(); diff --git a/docs/examples/account/update-m-f-a-authenticator.md b/docs/examples/account/update-m-f-a-authenticator.md new file mode 100644 index 0000000..8486e88 --- /dev/null +++ b/docs/examples/account/update-m-f-a-authenticator.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMFAAuthenticator( + type: AuthenticatorType::TOTP(), + otp: '' +); \ No newline at end of file diff --git a/docs/examples/account/update-m-f-a-challenge.md b/docs/examples/account/update-m-f-a-challenge.md new file mode 100644 index 0000000..e5821e5 --- /dev/null +++ b/docs/examples/account/update-m-f-a-challenge.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMFAChallenge( + challengeId: '', + otp: '' +); \ No newline at end of file diff --git a/docs/examples/account/update-m-f-a-recovery-codes.md b/docs/examples/account/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..f57e490 --- /dev/null +++ b/docs/examples/account/update-m-f-a-recovery-codes.md @@ -0,0 +1,13 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMFARecoveryCodes(); diff --git a/docs/examples/messaging/create-a-p-n-s-provider.md b/docs/examples/messaging/create-a-p-n-s-provider.md new file mode 100644 index 0000000..2ce4b7f --- /dev/null +++ b/docs/examples/messaging/create-a-p-n-s-provider.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createAPNSProvider( + providerId: '', + name: '', + authKey: '', // optional + authKeyId: '', // optional + teamId: '', // optional + bundleId: '', // optional + sandbox: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-f-c-m-provider.md b/docs/examples/messaging/create-f-c-m-provider.md new file mode 100644 index 0000000..8037c23 --- /dev/null +++ b/docs/examples/messaging/create-f-c-m-provider.md @@ -0,0 +1,18 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createFCMProvider( + providerId: '', + name: '', + serviceAccountJSON: [], // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-s-m-s.md b/docs/examples/messaging/create-s-m-s.md new file mode 100644 index 0000000..50623b5 --- /dev/null +++ b/docs/examples/messaging/create-s-m-s.md @@ -0,0 +1,21 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSMS( + messageId: '', + content: '', + topics: [], // optional + users: [], // optional + targets: [], // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/create-s-m-t-p-provider.md b/docs/examples/messaging/create-s-m-t-p-provider.md new file mode 100644 index 0000000..017f20c --- /dev/null +++ b/docs/examples/messaging/create-s-m-t-p-provider.md @@ -0,0 +1,28 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSMTPProvider( + providerId: '', + name: '', + host: '', + port: 1, // optional + username: '', // optional + password: '', // optional + encryption: SmtpEncryption::NONE(), // optional + autoTLS: false, // optional + mailer: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-a-p-n-s-provider.md new file mode 100644 index 0000000..161a148 --- /dev/null +++ b/docs/examples/messaging/update-a-p-n-s-provider.md @@ -0,0 +1,22 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateAPNSProvider( + providerId: '', + name: '', // optional + enabled: false, // optional + authKey: '', // optional + authKeyId: '', // optional + teamId: '', // optional + bundleId: '', // optional + sandbox: false // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-f-c-m-provider.md new file mode 100644 index 0000000..0df2b93 --- /dev/null +++ b/docs/examples/messaging/update-f-c-m-provider.md @@ -0,0 +1,18 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateFCMProvider( + providerId: '', + name: '', // optional + enabled: false, // optional + serviceAccountJSON: [] // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-s-m-s.md b/docs/examples/messaging/update-s-m-s.md new file mode 100644 index 0000000..92d3ebb --- /dev/null +++ b/docs/examples/messaging/update-s-m-s.md @@ -0,0 +1,21 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSMS( + messageId: '', + topics: [], // optional + users: [], // optional + targets: [], // optional + content: '', // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/messaging/update-s-m-t-p-provider.md b/docs/examples/messaging/update-s-m-t-p-provider.md new file mode 100644 index 0000000..3bc80d2 --- /dev/null +++ b/docs/examples/messaging/update-s-m-t-p-provider.md @@ -0,0 +1,28 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSMTPProvider( + providerId: '', + name: '', // optional + host: '', // optional + port: 1, // optional + username: '', // optional + password: '', // optional + encryption: SmtpEncryption::NONE(), // optional + autoTLS: false, // optional + mailer: '', // optional + fromName: '', // optional + fromEmail: 'email@example.com', // optional + replyToName: '', // optional + replyToEmail: '', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 5a609b6..5f0a2de 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createBooleanColumn( +$result = $tablesDB->createBooleanColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 9ac6470..9ea8e8f 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createDatetimeColumn( +$result = $tablesDB->createDatetimeColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index c0102f2..64f3a08 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createEmailColumn( +$result = $tablesDB->createEmailColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index eb299bb..0506a33 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createEnumColumn( +$result = $tablesDB->createEnumColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index 3fad526..65a7f00 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createFloatColumn( +$result = $tablesDB->createFloatColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index ecb9cf8..1a3fd13 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -1,7 +1,7 @@ setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createIndex( +$result = $tablesDB->createIndex( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index f6ef4b2..4bf96e8 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createIntegerColumn( +$result = $tablesDB->createIntegerColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 3b993a1..ab0032e 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createIpColumn( +$result = $tablesDB->createIpColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 713541c..031d1fd 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -1,7 +1,7 @@ setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createRelationshipColumn( +$result = $tablesDB->createRelationshipColumn( databaseId: '', tableId: '', relatedTableId: '', diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index bfdd395..0002b79 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createRow( +$result = $tablesDB->createRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index 8b5868a..0114438 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createRows( +$result = $tablesDB->createRows( databaseId: '', tableId: '', rows: [] diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 8534713..22fc7cc 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createStringColumn( +$result = $tablesDB->createStringColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index d72fa62..46cf388 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createTable( +$result = $tablesDB->createTable( databaseId: '', tableId: '', name: '', diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index e180b08..fe25988 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->createUrlColumn( +$result = $tablesDB->createUrlColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 2c82e73..c3c4faa 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->create( +$result = $tablesDB->create( databaseId: '', name: '', enabled: false // optional diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index c4c7c63..a58bd71 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->decrementRowColumn( +$result = $tablesDB->decrementRowColumn( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index 84f665c..dd99fab 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->deleteColumn( +$result = $tablesDB->deleteColumn( databaseId: '', tableId: '', key: '' diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index f979e89..1ef346f 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->deleteIndex( +$result = $tablesDB->deleteIndex( databaseId: '', tableId: '', key: '' diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index f71cd58..4ffc112 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->deleteRow( +$result = $tablesDB->deleteRow( databaseId: '', tableId: '', rowId: '' diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index 81056ed..10a3c87 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->deleteRows( +$result = $tablesDB->deleteRows( databaseId: '', tableId: '', queries: [] // optional diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md index 3df53e5..3cbb35d 100644 --- a/docs/examples/tablesdb/delete-table.md +++ b/docs/examples/tablesdb/delete-table.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->deleteTable( +$result = $tablesDB->deleteTable( databaseId: '', tableId: '' ); \ No newline at end of file diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md index 1013108..ea996e9 100644 --- a/docs/examples/tablesdb/delete.md +++ b/docs/examples/tablesdb/delete.md @@ -1,15 +1,15 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->delete( +$result = $tablesDB->delete( databaseId: '' ); \ No newline at end of file diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 9a3af22..d1705a4 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->getColumn( +$result = $tablesDB->getColumn( databaseId: '', tableId: '', key: '' diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 9847d6a..0d67648 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->getIndex( +$result = $tablesDB->getIndex( databaseId: '', tableId: '', key: '' diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 40487b6..00ba9b6 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->getRow( +$result = $tablesDB->getRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md index 6e85066..ee8812f 100644 --- a/docs/examples/tablesdb/get-table.md +++ b/docs/examples/tablesdb/get-table.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->getTable( +$result = $tablesDB->getTable( databaseId: '', tableId: '' ); \ No newline at end of file diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md index 8e79508..07f7098 100644 --- a/docs/examples/tablesdb/get.md +++ b/docs/examples/tablesdb/get.md @@ -1,15 +1,15 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->get( +$result = $tablesDB->get( databaseId: '' ); \ No newline at end of file diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index bf986b6..d72a1e3 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->incrementRowColumn( +$result = $tablesDB->incrementRowColumn( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index 4e3631e..d12d52d 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->listColumns( +$result = $tablesDB->listColumns( databaseId: '', tableId: '', queries: [] // optional diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index 5a777e9..cb51dbb 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->listIndexes( +$result = $tablesDB->listIndexes( databaseId: '', tableId: '', queries: [] // optional diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 7674a4b..c3b7137 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->listRows( +$result = $tablesDB->listRows( databaseId: '', tableId: '', queries: [] // optional diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index a46fdaf..05f044b 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->listTables( +$result = $tablesDB->listTables( databaseId: '', queries: [], // optional search: '' // optional diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index d03a68b..c3f97c2 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->list( +$result = $tablesDB->list( queries: [], // optional search: '' // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index ed043ae..0c73516 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateBooleanColumn( +$result = $tablesDB->updateBooleanColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 3b7aa77..52213c6 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateDatetimeColumn( +$result = $tablesDB->updateDatetimeColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 9833589..d13de56 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateEmailColumn( +$result = $tablesDB->updateEmailColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index dbbadba..d54c0b3 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateEnumColumn( +$result = $tablesDB->updateEnumColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index 2ac1708..bb091ab 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateFloatColumn( +$result = $tablesDB->updateFloatColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index b81911f..2436bc2 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateIntegerColumn( +$result = $tablesDB->updateIntegerColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index 2eddf86..aa97752 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateIpColumn( +$result = $tablesDB->updateIpColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index c36e79a..834dc18 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateRelationshipColumn( +$result = $tablesDB->updateRelationshipColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index c6df2e0..70e5d15 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateRow( +$result = $tablesDB->updateRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 8349727..8a67628 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateRows( +$result = $tablesDB->updateRows( databaseId: '', tableId: '', data: [], // optional diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index 457c4ba..eb1acc1 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateStringColumn( +$result = $tablesDB->updateStringColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 6cd7f0f..294d8d6 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateTable( +$result = $tablesDB->updateTable( databaseId: '', tableId: '', name: '', diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index 43a3e45..b64b302 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->updateUrlColumn( +$result = $tablesDB->updateUrlColumn( databaseId: '', tableId: '', key: '', diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index fe6764e..106b75e 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->update( +$result = $tablesDB->update( databaseId: '', name: '', enabled: false // optional diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index db02dc2..235f0e5 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setSession(''); // The user session to authenticate with -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->upsertRow( +$result = $tablesDB->upsertRow( databaseId: '', tableId: '', rowId: '', diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index 77d321a..c1890f1 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -1,16 +1,16 @@ setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint ->setProject('') // Your project ID ->setKey(''); // Your secret API key -$tablesDb = new TablesDb($client); +$tablesDB = new TablesDB($client); -$result = $tablesDb->upsertRows( +$result = $tablesDB->upsertRows( databaseId: '', tableId: '', rows: [] diff --git a/docs/examples/users/create-m-f-a-recovery-codes.md b/docs/examples/users/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..ee96d2e --- /dev/null +++ b/docs/examples/users/create-m-f-a-recovery-codes.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$users = new Users($client); + +$result = $users->createMFARecoveryCodes( + userId: '' +); \ No newline at end of file diff --git a/docs/examples/users/delete-m-f-a-authenticator.md b/docs/examples/users/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..f2f08ec --- /dev/null +++ b/docs/examples/users/delete-m-f-a-authenticator.md @@ -0,0 +1,17 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteMFAAuthenticator( + userId: '', + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/users/get-m-f-a-recovery-codes.md b/docs/examples/users/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..7937e6a --- /dev/null +++ b/docs/examples/users/get-m-f-a-recovery-codes.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$users = new Users($client); + +$result = $users->getMFARecoveryCodes( + userId: '' +); \ No newline at end of file diff --git a/docs/examples/users/list-m-f-a-factors.md b/docs/examples/users/list-m-f-a-factors.md new file mode 100644 index 0000000..5dae790 --- /dev/null +++ b/docs/examples/users/list-m-f-a-factors.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$users = new Users($client); + +$result = $users->listMFAFactors( + userId: '' +); \ No newline at end of file diff --git a/docs/examples/users/update-m-f-a-recovery-codes.md b/docs/examples/users/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..8474755 --- /dev/null +++ b/docs/examples/users/update-m-f-a-recovery-codes.md @@ -0,0 +1,15 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$users = new Users($client); + +$result = $users->updateMFARecoveryCodes( + userId: '' +); \ No newline at end of file diff --git a/docs/examples/users/update-m-f-a.md b/docs/examples/users/update-m-f-a.md new file mode 100644 index 0000000..c24916a --- /dev/null +++ b/docs/examples/users/update-m-f-a.md @@ -0,0 +1,16 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$users = new Users($client); + +$result = $users->updateMFA( + userId: '', + mfa: false +); \ No newline at end of file diff --git a/docs/messaging.md b/docs/messaging.md index b38c34e..1cc5298 100644 --- a/docs/messaging.md +++ b/docs/messaging.md @@ -146,6 +146,45 @@ POST https://cloud.appwrite.io/v1/messaging/messages/sms | scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | +```http request +POST https://cloud.appwrite.io/v1/messaging/messages/sms +``` + +** Create a new SMS message. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | Message 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. | | +| content | string | SMS Content. | | +| topics | array | List of Topic IDs. | [] | +| users | array | List of User IDs. | [] | +| targets | array | List of Targets IDs. | [] | +| draft | boolean | Is message a draft | | +| scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/messages/sms/{messageId} +``` + +** Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| messageId | string | **Required** Message ID. | | +| topics | array | List of Topic IDs. | | +| users | array | List of User IDs. | | +| targets | array | List of Targets IDs. | | +| content | string | Email Content. | | +| draft | boolean | Is message a draft | | +| scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | + + ```http request PATCH https://cloud.appwrite.io/v1/messaging/messages/sms/{messageId} ``` @@ -255,6 +294,46 @@ POST https://cloud.appwrite.io/v1/messaging/providers/apns | enabled | boolean | Set as enabled. | | +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/apns +``` + +** Create a new Apple Push Notification service provider. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | Provider 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 | Provider name. | | +| authKey | string | APNS authentication key. | | +| authKeyId | string | APNS authentication key ID. | | +| teamId | string | APNS team ID. | | +| bundleId | string | APNS bundle ID. | | +| sandbox | boolean | Use APNS sandbox environment. | | +| enabled | boolean | Set as enabled. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/apns/{providerId} +``` + +** Update a Apple Push Notification service provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | +| name | string | Provider name. | | +| enabled | boolean | Set as enabled. | | +| authKey | string | APNS authentication key. | | +| authKeyId | string | APNS authentication key ID. | | +| teamId | string | APNS team ID. | | +| bundleId | string | APNS bundle ID. | | +| sandbox | boolean | Use APNS sandbox environment. | | + + ```http request PATCH https://cloud.appwrite.io/v1/messaging/providers/apns/{providerId} ``` @@ -291,6 +370,38 @@ POST https://cloud.appwrite.io/v1/messaging/providers/fcm | enabled | boolean | Set as enabled. | | +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/fcm +``` + +** Create a new Firebase Cloud Messaging provider. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | Provider 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 | Provider name. | | +| serviceAccountJSON | object | FCM service account JSON. | {} | +| enabled | boolean | Set as enabled. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/fcm/{providerId} +``` + +** Update a Firebase Cloud Messaging provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | +| name | string | Provider name. | | +| enabled | boolean | Set as enabled. | | +| serviceAccountJSON | object | FCM service account JSON. | {} | + + ```http request PATCH https://cloud.appwrite.io/v1/messaging/providers/fcm/{providerId} ``` @@ -453,6 +564,58 @@ POST https://cloud.appwrite.io/v1/messaging/providers/smtp | enabled | boolean | Set as enabled. | | +```http request +POST https://cloud.appwrite.io/v1/messaging/providers/smtp +``` + +** Create a new SMTP provider. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | Provider 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 | Provider name. | | +| host | string | SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. | | +| port | integer | The default SMTP server port. | 587 | +| username | string | Authentication username. | | +| password | string | Authentication password. | | +| encryption | string | Encryption type. Can be omitted, 'ssl', or 'tls' | | +| autoTLS | boolean | Enable SMTP AutoTLS feature. | 1 | +| mailer | string | The value to use for the X-Mailer header. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the reply to field for the mail. Default value is sender name. | | +| replyToEmail | string | Email set in the reply to field for the mail. Default value is sender email. | | +| enabled | boolean | Set as enabled. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/messaging/providers/smtp/{providerId} +``` + +** Update a SMTP provider by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| providerId | string | **Required** Provider ID. | | +| name | string | Provider name. | | +| host | string | SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. | | +| port | integer | SMTP port. | | +| username | string | Authentication username. | | +| password | string | Authentication password. | | +| encryption | string | Encryption type. Can be 'ssl' or 'tls' | | +| autoTLS | boolean | Enable SMTP AutoTLS feature. | | +| mailer | string | The value to use for the X-Mailer header. | | +| fromName | string | Sender Name. | | +| fromEmail | string | Sender email address. | | +| replyToName | string | Name set in the Reply To field for the mail. Default value is Sender Name. | | +| replyToEmail | string | Email set in the Reply To field for the mail. Default value is Sender Email. | | +| enabled | boolean | Set as enabled. | | + + ```http request PATCH https://cloud.appwrite.io/v1/messaging/providers/smtp/{providerId} ``` diff --git a/docs/tablesdb.md b/docs/tablesdb.md index f03d5b3..308efcd 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -1,4 +1,4 @@ -# TablesDb Service +# TablesDB Service ```http request @@ -91,7 +91,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables ``` -** Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** +** Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console. ** ### Parameters @@ -178,7 +178,7 @@ POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | Column Key. | | | required | boolean | Is column required? | | | default | boolean | Default value for column when not provided. Cannot be set when column is required. | | @@ -196,7 +196,7 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | **Required** Column Key. | | | required | boolean | Is column required? | | | default | boolean | Default value for column when not provided. Cannot be set when column is required. | | @@ -471,7 +471,7 @@ POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | Column Key. | | | size | integer | Attribute size for text attributes, in number of characters. | | | required | boolean | Is column required? | | @@ -492,7 +492,7 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | **Required** Column Key. | | | required | boolean | Is column required? | | | default | string | Default value for column when not provided. Cannot be set when column is required. | | @@ -597,7 +597,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | 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 | [] | @@ -613,7 +613,7 @@ Type can be `key`, `fulltext`, or `unique`. ** | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | Index Key. | | | type | string | Index type. | | | columns | array | Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. | | @@ -632,7 +632,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes/ | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | **Required** Index Key. | | @@ -647,7 +647,7 @@ DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/index | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | **Required** Index Key. | | @@ -662,7 +662,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the TableDB service [server integration](https://appwrite.io/docs/server/tablesdbdb#tablesdbCreate). | | | 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. | [] | @@ -670,14 +670,14 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows ``` -** Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** +** Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console. ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows. | | | rowId | string | Row 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 | Row 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). | | @@ -687,14 +687,14 @@ POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows ``` -** Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** +** Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console. ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows. | | | rows | array | Array of documents data as JSON objects. | [] | @@ -702,7 +702,7 @@ POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows PUT https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows ``` -** Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. +** Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console. ** ### Parameters @@ -741,7 +741,7 @@ DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | 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. | [] | @@ -756,7 +756,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{ro | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | rowId | string | **Required** Row 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. | [] | @@ -765,7 +765,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{ro PUT https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId} ``` -** Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. ** +** Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) API or directly from your database console. ** ### Parameters @@ -806,7 +806,7 @@ DELETE https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/rows/ | Field Name | Type | Description | Default | | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | -| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | rowId | string | **Required** Row ID. | | diff --git a/docs/users.md b/docs/users.md index a31ac8c..cf39ee4 100644 --- a/docs/users.md +++ b/docs/users.md @@ -294,6 +294,34 @@ PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa | mfa | boolean | Enable or disable MFA. | | +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa +``` + +** Enable or disable MFA on a user account. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| mfa | boolean | Enable or disable MFA. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/users/{userId}/mfa/authenticators/{type} +``` + +** Delete an authenticator app. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | +| type | string | **Required** Type of authenticator. | | + + ```http request DELETE https://cloud.appwrite.io/v1/users/{userId}/mfa/authenticators/{type} ``` @@ -321,6 +349,32 @@ GET https://cloud.appwrite.io/v1/users/{userId}/mfa/factors | userId | string | **Required** User ID. | | +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/mfa/factors +``` + +** List the factors available on the account to be used as a MFA challange. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes +``` + +** Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + + ```http request GET https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes ``` @@ -347,6 +401,32 @@ PUT https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes | userId | string | **Required** User ID. | | +```http request +PUT https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes +``` + +** Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes +``` + +** Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User ID. | | + + ```http request PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes ``` diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 92257b8..6ca8015 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -286,6 +286,9 @@ public function updateMFA(bool $mfa): array * @param AuthenticatorType $type * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createMFAAuthenticator` instead. + * @see CreateMFAAuthenticator */ public function createMfaAuthenticator(AuthenticatorType $type): array { @@ -309,6 +312,38 @@ public function createMfaAuthenticator(AuthenticatorType $type): array ); } + /** + * Add an authenticator app to be used as an MFA factor. Verify the + * authenticator using the [verify + * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) + * method. + * + * @param AuthenticatorType $type + * @throws AppwriteException + * @return array + */ + public function createMFAAuthenticator(AuthenticatorType $type): array + { + $apiPath = str_replace( + ['{type}'], + [$type], + '/account/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Verify an authenticator app after adding it using the [add * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) @@ -318,6 +353,9 @@ public function createMfaAuthenticator(AuthenticatorType $type): array * @param string $otp * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFAAuthenticator` instead. + * @see UpdateMFAAuthenticator */ public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): array { @@ -342,12 +380,48 @@ public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): ar ); } + /** + * Verify an authenticator app after adding it using the [add + * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) + * method. + * + * @param AuthenticatorType $type + * @param string $otp + * @throws AppwriteException + * @return array + */ + public function updateMFAAuthenticator(AuthenticatorType $type, string $otp): array + { + $apiPath = str_replace( + ['{type}'], + [$type], + '/account/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['type'] = $type; + $apiParams['otp'] = $otp; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Delete an authenticator for a user by ID. * * @param AuthenticatorType $type * @throws AppwriteException * @return string + * + * @deprecated This API has been deprecated since 1.8.0. Please use `deleteMFAAuthenticator` instead. + * @see DeleteMFAAuthenticator */ public function deleteMfaAuthenticator(AuthenticatorType $type): string { @@ -371,6 +445,35 @@ public function deleteMfaAuthenticator(AuthenticatorType $type): string ); } + /** + * Delete an authenticator for a user by ID. + * + * @param AuthenticatorType $type + * @throws AppwriteException + * @return string + */ + public function deleteMFAAuthenticator(AuthenticatorType $type): string + { + $apiPath = str_replace( + ['{type}'], + [$type], + '/account/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Begin the process of MFA verification after sign-in. Finish the flow with * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) @@ -379,6 +482,9 @@ public function deleteMfaAuthenticator(AuthenticatorType $type): string * @param AuthenticationFactor $factor * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createMFAChallenge` instead. + * @see CreateMFAChallenge */ public function createMfaChallenge(AuthenticationFactor $factor): array { @@ -402,6 +508,37 @@ public function createMfaChallenge(AuthenticationFactor $factor): array ); } + /** + * Begin the process of MFA verification after sign-in. Finish the flow with + * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) + * method. + * + * @param AuthenticationFactor $factor + * @throws AppwriteException + * @return array + */ + public function createMFAChallenge(AuthenticationFactor $factor): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/challenge' + ); + + $apiParams = []; + $apiParams['factor'] = $factor; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Complete the MFA challenge by providing the one-time password. Finish the * process of MFA verification by providing the one-time password. To begin @@ -413,6 +550,9 @@ public function createMfaChallenge(AuthenticationFactor $factor): array * @param string $otp * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFAChallenge` instead. + * @see UpdateMFAChallenge */ public function updateMfaChallenge(string $challengeId, string $otp): array { @@ -437,11 +577,49 @@ public function updateMfaChallenge(string $challengeId, string $otp): array ); } + /** + * Complete the MFA challenge by providing the one-time password. Finish the + * process of MFA verification by providing the one-time password. To begin + * the flow, use + * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) + * method. + * + * @param string $challengeId + * @param string $otp + * @throws AppwriteException + * @return array + */ + public function updateMFAChallenge(string $challengeId, string $otp): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/challenge' + ); + + $apiParams = []; + $apiParams['challengeId'] = $challengeId; + $apiParams['otp'] = $otp; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * List the factors available on the account to be used as a MFA challange. * * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `listMFAFactors` instead. + * @see ListMFAFactors */ public function listMfaFactors(): array { @@ -463,6 +641,32 @@ public function listMfaFactors(): array ); } + /** + * List the factors available on the account to be used as a MFA challange. + * + * @throws AppwriteException + * @return array + */ + public function listMFAFactors(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/factors' + ); + + $apiParams = []; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get recovery codes that can be used as backup for MFA flow. Before getting * codes, they must be generated using @@ -471,6 +675,9 @@ public function listMfaFactors(): array * * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `getMFARecoveryCodes` instead. + * @see GetMFARecoveryCodes */ public function getMfaRecoveryCodes(): array { @@ -492,6 +699,35 @@ public function getMfaRecoveryCodes(): array ); } + /** + * Get recovery codes that can be used as backup for MFA flow. Before getting + * codes, they must be generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. An OTP challenge is required to read recovery codes. + * + * @throws AppwriteException + * @return array + */ + public function getMFARecoveryCodes(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); + + $apiParams = []; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Generate recovery codes as backup for MFA flow. It's recommended to * generate and show then immediately after user successfully adds their @@ -501,6 +737,9 @@ public function getMfaRecoveryCodes(): array * * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createMFARecoveryCodes` instead. + * @see CreateMFARecoveryCodes */ public function createMfaRecoveryCodes(): array { @@ -523,6 +762,37 @@ public function createMfaRecoveryCodes(): array ); } + /** + * Generate recovery codes as backup for MFA flow. It's recommended to + * generate and show then immediately after user successfully adds their + * authehticator. Recovery codes can be used as a MFA verification type in + * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) + * method. + * + * @throws AppwriteException + * @return array + */ + public function createMFARecoveryCodes(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Regenerate recovery codes that can be used as backup for MFA flow. Before * regenerating codes, they must be first generated using @@ -531,6 +801,9 @@ public function createMfaRecoveryCodes(): array * * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFARecoveryCodes` instead. + * @see UpdateMFARecoveryCodes */ public function updateMfaRecoveryCodes(): array { @@ -553,6 +826,36 @@ public function updateMfaRecoveryCodes(): array ); } + /** + * Regenerate recovery codes that can be used as backup for MFA flow. Before + * regenerating codes, they must be first generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. An OTP challenge is required to regenreate recovery codes. + * + * @throws AppwriteException + * @return array + */ + public function updateMFARecoveryCodes(): array + { + $apiPath = str_replace( + [], + [], + '/account/mfa/recovery-codes' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Update currently logged in user account name. * diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 211a520..1060a0a 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -27,7 +27,7 @@ public function __construct(Client $client) * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `list` instead. - * @see TablesDb::list + * @see TablesDB::list */ public function list(?array $queries = null, ?string $search = null): array { @@ -68,7 +68,7 @@ public function list(?array $queries = null, ?string $search = null): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createDatabase` instead. - * @see TablesDb::createDatabase + * @see TablesDB::createDatabase */ public function create(string $databaseId, string $name, ?bool $enabled = null): array { @@ -106,7 +106,7 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `get` instead. - * @see TablesDb::get + * @see TablesDB::get */ public function get(string $databaseId): array { @@ -139,7 +139,7 @@ public function get(string $databaseId): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `update` instead. - * @see TablesDb::update + * @see TablesDB::update */ public function update(string $databaseId, string $name, ?bool $enabled = null): array { @@ -177,7 +177,7 @@ public function update(string $databaseId, string $name, ?bool $enabled = null): * @return string * * @deprecated This API has been deprecated since 1.8.0. Please use `delete` instead. - * @see TablesDb::delete + * @see TablesDB::delete */ public function delete(string $databaseId): string { @@ -212,7 +212,7 @@ public function delete(string $databaseId): string * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listTables` instead. - * @see TablesDb::listTables + * @see TablesDB::listTables */ public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null): array { @@ -259,7 +259,7 @@ public function listCollections(string $databaseId, ?array $queries = null, ?str * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createTable` instead. - * @see TablesDb::createTable + * @see TablesDB::createTable */ public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array { @@ -307,7 +307,7 @@ public function createCollection(string $databaseId, string $collectionId, strin * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `getTable` instead. - * @see TablesDb::getTable + * @see TablesDB::getTable */ public function getCollection(string $databaseId, string $collectionId): array { @@ -344,7 +344,7 @@ public function getCollection(string $databaseId, string $collectionId): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateTable` instead. - * @see TablesDb::updateTable + * @see TablesDB::updateTable */ public function updateCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array { @@ -392,7 +392,7 @@ public function updateCollection(string $databaseId, string $collectionId, strin * @return string * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteTable` instead. - * @see TablesDb::deleteTable + * @see TablesDB::deleteTable */ public function deleteCollection(string $databaseId, string $collectionId): string { @@ -427,7 +427,7 @@ public function deleteCollection(string $databaseId, string $collectionId): stri * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listColumns` instead. - * @see TablesDb::listColumns + * @see TablesDB::listColumns */ public function listAttributes(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -469,7 +469,7 @@ public function listAttributes(string $databaseId, string $collectionId, ?array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createBooleanColumn` instead. - * @see TablesDb::createBooleanColumn + * @see TablesDB::createBooleanColumn */ public function createBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault = null, ?bool $xarray = null): array { @@ -518,7 +518,7 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateBooleanColumn` instead. - * @see TablesDb::updateBooleanColumn + * @see TablesDB::updateBooleanColumn */ public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): array { @@ -563,7 +563,7 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createDatetimeColumn` instead. - * @see TablesDb::createDatetimeColumn + * @see TablesDB::createDatetimeColumn */ public function createDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -612,7 +612,7 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateDatetimeColumn` instead. - * @see TablesDb::updateDatetimeColumn + * @see TablesDB::updateDatetimeColumn */ public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -658,7 +658,7 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createEmailColumn` instead. - * @see TablesDb::createEmailColumn + * @see TablesDB::createEmailColumn */ public function createEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -708,7 +708,7 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateEmailColumn` instead. - * @see TablesDb::updateEmailColumn + * @see TablesDB::updateEmailColumn */ public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -756,7 +756,7 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createEnumColumn` instead. - * @see TablesDb::createEnumColumn + * @see TablesDB::createEnumColumn */ public function createEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -808,7 +808,7 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateEnumColumn` instead. - * @see TablesDb::updateEnumColumn + * @see TablesDB::updateEnumColumn */ public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -858,7 +858,7 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createFloatColumn` instead. - * @see TablesDb::createFloatColumn + * @see TablesDB::createFloatColumn */ public function createFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $min = null, ?float $max = null, ?float $xdefault = null, ?bool $xarray = null): array { @@ -918,7 +918,7 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateFloatColumn` instead. - * @see TablesDb::updateFloatColumn + * @see TablesDB::updateFloatColumn */ public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?float $xdefault, ?float $min = null, ?float $max = null, ?string $newKey = null): array { @@ -975,7 +975,7 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createIntegerColumn` instead. - * @see TablesDb::createIntegerColumn + * @see TablesDB::createIntegerColumn */ public function createIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $min = null, ?int $max = null, ?int $xdefault = null, ?bool $xarray = null): array { @@ -1035,7 +1035,7 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateIntegerColumn` instead. - * @see TablesDb::updateIntegerColumn + * @see TablesDB::updateIntegerColumn */ public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?int $xdefault, ?int $min = null, ?int $max = null, ?string $newKey = null): array { @@ -1089,7 +1089,7 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createIpColumn` instead. - * @see TablesDb::createIpColumn + * @see TablesDB::createIpColumn */ public function createIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -1139,7 +1139,7 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateIpColumn` instead. - * @see TablesDb::updateIpColumn + * @see TablesDB::updateIpColumn */ public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -1188,7 +1188,7 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createRelationshipColumn` instead. - * @see TablesDb::createRelationshipColumn + * @see TablesDB::createRelationshipColumn */ public function createRelationshipAttribute(string $databaseId, string $collectionId, string $relatedCollectionId, RelationshipType $type, ?bool $twoWay = null, ?string $key = null, ?string $twoWayKey = null, ?RelationMutate $onDelete = null): array { @@ -1247,7 +1247,7 @@ public function createRelationshipAttribute(string $databaseId, string $collecti * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createStringColumn` instead. - * @see TablesDb::createStringColumn + * @see TablesDB::createStringColumn */ public function createStringAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array { @@ -1303,7 +1303,7 @@ public function createStringAttribute(string $databaseId, string $collectionId, * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateStringColumn` instead. - * @see TablesDb::updateStringColumn + * @see TablesDB::updateStringColumn */ public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array { @@ -1353,7 +1353,7 @@ public function updateStringAttribute(string $databaseId, string $collectionId, * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createUrlColumn` instead. - * @see TablesDb::createUrlColumn + * @see TablesDB::createUrlColumn */ public function createUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array { @@ -1403,7 +1403,7 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateUrlColumn` instead. - * @see TablesDb::updateUrlColumn + * @see TablesDB::updateUrlColumn */ public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { @@ -1445,7 +1445,7 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `getColumn` instead. - * @see TablesDb::getColumn + * @see TablesDB::getColumn */ public function getAttribute(string $databaseId, string $collectionId, string $key): array { @@ -1480,7 +1480,7 @@ public function getAttribute(string $databaseId, string $collectionId, string $k * @return string * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteColumn` instead. - * @see TablesDb::deleteColumn + * @see TablesDB::deleteColumn */ public function deleteAttribute(string $databaseId, string $collectionId, string $key): string { @@ -1520,7 +1520,7 @@ public function deleteAttribute(string $databaseId, string $collectionId, string * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateRelationshipColumn` instead. - * @see TablesDb::updateRelationshipColumn + * @see TablesDB::updateRelationshipColumn */ public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): array { @@ -1565,7 +1565,7 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listRows` instead. - * @see TablesDb::listRows + * @see TablesDB::listRows */ public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -1608,7 +1608,7 @@ public function listDocuments(string $databaseId, string $collectionId, ?array $ * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createRow` instead. - * @see TablesDb::createRow + * @see TablesDB::createRow */ public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array { @@ -1652,7 +1652,7 @@ public function createDocument(string $databaseId, string $collectionId, string * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createRows` instead. - * @see TablesDb::createRows + * @see TablesDB::createRows */ public function createDocuments(string $databaseId, string $collectionId, array $documents): array { @@ -1692,7 +1692,7 @@ public function createDocuments(string $databaseId, string $collectionId, array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRows` instead. - * @see TablesDb::upsertRows + * @see TablesDB::upsertRows */ public function upsertDocuments(string $databaseId, string $collectionId, array $documents): array { @@ -1731,7 +1731,7 @@ public function upsertDocuments(string $databaseId, string $collectionId, array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateRows` instead. - * @see TablesDb::updateRows + * @see TablesDB::updateRows */ public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null): array { @@ -1775,7 +1775,7 @@ public function updateDocuments(string $databaseId, string $collectionId, ?array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteRows` instead. - * @see TablesDb::deleteRows + * @see TablesDB::deleteRows */ public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -1816,7 +1816,7 @@ public function deleteDocuments(string $databaseId, string $collectionId, ?array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `getRow` instead. - * @see TablesDb::getRow + * @see TablesDB::getRow */ public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null): array { @@ -1860,7 +1860,7 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRow` instead. - * @see TablesDb::upsertRow + * @see TablesDB::upsertRow */ public function upsertDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): array { @@ -1904,7 +1904,7 @@ public function upsertDocument(string $databaseId, string $collectionId, string * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateRow` instead. - * @see TablesDb::updateRow + * @see TablesDB::updateRow */ public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null): array { @@ -1948,7 +1948,7 @@ public function updateDocument(string $databaseId, string $collectionId, string * @return string * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteRow` instead. - * @see TablesDb::deleteRow + * @see TablesDB::deleteRow */ public function deleteDocument(string $databaseId, string $collectionId, string $documentId): string { @@ -1987,7 +1987,7 @@ public function deleteDocument(string $databaseId, string $collectionId, string * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `decrementRowColumn` instead. - * @see TablesDb::decrementRowColumn + * @see TablesDB::decrementRowColumn */ public function decrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $min = null): array { @@ -2035,7 +2035,7 @@ public function decrementDocumentAttribute(string $databaseId, string $collectio * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `incrementRowColumn` instead. - * @see TablesDb::incrementRowColumn + * @see TablesDB::incrementRowColumn */ public function incrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $max = null): array { @@ -2080,7 +2080,7 @@ public function incrementDocumentAttribute(string $databaseId, string $collectio * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listIndexes` instead. - * @see TablesDb::listIndexes + * @see TablesDB::listIndexes */ public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null): array { @@ -2124,7 +2124,7 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createIndex` instead. - * @see TablesDb::createIndex + * @see TablesDB::createIndex */ public function createIndex(string $databaseId, string $collectionId, string $key, IndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): array { @@ -2170,7 +2170,7 @@ public function createIndex(string $databaseId, string $collectionId, string $ke * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `getIndex` instead. - * @see TablesDb::getIndex + * @see TablesDB::getIndex */ public function getIndex(string $databaseId, string $collectionId, string $key): array { @@ -2205,7 +2205,7 @@ public function getIndex(string $databaseId, string $collectionId, string $key): * @return string * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteIndex` instead. - * @see TablesDb::deleteIndex + * @see TablesDB::deleteIndex */ public function deleteIndex(string $databaseId, string $collectionId, string $key): string { diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index 70f93fb..1f6c81d 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -470,6 +470,9 @@ public function updatePush(string $messageId, ?array $topics = null, ?array $use * @param ?string $scheduledAt * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createSMS` instead. + * @see CreateSMS */ public function createSms(string $messageId, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?bool $draft = null, ?string $scheduledAt = null): array { @@ -514,6 +517,62 @@ public function createSms(string $messageId, string $content, ?array $topics = n ); } + /** + * Create a new SMS message. + * + * @param string $messageId + * @param string $content + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?bool $draft + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + public function createSMS(string $messageId, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?bool $draft = null, ?string $scheduledAt = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/messages/sms' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + $apiParams['content'] = $content; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Update an SMS message by its unique ID. This endpoint only works on * messages that are in draft status. Messages that are already processing, @@ -529,6 +588,9 @@ public function createSms(string $messageId, string $content, ?array $topics = n * @param ?string $scheduledAt * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateSMS` instead. + * @see UpdateSMS */ public function updateSms(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $content = null, ?bool $draft = null, ?string $scheduledAt = null): array { @@ -576,6 +638,68 @@ public function updateSms(string $messageId, ?array $topics = null, ?array $user ); } + /** + * Update an SMS message by its unique ID. This endpoint only works on + * messages that are in draft status. Messages that are already processing, + * sent, or failed cannot be updated. + * + * + * @param string $messageId + * @param ?array $topics + * @param ?array $users + * @param ?array $targets + * @param ?string $content + * @param ?bool $draft + * @param ?string $scheduledAt + * @throws AppwriteException + * @return array + */ + public function updateSMS(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $content = null, ?bool $draft = null, ?string $scheduledAt = null): array + { + $apiPath = str_replace( + ['{messageId}'], + [$messageId], + '/messaging/messages/sms/{messageId}' + ); + + $apiParams = []; + $apiParams['messageId'] = $messageId; + + if (!is_null($topics)) { + $apiParams['topics'] = $topics; + } + + if (!is_null($users)) { + $apiParams['users'] = $users; + } + + if (!is_null($targets)) { + $apiParams['targets'] = $targets; + } + + if (!is_null($content)) { + $apiParams['content'] = $content; + } + + if (!is_null($draft)) { + $apiParams['draft'] = $draft; + } + + if (!is_null($scheduledAt)) { + $apiParams['scheduledAt'] = $scheduledAt; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get a message by its unique ID. * @@ -750,6 +874,9 @@ public function listProviders(?array $queries = null, ?string $search = null): a * @param ?bool $enabled * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createAPNSProvider` instead. + * @see CreateAPNSProvider */ public function createApnsProvider(string $providerId, string $name, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null, ?bool $enabled = null): array { @@ -798,6 +925,67 @@ public function createApnsProvider(string $providerId, string $name, ?string $au ); } + /** + * Create a new Apple Push Notification service provider. + * + * @param string $providerId + * @param string $name + * @param ?string $authKey + * @param ?string $authKeyId + * @param ?string $teamId + * @param ?string $bundleId + * @param ?bool $sandbox + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createAPNSProvider(string $providerId, string $name, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/apns' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($authKey)) { + $apiParams['authKey'] = $authKey; + } + + if (!is_null($authKeyId)) { + $apiParams['authKeyId'] = $authKeyId; + } + + if (!is_null($teamId)) { + $apiParams['teamId'] = $teamId; + } + + if (!is_null($bundleId)) { + $apiParams['bundleId'] = $bundleId; + } + + if (!is_null($sandbox)) { + $apiParams['sandbox'] = $sandbox; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Update a Apple Push Notification service provider by its unique ID. * @@ -811,6 +999,9 @@ public function createApnsProvider(string $providerId, string $name, ?string $au * @param ?bool $sandbox * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateAPNSProvider` instead. + * @see UpdateAPNSProvider */ public function updateApnsProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null): array { @@ -862,6 +1053,70 @@ public function updateApnsProvider(string $providerId, ?string $name = null, ?bo ); } + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?string $authKey + * @param ?string $authKeyId + * @param ?string $teamId + * @param ?string $bundleId + * @param ?bool $sandbox + * @throws AppwriteException + * @return array + */ + public function updateAPNSProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/apns/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($authKey)) { + $apiParams['authKey'] = $authKey; + } + + if (!is_null($authKeyId)) { + $apiParams['authKeyId'] = $authKeyId; + } + + if (!is_null($teamId)) { + $apiParams['teamId'] = $teamId; + } + + if (!is_null($bundleId)) { + $apiParams['bundleId'] = $bundleId; + } + + if (!is_null($sandbox)) { + $apiParams['sandbox'] = $sandbox; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a new Firebase Cloud Messaging provider. * @@ -871,6 +1126,9 @@ public function updateApnsProvider(string $providerId, ?string $name = null, ?bo * @param ?bool $enabled * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createFCMProvider` instead. + * @see CreateFCMProvider */ public function createFcmProvider(string $providerId, string $name, ?array $serviceAccountJSON = null, ?bool $enabled = null): array { @@ -903,6 +1161,47 @@ public function createFcmProvider(string $providerId, string $name, ?array $serv ); } + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param string $providerId + * @param string $name + * @param ?array $serviceAccountJSON + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createFCMProvider(string $providerId, string $name, ?array $serviceAccountJSON = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/fcm' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + + if (!is_null($serviceAccountJSON)) { + $apiParams['serviceAccountJSON'] = $serviceAccountJSON; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -912,6 +1211,9 @@ public function createFcmProvider(string $providerId, string $name, ?array $serv * @param ?array $serviceAccountJSON * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateFCMProvider` instead. + * @see UpdateFCMProvider */ public function updateFcmProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?array $serviceAccountJSON = null): array { @@ -947,6 +1249,50 @@ public function updateFcmProvider(string $providerId, ?string $name = null, ?boo ); } + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?bool $enabled + * @param ?array $serviceAccountJSON + * @throws AppwriteException + * @return array + */ + public function updateFCMProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?array $serviceAccountJSON = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/fcm/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($serviceAccountJSON)) { + $apiParams['serviceAccountJSON'] = $serviceAccountJSON; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a new Mailgun provider. * @@ -1341,6 +1687,9 @@ public function updateSendgridProvider(string $providerId, ?string $name = null, * @param ?bool $enabled * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createSMTPProvider` instead. + * @see CreateSMTPProvider */ public function createSmtpProvider(string $providerId, string $name, string $host, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array { @@ -1410,6 +1759,94 @@ public function createSmtpProvider(string $providerId, string $name, string $hos ); } + /** + * Create a new SMTP provider. + * + * @param string $providerId + * @param string $name + * @param string $host + * @param ?int $port + * @param ?string $username + * @param ?string $password + * @param ?SmtpEncryption $encryption + * @param ?bool $autoTLS + * @param ?string $mailer + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createSMTPProvider(string $providerId, string $name, string $host, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/messaging/providers/smtp' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + $apiParams['name'] = $name; + $apiParams['host'] = $host; + + if (!is_null($port)) { + $apiParams['port'] = $port; + } + + if (!is_null($username)) { + $apiParams['username'] = $username; + } + + if (!is_null($password)) { + $apiParams['password'] = $password; + } + + if (!is_null($encryption)) { + $apiParams['encryption'] = $encryption; + } + + if (!is_null($autoTLS)) { + $apiParams['autoTLS'] = $autoTLS; + } + + if (!is_null($mailer)) { + $apiParams['mailer'] = $mailer; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Update a SMTP provider by its unique ID. * @@ -1429,6 +1866,9 @@ public function createSmtpProvider(string $providerId, string $name, string $hos * @param ?bool $enabled * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateSMTPProvider` instead. + * @see UpdateSMTPProvider */ public function updateSmtpProvider(string $providerId, ?string $name = null, ?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array { @@ -1504,6 +1944,100 @@ public function updateSmtpProvider(string $providerId, ?string $name = null, ?st ); } + /** + * Update a SMTP provider by its unique ID. + * + * @param string $providerId + * @param ?string $name + * @param ?string $host + * @param ?int $port + * @param ?string $username + * @param ?string $password + * @param ?SmtpEncryption $encryption + * @param ?bool $autoTLS + * @param ?string $mailer + * @param ?string $fromName + * @param ?string $fromEmail + * @param ?string $replyToName + * @param ?string $replyToEmail + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updateSMTPProvider(string $providerId, ?string $name = null, ?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{providerId}'], + [$providerId], + '/messaging/providers/smtp/{providerId}' + ); + + $apiParams = []; + $apiParams['providerId'] = $providerId; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + + if (!is_null($host)) { + $apiParams['host'] = $host; + } + + if (!is_null($port)) { + $apiParams['port'] = $port; + } + + if (!is_null($username)) { + $apiParams['username'] = $username; + } + + if (!is_null($password)) { + $apiParams['password'] = $password; + } + + if (!is_null($encryption)) { + $apiParams['encryption'] = $encryption; + } + + if (!is_null($autoTLS)) { + $apiParams['autoTLS'] = $autoTLS; + } + + if (!is_null($mailer)) { + $apiParams['mailer'] = $mailer; + } + + if (!is_null($fromName)) { + $apiParams['fromName'] = $fromName; + } + + if (!is_null($fromEmail)) { + $apiParams['fromEmail'] = $fromEmail; + } + + if (!is_null($replyToName)) { + $apiParams['replyToName'] = $replyToName; + } + + if (!is_null($replyToEmail)) { + $apiParams['replyToEmail'] = $replyToEmail; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a new Telesign provider. * diff --git a/src/Appwrite/Services/TablesDb.php b/src/Appwrite/Services/TablesDb.php index dcb1e2c..59a4254 100644 --- a/src/Appwrite/Services/TablesDb.php +++ b/src/Appwrite/Services/TablesDb.php @@ -10,7 +10,7 @@ use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; -class TablesDb extends Service +class TablesDB extends Service { public function __construct(Client $client) { @@ -228,7 +228,7 @@ public function listTables(string $databaseId, ?array $queries = null, ?string $ /** * Create a new Table. Before using this route, you should create a new * database resource using either a [server - * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) * API or directly from your database console. * * @param string $databaseId @@ -1642,7 +1642,7 @@ public function listRows(string $databaseId, string $tableId, ?array $queries = /** * Create a new Row. Before using this route, you should create a new table * resource using either a [server - * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) * API or directly from your database console. * * @param string $databaseId @@ -1685,7 +1685,7 @@ public function createRow(string $databaseId, string $tableId, string $rowId, ar /** * Create new Rows. Before using this route, you should create a new table * resource using either a [server - * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) * API or directly from your database console. * * @param string $databaseId @@ -1721,7 +1721,7 @@ public function createRows(string $databaseId, string $tableId, array $rows): ar /** * Create or update Rows. Before using this route, you should create a new * table resource using either a [server - * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) * API or directly from your database console. * * @@ -1875,7 +1875,7 @@ public function getRow(string $databaseId, string $tableId, string $rowId, ?arra /** * Create or update a Row. Before using this route, you should create a new * table resource using either a [server - * integration](https://appwrite.io/docs/server/databases#databasesCreateTable) + * integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) * API or directly from your database console. * * @param string $databaseId diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index e5c2841..7c55c47 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -725,6 +725,9 @@ public function listMemberships(string $userId, ?array $queries = null, ?string * @param bool $mfa * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFA` instead. + * @see UpdateMFA */ public function updateMfa(string $userId, bool $mfa): array { @@ -749,6 +752,37 @@ public function updateMfa(string $userId, bool $mfa): array ); } + /** + * Enable or disable MFA on a user account. + * + * @param string $userId + * @param bool $mfa + * @throws AppwriteException + * @return array + */ + public function updateMFA(string $userId, bool $mfa): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['mfa'] = $mfa; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Delete an authenticator app. * @@ -756,6 +790,9 @@ public function updateMfa(string $userId, bool $mfa): array * @param AuthenticatorType $type * @throws AppwriteException * @return string + * + * @deprecated This API has been deprecated since 1.8.0. Please use `deleteMFAAuthenticator` instead. + * @see DeleteMFAAuthenticator */ public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): string { @@ -780,12 +817,46 @@ public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): ); } + /** + * Delete an authenticator app. + * + * @param string $userId + * @param AuthenticatorType $type + * @throws AppwriteException + * @return string + */ + public function deleteMFAAuthenticator(string $userId, AuthenticatorType $type): string + { + $apiPath = str_replace( + ['{userId}', '{type}'], + [$userId, $type], + '/users/{userId}/mfa/authenticators/{type}' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + $apiParams['type'] = $type; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * List the factors available on the account to be used as a MFA challange. * * @param string $userId * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `listMFAFactors` instead. + * @see ListMFAFactors */ public function listMfaFactors(string $userId): array { @@ -808,6 +879,34 @@ public function listMfaFactors(string $userId): array ); } + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function listMFAFactors(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/factors' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get recovery codes that can be used as backup for MFA flow by User ID. * Before getting codes, they must be generated using @@ -817,6 +916,9 @@ public function listMfaFactors(string $userId): array * @param string $userId * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `getMFARecoveryCodes` instead. + * @see GetMFARecoveryCodes */ public function getMfaRecoveryCodes(string $userId): array { @@ -839,6 +941,37 @@ public function getMfaRecoveryCodes(string $userId): array ); } + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. + * Before getting codes, they must be generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function getMFARecoveryCodes(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Regenerate recovery codes that can be used as backup for MFA flow by User * ID. Before regenerating codes, they must be first generated using @@ -848,6 +981,9 @@ public function getMfaRecoveryCodes(string $userId): array * @param string $userId * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFARecoveryCodes` instead. + * @see UpdateMFARecoveryCodes */ public function updateMfaRecoveryCodes(string $userId): array { @@ -871,6 +1007,38 @@ public function updateMfaRecoveryCodes(string $userId): array ); } + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User + * ID. Before regenerating codes, they must be first generated using + * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) + * method. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function updateMFARecoveryCodes(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Generate recovery codes used as backup for MFA flow for User ID. Recovery * codes can be used as a MFA verification type in @@ -880,6 +1048,9 @@ public function updateMfaRecoveryCodes(string $userId): array * @param string $userId * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createMFARecoveryCodes` instead. + * @see CreateMFARecoveryCodes */ public function createMfaRecoveryCodes(string $userId): array { @@ -903,6 +1074,38 @@ public function createMfaRecoveryCodes(string $userId): array ); } + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery + * codes can be used as a MFA verification type in + * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) + * method by client SDK. + * + * @param string $userId + * @throws AppwriteException + * @return array + */ + public function createMFARecoveryCodes(string $userId): array + { + $apiPath = str_replace( + ['{userId}'], + [$userId], + '/users/{userId}/mfa/recovery-codes' + ); + + $apiParams = []; + $apiParams['userId'] = $userId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Update the user name by its unique ID. * diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index 8419699..b6a7be5 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -230,6 +230,24 @@ public function testMethodCreateMfaAuthenticator(): void { $this->assertSame($data, $response); } + public function testMethodCreateMFAAuthenticator(): void { + + $data = array( + "secret" => "1", + "uri" => "1",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createMFAAuthenticator( + "totp" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateMfaAuthenticator(): void { $data = array( @@ -263,6 +281,39 @@ public function testMethodUpdateMfaAuthenticator(): void { $this->assertSame($data, $response); } + public function testMethodUpdateMFAAuthenticator(): 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->account->updateMFAAuthenticator( + "totp", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodDeleteMfaAuthenticator(): void { $data = ''; @@ -279,6 +330,22 @@ public function testMethodDeleteMfaAuthenticator(): void { $this->assertSame($data, $response); } + public function testMethodDeleteMFAAuthenticator(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->deleteMFAAuthenticator( + "totp" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateMfaChallenge(): void { $data = array( @@ -299,6 +366,26 @@ public function testMethodCreateMfaChallenge(): void { $this->assertSame($data, $response); } + public function testMethodCreateMFAChallenge(): void { + + $data = array( + "\$id" => "bb8ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5ea5c168bb8", + "expire" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createMFAChallenge( + "email" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateMfaChallenge(): void { $data = array( @@ -345,6 +432,52 @@ public function testMethodUpdateMfaChallenge(): void { $this->assertSame($data, $response); } + public function testMethodUpdateMFAChallenge(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "userId" => "5e5bb8c16897e", + "expire" => "2020-10-15T06:38:00.000+00:00", + "provider" => "email", + "providerUid" => "user@example.com", + "providerAccessToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "providerAccessTokenExpiry" => "2020-10-15T06:38:00.000+00:00", + "providerRefreshToken" => "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3", + "ip" => "127.0.0.1", + "osCode" => "Mac", + "osName" => "Mac", + "osVersion" => "Mac", + "clientType" => "browser", + "clientCode" => "CM", + "clientName" => "Chrome Mobile iOS", + "clientVersion" => "84.0", + "clientEngine" => "WebKit", + "clientEngineVersion" => "605.1.15", + "deviceName" => "smartphone", + "deviceBrand" => "Google", + "deviceModel" => "Nexus 5", + "countryCode" => "US", + "countryName" => "United States", + "current" => true, + "factors" => array(), + "secret" => "5e5bb8c16897e", + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateMFAChallenge( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListMfaFactors(): void { $data = array( @@ -364,6 +497,25 @@ public function testMethodListMfaFactors(): void { $this->assertSame($data, $response); } + public function testMethodListMFAFactors(): void { + + $data = array( + "totp" => true, + "phone" => true, + "email" => true, + "recoveryCode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->listMFAFactors( + ); + + $this->assertSame($data, $response); + } + public function testMethodGetMfaRecoveryCodes(): void { $data = array( @@ -380,6 +532,22 @@ public function testMethodGetMfaRecoveryCodes(): void { $this->assertSame($data, $response); } + public function testMethodGetMFARecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->getMFARecoveryCodes( + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateMfaRecoveryCodes(): void { $data = array( @@ -396,6 +564,22 @@ public function testMethodCreateMfaRecoveryCodes(): void { $this->assertSame($data, $response); } + public function testMethodCreateMFARecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createMFARecoveryCodes( + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateMfaRecoveryCodes(): void { $data = array( @@ -412,6 +596,22 @@ public function testMethodUpdateMfaRecoveryCodes(): void { $this->assertSame($data, $response); } + public function testMethodUpdateMFARecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateMFARecoveryCodes( + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateName(): void { $data = array( diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php index f447883..1c37cdf 100644 --- a/tests/Appwrite/Services/MessagingTest.php +++ b/tests/Appwrite/Services/MessagingTest.php @@ -166,6 +166,33 @@ public function testMethodCreateSms(): void { $this->assertSame($data, $response); } + public function testMethodCreateSMS(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createSMS( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateSms(): void { $data = array( @@ -192,6 +219,32 @@ public function testMethodUpdateSms(): void { $this->assertSame($data, $response); } + public function testMethodUpdateSMS(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "providerType" => "email", + "topics" => array(), + "users" => array(), + "targets" => array(), + "deliveredTotal" => 1, + "data" => array(), + "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateSMS( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodGetMessage(): void { $data = array( @@ -312,6 +365,31 @@ public function testMethodCreateApnsProvider(): void { $this->assertSame($data, $response); } + public function testMethodCreateAPNSProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createAPNSProvider( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateApnsProvider(): void { $data = array( @@ -336,6 +414,30 @@ public function testMethodUpdateApnsProvider(): void { $this->assertSame($data, $response); } + public function testMethodUpdateAPNSProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateAPNSProvider( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateFcmProvider(): void { $data = array( @@ -361,6 +463,31 @@ public function testMethodCreateFcmProvider(): void { $this->assertSame($data, $response); } + public function testMethodCreateFCMProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createFCMProvider( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateFcmProvider(): void { $data = array( @@ -385,6 +512,30 @@ public function testMethodUpdateFcmProvider(): void { $this->assertSame($data, $response); } + public function testMethodUpdateFCMProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateFCMProvider( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateMailgunProvider(): void { $data = array( @@ -558,6 +709,32 @@ public function testMethodCreateSmtpProvider(): void { $this->assertSame($data, $response); } + public function testMethodCreateSMTPProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->createSMTPProvider( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateSmtpProvider(): void { $data = array( @@ -582,6 +759,30 @@ public function testMethodUpdateSmtpProvider(): void { $this->assertSame($data, $response); } + public function testMethodUpdateSMTPProvider(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Mailgun", + "provider" => "mailgun", + "enabled" => true, + "type" => "sms", + "credentials" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->messaging->updateSMTPProvider( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateTelesignProvider(): void { $data = array( diff --git a/tests/Appwrite/Services/TablesDbTest.php b/tests/Appwrite/Services/TablesDbTest.php index 3e10d75..6a47bea 100644 --- a/tests/Appwrite/Services/TablesDbTest.php +++ b/tests/Appwrite/Services/TablesDbTest.php @@ -7,13 +7,13 @@ use Mockery; use PHPUnit\Framework\TestCase; -final class TablesDbTest extends TestCase { +final class TablesDBTest extends TestCase { private $client; - private $tablesDb; + private $tablesDB; protected function setUp(): void { $this->client = Mockery::mock(Client::class); - $this->tablesDb = new TablesDb($this->client); + $this->tablesDB = new TablesDB($this->client); } public function testMethodList(): void { @@ -27,7 +27,7 @@ public function testMethodList(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->list( + $response = $this->tablesDB->list( ); $this->assertSame($data, $response); @@ -48,7 +48,7 @@ public function testMethodCreate(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->create( + $response = $this->tablesDB->create( "", "" ); @@ -71,7 +71,7 @@ public function testMethodGet(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->get( + $response = $this->tablesDB->get( "" ); @@ -93,7 +93,7 @@ public function testMethodUpdate(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->update( + $response = $this->tablesDB->update( "", "" ); @@ -110,7 +110,7 @@ public function testMethodDelete(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->delete( + $response = $this->tablesDB->delete( "" ); @@ -128,7 +128,7 @@ public function testMethodListTables(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->listTables( + $response = $this->tablesDB->listTables( "" ); @@ -154,7 +154,7 @@ public function testMethodCreateTable(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createTable( + $response = $this->tablesDB->createTable( "", "", "" @@ -182,7 +182,7 @@ public function testMethodGetTable(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->getTable( + $response = $this->tablesDB->getTable( "", "" ); @@ -209,7 +209,7 @@ public function testMethodUpdateTable(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateTable( + $response = $this->tablesDB->updateTable( "", "", "" @@ -227,7 +227,7 @@ public function testMethodDeleteTable(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->deleteTable( + $response = $this->tablesDB->deleteTable( "", "" ); @@ -246,7 +246,7 @@ public function testMethodListColumns(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->listColumns( + $response = $this->tablesDB->listColumns( "", "" ); @@ -270,7 +270,7 @@ public function testMethodCreateBooleanColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createBooleanColumn( + $response = $this->tablesDB->createBooleanColumn( "", "", "", @@ -296,7 +296,7 @@ public function testMethodUpdateBooleanColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateBooleanColumn( + $response = $this->tablesDB->updateBooleanColumn( "", "", "", @@ -324,7 +324,7 @@ public function testMethodCreateDatetimeColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createDatetimeColumn( + $response = $this->tablesDB->createDatetimeColumn( "", "", "", @@ -351,7 +351,7 @@ public function testMethodUpdateDatetimeColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateDatetimeColumn( + $response = $this->tablesDB->updateDatetimeColumn( "", "", "", @@ -379,7 +379,7 @@ public function testMethodCreateEmailColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createEmailColumn( + $response = $this->tablesDB->createEmailColumn( "", "", "", @@ -406,7 +406,7 @@ public function testMethodUpdateEmailColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateEmailColumn( + $response = $this->tablesDB->updateEmailColumn( "", "", "", @@ -435,7 +435,7 @@ public function testMethodCreateEnumColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createEnumColumn( + $response = $this->tablesDB->createEnumColumn( "", "", "", @@ -464,7 +464,7 @@ public function testMethodUpdateEnumColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateEnumColumn( + $response = $this->tablesDB->updateEnumColumn( "", "", "", @@ -492,7 +492,7 @@ public function testMethodCreateFloatColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createFloatColumn( + $response = $this->tablesDB->createFloatColumn( "", "", "", @@ -518,7 +518,7 @@ public function testMethodUpdateFloatColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateFloatColumn( + $response = $this->tablesDB->updateFloatColumn( "", "", "", @@ -545,7 +545,7 @@ public function testMethodCreateIntegerColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createIntegerColumn( + $response = $this->tablesDB->createIntegerColumn( "", "", "", @@ -571,7 +571,7 @@ public function testMethodUpdateIntegerColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateIntegerColumn( + $response = $this->tablesDB->updateIntegerColumn( "", "", "", @@ -599,7 +599,7 @@ public function testMethodCreateIpColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createIpColumn( + $response = $this->tablesDB->createIpColumn( "", "", "", @@ -626,7 +626,7 @@ public function testMethodUpdateIpColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateIpColumn( + $response = $this->tablesDB->updateIpColumn( "", "", "", @@ -659,7 +659,7 @@ public function testMethodCreateRelationshipColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createRelationshipColumn( + $response = $this->tablesDB->createRelationshipColumn( "", "", "", @@ -686,7 +686,7 @@ public function testMethodCreateStringColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createStringColumn( + $response = $this->tablesDB->createStringColumn( "", "", "", @@ -714,7 +714,7 @@ public function testMethodUpdateStringColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateStringColumn( + $response = $this->tablesDB->updateStringColumn( "", "", "", @@ -742,7 +742,7 @@ public function testMethodCreateUrlColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createUrlColumn( + $response = $this->tablesDB->createUrlColumn( "", "", "", @@ -769,7 +769,7 @@ public function testMethodUpdateUrlColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateUrlColumn( + $response = $this->tablesDB->updateUrlColumn( "", "", "", @@ -789,7 +789,7 @@ public function testMethodGetColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->getColumn( + $response = $this->tablesDB->getColumn( "", "", "" @@ -807,7 +807,7 @@ public function testMethodDeleteColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->deleteColumn( + $response = $this->tablesDB->deleteColumn( "", "", "" @@ -838,7 +838,7 @@ public function testMethodUpdateRelationshipColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateRelationshipColumn( + $response = $this->tablesDB->updateRelationshipColumn( "", "", "" @@ -858,7 +858,7 @@ public function testMethodListIndexes(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->listIndexes( + $response = $this->tablesDB->listIndexes( "", "" ); @@ -884,7 +884,7 @@ public function testMethodCreateIndex(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createIndex( + $response = $this->tablesDB->createIndex( "", "", "", @@ -913,7 +913,7 @@ public function testMethodGetIndex(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->getIndex( + $response = $this->tablesDB->getIndex( "", "", "" @@ -931,7 +931,7 @@ public function testMethodDeleteIndex(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->deleteIndex( + $response = $this->tablesDB->deleteIndex( "", "", "" @@ -951,7 +951,7 @@ public function testMethodListRows(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->listRows( + $response = $this->tablesDB->listRows( "", "" ); @@ -975,7 +975,7 @@ public function testMethodCreateRow(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createRow( + $response = $this->tablesDB->createRow( "", "", "", @@ -996,7 +996,7 @@ public function testMethodCreateRows(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->createRows( + $response = $this->tablesDB->createRows( "", "", array() @@ -1016,7 +1016,7 @@ public function testMethodUpsertRows(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->upsertRows( + $response = $this->tablesDB->upsertRows( "", "", array() @@ -1036,7 +1036,7 @@ public function testMethodUpdateRows(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateRows( + $response = $this->tablesDB->updateRows( "", "" ); @@ -1055,7 +1055,7 @@ public function testMethodDeleteRows(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->deleteRows( + $response = $this->tablesDB->deleteRows( "", "" ); @@ -1079,7 +1079,7 @@ public function testMethodGetRow(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->getRow( + $response = $this->tablesDB->getRow( "", "", "" @@ -1104,7 +1104,7 @@ public function testMethodUpsertRow(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->upsertRow( + $response = $this->tablesDB->upsertRow( "", "", "" @@ -1129,7 +1129,7 @@ public function testMethodUpdateRow(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->updateRow( + $response = $this->tablesDB->updateRow( "", "", "" @@ -1147,7 +1147,7 @@ public function testMethodDeleteRow(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->deleteRow( + $response = $this->tablesDB->deleteRow( "", "", "" @@ -1172,7 +1172,7 @@ public function testMethodDecrementRowColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->decrementRowColumn( + $response = $this->tablesDB->decrementRowColumn( "", "", "", @@ -1198,7 +1198,7 @@ public function testMethodIncrementRowColumn(): void { ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); - $response = $this->tablesDb->incrementRowColumn( + $response = $this->tablesDB->incrementRowColumn( "", "", "", diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index abbe31e..db74cd6 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -544,6 +544,39 @@ public function testMethodUpdateMfa(): void { $this->assertSame($data, $response); } + public function testMethodUpdateMFA(): 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->updateMFA( + "", + true + ); + + $this->assertSame($data, $response); + } + public function testMethodDeleteMfaAuthenticator(): void { $data = ''; @@ -561,6 +594,23 @@ public function testMethodDeleteMfaAuthenticator(): void { $this->assertSame($data, $response); } + public function testMethodDeleteMFAAuthenticator(): void { + + $data = ''; + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->deleteMFAAuthenticator( + "", + "totp" + ); + + $this->assertSame($data, $response); + } + public function testMethodListMfaFactors(): void { $data = array( @@ -581,6 +631,26 @@ public function testMethodListMfaFactors(): void { $this->assertSame($data, $response); } + public function testMethodListMFAFactors(): void { + + $data = array( + "totp" => true, + "phone" => true, + "email" => true, + "recoveryCode" => true,); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->listMFAFactors( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodGetMfaRecoveryCodes(): void { $data = array( @@ -598,6 +668,23 @@ public function testMethodGetMfaRecoveryCodes(): void { $this->assertSame($data, $response); } + public function testMethodGetMFARecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->getMFARecoveryCodes( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateMfaRecoveryCodes(): void { $data = array( @@ -615,6 +702,23 @@ public function testMethodUpdateMfaRecoveryCodes(): void { $this->assertSame($data, $response); } + public function testMethodUpdateMFARecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->updateMFARecoveryCodes( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateMfaRecoveryCodes(): void { $data = array( @@ -632,6 +736,23 @@ public function testMethodCreateMfaRecoveryCodes(): void { $this->assertSame($data, $response); } + public function testMethodCreateMFARecoveryCodes(): void { + + $data = array( + "recoveryCodes" => array(),); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->users->createMFARecoveryCodes( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateName(): void { $data = array( From 73b843adca4b693d87088f2d561c2f97f5998c84 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 23 Aug 2025 20:11:04 +1200 Subject: [PATCH 5/7] Add 1.8.x support --- docs/account.md | 11 ++++++----- src/Appwrite/Services/Account.php | 8 ++++++-- tests/Appwrite/Services/FunctionsTest.php | 2 ++ tests/Appwrite/Services/SitesTest.php | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/account.md b/docs/account.md index 4ba4c4d..5f6cc02 100644 --- a/docs/account.md +++ b/docs/account.md @@ -510,15 +510,16 @@ PATCH https://cloud.appwrite.io/v1/account/status POST https://cloud.appwrite.io/v1/account/tokens/email ``` -** Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. +** Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. -A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). ** +A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + ** ### Parameters | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| userId | string | User 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. | | +| userId | string | User 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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. | | | email | string | User email. | | | phrase | boolean | Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. | | @@ -536,7 +537,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| userId | 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. | | +| userId | 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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. | | | email | string | User email. | | | url | string | URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | phrase | boolean | Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. | | @@ -574,7 +575,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| userId | 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. | | +| userId | 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. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. | | | phone | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. | | diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 6ca8015..72714ac 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -1444,8 +1444,11 @@ public function updateStatus(): array /** * Sends the user an email with a secret key for creating a session. If the - * provided user ID has not be registered, a new user will be created. Use the - * returned user ID and secret and submit a request to the [POST + * email address has never been used, a **new account is created** using the + * provided `userId`. Otherwise, if the email address is already attached to + * an account, the **user ID is ignored**. Then, the user will receive an + * email with the one-time password. Use the returned user ID and secret and + * submit a request to the [POST * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) * endpoint to complete the login process. The secret sent to the user's email * is valid for 15 minutes. @@ -1453,6 +1456,7 @@ public function updateStatus(): array * A user is limited to 10 active sessions at a time by default. [Learn more * about session * limits](https://appwrite.io/docs/authentication-security#limits). + * * * @param string $userId * @param string $email diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index c92a32c..e3f7b91 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -610,6 +610,7 @@ public function testMethodCreateExecution(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "\$permissions" => array(), "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", "trigger" => "http", "status" => "processing", "requestMethod" => "GET", @@ -642,6 +643,7 @@ public function testMethodGetExecution(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "\$permissions" => array(), "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", "trigger" => "http", "status" => "processing", "requestMethod" => "GET", diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index 2d287de..4768471 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -616,6 +616,7 @@ public function testMethodGetLog(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "\$permissions" => array(), "functionId" => "5e5ea6g16897e", + "deploymentId" => "5e5ea5c16897e", "trigger" => "http", "status" => "processing", "requestMethod" => "GET", From 9146fac3f3a3e81fb3a622d66444ffad40898a54 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 23 Aug 2025 22:16:40 +1200 Subject: [PATCH 6/7] Add 1.8.x support --- docs/tablesdb.md | 10 +++++----- src/Appwrite/Services/Account.php | 18 +++++++++--------- src/Appwrite/Services/Messaging.php | 16 ++++++++-------- src/Appwrite/Services/Users.php | 12 ++++++------ 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/tablesdb.md b/docs/tablesdb.md index 308efcd..4e37b4a 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -11,7 +11,7 @@ GET https://cloud.appwrite.io/v1/tablesdb | 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 | [] | +| 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. | | @@ -83,7 +83,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables | 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, rowSecurity | [] | +| 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, enabled, rowSecurity | [] | | search | string | Search term to filter your list results. Max length: 256 chars. | | @@ -163,7 +163,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | | tableId | string | **Required** Table 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: key, type, size, required, array, status, error | [] | +| 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: key, type, size, required, array, status, error | [] | ```http request @@ -473,7 +473,7 @@ POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns | databaseId | string | **Required** Database ID. | | | tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | | key | string | Column Key. | | -| size | integer | Attribute size for text attributes, in number of characters. | | +| size | integer | Column size for text columns, in number of characters. | | | required | boolean | Is column required? | | | default | string | Default value for column when not provided. Cannot be set when column is required. | | | array | boolean | Is column an array? | | @@ -598,7 +598,7 @@ GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/indexes | --- | --- | --- | --- | | databaseId | string | **Required** Database ID. | | | tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | -| 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 | [] | +| 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: key, type, status, attributes, error | [] | ```http request diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 72714ac..ca28ff4 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -288,7 +288,7 @@ public function updateMFA(bool $mfa): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createMFAAuthenticator` instead. - * @see CreateMFAAuthenticator + * @see Account::createMFAAuthenticator */ public function createMfaAuthenticator(AuthenticatorType $type): array { @@ -355,7 +355,7 @@ public function createMFAAuthenticator(AuthenticatorType $type): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFAAuthenticator` instead. - * @see UpdateMFAAuthenticator + * @see Account::updateMFAAuthenticator */ public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): array { @@ -421,7 +421,7 @@ public function updateMFAAuthenticator(AuthenticatorType $type, string $otp): ar * @return string * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteMFAAuthenticator` instead. - * @see DeleteMFAAuthenticator + * @see Account::deleteMFAAuthenticator */ public function deleteMfaAuthenticator(AuthenticatorType $type): string { @@ -484,7 +484,7 @@ public function deleteMFAAuthenticator(AuthenticatorType $type): string * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createMFAChallenge` instead. - * @see CreateMFAChallenge + * @see Account::createMFAChallenge */ public function createMfaChallenge(AuthenticationFactor $factor): array { @@ -552,7 +552,7 @@ public function createMFAChallenge(AuthenticationFactor $factor): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFAChallenge` instead. - * @see UpdateMFAChallenge + * @see Account::updateMFAChallenge */ public function updateMfaChallenge(string $challengeId, string $otp): array { @@ -619,7 +619,7 @@ public function updateMFAChallenge(string $challengeId, string $otp): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listMFAFactors` instead. - * @see ListMFAFactors + * @see Account::listMFAFactors */ public function listMfaFactors(): array { @@ -677,7 +677,7 @@ public function listMFAFactors(): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `getMFARecoveryCodes` instead. - * @see GetMFARecoveryCodes + * @see Account::getMFARecoveryCodes */ public function getMfaRecoveryCodes(): array { @@ -739,7 +739,7 @@ public function getMFARecoveryCodes(): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createMFARecoveryCodes` instead. - * @see CreateMFARecoveryCodes + * @see Account::createMFARecoveryCodes */ public function createMfaRecoveryCodes(): array { @@ -803,7 +803,7 @@ public function createMFARecoveryCodes(): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFARecoveryCodes` instead. - * @see UpdateMFARecoveryCodes + * @see Account::updateMFARecoveryCodes */ public function updateMfaRecoveryCodes(): array { diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index 1f6c81d..3fbebd2 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -472,7 +472,7 @@ public function updatePush(string $messageId, ?array $topics = null, ?array $use * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createSMS` instead. - * @see CreateSMS + * @see Messaging::createSMS */ public function createSms(string $messageId, string $content, ?array $topics = null, ?array $users = null, ?array $targets = null, ?bool $draft = null, ?string $scheduledAt = null): array { @@ -590,7 +590,7 @@ public function createSMS(string $messageId, string $content, ?array $topics = n * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateSMS` instead. - * @see UpdateSMS + * @see Messaging::updateSMS */ public function updateSms(string $messageId, ?array $topics = null, ?array $users = null, ?array $targets = null, ?string $content = null, ?bool $draft = null, ?string $scheduledAt = null): array { @@ -876,7 +876,7 @@ public function listProviders(?array $queries = null, ?string $search = null): a * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createAPNSProvider` instead. - * @see CreateAPNSProvider + * @see Messaging::createAPNSProvider */ public function createApnsProvider(string $providerId, string $name, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null, ?bool $enabled = null): array { @@ -1001,7 +1001,7 @@ public function createAPNSProvider(string $providerId, string $name, ?string $au * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateAPNSProvider` instead. - * @see UpdateAPNSProvider + * @see Messaging::updateAPNSProvider */ public function updateApnsProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?string $authKey = null, ?string $authKeyId = null, ?string $teamId = null, ?string $bundleId = null, ?bool $sandbox = null): array { @@ -1128,7 +1128,7 @@ public function updateAPNSProvider(string $providerId, ?string $name = null, ?bo * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createFCMProvider` instead. - * @see CreateFCMProvider + * @see Messaging::createFCMProvider */ public function createFcmProvider(string $providerId, string $name, ?array $serviceAccountJSON = null, ?bool $enabled = null): array { @@ -1213,7 +1213,7 @@ public function createFCMProvider(string $providerId, string $name, ?array $serv * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateFCMProvider` instead. - * @see UpdateFCMProvider + * @see Messaging::updateFCMProvider */ public function updateFcmProvider(string $providerId, ?string $name = null, ?bool $enabled = null, ?array $serviceAccountJSON = null): array { @@ -1689,7 +1689,7 @@ public function updateSendgridProvider(string $providerId, ?string $name = null, * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createSMTPProvider` instead. - * @see CreateSMTPProvider + * @see Messaging::createSMTPProvider */ public function createSmtpProvider(string $providerId, string $name, string $host, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array { @@ -1868,7 +1868,7 @@ public function createSMTPProvider(string $providerId, string $name, string $hos * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateSMTPProvider` instead. - * @see UpdateSMTPProvider + * @see Messaging::updateSMTPProvider */ public function updateSmtpProvider(string $providerId, ?string $name = null, ?string $host = null, ?int $port = null, ?string $username = null, ?string $password = null, ?SmtpEncryption $encryption = null, ?bool $autoTLS = null, ?string $mailer = null, ?string $fromName = null, ?string $fromEmail = null, ?string $replyToName = null, ?string $replyToEmail = null, ?bool $enabled = null): array { diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index 7c55c47..f263049 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -727,7 +727,7 @@ public function listMemberships(string $userId, ?array $queries = null, ?string * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFA` instead. - * @see UpdateMFA + * @see Users::updateMFA */ public function updateMfa(string $userId, bool $mfa): array { @@ -792,7 +792,7 @@ public function updateMFA(string $userId, bool $mfa): array * @return string * * @deprecated This API has been deprecated since 1.8.0. Please use `deleteMFAAuthenticator` instead. - * @see DeleteMFAAuthenticator + * @see Users::deleteMFAAuthenticator */ public function deleteMfaAuthenticator(string $userId, AuthenticatorType $type): string { @@ -856,7 +856,7 @@ public function deleteMFAAuthenticator(string $userId, AuthenticatorType $type): * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `listMFAFactors` instead. - * @see ListMFAFactors + * @see Users::listMFAFactors */ public function listMfaFactors(string $userId): array { @@ -918,7 +918,7 @@ public function listMFAFactors(string $userId): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `getMFARecoveryCodes` instead. - * @see GetMFARecoveryCodes + * @see Users::getMFARecoveryCodes */ public function getMfaRecoveryCodes(string $userId): array { @@ -983,7 +983,7 @@ public function getMFARecoveryCodes(string $userId): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `updateMFARecoveryCodes` instead. - * @see UpdateMFARecoveryCodes + * @see Users::updateMFARecoveryCodes */ public function updateMfaRecoveryCodes(string $userId): array { @@ -1050,7 +1050,7 @@ public function updateMFARecoveryCodes(string $userId): array * @return array * * @deprecated This API has been deprecated since 1.8.0. Please use `createMFARecoveryCodes` instead. - * @see CreateMFARecoveryCodes + * @see Users::createMFARecoveryCodes */ public function createMfaRecoveryCodes(string $userId): array { From 01270b2f7da897602db4d6f124adf756f28d30f9 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 26 Aug 2025 04:24:16 +1200 Subject: [PATCH 7/7] Fix docs --- .../{create-j-w-t.md => create-jwt.md} | 0 .../account/create-m-f-a-authenticator.md | 16 ----------- .../account/create-m-f-a-challenge.md | 15 ---------- .../account/create-m-f-a-recovery-codes.md | 13 --------- ...r-l-token.md => create-magic-url-token.md} | 0 .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- ...auth2token.md => create-o-auth-2-token.md} | 0 .../account/delete-m-f-a-authenticator.md | 16 ----------- .../account/delete-mfa-authenticator.md | 2 +- .../account/get-m-f-a-recovery-codes.md | 13 --------- .../account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/list-m-f-a-factors.md | 13 --------- docs/examples/account/list-mfa-factors.md | 2 +- .../account/update-m-f-a-authenticator.md | 17 ----------- .../account/update-m-f-a-challenge.md | 16 ----------- .../account/update-m-f-a-recovery-codes.md | 13 --------- ...session.md => update-magic-url-session.md} | 0 .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- .../account/update-mfa-recovery-codes.md | 2 +- .../{update-m-f-a.md => update-mfa.md} | 0 .../avatars/{get-q-r.md => get-qr.md} | 0 .../examples/health/{get-d-b.md => get-db.md} | 0 ...-countries-e-u.md => list-countries-eu.md} | 0 .../messaging/create-a-p-n-s-provider.md | 22 --------------- .../messaging/create-apns-provider.md | 2 +- .../messaging/create-f-c-m-provider.md | 18 ------------ .../examples/messaging/create-fcm-provider.md | 2 +- ...1provider.md => create-msg-91-provider.md} | 0 docs/examples/messaging/create-s-m-s.md | 21 -------------- .../messaging/create-s-m-t-p-provider.md | 28 ------------------- docs/examples/messaging/create-sms.md | 2 +- .../messaging/create-smtp-provider.md | 2 +- .../messaging/update-a-p-n-s-provider.md | 22 --------------- .../messaging/update-apns-provider.md | 2 +- .../messaging/update-f-c-m-provider.md | 18 ------------ .../examples/messaging/update-fcm-provider.md | 2 +- ...1provider.md => update-msg-91-provider.md} | 0 docs/examples/messaging/update-s-m-s.md | 21 -------------- .../messaging/update-s-m-t-p-provider.md | 28 ------------------- docs/examples/messaging/update-sms.md | 2 +- .../messaging/update-smtp-provider.md | 2 +- ...e-argon2user.md => create-argon-2-user.md} | 0 .../users/{create-j-w-t.md => create-jwt.md} | 0 .../users/create-m-f-a-recovery-codes.md | 15 ---------- ...create-m-d5user.md => create-md-5-user.md} | 0 .../users/create-mfa-recovery-codes.md | 2 +- ...-h-pass-user.md => create-ph-pass-user.md} | 0 ...reate-s-h-a-user.md => create-sha-user.md} | 0 .../users/delete-m-f-a-authenticator.md | 17 ----------- .../users/delete-mfa-authenticator.md | 2 +- .../users/get-m-f-a-recovery-codes.md | 15 ---------- docs/examples/users/get-mfa-recovery-codes.md | 2 +- docs/examples/users/list-m-f-a-factors.md | 15 ---------- docs/examples/users/list-mfa-factors.md | 2 +- .../users/update-m-f-a-recovery-codes.md | 15 ---------- docs/examples/users/update-m-f-a.md | 16 ----------- .../users/update-mfa-recovery-codes.md | 2 +- docs/examples/users/update-mfa.md | 2 +- 61 files changed, 23 insertions(+), 426 deletions(-) rename docs/examples/account/{create-j-w-t.md => create-jwt.md} (100%) delete mode 100644 docs/examples/account/create-m-f-a-authenticator.md delete mode 100644 docs/examples/account/create-m-f-a-challenge.md delete mode 100644 docs/examples/account/create-m-f-a-recovery-codes.md rename docs/examples/account/{create-magic-u-r-l-token.md => create-magic-url-token.md} (100%) rename docs/examples/account/{create-o-auth2token.md => create-o-auth-2-token.md} (100%) delete mode 100644 docs/examples/account/delete-m-f-a-authenticator.md delete mode 100644 docs/examples/account/get-m-f-a-recovery-codes.md delete mode 100644 docs/examples/account/list-m-f-a-factors.md delete mode 100644 docs/examples/account/update-m-f-a-authenticator.md delete mode 100644 docs/examples/account/update-m-f-a-challenge.md delete mode 100644 docs/examples/account/update-m-f-a-recovery-codes.md rename docs/examples/account/{update-magic-u-r-l-session.md => update-magic-url-session.md} (100%) rename docs/examples/account/{update-m-f-a.md => update-mfa.md} (100%) rename docs/examples/avatars/{get-q-r.md => get-qr.md} (100%) rename docs/examples/health/{get-d-b.md => get-db.md} (100%) rename docs/examples/locale/{list-countries-e-u.md => list-countries-eu.md} (100%) delete mode 100644 docs/examples/messaging/create-a-p-n-s-provider.md delete mode 100644 docs/examples/messaging/create-f-c-m-provider.md rename docs/examples/messaging/{create-msg91provider.md => create-msg-91-provider.md} (100%) delete mode 100644 docs/examples/messaging/create-s-m-s.md delete mode 100644 docs/examples/messaging/create-s-m-t-p-provider.md delete mode 100644 docs/examples/messaging/update-a-p-n-s-provider.md delete mode 100644 docs/examples/messaging/update-f-c-m-provider.md rename docs/examples/messaging/{update-msg91provider.md => update-msg-91-provider.md} (100%) delete mode 100644 docs/examples/messaging/update-s-m-s.md delete mode 100644 docs/examples/messaging/update-s-m-t-p-provider.md rename docs/examples/users/{create-argon2user.md => create-argon-2-user.md} (100%) rename docs/examples/users/{create-j-w-t.md => create-jwt.md} (100%) delete mode 100644 docs/examples/users/create-m-f-a-recovery-codes.md rename docs/examples/users/{create-m-d5user.md => create-md-5-user.md} (100%) rename docs/examples/users/{create-p-h-pass-user.md => create-ph-pass-user.md} (100%) rename docs/examples/users/{create-s-h-a-user.md => create-sha-user.md} (100%) delete mode 100644 docs/examples/users/delete-m-f-a-authenticator.md delete mode 100644 docs/examples/users/get-m-f-a-recovery-codes.md delete mode 100644 docs/examples/users/list-m-f-a-factors.md delete mode 100644 docs/examples/users/update-m-f-a-recovery-codes.md delete mode 100644 docs/examples/users/update-m-f-a.md diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-jwt.md similarity index 100% rename from docs/examples/account/create-j-w-t.md rename to docs/examples/account/create-jwt.md diff --git a/docs/examples/account/create-m-f-a-authenticator.md b/docs/examples/account/create-m-f-a-authenticator.md deleted file mode 100644 index 2eb50c3..0000000 --- a/docs/examples/account/create-m-f-a-authenticator.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->createMFAAuthenticator( - type: AuthenticatorType::TOTP() -); \ No newline at end of file diff --git a/docs/examples/account/create-m-f-a-challenge.md b/docs/examples/account/create-m-f-a-challenge.md deleted file mode 100644 index 64471ef..0000000 --- a/docs/examples/account/create-m-f-a-challenge.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject(''); // Your project ID - -$account = new Account($client); - -$result = $account->createMFAChallenge( - factor: AuthenticationFactor::EMAIL() -); \ No newline at end of file diff --git a/docs/examples/account/create-m-f-a-recovery-codes.md b/docs/examples/account/create-m-f-a-recovery-codes.md deleted file mode 100644 index 031bc4d..0000000 --- a/docs/examples/account/create-m-f-a-recovery-codes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->createMFARecoveryCodes(); diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-url-token.md similarity index 100% rename from docs/examples/account/create-magic-u-r-l-token.md rename to docs/examples/account/create-magic-url-token.md diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index da3b463..2eb50c3 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -11,6 +11,6 @@ $client = (new Client()) $account = new Account($client); -$result = $account->createMfaAuthenticator( +$result = $account->createMFAAuthenticator( type: AuthenticatorType::TOTP() ); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index faa679f..64471ef 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -10,6 +10,6 @@ $client = (new Client()) $account = new Account($client); -$result = $account->createMfaChallenge( +$result = $account->createMFAChallenge( factor: AuthenticationFactor::EMAIL() ); \ No newline at end of file diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 223c95b..031bc4d 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -10,4 +10,4 @@ $client = (new Client()) $account = new Account($client); -$result = $account->createMfaRecoveryCodes(); +$result = $account->createMFARecoveryCodes(); diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth-2-token.md similarity index 100% rename from docs/examples/account/create-o-auth2token.md rename to docs/examples/account/create-o-auth-2-token.md diff --git a/docs/examples/account/delete-m-f-a-authenticator.md b/docs/examples/account/delete-m-f-a-authenticator.md deleted file mode 100644 index 524b9b3..0000000 --- a/docs/examples/account/delete-m-f-a-authenticator.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->deleteMFAAuthenticator( - type: AuthenticatorType::TOTP() -); \ No newline at end of file diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 42806f8..524b9b3 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -11,6 +11,6 @@ $client = (new Client()) $account = new Account($client); -$result = $account->deleteMfaAuthenticator( +$result = $account->deleteMFAAuthenticator( type: AuthenticatorType::TOTP() ); \ No newline at end of file diff --git a/docs/examples/account/get-m-f-a-recovery-codes.md b/docs/examples/account/get-m-f-a-recovery-codes.md deleted file mode 100644 index fc5aef2..0000000 --- a/docs/examples/account/get-m-f-a-recovery-codes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->getMFARecoveryCodes(); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index bafd6d8..fc5aef2 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -10,4 +10,4 @@ $client = (new Client()) $account = new Account($client); -$result = $account->getMfaRecoveryCodes(); +$result = $account->getMFARecoveryCodes(); diff --git a/docs/examples/account/list-m-f-a-factors.md b/docs/examples/account/list-m-f-a-factors.md deleted file mode 100644 index f7b6e26..0000000 --- a/docs/examples/account/list-m-f-a-factors.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->listMFAFactors(); diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 6756573..f7b6e26 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -10,4 +10,4 @@ $client = (new Client()) $account = new Account($client); -$result = $account->listMfaFactors(); +$result = $account->listMFAFactors(); diff --git a/docs/examples/account/update-m-f-a-authenticator.md b/docs/examples/account/update-m-f-a-authenticator.md deleted file mode 100644 index 8486e88..0000000 --- a/docs/examples/account/update-m-f-a-authenticator.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateMFAAuthenticator( - type: AuthenticatorType::TOTP(), - otp: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-m-f-a-challenge.md b/docs/examples/account/update-m-f-a-challenge.md deleted file mode 100644 index e5821e5..0000000 --- a/docs/examples/account/update-m-f-a-challenge.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateMFAChallenge( - challengeId: '', - otp: '' -); \ No newline at end of file diff --git a/docs/examples/account/update-m-f-a-recovery-codes.md b/docs/examples/account/update-m-f-a-recovery-codes.md deleted file mode 100644 index f57e490..0000000 --- a/docs/examples/account/update-m-f-a-recovery-codes.md +++ /dev/null @@ -1,13 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setSession(''); // The user session to authenticate with - -$account = new Account($client); - -$result = $account->updateMFARecoveryCodes(); diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-url-session.md similarity index 100% rename from docs/examples/account/update-magic-u-r-l-session.md rename to docs/examples/account/update-magic-url-session.md diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index 6a09d95..8486e88 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -11,7 +11,7 @@ $client = (new Client()) $account = new Account($client); -$result = $account->updateMfaAuthenticator( +$result = $account->updateMFAAuthenticator( type: AuthenticatorType::TOTP(), otp: '' ); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index 03ace31..e5821e5 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -10,7 +10,7 @@ $client = (new Client()) $account = new Account($client); -$result = $account->updateMfaChallenge( +$result = $account->updateMFAChallenge( challengeId: '', otp: '' ); \ No newline at end of file diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index c7ec6cb..f57e490 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -10,4 +10,4 @@ $client = (new Client()) $account = new Account($client); -$result = $account->updateMfaRecoveryCodes(); +$result = $account->updateMFARecoveryCodes(); diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-mfa.md similarity index 100% rename from docs/examples/account/update-m-f-a.md rename to docs/examples/account/update-mfa.md diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-qr.md similarity index 100% rename from docs/examples/avatars/get-q-r.md rename to docs/examples/avatars/get-qr.md diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-db.md similarity index 100% rename from docs/examples/health/get-d-b.md rename to docs/examples/health/get-db.md diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-eu.md similarity index 100% rename from docs/examples/locale/list-countries-e-u.md rename to docs/examples/locale/list-countries-eu.md diff --git a/docs/examples/messaging/create-a-p-n-s-provider.md b/docs/examples/messaging/create-a-p-n-s-provider.md deleted file mode 100644 index 2ce4b7f..0000000 --- a/docs/examples/messaging/create-a-p-n-s-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createAPNSProvider( - providerId: '', - name: '', - authKey: '', // optional - authKeyId: '', // optional - teamId: '', // optional - bundleId: '', // optional - sandbox: false, // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index da13d17..2ce4b7f 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->createApnsProvider( +$result = $messaging->createAPNSProvider( providerId: '', name: '', authKey: '', // optional diff --git a/docs/examples/messaging/create-f-c-m-provider.md b/docs/examples/messaging/create-f-c-m-provider.md deleted file mode 100644 index 8037c23..0000000 --- a/docs/examples/messaging/create-f-c-m-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createFCMProvider( - providerId: '', - name: '', - serviceAccountJSON: [], // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index baf72a1..8037c23 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->createFcmProvider( +$result = $messaging->createFCMProvider( providerId: '', name: '', serviceAccountJSON: [], // optional diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg-91-provider.md similarity index 100% rename from docs/examples/messaging/create-msg91provider.md rename to docs/examples/messaging/create-msg-91-provider.md diff --git a/docs/examples/messaging/create-s-m-s.md b/docs/examples/messaging/create-s-m-s.md deleted file mode 100644 index 50623b5..0000000 --- a/docs/examples/messaging/create-s-m-s.md +++ /dev/null @@ -1,21 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createSMS( - messageId: '', - content: '', - topics: [], // optional - users: [], // optional - targets: [], // optional - draft: false, // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-s-m-t-p-provider.md b/docs/examples/messaging/create-s-m-t-p-provider.md deleted file mode 100644 index 017f20c..0000000 --- a/docs/examples/messaging/create-s-m-t-p-provider.md +++ /dev/null @@ -1,28 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->createSMTPProvider( - providerId: '', - name: '', - host: '', - port: 1, // optional - username: '', // optional - password: '', // optional - encryption: SmtpEncryption::NONE(), // optional - autoTLS: false, // optional - mailer: '', // optional - fromName: '', // optional - fromEmail: 'email@example.com', // optional - replyToName: '', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 1e2d9ac..50623b5 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->createSms( +$result = $messaging->createSMS( messageId: '', content: '', topics: [], // optional diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 4dcfb3a..017f20c 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->createSmtpProvider( +$result = $messaging->createSMTPProvider( providerId: '', name: '', host: '', diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-a-p-n-s-provider.md deleted file mode 100644 index 161a148..0000000 --- a/docs/examples/messaging/update-a-p-n-s-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateAPNSProvider( - providerId: '', - name: '', // optional - enabled: false, // optional - authKey: '', // optional - authKeyId: '', // optional - teamId: '', // optional - bundleId: '', // optional - sandbox: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 724453b..161a148 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->updateApnsProvider( +$result = $messaging->updateAPNSProvider( providerId: '', name: '', // optional enabled: false, // optional diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-f-c-m-provider.md deleted file mode 100644 index 0df2b93..0000000 --- a/docs/examples/messaging/update-f-c-m-provider.md +++ /dev/null @@ -1,18 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateFCMProvider( - providerId: '', - name: '', // optional - enabled: false, // optional - serviceAccountJSON: [] // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 36672f4..0df2b93 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->updateFcmProvider( +$result = $messaging->updateFCMProvider( providerId: '', name: '', // optional enabled: false, // optional diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg-91-provider.md similarity index 100% rename from docs/examples/messaging/update-msg91provider.md rename to docs/examples/messaging/update-msg-91-provider.md diff --git a/docs/examples/messaging/update-s-m-s.md b/docs/examples/messaging/update-s-m-s.md deleted file mode 100644 index 92d3ebb..0000000 --- a/docs/examples/messaging/update-s-m-s.md +++ /dev/null @@ -1,21 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateSMS( - messageId: '', - topics: [], // optional - users: [], // optional - targets: [], // optional - content: '', // optional - draft: false, // optional - scheduledAt: '' // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-s-m-t-p-provider.md b/docs/examples/messaging/update-s-m-t-p-provider.md deleted file mode 100644 index 3bc80d2..0000000 --- a/docs/examples/messaging/update-s-m-t-p-provider.md +++ /dev/null @@ -1,28 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$messaging = new Messaging($client); - -$result = $messaging->updateSMTPProvider( - providerId: '', - name: '', // optional - host: '', // optional - port: 1, // optional - username: '', // optional - password: '', // optional - encryption: SmtpEncryption::NONE(), // optional - autoTLS: false, // optional - mailer: '', // optional - fromName: '', // optional - fromEmail: 'email@example.com', // optional - replyToName: '', // optional - replyToEmail: '', // optional - enabled: false // optional -); \ No newline at end of file diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 730da41..92d3ebb 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->updateSms( +$result = $messaging->updateSMS( messageId: '', topics: [], // optional users: [], // optional diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index a16a630..3bc80d2 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -10,7 +10,7 @@ $client = (new Client()) $messaging = new Messaging($client); -$result = $messaging->updateSmtpProvider( +$result = $messaging->updateSMTPProvider( providerId: '', name: '', // optional host: '', // optional diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon-2-user.md similarity index 100% rename from docs/examples/users/create-argon2user.md rename to docs/examples/users/create-argon-2-user.md diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-jwt.md similarity index 100% rename from docs/examples/users/create-j-w-t.md rename to docs/examples/users/create-jwt.md diff --git a/docs/examples/users/create-m-f-a-recovery-codes.md b/docs/examples/users/create-m-f-a-recovery-codes.md deleted file mode 100644 index ee96d2e..0000000 --- a/docs/examples/users/create-m-f-a-recovery-codes.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$users = new Users($client); - -$result = $users->createMFARecoveryCodes( - userId: '' -); \ No newline at end of file diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-md-5-user.md similarity index 100% rename from docs/examples/users/create-m-d5user.md rename to docs/examples/users/create-md-5-user.md diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index 372fb1b..ee96d2e 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -10,6 +10,6 @@ $client = (new Client()) $users = new Users($client); -$result = $users->createMfaRecoveryCodes( +$result = $users->createMFARecoveryCodes( userId: '' ); \ No newline at end of file diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-ph-pass-user.md similarity index 100% rename from docs/examples/users/create-p-h-pass-user.md rename to docs/examples/users/create-ph-pass-user.md diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-sha-user.md similarity index 100% rename from docs/examples/users/create-s-h-a-user.md rename to docs/examples/users/create-sha-user.md diff --git a/docs/examples/users/delete-m-f-a-authenticator.md b/docs/examples/users/delete-m-f-a-authenticator.md deleted file mode 100644 index f2f08ec..0000000 --- a/docs/examples/users/delete-m-f-a-authenticator.md +++ /dev/null @@ -1,17 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$users = new Users($client); - -$result = $users->deleteMFAAuthenticator( - userId: '', - type: AuthenticatorType::TOTP() -); \ No newline at end of file diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index 8ef1279..f2f08ec 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -11,7 +11,7 @@ $client = (new Client()) $users = new Users($client); -$result = $users->deleteMfaAuthenticator( +$result = $users->deleteMFAAuthenticator( userId: '', type: AuthenticatorType::TOTP() ); \ No newline at end of file diff --git a/docs/examples/users/get-m-f-a-recovery-codes.md b/docs/examples/users/get-m-f-a-recovery-codes.md deleted file mode 100644 index 7937e6a..0000000 --- a/docs/examples/users/get-m-f-a-recovery-codes.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$users = new Users($client); - -$result = $users->getMFARecoveryCodes( - userId: '' -); \ No newline at end of file diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index db090fb..7937e6a 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -10,6 +10,6 @@ $client = (new Client()) $users = new Users($client); -$result = $users->getMfaRecoveryCodes( +$result = $users->getMFARecoveryCodes( userId: '' ); \ No newline at end of file diff --git a/docs/examples/users/list-m-f-a-factors.md b/docs/examples/users/list-m-f-a-factors.md deleted file mode 100644 index 5dae790..0000000 --- a/docs/examples/users/list-m-f-a-factors.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$users = new Users($client); - -$result = $users->listMFAFactors( - userId: '' -); \ No newline at end of file diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 6a0088c..5dae790 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -10,6 +10,6 @@ $client = (new Client()) $users = new Users($client); -$result = $users->listMfaFactors( +$result = $users->listMFAFactors( userId: '' ); \ No newline at end of file diff --git a/docs/examples/users/update-m-f-a-recovery-codes.md b/docs/examples/users/update-m-f-a-recovery-codes.md deleted file mode 100644 index 8474755..0000000 --- a/docs/examples/users/update-m-f-a-recovery-codes.md +++ /dev/null @@ -1,15 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$users = new Users($client); - -$result = $users->updateMFARecoveryCodes( - userId: '' -); \ No newline at end of file diff --git a/docs/examples/users/update-m-f-a.md b/docs/examples/users/update-m-f-a.md deleted file mode 100644 index c24916a..0000000 --- a/docs/examples/users/update-m-f-a.md +++ /dev/null @@ -1,16 +0,0 @@ -setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - ->setProject('') // Your project ID - ->setKey(''); // Your secret API key - -$users = new Users($client); - -$result = $users->updateMFA( - userId: '', - mfa: false -); \ No newline at end of file diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index 75214de..8474755 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -10,6 +10,6 @@ $client = (new Client()) $users = new Users($client); -$result = $users->updateMfaRecoveryCodes( +$result = $users->updateMFARecoveryCodes( userId: '' ); \ No newline at end of file diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 3eda496..c24916a 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -10,7 +10,7 @@ $client = (new Client()) $users = new Users($client); -$result = $users->updateMfa( +$result = $users->updateMFA( userId: '', mfa: false ); \ No newline at end of file