diff --git a/docs/avatars.md b/docs/avatars.md index 97bbfc3..1517dc7 100644 --- a/docs/avatars.md +++ b/docs/avatars.md @@ -32,7 +32,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay. | | +| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. | | | width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | | height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | | quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. | -1 | diff --git a/docs/databases.md b/docs/databases.md index 998532a..e97a483 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -439,6 +439,111 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | newKey | string | New Attribute Key. | | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/line +``` + +** Create a geometric line attribute. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | array | Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/line/{key} +``` + +** Update a line attribute. Changing the `default` value will not update already existing documents. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | array | Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | + + +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/point +``` + +** Create a geometric point attribute. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | array | Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/point/{key} +``` + +** Update a point attribute. Changing the `default` value will not update already existing documents. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | array | Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | + + +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/polygon +``` + +** Create a geometric polygon attribute. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | array | Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key} +``` + +** Update a polygon attribute. Changing the `default` value will not update already existing documents. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | array | Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. | | +| newKey | string | New attribute key. | | + + ```http request POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/relationship ``` diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index 698da0f..f6a1003 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -11,5 +11,9 @@ $client = (new Client()) $account = new Account($client); $result = $account->updatePrefs( - prefs: [] + prefs: [ + 'language' => 'en', + 'timezone' => 'UTC', + 'darkTheme' => true + ] ); \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index bf1ee3f..9f2e8f3 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -14,6 +14,12 @@ $result = $databases->createDocument( databaseId: '', collectionId: '', documentId: '', - data: [], + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 30, + 'isAdmin' => false + ], permissions: ["read("any")"] // optional ); \ No newline at end of file diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md new file mode 100644 index 0000000..de9e624 --- /dev/null +++ b/docs/examples/databases/create-line-attribute.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createLineAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: [[1,2], [3, 4]] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md new file mode 100644 index 0000000..de3f3a4 --- /dev/null +++ b/docs/examples/databases/create-point-attribute.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createPointAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: [[1,2], [3, 4]] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md new file mode 100644 index 0000000..b79a48e --- /dev/null +++ b/docs/examples/databases/create-polygon-attribute.md @@ -0,0 +1,19 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createPolygonAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: [[1,2], [3, 4]] // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md new file mode 100644 index 0000000..e24e9e4 --- /dev/null +++ b/docs/examples/databases/update-line-attribute.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateLineAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: [[1,2], [3, 4]], // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md new file mode 100644 index 0000000..0a61026 --- /dev/null +++ b/docs/examples/databases/update-point-attribute.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updatePointAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: [[1,2], [3, 4]], // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md new file mode 100644 index 0000000..3bf5228 --- /dev/null +++ b/docs/examples/databases/update-polygon-attribute.md @@ -0,0 +1,20 @@ +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updatePolygonAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: [[1,2], [3, 4]], // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md new file mode 100644 index 0000000..8d9353c --- /dev/null +++ b/docs/examples/tablesdb/create-line-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->createLineColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: [[1,2], [3, 4]] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md new file mode 100644 index 0000000..2832479 --- /dev/null +++ b/docs/examples/tablesdb/create-point-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->createPointColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: [[1,2], [3, 4]] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md new file mode 100644 index 0000000..a6f685a --- /dev/null +++ b/docs/examples/tablesdb/create-polygon-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->createPolygonColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: [[1,2], [3, 4]] // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 0002b79..fa5137b 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -14,6 +14,12 @@ $result = $tablesDB->createRow( databaseId: '', tableId: '', rowId: '', - data: [], + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 30, + 'isAdmin' => false + ], permissions: ["read("any")"] // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md new file mode 100644 index 0000000..184fada --- /dev/null +++ b/docs/examples/tablesdb/update-line-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->updateLineColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: [[1,2], [3, 4]], // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md new file mode 100644 index 0000000..4b1d73c --- /dev/null +++ b/docs/examples/tablesdb/update-point-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->updatePointColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: [[1,2], [3, 4]], // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md new file mode 100644 index 0000000..647fd27 --- /dev/null +++ b/docs/examples/tablesdb/update-polygon-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->updatePolygonColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: [[1,2], [3, 4]], // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/functions.md b/docs/functions.md index 4e55bba..ff64822 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -303,7 +303,7 @@ POST https://cloud.appwrite.io/v1/functions/{functionId}/executions | body | string | HTTP body of execution. Default value is empty string. | | | async | boolean | Execute code in the background. Default value is false. | | | path | string | HTTP path of execution. Path can include query params. Default value is / | / | -| method | string | HTTP method of execution. Default value is GET. | POST | +| method | string | HTTP method of execution. Default value is POST. | POST | | headers | object | HTTP headers of execution. Defaults to empty. | {} | | scheduledAt | string | Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. | | diff --git a/docs/tablesdb.md b/docs/tablesdb.md index 4e37b4a..40dfded 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -438,6 +438,111 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | newKey | string | New Column Key. | | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/line +``` + +** Create a geometric line 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 TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | array | Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key} +``` + +** Update a line 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 TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | array | Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. 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/point +``` + +** Create a geometric point 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 TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | array | Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key} +``` + +** Update a point 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 TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | array | Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. 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/polygon +``` + +** Create a geometric polygon 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 TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | array | Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key} +``` + +** Update a polygon 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 TablesDB service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | array | Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. 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 ``` diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 5c1c208..49aa1ae 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/16.0.0 ()', + 'user-agent' => 'AppwritePHPSDK/17.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '16.0.0', + 'x-sdk-version'=> '17.0.0', ]; /** @@ -262,7 +262,7 @@ public function call( $warnings = $responseHeaders['x-appwrite-warning'] ?? ''; if ($warnings) { foreach(explode(';', $warnings) as $warning) { - echo 'Warning: ' . $warning . PHP_EOL; + \trigger_error($warning, E_USER_WARNING); } } diff --git a/src/Appwrite/Enums/CreditCard.php b/src/Appwrite/Enums/CreditCard.php index d79834e..416a5b4 100644 --- a/src/Appwrite/Enums/CreditCard.php +++ b/src/Appwrite/Enums/CreditCard.php @@ -18,7 +18,7 @@ class CreditCard implements JsonSerializable private static CreditCard $MASTERCARD; private static CreditCard $NARANJA; private static CreditCard $TARJETASHOPPING; - private static CreditCard $UNIONCHINAPAY; + private static CreditCard $UNIONPAY; private static CreditCard $VISA; private static CreditCard $MIR; private static CreditCard $MAESTRO; @@ -125,12 +125,12 @@ public static function TARJETASHOPPING(): CreditCard } return self::$TARJETASHOPPING; } - public static function UNIONCHINAPAY(): CreditCard + public static function UNIONPAY(): CreditCard { - if (!isset(self::$UNIONCHINAPAY)) { - self::$UNIONCHINAPAY = new CreditCard('union-china-pay'); + if (!isset(self::$UNIONPAY)) { + self::$UNIONPAY = new CreditCard('unionpay'); } - return self::$UNIONCHINAPAY; + return self::$UNIONPAY; } public static function VISA(): CreditCard { diff --git a/src/Appwrite/Enums/ExecutionMethod.php b/src/Appwrite/Enums/ExecutionMethod.php index 9ffea9c..6f16869 100644 --- a/src/Appwrite/Enums/ExecutionMethod.php +++ b/src/Appwrite/Enums/ExecutionMethod.php @@ -12,6 +12,7 @@ class ExecutionMethod implements JsonSerializable private static ExecutionMethod $PATCH; private static ExecutionMethod $DELETE; private static ExecutionMethod $OPTIONS; + private static ExecutionMethod $HEAD; private string $value; @@ -72,4 +73,11 @@ public static function OPTIONS(): ExecutionMethod } return self::$OPTIONS; } + public static function HEAD(): ExecutionMethod + { + if (!isset(self::$HEAD)) { + self::$HEAD = new ExecutionMethod('HEAD'); + } + return self::$HEAD; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/IndexType.php b/src/Appwrite/Enums/IndexType.php index fa71d60..16d0433 100644 --- a/src/Appwrite/Enums/IndexType.php +++ b/src/Appwrite/Enums/IndexType.php @@ -9,6 +9,7 @@ class IndexType implements JsonSerializable private static IndexType $KEY; private static IndexType $FULLTEXT; private static IndexType $UNIQUE; + private static IndexType $SPATIAL; private string $value; @@ -48,4 +49,11 @@ public static function UNIQUE(): IndexType } return self::$UNIQUE; } + public static function SPATIAL(): IndexType + { + if (!isset(self::$SPATIAL)) { + self::$SPATIAL = new IndexType('spatial'); + } + return self::$SPATIAL; + } } \ No newline at end of file diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php index ab717fd..c49575c 100644 --- a/src/Appwrite/Query.php +++ b/src/Appwrite/Query.php @@ -350,6 +350,18 @@ public static function createdAfter(string $value): string return (new Query('createdAfter', null, $value))->__toString(); } + /** + * Created Between + * + * @param string $start + * @param string $end + * @return string + */ + public static function createdBetween(string $start, string $end): string + { + return (new Query('createdBetween', null, [$start, $end]))->__toString(); + } + /** * Updated Before * @@ -372,6 +384,18 @@ public static function updatedAfter(string $value): string return (new Query('updatedAfter', null, $value))->__toString(); } + /** + * Updated Between + * + * @param string $start + * @param string $end + * @return string + */ + public static function updatedBetween(string $start, string $end): string + { + return (new Query('updatedBetween', null, [$start, $end]))->__toString(); + } + /** * Or * @@ -399,4 +423,153 @@ public static function and(array $queries): string } return (new Query('and', null, $queries))->__toString(); } + + /** + * Distance Equal + * + * @param string $attribute + * @param array $values + * @param int|float $distance + * @return string + */ + public static function distanceEqual(string $attribute, array $values, int|float $distance, bool $meters = true): string + { + return (new Query('distanceEqual', $attribute, [[$values, $distance, $meters]]))->__toString(); + } + + /** + * Distance Not Equal + * + * @param string $attribute + * @param array $values + * @param int|float $distance + * @return string + */ + public static function distanceNotEqual(string $attribute, array $values, int|float $distance, bool $meters = true): string + { + return (new Query('distanceNotEqual', $attribute, [[$values, $distance, $meters]]))->__toString(); + } + + /** + * Distance Greater Than + * + * @param string $attribute + * @param array $values + * @param int|float $distance + * @return string + */ + public static function distanceGreaterThan(string $attribute, array $values, int|float $distance, bool $meters = true): string + { + return (new Query('distanceGreaterThan', $attribute, [[$values, $distance, $meters]]))->__toString(); + } + + /** + * Distance Less Than + * + * @param string $attribute + * @param array $values + * @param int|float $distance + * @param bool $meters + * @return string + */ + public static function distanceLessThan(string $attribute, array $values, int|float $distance, bool $meters = true): string + { + return (new Query('distanceLessThan', $attribute, [[$values, $distance, $meters]]))->__toString(); + } + + /** + * Intersects + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function intersects(string $attribute, array $values): string + { + return (new Query('intersects', $attribute, [$values]))->__toString(); + } + + /** + * Not Intersects + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function notIntersects(string $attribute, array $values): string + { + return (new Query('notIntersects', $attribute, [$values]))->__toString(); + } + + /** + * Crosses + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function crosses(string $attribute, array $values): string + { + return (new Query('crosses', $attribute, [$values]))->__toString(); + } + + /** + * Not Crosses + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function notCrosses(string $attribute, array $values): string + { + return (new Query('notCrosses', $attribute, [$values]))->__toString(); + } + + /** + * Overlaps + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function overlaps(string $attribute, array $values): string + { + return (new Query('overlaps', $attribute, [$values]))->__toString(); + } + + /** + * Not Overlaps + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function notOverlaps(string $attribute, array $values): string + { + return (new Query('notOverlaps', $attribute, [$values]))->__toString(); + } + + /** + * Touches + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function touches(string $attribute, array $values): string + { + return (new Query('touches', $attribute, [$values]))->__toString(); + } + + /** + * Not Touches + * + * @param string $attribute + * @param array $values + * @return string + */ + public static function notTouches(string $attribute, array $values): string + { + return (new Query('notTouches', $attribute, [$values]))->__toString(); + } } diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index ca28ff4..76b8bd5 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -1227,7 +1227,8 @@ public function createEmailPasswordSession(string $email, string $password): arr * @throws AppwriteException * @return array * - * @deprecated This API has been deprecated. + * @deprecated This API has been deprecated since 1.6.0. Please use `createSession` instead. + * @see Account::createSession */ public function updateMagicURLSession(string $userId, string $secret): array { @@ -1262,7 +1263,8 @@ public function updateMagicURLSession(string $userId, string $secret): array * @throws AppwriteException * @return array * - * @deprecated This API has been deprecated. + * @deprecated This API has been deprecated since 1.6.0. Please use `createSession` instead. + * @see Account::createSession */ public function updatePhoneSession(string $userId, string $secret): array { diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index 1060a0a..9c1b16e 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -67,8 +67,8 @@ public function list(?array $queries = null, ?string $search = null): array * @throws AppwriteException * @return array * - * @deprecated This API has been deprecated since 1.8.0. Please use `createDatabase` instead. - * @see TablesDB::createDatabase + * @deprecated This API has been deprecated since 1.8.0. Please use `create` instead. + * @see TablesDB::create */ public function create(string $databaseId, string $name, ?bool $enabled = null): array { @@ -1171,6 +1171,264 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri ); } + /** + * Create a geometric line attribute. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @throws AppwriteException + * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createLineColumn` instead. + * @see TablesDB::createLineColumn + */ + public function createLineAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/line' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a line attribute. Changing the `default` value will not update + * already existing documents. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateLineColumn` instead. + * @see TablesDB::updateLineColumn + */ + public function updateLineAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $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 geometric point attribute. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @throws AppwriteException + * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createPointColumn` instead. + * @see TablesDB::createPointColumn + */ + public function createPointAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/point' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a point attribute. Changing the `default` value will not update + * already existing documents. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updatePointColumn` instead. + * @see TablesDB::updatePointColumn + */ + public function updatePointAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $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 geometric polygon attribute. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @throws AppwriteException + * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `createPolygonColumn` instead. + * @see TablesDB::createPolygonColumn + */ + public function createPolygonAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/polygon' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a polygon attribute. Changing the `default` value will not update + * already existing documents. + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updatePolygonColumn` instead. + * @see TablesDB::updatePolygonColumn + */ + public function updatePolygonAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $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 attribute. [Learn more about relationship * attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). diff --git a/src/Appwrite/Services/TablesDb.php b/src/Appwrite/Services/TablesDb.php index 59a4254..0258f25 100644 --- a/src/Appwrite/Services/TablesDb.php +++ b/src/Appwrite/Services/TablesDb.php @@ -1095,6 +1095,246 @@ public function updateIpColumn(string $databaseId, string $tableId, string $key, ); } + /** + * Create a geometric line column. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @throws AppwriteException + * @return array + */ + public function createLineColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/line' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a line column. Changing the `default` value will not update already + * existing rows. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateLineColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{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 geometric point column. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @throws AppwriteException + * @return array + */ + public function createPointColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/point' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a point column. Changing the `default` value will not update already + * existing rows. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updatePointColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{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 geometric polygon column. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @throws AppwriteException + * @return array + */ + public function createPolygonColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a polygon column. Changing the `default` value will not update + * already existing rows. + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?array $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updatePolygonColumn(string $databaseId, string $tableId, string $key, bool $required, ?array $xdefault = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{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). diff --git a/tests/Appwrite/QueryTest.php b/tests/Appwrite/QueryTest.php index a9ac2c3..01332ef 100644 --- a/tests/Appwrite/QueryTest.php +++ b/tests/Appwrite/QueryTest.php @@ -183,6 +183,10 @@ public function testCreatedAfter(): void { $this->assertSame('createdAfter("2023-01-01")', Query::createdAfter('2023-01-01')); } + public function testCreatedBetween(): void { + $this->assertSame('{"method":"createdBetween","values":["2023-01-01","2023-12-31"]}', Query::createdBetween('2023-01-01', '2023-12-31')); + } + public function testUpdatedBefore(): void { $this->assertSame('updatedBefore("2023-01-01")', Query::updatedBefore('2023-01-01')); } @@ -190,4 +194,8 @@ public function testUpdatedBefore(): void { public function testUpdatedAfter(): void { $this->assertSame('updatedAfter("2023-01-01")', Query::updatedAfter('2023-01-01')); } + + public function testUpdatedBetween(): void { + $this->assertSame('{"method":"updatedBetween","values":["2023-01-01","2023-12-31"]}', Query::updatedBetween('2023-01-01', '2023-12-31')); + } } diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index b11271f..daa113b 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -637,6 +637,162 @@ public function testMethodUpdateIpAttribute(): void { $this->assertSame($data, $response); } + public function testMethodCreateLineAttribute(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createLineAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateLineAttribute(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateLineAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePointAttribute(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createPointAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePointAttribute(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updatePointAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePolygonAttribute(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createPolygonAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePolygonAttribute(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updatePolygonAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateRelationshipAttribute(): void { $data = array( diff --git a/tests/Appwrite/Services/TablesDbTest.php b/tests/Appwrite/Services/TablesDbTest.php index 6a47bea..34c01d1 100644 --- a/tests/Appwrite/Services/TablesDbTest.php +++ b/tests/Appwrite/Services/TablesDbTest.php @@ -637,6 +637,162 @@ public function testMethodUpdateIpColumn(): void { $this->assertSame($data, $response); } + public function testMethodCreateLineColumn(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createLineColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateLineColumn(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateLineColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePointColumn(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createPointColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePointColumn(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updatePointColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePolygonColumn(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createPolygonColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePolygonColumn(): 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",); + + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updatePolygonColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateRelationshipColumn(): void { $data = array(