diff --git a/docs/databases.md b/docs/databases.md index 9267e14..538973c 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -213,6 +213,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | +| newKey | string | New attribute key. | | ## Create datetime attribute @@ -250,6 +251,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | ## Create email attribute @@ -289,6 +291,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | ## Create enum attribute @@ -330,6 +333,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | | 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. | | ## Create float attribute @@ -373,6 +377,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | ## Create integer attribute @@ -416,6 +421,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | ## Create IP address attribute @@ -455,6 +461,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | ## Create relationship attribute @@ -518,6 +525,8 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | ## Create URL attribute @@ -557,6 +566,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | 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. | | ## Get attribute @@ -607,6 +617,7 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | | key | string | **Required** Attribute Key. | | | onDelete | string | Constraints option | | +| newKey | string | New attribute key. | | ## List documents diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 1b3355a..133fbb8 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateBooleanAttribute( collectionId: '', key: '', required: false, - default: false + default: false, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 978cde0..4773e54 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateDatetimeAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 1623b64..9c1bdb4 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateEmailAttribute( collectionId: '', key: '', required: false, - default: 'email@example.com' + default: 'email@example.com', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 8a8d035..88229bc 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -16,5 +16,6 @@ $result = $databases->updateEnumAttribute( key: '', elements: [], required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 105ebc6..7beac26 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -17,5 +17,6 @@ $result = $databases->updateFloatAttribute( required: false, min: null, max: null, - default: null + default: null, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 65bed51..e92385d 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -17,5 +17,6 @@ $result = $databases->updateIntegerAttribute( required: false, min: null, max: null, - default: null + default: null, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index f7ce1a6..e88e75c 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateIpAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index a0ba877..0afaea2 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -14,5 +14,6 @@ $result = $databases->updateRelationshipAttribute( databaseId: '', collectionId: '', key: '', - onDelete: RelationMutate::CASCADE() // optional + onDelete: RelationMutate::CASCADE(), // optional + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 08c5c5e..9e821e4 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -15,5 +15,7 @@ $result = $databases->updateStringAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + size: null, // optional + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 9595176..1825e55 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateUrlAttribute( collectionId: '', key: '', required: false, - default: 'https://example.com' + default: 'https://example.com', + newKey: '' // optional ); \ No newline at end of file diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index a0ac3a4..6eb85cf 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -508,10 +508,11 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, * @param string $key * @param bool $required * @param ?bool $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault): array + public function updateBooleanAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?bool $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -526,6 +527,10 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, $apiParams['required'] = $required; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -595,10 +600,11 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId * @param string $key * @param bool $required * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + public function updateDatetimeAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -613,6 +619,10 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId $apiParams['required'] = $required; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -684,10 +694,11 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s * @param string $key * @param bool $required * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + public function updateEmailAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -702,6 +713,10 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s $apiParams['required'] = $required; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -777,10 +792,11 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st * @param array $elements * @param bool $required * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault): array + public function updateEnumAttribute(string $databaseId, string $collectionId, string $key, array $elements, bool $required, ?string $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -796,6 +812,10 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st $apiParams['required'] = $required; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -880,10 +900,11 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s * @param float $min * @param float $max * @param ?float $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min, float $max, ?float $xdefault): array + public function updateFloatAttribute(string $databaseId, string $collectionId, string $key, bool $required, float $min, float $max, ?float $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -900,6 +921,10 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s $apiParams['max'] = $max; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -984,10 +1009,11 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, * @param int $min * @param int $max * @param ?int $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min, int $max, ?int $xdefault): array + public function updateIntegerAttribute(string $databaseId, string $collectionId, string $key, bool $required, int $min, int $max, ?int $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1004,6 +1030,10 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, $apiParams['max'] = $max; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1075,10 +1105,11 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri * @param string $key * @param bool $required * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + public function updateIpAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1093,6 +1124,10 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri $apiParams['required'] = $required; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1230,10 +1265,12 @@ public function createStringAttribute(string $databaseId, string $collectionId, * @param string $key * @param bool $required * @param ?string $xdefault + * @param ?int $size + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + public function updateStringAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1248,6 +1285,14 @@ public function updateStringAttribute(string $databaseId, string $collectionId, $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'; @@ -1319,10 +1364,11 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str * @param string $key * @param bool $required * @param ?string $xdefault + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault): array + public function updateUrlAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1337,6 +1383,10 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str $apiParams['required'] = $required; $apiParams['default'] = $xdefault; + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -1429,10 +1479,11 @@ public function deleteAttribute(string $databaseId, string $collectionId, string * @param string $collectionId * @param string $key * @param ?RelationMutate $onDelete + * @param ?string $newKey * @throws AppwriteException * @return array */ - public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null): array + public function updateRelationshipAttribute(string $databaseId, string $collectionId, string $key, ?RelationMutate $onDelete = null, ?string $newKey = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{key}'], @@ -1449,6 +1500,10 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti $apiParams['onDelete'] = $onDelete; } + if (!is_null($newKey)) { + $apiParams['newKey'] = $newKey; + } + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json';