diff --git a/CHANGELOG.md b/CHANGELOG.md index 526efd2..eca2e74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## 30.0.0-rc.1 + +* Breaking: `EmbeddingModel` no longer offers `embedding-gemma` or `bge-small` +* Added: `documentsDB`, `vectorsDB`, `mysql`, `postgresql`, and `mongo` services, no longer hidden from server SDKs +* Added: `DocumentsDBIndexType` and `VectorsDBIndexType` enums +* Added: dedicated database models for branches, backups, restorations, poolers, PITR windows, extensions, and executions +* Added: `PostgresExtension`, `VectorsdbCollection`, `AttributeObject`, and `AttributeVector` models +* Added: `userId`, `emailHash`, and `name` parameters to `avatars.getPhoto` +* Added: `error`, `containerStatus`, and `lifecycleState` on the `Database` model +* Added: `changelogWatermark` on the `DatabaseMigration` model +* Added: `total` on the `DedicatedDatabaseBranchList` model +* Updated: `DedicatedDatabaseOperation.status` documents the new `queued` state + ## 29.0.0 * Breaking: requires PHP 8.5 or later, up from PHP 8.2 diff --git a/docs/documentsdb.md b/docs/documentsdb.md new file mode 100644 index 0000000..6f585a2 --- /dev/null +++ b/docs/documentsdb.md @@ -0,0 +1,579 @@ +# DocumentsDB Service + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb +``` + +** Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb +``` + +** Create a new Database. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Database name. Max length: 128 chars. | | +| enabled | boolean | Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | +| specification | string | Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. | serverless | +| replicas | integer | Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. | 0 | +| syncMode | string | Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/specifications +``` + +** List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. ** + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/transactions +``` + +** List transactions across all databases. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). | [] | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/transactions +``` + +** Create a new transaction. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ttl | integer | Seconds before the transaction expires. | 300 | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} +``` + +** Get a transaction by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} +``` + +** Update a transaction, to either commit or roll back its operations. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| commit | boolean | Commit transaction? | | +| rollback | boolean | Rollback transaction? | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId} +``` + +** Delete a transaction by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/transactions/{transactionId}/operations +``` + +** Create multiple operations in a single transaction. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| operations | array | Array of staged operations. | [] | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId} +``` + +** Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId} +``` + +** Update a database by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| name | string | Database name. Max length: 128 chars. | | +| enabled | boolean | Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | +| specification | string | Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. | | +| replicas | integer | Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. | | +| syncMode | string | Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId} +``` + +** Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections +``` + +** Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections +``` + +** Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Collection name. Max length: 128 chars. | | +| permissions | array | An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | +| attributes | array | Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, varchar, text, mediumtext, longtext, integer, bigint, double, boolean, datetime, point, linestring, polygon, email, url, ip, enum), size (integer, required for string and varchar types), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. | [] | +| indexes | array | Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). | [] | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} +``` + +** Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} +``` + +** Update a collection by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| name | string | Collection name. Max length: 128 chars. | | +| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | +| purge | boolean | When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId} +``` + +** Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Get a list of all the user's documents in a given collection. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +| ttl | integer | TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). | 0 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documentId | string | Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| data | object | Document data as JSON object. | {} | +| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documents | array | Array of documents data as JSON objects. | [] | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documents | array | Array of document data as JSON objects. May contain partial documents. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| data | object | Document data as JSON object. Include only attribute and value pairs to be updated. | {} | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Bulk delete documents using queries, if no queries are passed then all documents are deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Get a document by its unique ID. This endpoint response returns a JSON object with the document data. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | + + +```http request +PUT https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include all required fields of the document to be created or updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include only fields and value pairs to be updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Delete a document by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement +``` + +** Decrement a specific column of a row by a given value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| attribute | string | **Required** Attribute key. | | +| value | number | Value to decrement the attribute by. The value must be a number. | 1 | +| min | number | Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment +``` + +** Increment a specific column of a row by a given value. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| attribute | string | **Required** Attribute key. | | +| value | number | Value to increment the attribute by. The value must be a number. | 1 | +| max | number | Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes +``` + +** List indexes in the collection. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes +``` + +** Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. +Attributes can be `key`, `fulltext`, and `unique`. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Index Key. | | +| type | string | Index type. | | +| attributes | array | Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. | | +| orders | array | Array of index orders. Maximum of 100 orders are allowed. | [] | +| lengths | array | Length of index. Maximum of 100 | [] | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +** Get index by ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +** Delete an index. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/documentsdb/{databaseId}/failovers +``` + +** Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetReplicaId | string | Target replica ID to promote. If not specified, the healthiest replica is selected. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/operations +``` + +** List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by operation status. | | +| limit | integer | Maximum number of operations to return. | 25 | +| offset | integer | Number of operations to skip. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/replicas +``` + +** Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/documentsdb/{databaseId}/status +``` + +** Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 88f45c1..67681d0 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -15,6 +15,6 @@ $result = $avatars->getInitials( name: '', // optional width: 0, // optional height: 0, // optional - background: '' // optional + background: 'FFFFFF' // optional ); ``` diff --git a/docs/examples/avatars/get-photo.md b/docs/examples/avatars/get-photo.md index 5e8af41..5f5899d 100644 --- a/docs/examples/avatars/get-photo.md +++ b/docs/examples/avatars/get-photo.md @@ -17,7 +17,7 @@ $result = $avatars->getPhoto( quality: 0, // optional output: 'png', // optional rating: 'g', // optional - userId: '', // optional + userId: 'current()', // optional emailHash: '', // optional name: '' // optional ); diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md index e746cff..1384fb1 100644 --- a/docs/examples/databases/create-big-int-attribute.md +++ b/docs/examples/databases/create-big-int-attribute.md @@ -14,11 +14,11 @@ $databases = new Databases($client); $result = $databases->createBigIntAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - default: null, // optional + min: 0, // optional + max: 1000000, // optional + default: 0, // optional array: false // optional ); ``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 1cc6d1a..2004cf6 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -14,7 +14,7 @@ $databases = new Databases($client); $result = $databases->createBooleanAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: false, // optional array: false // optional diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 788eba6..9ff49a8 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -14,7 +14,7 @@ $databases = new Databases($client); $result = $databases->createDatetimeAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', // optional array: false // optional diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index fb2654a..0a104de 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -14,7 +14,7 @@ $databases = new Databases($client); $result = $databases->createEmailAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: 'email@example.com', // optional array: false // optional diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 4f77fcd..962b5a7 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -14,10 +14,10 @@ $databases = new Databases($client); $result = $databases->createEnumAttribute( databaseId: '', collectionId: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', // optional + default: 'active', // optional array: false // optional ); ``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index c6946d7..5df36f2 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -14,11 +14,11 @@ $databases = new Databases($client); $result = $databases->createFloatAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - default: null, // optional + min: 0, // optional + max: 100, // optional + default: 10.5, // optional array: false // optional ); ``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 6e5870a..1005239 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -16,7 +16,7 @@ $databases = new Databases($client); $result = $databases->createIndex( databaseId: '', collectionId: '', - key: '', + key: '', type: DatabasesIndexType::KEY(), attributes: [], orders: [OrderBy::ASC()], // optional diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 12b5f95..1b9c453 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -14,11 +14,11 @@ $databases = new Databases($client); $result = $databases->createIntegerAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - default: null, // optional + min: 0, // optional + max: 100, // optional + default: 10, // optional array: false // optional ); ``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 27a934b..afb0ed3 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->createIpAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', // optional + default: '192.0.2.0', // optional array: false // optional ); ``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 80c8faa..c892610 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -14,7 +14,7 @@ $databases = new Databases($client); $result = $databases->createLineAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] // optional ); diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index 91be4ce..376288b 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->createLongtextAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index 4b36980..67e3da1 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->createMediumtextAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 94255f8..3854154 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -14,7 +14,7 @@ $databases = new Databases($client); $result = $databases->createPointAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: [1, 2] // optional ); diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index 6cccf53..5a37c35 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -14,7 +14,7 @@ $databases = new Databases($client); $result = $databases->createPolygonAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional ); diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 3581c89..6be3488 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -19,8 +19,8 @@ $result = $databases->createRelationshipAttribute( relatedCollectionId: '', type: RelationshipType::ONETOONE(), twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional + key: '', // optional + twoWayKey: '', // optional onDelete: RelationMutate::CASCADE() // optional ); ``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 34f1311..c0d9321 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -14,10 +14,10 @@ $databases = new Databases($client); $result = $databases->createStringAttribute( databaseId: '', collectionId: '', - key: '', + key: '', size: 1, required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index b189bab..4ad0643 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->createTextAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index c470611..a5e837b 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -14,7 +14,7 @@ $databases = new Databases($client); $result = $databases->createUrlAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: 'https://example.com', // optional array: false // optional diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index 42d69aa..2bd5582 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -14,10 +14,10 @@ $databases = new Databases($client); $result = $databases->createVarcharAttribute( databaseId: '', collectionId: '', - key: '', + key: '', size: 1, required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index 8298120..ca4a5e3 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -15,9 +15,9 @@ $result = $databases->decrementDocumentAttribute( databaseId: '', collectionId: '', documentId: '', - attribute: '', - value: null, // optional - min: null, // optional + attribute: '', + value: 1, // optional + min: 0, // optional transactionId: '' // optional ); ``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 84ba990..4d8b12b 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -14,6 +14,6 @@ $databases = new Databases($client); $result = $databases->deleteAttribute( databaseId: '', collectionId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index b752023..ffbc6c2 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -14,6 +14,6 @@ $databases = new Databases($client); $result = $databases->deleteIndex( databaseId: '', collectionId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index cd77f50..bf6db3c 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -14,6 +14,6 @@ $databases = new Databases($client); $result = $databases->getAttribute( databaseId: '', collectionId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index a8cf9ad..f0d58b2 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -14,6 +14,6 @@ $databases = new Databases($client); $result = $databases->getIndex( databaseId: '', collectionId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index 30450c0..5eec9fb 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -15,9 +15,9 @@ $result = $databases->incrementDocumentAttribute( databaseId: '', collectionId: '', documentId: '', - attribute: '', - value: null, // optional - max: null, // optional + attribute: '', + value: 1, // optional + max: 100, // optional transactionId: '' // optional ); ``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md index 44d70a9..41a27b1 100644 --- a/docs/examples/databases/update-big-int-attribute.md +++ b/docs/examples/databases/update-big-int-attribute.md @@ -14,11 +14,11 @@ $databases = new Databases($client); $result = $databases->updateBigIntAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + default: 0, + min: 0, // optional + max: 1000000, // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index a92a699..ed2ff66 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateBooleanAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: false, - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 7158e91..83e7048 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateDatetimeAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 6dfd6b6..44a4da0 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateEmailAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: 'email@example.com', - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 955e6c1..8a736be 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -14,10 +14,10 @@ $databases = new Databases($client); $result = $databases->updateEnumAttribute( databaseId: '', collectionId: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', - newKey: '' // optional + default: 'active', + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 631a280..d5ad4a1 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -14,11 +14,11 @@ $databases = new Databases($client); $result = $databases->updateFloatAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + default: 10.5, + min: 0, // optional + max: 100, // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 1feaf6a..7a51383 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -14,11 +14,11 @@ $databases = new Databases($client); $result = $databases->updateIntegerAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + default: 10, + min: 0, // optional + max: 100, // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index fe9fb4b..1daf500 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateIpAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: '192.0.2.0', + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index 008c041..a18dbb7 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateLineAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md index 5b21ef0..06e0ef9 100644 --- a/docs/examples/databases/update-longtext-attribute.md +++ b/docs/examples/databases/update-longtext-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateLongtextAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: 'Hello World', + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md index 6288fee..e08925a 100644 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateMediumtextAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: 'Hello World', + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index 505944d..5457717 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updatePointAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: [1, 2], // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index e6a940b..448b4ef 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updatePolygonAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 38fc8dc..d1264df 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -15,8 +15,8 @@ $databases = new Databases($client); $result = $databases->updateRelationshipAttribute( databaseId: '', collectionId: '', - key: '', + key: '', onDelete: RelationMutate::CASCADE(), // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index a325638..656401d 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -14,10 +14,10 @@ $databases = new Databases($client); $result = $databases->updateStringAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md index ff4ce5d..61bf96f 100644 --- a/docs/examples/databases/update-text-attribute.md +++ b/docs/examples/databases/update-text-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateTextAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: 'Hello World', + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index f03123c..9ab7706 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -14,9 +14,9 @@ $databases = new Databases($client); $result = $databases->updateUrlAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, default: 'https://example.com', - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md index 03ea4c0..73b2b7d 100644 --- a/docs/examples/databases/update-varchar-attribute.md +++ b/docs/examples/databases/update-varchar-attribute.md @@ -14,10 +14,10 @@ $databases = new Databases($client); $result = $databases->updateVarcharAttribute( databaseId: '', collectionId: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/documentsdb/create-collection.md b/docs/examples/documentsdb/create-collection.md new file mode 100644 index 0000000..b149a15 --- /dev/null +++ b/docs/examples/documentsdb/create-collection.md @@ -0,0 +1,26 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createCollection( + databaseId: '', + collectionId: '', + name: '', + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + attributes: [], // optional + indexes: [] // optional +); +``` diff --git a/docs/examples/documentsdb/create-document.md b/docs/examples/documentsdb/create-document.md new file mode 100644 index 0000000..dc88f16 --- /dev/null +++ b/docs/examples/documentsdb/create-document.md @@ -0,0 +1,29 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 30, + 'isAdmin' => false + ], + permissions: [Permission::read(Role::any())] // optional +); +``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md new file mode 100644 index 0000000..e8f0ded --- /dev/null +++ b/docs/examples/documentsdb/create-documents.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createDocuments( + databaseId: '', + collectionId: '', + documents: [] +); +``` diff --git a/docs/examples/documentsdb/create-failover.md b/docs/examples/documentsdb/create-failover.md new file mode 100644 index 0000000..9198a42 --- /dev/null +++ b/docs/examples/documentsdb/create-failover.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createFailover( + databaseId: '', + targetReplicaId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md new file mode 100644 index 0000000..b64d1f8 --- /dev/null +++ b/docs/examples/documentsdb/create-index.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createIndex( + databaseId: '', + collectionId: '', + key: '', + type: DocumentsDBIndexType::KEY(), + attributes: [], + orders: [OrderBy::ASC()], // optional + lengths: [] // optional +); +``` diff --git a/docs/examples/documentsdb/create-operations.md b/docs/examples/documentsdb/create-operations.md new file mode 100644 index 0000000..83d3bab --- /dev/null +++ b/docs/examples/documentsdb/create-operations.md @@ -0,0 +1,28 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createOperations( + transactionId: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] // optional +); +``` diff --git a/docs/examples/documentsdb/create-transaction.md b/docs/examples/documentsdb/create-transaction.md new file mode 100644 index 0000000..bcf4ad3 --- /dev/null +++ b/docs/examples/documentsdb/create-transaction.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->createTransaction( + ttl: 60 // optional +); +``` diff --git a/docs/examples/documentsdb/create.md b/docs/examples/documentsdb/create.md new file mode 100644 index 0000000..a82f793 --- /dev/null +++ b/docs/examples/documentsdb/create.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->create( + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async' // optional +); +``` diff --git a/docs/examples/documentsdb/decrement-document-attribute.md b/docs/examples/documentsdb/decrement-document-attribute.md new file mode 100644 index 0000000..3c7224e --- /dev/null +++ b/docs/examples/documentsdb/decrement-document-attribute.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->decrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + value: 1, // optional + min: 0, // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/delete-collection.md b/docs/examples/documentsdb/delete-collection.md new file mode 100644 index 0000000..2b11da4 --- /dev/null +++ b/docs/examples/documentsdb/delete-collection.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteCollection( + databaseId: '', + collectionId: '' +); +``` diff --git a/docs/examples/documentsdb/delete-document.md b/docs/examples/documentsdb/delete-document.md new file mode 100644 index 0000000..1e01f3e --- /dev/null +++ b/docs/examples/documentsdb/delete-document.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md new file mode 100644 index 0000000..b77b375 --- /dev/null +++ b/docs/examples/documentsdb/delete-documents.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/delete-index.md b/docs/examples/documentsdb/delete-index.md new file mode 100644 index 0000000..a587948 --- /dev/null +++ b/docs/examples/documentsdb/delete-index.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteIndex( + databaseId: '', + collectionId: '', + key: '' +); +``` diff --git a/docs/examples/documentsdb/delete-transaction.md b/docs/examples/documentsdb/delete-transaction.md new file mode 100644 index 0000000..6e1f20c --- /dev/null +++ b/docs/examples/documentsdb/delete-transaction.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->deleteTransaction( + transactionId: '' +); +``` diff --git a/docs/examples/documentsdb/delete.md b/docs/examples/documentsdb/delete.md new file mode 100644 index 0000000..48d8885 --- /dev/null +++ b/docs/examples/documentsdb/delete.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->delete( + databaseId: '' +); +``` diff --git a/docs/examples/documentsdb/get-collection.md b/docs/examples/documentsdb/get-collection.md new file mode 100644 index 0000000..4aa50f2 --- /dev/null +++ b/docs/examples/documentsdb/get-collection.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getCollection( + databaseId: '', + collectionId: '' +); +``` diff --git a/docs/examples/documentsdb/get-document.md b/docs/examples/documentsdb/get-document.md new file mode 100644 index 0000000..f82d09a --- /dev/null +++ b/docs/examples/documentsdb/get-document.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getDocument( + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/get-index.md b/docs/examples/documentsdb/get-index.md new file mode 100644 index 0000000..2f4c28e --- /dev/null +++ b/docs/examples/documentsdb/get-index.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getIndex( + databaseId: '', + collectionId: '', + key: '' +); +``` diff --git a/docs/examples/documentsdb/get-replicas.md b/docs/examples/documentsdb/get-replicas.md new file mode 100644 index 0000000..3ccdbb3 --- /dev/null +++ b/docs/examples/documentsdb/get-replicas.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getReplicas( + databaseId: '' +); +``` diff --git a/docs/examples/documentsdb/get-status.md b/docs/examples/documentsdb/get-status.md new file mode 100644 index 0000000..a18b0c4 --- /dev/null +++ b/docs/examples/documentsdb/get-status.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getStatus( + databaseId: '' +); +``` diff --git a/docs/examples/documentsdb/get-transaction.md b/docs/examples/documentsdb/get-transaction.md new file mode 100644 index 0000000..44ddeac --- /dev/null +++ b/docs/examples/documentsdb/get-transaction.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->getTransaction( + transactionId: '' +); +``` diff --git a/docs/examples/documentsdb/get.md b/docs/examples/documentsdb/get.md new file mode 100644 index 0000000..c69054b --- /dev/null +++ b/docs/examples/documentsdb/get.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->get( + databaseId: '' +); +``` diff --git a/docs/examples/documentsdb/increment-document-attribute.md b/docs/examples/documentsdb/increment-document-attribute.md new file mode 100644 index 0000000..5be35f3 --- /dev/null +++ b/docs/examples/documentsdb/increment-document-attribute.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->incrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + value: 1, // optional + max: 100, // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/list-collections.md b/docs/examples/documentsdb/list-collections.md new file mode 100644 index 0000000..a4a3c99 --- /dev/null +++ b/docs/examples/documentsdb/list-collections.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listCollections( + databaseId: '', + queries: [], // optional + search: '', // optional + total: false // optional +); +``` diff --git a/docs/examples/documentsdb/list-documents.md b/docs/examples/documentsdb/list-documents.md new file mode 100644 index 0000000..57c24c2 --- /dev/null +++ b/docs/examples/documentsdb/list-documents.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0 // optional +); +``` diff --git a/docs/examples/documentsdb/list-indexes.md b/docs/examples/documentsdb/list-indexes.md new file mode 100644 index 0000000..a229e11 --- /dev/null +++ b/docs/examples/documentsdb/list-indexes.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listIndexes( + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +); +``` diff --git a/docs/examples/documentsdb/list-operations.md b/docs/examples/documentsdb/list-operations.md new file mode 100644 index 0000000..beea6b5 --- /dev/null +++ b/docs/examples/documentsdb/list-operations.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listOperations( + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/documentsdb/list-specifications.md b/docs/examples/documentsdb/list-specifications.md new file mode 100644 index 0000000..79371a2 --- /dev/null +++ b/docs/examples/documentsdb/list-specifications.md @@ -0,0 +1,15 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listSpecifications(); +``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md new file mode 100644 index 0000000..f154df8 --- /dev/null +++ b/docs/examples/documentsdb/list-transactions.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->listTransactions( + queries: [] // optional +); +``` diff --git a/docs/examples/documentsdb/list.md b/docs/examples/documentsdb/list.md new file mode 100644 index 0000000..8345a88 --- /dev/null +++ b/docs/examples/documentsdb/list.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->list( + queries: [], // optional + total: false // optional +); +``` diff --git a/docs/examples/documentsdb/update-collection.md b/docs/examples/documentsdb/update-collection.md new file mode 100644 index 0000000..a160bac --- /dev/null +++ b/docs/examples/documentsdb/update-collection.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateCollection( + databaseId: '', + collectionId: '', + name: '', + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + purge: false // optional +); +``` diff --git a/docs/examples/documentsdb/update-document.md b/docs/examples/documentsdb/update-document.md new file mode 100644 index 0000000..0bd2095 --- /dev/null +++ b/docs/examples/documentsdb/update-document.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/update-documents.md b/docs/examples/documentsdb/update-documents.md new file mode 100644 index 0000000..3daf903 --- /dev/null +++ b/docs/examples/documentsdb/update-documents.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateDocuments( + databaseId: '', + collectionId: '', + data: [], // optional + queries: [], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/update-transaction.md b/docs/examples/documentsdb/update-transaction.md new file mode 100644 index 0000000..30b0b7b --- /dev/null +++ b/docs/examples/documentsdb/update-transaction.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->updateTransaction( + transactionId: '', + commit: false, // optional + rollback: false // optional +); +``` diff --git a/docs/examples/documentsdb/update.md b/docs/examples/documentsdb/update.md new file mode 100644 index 0000000..d9caf5b --- /dev/null +++ b/docs/examples/documentsdb/update.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->update( + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async' // optional +); +``` diff --git a/docs/examples/documentsdb/upsert-document.md b/docs/examples/documentsdb/upsert-document.md new file mode 100644 index 0000000..c35cb3b --- /dev/null +++ b/docs/examples/documentsdb/upsert-document.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->upsertDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md new file mode 100644 index 0000000..09021e0 --- /dev/null +++ b/docs/examples/documentsdb/upsert-documents.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$documentsDB = new DocumentsDB($client); + +$result = $documentsDB->upsertDocuments( + databaseId: '', + collectionId: '', + documents: [], + transactionId: '' // optional +); +``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 4640687..206ac80 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -14,7 +14,7 @@ $functions = new Functions($client); $result = $functions->createVariable( functionId: '', variableId: '', - key: '', + key: '', value: '', secret: false // optional ); diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 8316934..0fcac58 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -19,7 +19,7 @@ $result = $functions->create( runtime: Runtime::NODE145(), execute: ["any"], // optional events: [], // optional - schedule: '', // optional + schedule: '0 0 * * *', // optional timeout: 1, // optional enabled: false, // optional logging: false, // optional @@ -33,8 +33,8 @@ $result = $functions->create( providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional deploymentRetention: 0 // optional ); ``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 14a284d..a60cea5 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -14,7 +14,7 @@ $functions = new Functions($client); $result = $functions->updateVariable( functionId: '', variableId: '', - key: '', // optional + key: '', // optional value: '', // optional secret: false // optional ); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index e857349..e13ede1 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -19,7 +19,7 @@ $result = $functions->update( runtime: Runtime::NODE145(), // optional execute: ["any"], // optional events: [], // optional - schedule: '', // optional + schedule: '0 0 * * *', // optional timeout: 1, // optional enabled: false, // optional logging: false, // optional @@ -33,8 +33,8 @@ $result = $functions->update( providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional deploymentRetention: 0 // optional ); ``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 9201f31..23eede5 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -15,7 +15,7 @@ $result = $messaging->createMailgunProvider( providerId: '', name: '', apiKey: '', // optional - domain: '', // optional + domain: 'example.com', // optional isEuRegion: false, // optional fromName: '', // optional fromEmail: 'email@example.com', // optional diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 82d1e2d..7573417 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -26,7 +26,7 @@ $result = $messaging->createPush( sound: '', // optional color: '', // optional tag: '', // optional - badge: null, // optional + badge: 1, // optional draft: false, // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 0e19cf2..4da37c0 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -16,7 +16,7 @@ $result = $messaging->createSMTPProvider( providerId: '', name: '', host: '', - port: 1, // optional + port: 587, // optional username: '', // optional password: 'password', // optional encryption: SmtpEncryption::NONE(), // optional diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index c32e95f..9aaabcf 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -15,7 +15,7 @@ $result = $messaging->updateMailgunProvider( providerId: '', name: '', // optional apiKey: '', // optional - domain: '', // optional + domain: 'example.com', // optional isEuRegion: false, // optional enabled: false, // optional fromName: '', // optional diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 4440661..a1b14b7 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -26,7 +26,7 @@ $result = $messaging->updatePush( sound: '', // optional color: '', // optional tag: '', // optional - badge: null, // optional + badge: 1, // optional draft: false, // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional contentAvailable: false, // optional diff --git a/docs/examples/mongo/create-backup-policy.md b/docs/examples/mongo/create-backup-policy.md new file mode 100644 index 0000000..72bffa6 --- /dev/null +++ b/docs/examples/mongo/create-backup-policy.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->createBackupPolicy( + databaseId: '', + policyId: '', + name: '', + schedule: '', + retention: 1, + type: 'full', // optional + enabled: false // optional +); +``` diff --git a/docs/examples/mongo/create-backup.md b/docs/examples/mongo/create-backup.md new file mode 100644 index 0000000..d1af454 --- /dev/null +++ b/docs/examples/mongo/create-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->createBackup( + databaseId: '', + type: 'full' // optional +); +``` diff --git a/docs/examples/mongo/create-branch.md b/docs/examples/mongo/create-branch.md new file mode 100644 index 0000000..de857b4 --- /dev/null +++ b/docs/examples/mongo/create-branch.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->createBranch( + databaseId: '', + branchId: '', // optional + ttl: 300 // optional +); +``` diff --git a/docs/examples/mongo/create-failover.md b/docs/examples/mongo/create-failover.md new file mode 100644 index 0000000..455e657 --- /dev/null +++ b/docs/examples/mongo/create-failover.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->createFailover( + databaseId: '', + targetReplicaId: '' // optional +); +``` diff --git a/docs/examples/mongo/create-migration.md b/docs/examples/mongo/create-migration.md new file mode 100644 index 0000000..53b9f7d --- /dev/null +++ b/docs/examples/mongo/create-migration.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->createMigration( + databaseId: '', + targetType: 'shared', + specification: '' // optional +); +``` diff --git a/docs/examples/mongo/create-restoration.md b/docs/examples/mongo/create-restoration.md new file mode 100644 index 0000000..e16d2e3 --- /dev/null +++ b/docs/examples/mongo/create-restoration.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->createRestoration( + databaseId: '', + type: 'backup', // optional + backupId: '', // optional + targetDatabaseId: '', // optional + targetTime: '2020-10-15T06:38:00.000+00:00' // optional +); +``` diff --git a/docs/examples/mongo/create-upgrade.md b/docs/examples/mongo/create-upgrade.md new file mode 100644 index 0000000..8c9e9eb --- /dev/null +++ b/docs/examples/mongo/create-upgrade.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->createUpgrade( + databaseId: '', + targetVersion: '' +); +``` diff --git a/docs/examples/mongo/create.md b/docs/examples/mongo/create.md new file mode 100644 index 0000000..d5c458d --- /dev/null +++ b/docs/examples/mongo/create.md @@ -0,0 +1,30 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->create( + databaseId: '', + name: '', + version: '17', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0 // optional +); +``` diff --git a/docs/examples/mongo/delete-backup-policy.md b/docs/examples/mongo/delete-backup-policy.md new file mode 100644 index 0000000..385d692 --- /dev/null +++ b/docs/examples/mongo/delete-backup-policy.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->deleteBackupPolicy( + databaseId: '', + policyId: '' +); +``` diff --git a/docs/examples/mongo/delete-backup.md b/docs/examples/mongo/delete-backup.md new file mode 100644 index 0000000..77eddff --- /dev/null +++ b/docs/examples/mongo/delete-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->deleteBackup( + databaseId: '', + backupId: '' +); +``` diff --git a/docs/examples/mongo/delete-branch.md b/docs/examples/mongo/delete-branch.md new file mode 100644 index 0000000..0996e1f --- /dev/null +++ b/docs/examples/mongo/delete-branch.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->deleteBranch( + databaseId: '', + branchId: '' +); +``` diff --git a/docs/examples/mongo/delete.md b/docs/examples/mongo/delete.md new file mode 100644 index 0000000..7d39dcd --- /dev/null +++ b/docs/examples/mongo/delete.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->delete( + databaseId: '' +); +``` diff --git a/docs/examples/mongo/get-backup-policy.md b/docs/examples/mongo/get-backup-policy.md new file mode 100644 index 0000000..19c2516 --- /dev/null +++ b/docs/examples/mongo/get-backup-policy.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->getBackupPolicy( + databaseId: '', + policyId: '' +); +``` diff --git a/docs/examples/mongo/get-backup.md b/docs/examples/mongo/get-backup.md new file mode 100644 index 0000000..0e85d1b --- /dev/null +++ b/docs/examples/mongo/get-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->getBackup( + databaseId: '', + backupId: '' +); +``` diff --git a/docs/examples/mongo/get-pitr.md b/docs/examples/mongo/get-pitr.md new file mode 100644 index 0000000..d864fae --- /dev/null +++ b/docs/examples/mongo/get-pitr.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->getPitr( + databaseId: '' +); +``` diff --git a/docs/examples/mongo/get-replicas.md b/docs/examples/mongo/get-replicas.md new file mode 100644 index 0000000..88b285c --- /dev/null +++ b/docs/examples/mongo/get-replicas.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->getReplicas( + databaseId: '' +); +``` diff --git a/docs/examples/mongo/get-restoration.md b/docs/examples/mongo/get-restoration.md new file mode 100644 index 0000000..a836fa0 --- /dev/null +++ b/docs/examples/mongo/get-restoration.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->getRestoration( + databaseId: '', + restorationId: '' +); +``` diff --git a/docs/examples/mongo/get-status.md b/docs/examples/mongo/get-status.md new file mode 100644 index 0000000..80a99a2 --- /dev/null +++ b/docs/examples/mongo/get-status.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->getStatus( + databaseId: '' +); +``` diff --git a/docs/examples/mongo/get.md b/docs/examples/mongo/get.md new file mode 100644 index 0000000..bc3cf51 --- /dev/null +++ b/docs/examples/mongo/get.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->get( + databaseId: '' +); +``` diff --git a/docs/examples/mongo/list-backup-policies.md b/docs/examples/mongo/list-backup-policies.md new file mode 100644 index 0000000..84922f6 --- /dev/null +++ b/docs/examples/mongo/list-backup-policies.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->listBackupPolicies( + databaseId: '', + queries: [] // optional +); +``` diff --git a/docs/examples/mongo/list-backups.md b/docs/examples/mongo/list-backups.md new file mode 100644 index 0000000..d712d12 --- /dev/null +++ b/docs/examples/mongo/list-backups.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->listBackups( + databaseId: '', + queries: [] // optional +); +``` diff --git a/docs/examples/mongo/list-branches.md b/docs/examples/mongo/list-branches.md new file mode 100644 index 0000000..c6181aa --- /dev/null +++ b/docs/examples/mongo/list-branches.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->listBranches( + databaseId: '' +); +``` diff --git a/docs/examples/mongo/list-operations.md b/docs/examples/mongo/list-operations.md new file mode 100644 index 0000000..bed15de --- /dev/null +++ b/docs/examples/mongo/list-operations.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->listOperations( + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/mongo/list-restorations.md b/docs/examples/mongo/list-restorations.md new file mode 100644 index 0000000..688d749 --- /dev/null +++ b/docs/examples/mongo/list-restorations.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->listRestorations( + databaseId: '', + status: 'pending', // optional + type: 'backup', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/mongo/list-specifications.md b/docs/examples/mongo/list-specifications.md new file mode 100644 index 0000000..c579bd4 --- /dev/null +++ b/docs/examples/mongo/list-specifications.md @@ -0,0 +1,15 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->listSpecifications(); +``` diff --git a/docs/examples/mongo/list.md b/docs/examples/mongo/list.md new file mode 100644 index 0000000..d9f3f9a --- /dev/null +++ b/docs/examples/mongo/list.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->list( + queries: [] // optional +); +``` diff --git a/docs/examples/mongo/update-backup-policy.md b/docs/examples/mongo/update-backup-policy.md new file mode 100644 index 0000000..4b8a264 --- /dev/null +++ b/docs/examples/mongo/update-backup-policy.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->updateBackupPolicy( + databaseId: '', + policyId: '', + name: '', // optional + schedule: '', // optional + retention: 1, // optional + enabled: false // optional +); +``` diff --git a/docs/examples/mongo/update-backup-storage.md b/docs/examples/mongo/update-backup-storage.md new file mode 100644 index 0000000..0960ed8 --- /dev/null +++ b/docs/examples/mongo/update-backup-storage.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->updateBackupStorage( + databaseId: '', + provider: 's3', + bucket: '', + accessKey: '', + secretKey: '', + region: '', // optional + prefix: '', // optional + endpoint: '' // optional +); +``` diff --git a/docs/examples/mongo/update-credentials.md b/docs/examples/mongo/update-credentials.md new file mode 100644 index 0000000..ef1cda8 --- /dev/null +++ b/docs/examples/mongo/update-credentials.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->updateCredentials( + databaseId: '' +); +``` diff --git a/docs/examples/mongo/update-maintenance.md b/docs/examples/mongo/update-maintenance.md new file mode 100644 index 0000000..871bc37 --- /dev/null +++ b/docs/examples/mongo/update-maintenance.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->updateMaintenance( + databaseId: '', + day: 'sun', + hourUtc: 0 +); +``` diff --git a/docs/examples/mongo/update.md b/docs/examples/mongo/update.md new file mode 100644 index 0000000..6a382ab --- /dev/null +++ b/docs/examples/mongo/update.md @@ -0,0 +1,37 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mongo = new Mongo($client); + +$result = $mongo->update( + databaseId: '', + name: '', // optional + status: 'ready', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + metricsTraceSampleRate: null, // optional + metricsSlowQueryLogThresholdMs: 0, // optional + sqlApiEnabled: false, // optional + sqlApiAllowedStatements: [], // optional + sqlApiMaxRows: 1, // optional + sqlApiMaxBytes: 1024, // optional + sqlApiTimeoutSeconds: 1 // optional +); +``` diff --git a/docs/examples/mysql/create-backup-policy.md b/docs/examples/mysql/create-backup-policy.md new file mode 100644 index 0000000..5fe91d0 --- /dev/null +++ b/docs/examples/mysql/create-backup-policy.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createBackupPolicy( + databaseId: '', + policyId: '', + name: '', + schedule: '', + retention: 1, + type: 'full', // optional + enabled: false // optional +); +``` diff --git a/docs/examples/mysql/create-backup.md b/docs/examples/mysql/create-backup.md new file mode 100644 index 0000000..82316ed --- /dev/null +++ b/docs/examples/mysql/create-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createBackup( + databaseId: '', + type: 'full' // optional +); +``` diff --git a/docs/examples/mysql/create-branch.md b/docs/examples/mysql/create-branch.md new file mode 100644 index 0000000..abb2c58 --- /dev/null +++ b/docs/examples/mysql/create-branch.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createBranch( + databaseId: '', + branchId: '', // optional + ttl: 300 // optional +); +``` diff --git a/docs/examples/mysql/create-execution.md b/docs/examples/mysql/create-execution.md new file mode 100644 index 0000000..fcaa046 --- /dev/null +++ b/docs/examples/mysql/create-execution.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createExecution( + databaseId: '', + sql: '', + bindings: [], // optional + timeoutSeconds: 1 // optional +); +``` diff --git a/docs/examples/mysql/create-failover.md b/docs/examples/mysql/create-failover.md new file mode 100644 index 0000000..4f6b59a --- /dev/null +++ b/docs/examples/mysql/create-failover.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createFailover( + databaseId: '', + targetReplicaId: '' // optional +); +``` diff --git a/docs/examples/mysql/create-migration.md b/docs/examples/mysql/create-migration.md new file mode 100644 index 0000000..65f318a --- /dev/null +++ b/docs/examples/mysql/create-migration.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createMigration( + databaseId: '', + targetType: 'shared', + specification: '' // optional +); +``` diff --git a/docs/examples/mysql/create-restoration.md b/docs/examples/mysql/create-restoration.md new file mode 100644 index 0000000..b906838 --- /dev/null +++ b/docs/examples/mysql/create-restoration.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createRestoration( + databaseId: '', + type: 'backup', // optional + backupId: '', // optional + targetDatabaseId: '', // optional + targetTime: '2020-10-15T06:38:00.000+00:00' // optional +); +``` diff --git a/docs/examples/mysql/create-upgrade.md b/docs/examples/mysql/create-upgrade.md new file mode 100644 index 0000000..a840d05 --- /dev/null +++ b/docs/examples/mysql/create-upgrade.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->createUpgrade( + databaseId: '', + targetVersion: '' +); +``` diff --git a/docs/examples/mysql/create.md b/docs/examples/mysql/create.md new file mode 100644 index 0000000..6d78be9 --- /dev/null +++ b/docs/examples/mysql/create.md @@ -0,0 +1,30 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->create( + databaseId: '', + name: '', + version: '17', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0 // optional +); +``` diff --git a/docs/examples/mysql/delete-backup-policy.md b/docs/examples/mysql/delete-backup-policy.md new file mode 100644 index 0000000..34c1cec --- /dev/null +++ b/docs/examples/mysql/delete-backup-policy.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->deleteBackupPolicy( + databaseId: '', + policyId: '' +); +``` diff --git a/docs/examples/mysql/delete-backup.md b/docs/examples/mysql/delete-backup.md new file mode 100644 index 0000000..2dc66b7 --- /dev/null +++ b/docs/examples/mysql/delete-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->deleteBackup( + databaseId: '', + backupId: '' +); +``` diff --git a/docs/examples/mysql/delete-branch.md b/docs/examples/mysql/delete-branch.md new file mode 100644 index 0000000..7088635 --- /dev/null +++ b/docs/examples/mysql/delete-branch.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->deleteBranch( + databaseId: '', + branchId: '' +); +``` diff --git a/docs/examples/mysql/delete.md b/docs/examples/mysql/delete.md new file mode 100644 index 0000000..28594d0 --- /dev/null +++ b/docs/examples/mysql/delete.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->delete( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/get-backup-policy.md b/docs/examples/mysql/get-backup-policy.md new file mode 100644 index 0000000..6174e24 --- /dev/null +++ b/docs/examples/mysql/get-backup-policy.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->getBackupPolicy( + databaseId: '', + policyId: '' +); +``` diff --git a/docs/examples/mysql/get-backup.md b/docs/examples/mysql/get-backup.md new file mode 100644 index 0000000..be6f448 --- /dev/null +++ b/docs/examples/mysql/get-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->getBackup( + databaseId: '', + backupId: '' +); +``` diff --git a/docs/examples/mysql/get-pitr.md b/docs/examples/mysql/get-pitr.md new file mode 100644 index 0000000..7fe7d04 --- /dev/null +++ b/docs/examples/mysql/get-pitr.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->getPitr( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/get-pooler.md b/docs/examples/mysql/get-pooler.md new file mode 100644 index 0000000..336067c --- /dev/null +++ b/docs/examples/mysql/get-pooler.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->getPooler( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/get-replicas.md b/docs/examples/mysql/get-replicas.md new file mode 100644 index 0000000..fe41dbb --- /dev/null +++ b/docs/examples/mysql/get-replicas.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->getReplicas( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/get-restoration.md b/docs/examples/mysql/get-restoration.md new file mode 100644 index 0000000..0cfaa22 --- /dev/null +++ b/docs/examples/mysql/get-restoration.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->getRestoration( + databaseId: '', + restorationId: '' +); +``` diff --git a/docs/examples/mysql/get-status.md b/docs/examples/mysql/get-status.md new file mode 100644 index 0000000..9467ffe --- /dev/null +++ b/docs/examples/mysql/get-status.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->getStatus( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/get.md b/docs/examples/mysql/get.md new file mode 100644 index 0000000..7d72ba5 --- /dev/null +++ b/docs/examples/mysql/get.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->get( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/list-backup-policies.md b/docs/examples/mysql/list-backup-policies.md new file mode 100644 index 0000000..5586d5a --- /dev/null +++ b/docs/examples/mysql/list-backup-policies.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->listBackupPolicies( + databaseId: '', + queries: [] // optional +); +``` diff --git a/docs/examples/mysql/list-backups.md b/docs/examples/mysql/list-backups.md new file mode 100644 index 0000000..1604dc8 --- /dev/null +++ b/docs/examples/mysql/list-backups.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->listBackups( + databaseId: '', + queries: [] // optional +); +``` diff --git a/docs/examples/mysql/list-branches.md b/docs/examples/mysql/list-branches.md new file mode 100644 index 0000000..079e58c --- /dev/null +++ b/docs/examples/mysql/list-branches.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->listBranches( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/list-operations.md b/docs/examples/mysql/list-operations.md new file mode 100644 index 0000000..1126a42 --- /dev/null +++ b/docs/examples/mysql/list-operations.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->listOperations( + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/mysql/list-restorations.md b/docs/examples/mysql/list-restorations.md new file mode 100644 index 0000000..8407ea0 --- /dev/null +++ b/docs/examples/mysql/list-restorations.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->listRestorations( + databaseId: '', + status: 'pending', // optional + type: 'backup', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/mysql/list-specifications.md b/docs/examples/mysql/list-specifications.md new file mode 100644 index 0000000..217a65e --- /dev/null +++ b/docs/examples/mysql/list-specifications.md @@ -0,0 +1,15 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->listSpecifications(); +``` diff --git a/docs/examples/mysql/list.md b/docs/examples/mysql/list.md new file mode 100644 index 0000000..a038ae9 --- /dev/null +++ b/docs/examples/mysql/list.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->list( + queries: [] // optional +); +``` diff --git a/docs/examples/mysql/update-backup-policy.md b/docs/examples/mysql/update-backup-policy.md new file mode 100644 index 0000000..ce71dc6 --- /dev/null +++ b/docs/examples/mysql/update-backup-policy.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->updateBackupPolicy( + databaseId: '', + policyId: '', + name: '', // optional + schedule: '', // optional + retention: 1, // optional + enabled: false // optional +); +``` diff --git a/docs/examples/mysql/update-backup-storage.md b/docs/examples/mysql/update-backup-storage.md new file mode 100644 index 0000000..5847be8 --- /dev/null +++ b/docs/examples/mysql/update-backup-storage.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->updateBackupStorage( + databaseId: '', + provider: 's3', + bucket: '', + accessKey: '', + secretKey: '', + region: '', // optional + prefix: '', // optional + endpoint: '' // optional +); +``` diff --git a/docs/examples/mysql/update-credentials.md b/docs/examples/mysql/update-credentials.md new file mode 100644 index 0000000..3b5a4fd --- /dev/null +++ b/docs/examples/mysql/update-credentials.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->updateCredentials( + databaseId: '' +); +``` diff --git a/docs/examples/mysql/update-maintenance.md b/docs/examples/mysql/update-maintenance.md new file mode 100644 index 0000000..1e15ad6 --- /dev/null +++ b/docs/examples/mysql/update-maintenance.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->updateMaintenance( + databaseId: '', + day: 'sun', + hourUtc: 0 +); +``` diff --git a/docs/examples/mysql/update-pooler.md b/docs/examples/mysql/update-pooler.md new file mode 100644 index 0000000..83b5a9e --- /dev/null +++ b/docs/examples/mysql/update-pooler.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->updatePooler( + databaseId: '', + mode: 'transaction', // optional + maxConnections: 10, // optional + defaultPoolSize: 1, // optional + readWriteSplitting: false, // optional + poolerCpuRequest: '', // optional + poolerCpuLimit: '', // optional + poolerMemoryRequest: '', // optional + poolerMemoryLimit: '' // optional +); +``` diff --git a/docs/examples/mysql/update.md b/docs/examples/mysql/update.md new file mode 100644 index 0000000..b9fd3a1 --- /dev/null +++ b/docs/examples/mysql/update.md @@ -0,0 +1,37 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$mysql = new Mysql($client); + +$result = $mysql->update( + databaseId: '', + name: '', // optional + status: 'ready', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + metricsTraceSampleRate: null, // optional + metricsSlowQueryLogThresholdMs: 0, // optional + sqlApiEnabled: false, // optional + sqlApiAllowedStatements: [], // optional + sqlApiMaxRows: 1, // optional + sqlApiMaxBytes: 1024, // optional + sqlApiTimeoutSeconds: 1 // optional +); +``` diff --git a/docs/examples/organization/create-project.md b/docs/examples/organization/create-project.md index 32fdc6f..12288f4 100644 --- a/docs/examples/organization/create-project.md +++ b/docs/examples/organization/create-project.md @@ -13,7 +13,7 @@ $client = (new Client()) $organization = new Organization($client); $result = $organization->createProject( - projectId: '', + projectId: '', name: '', region: Region::FRA() // optional ); diff --git a/docs/examples/postgresql/create-backup-policy.md b/docs/examples/postgresql/create-backup-policy.md new file mode 100644 index 0000000..76ac243 --- /dev/null +++ b/docs/examples/postgresql/create-backup-policy.md @@ -0,0 +1,23 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createBackupPolicy( + databaseId: '', + policyId: '', + name: '', + schedule: '', + retention: 1, + type: 'full', // optional + enabled: false // optional +); +``` diff --git a/docs/examples/postgresql/create-backup.md b/docs/examples/postgresql/create-backup.md new file mode 100644 index 0000000..7339850 --- /dev/null +++ b/docs/examples/postgresql/create-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createBackup( + databaseId: '', + type: 'full' // optional +); +``` diff --git a/docs/examples/postgresql/create-branch.md b/docs/examples/postgresql/create-branch.md new file mode 100644 index 0000000..88d0823 --- /dev/null +++ b/docs/examples/postgresql/create-branch.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createBranch( + databaseId: '', + branchId: '', // optional + ttl: 300 // optional +); +``` diff --git a/docs/examples/postgresql/create-execution.md b/docs/examples/postgresql/create-execution.md new file mode 100644 index 0000000..68bf4df --- /dev/null +++ b/docs/examples/postgresql/create-execution.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createExecution( + databaseId: '', + sql: '', + bindings: [], // optional + timeoutSeconds: 1 // optional +); +``` diff --git a/docs/examples/postgresql/create-extension.md b/docs/examples/postgresql/create-extension.md new file mode 100644 index 0000000..d53b5cd --- /dev/null +++ b/docs/examples/postgresql/create-extension.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createExtension( + databaseId: '', + name: '' +); +``` diff --git a/docs/examples/postgresql/create-failover.md b/docs/examples/postgresql/create-failover.md new file mode 100644 index 0000000..104996d --- /dev/null +++ b/docs/examples/postgresql/create-failover.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createFailover( + databaseId: '', + targetReplicaId: '' // optional +); +``` diff --git a/docs/examples/postgresql/create-migration.md b/docs/examples/postgresql/create-migration.md new file mode 100644 index 0000000..d3a294e --- /dev/null +++ b/docs/examples/postgresql/create-migration.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createMigration( + databaseId: '', + targetType: 'shared', + specification: '' // optional +); +``` diff --git a/docs/examples/postgresql/create-restoration.md b/docs/examples/postgresql/create-restoration.md new file mode 100644 index 0000000..f94c697 --- /dev/null +++ b/docs/examples/postgresql/create-restoration.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createRestoration( + databaseId: '', + type: 'backup', // optional + backupId: '', // optional + targetDatabaseId: '', // optional + targetTime: '2020-10-15T06:38:00.000+00:00' // optional +); +``` diff --git a/docs/examples/postgresql/create-upgrade.md b/docs/examples/postgresql/create-upgrade.md new file mode 100644 index 0000000..d8c472e --- /dev/null +++ b/docs/examples/postgresql/create-upgrade.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->createUpgrade( + databaseId: '', + targetVersion: '' +); +``` diff --git a/docs/examples/postgresql/create.md b/docs/examples/postgresql/create.md new file mode 100644 index 0000000..8f9c160 --- /dev/null +++ b/docs/examples/postgresql/create.md @@ -0,0 +1,30 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->create( + databaseId: '', + name: '', + version: '17', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0 // optional +); +``` diff --git a/docs/examples/postgresql/delete-backup-policy.md b/docs/examples/postgresql/delete-backup-policy.md new file mode 100644 index 0000000..74fb3d3 --- /dev/null +++ b/docs/examples/postgresql/delete-backup-policy.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->deleteBackupPolicy( + databaseId: '', + policyId: '' +); +``` diff --git a/docs/examples/postgresql/delete-backup.md b/docs/examples/postgresql/delete-backup.md new file mode 100644 index 0000000..4b05fc9 --- /dev/null +++ b/docs/examples/postgresql/delete-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->deleteBackup( + databaseId: '', + backupId: '' +); +``` diff --git a/docs/examples/postgresql/delete-branch.md b/docs/examples/postgresql/delete-branch.md new file mode 100644 index 0000000..c46f8a0 --- /dev/null +++ b/docs/examples/postgresql/delete-branch.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->deleteBranch( + databaseId: '', + branchId: '' +); +``` diff --git a/docs/examples/postgresql/delete-extension.md b/docs/examples/postgresql/delete-extension.md new file mode 100644 index 0000000..0d03c57 --- /dev/null +++ b/docs/examples/postgresql/delete-extension.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->deleteExtension( + databaseId: '', + extensionName: '' +); +``` diff --git a/docs/examples/postgresql/delete.md b/docs/examples/postgresql/delete.md new file mode 100644 index 0000000..94a1a54 --- /dev/null +++ b/docs/examples/postgresql/delete.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->delete( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/get-backup-policy.md b/docs/examples/postgresql/get-backup-policy.md new file mode 100644 index 0000000..a89ad91 --- /dev/null +++ b/docs/examples/postgresql/get-backup-policy.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->getBackupPolicy( + databaseId: '', + policyId: '' +); +``` diff --git a/docs/examples/postgresql/get-backup.md b/docs/examples/postgresql/get-backup.md new file mode 100644 index 0000000..f1bacfd --- /dev/null +++ b/docs/examples/postgresql/get-backup.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->getBackup( + databaseId: '', + backupId: '' +); +``` diff --git a/docs/examples/postgresql/get-pitr.md b/docs/examples/postgresql/get-pitr.md new file mode 100644 index 0000000..878354c --- /dev/null +++ b/docs/examples/postgresql/get-pitr.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->getPitr( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/get-pooler.md b/docs/examples/postgresql/get-pooler.md new file mode 100644 index 0000000..725fa54 --- /dev/null +++ b/docs/examples/postgresql/get-pooler.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->getPooler( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/get-replicas.md b/docs/examples/postgresql/get-replicas.md new file mode 100644 index 0000000..9ee0701 --- /dev/null +++ b/docs/examples/postgresql/get-replicas.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->getReplicas( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/get-restoration.md b/docs/examples/postgresql/get-restoration.md new file mode 100644 index 0000000..2b40395 --- /dev/null +++ b/docs/examples/postgresql/get-restoration.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->getRestoration( + databaseId: '', + restorationId: '' +); +``` diff --git a/docs/examples/postgresql/get-status.md b/docs/examples/postgresql/get-status.md new file mode 100644 index 0000000..541e611 --- /dev/null +++ b/docs/examples/postgresql/get-status.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->getStatus( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/get.md b/docs/examples/postgresql/get.md new file mode 100644 index 0000000..1c14c3f --- /dev/null +++ b/docs/examples/postgresql/get.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->get( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/list-backup-policies.md b/docs/examples/postgresql/list-backup-policies.md new file mode 100644 index 0000000..aff3883 --- /dev/null +++ b/docs/examples/postgresql/list-backup-policies.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->listBackupPolicies( + databaseId: '', + queries: [] // optional +); +``` diff --git a/docs/examples/postgresql/list-backups.md b/docs/examples/postgresql/list-backups.md new file mode 100644 index 0000000..7aa1544 --- /dev/null +++ b/docs/examples/postgresql/list-backups.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->listBackups( + databaseId: '', + queries: [] // optional +); +``` diff --git a/docs/examples/postgresql/list-branches.md b/docs/examples/postgresql/list-branches.md new file mode 100644 index 0000000..84d2600 --- /dev/null +++ b/docs/examples/postgresql/list-branches.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->listBranches( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/list-extensions.md b/docs/examples/postgresql/list-extensions.md new file mode 100644 index 0000000..7551322 --- /dev/null +++ b/docs/examples/postgresql/list-extensions.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->listExtensions( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/list-operations.md b/docs/examples/postgresql/list-operations.md new file mode 100644 index 0000000..fbd43f2 --- /dev/null +++ b/docs/examples/postgresql/list-operations.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->listOperations( + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/postgresql/list-restorations.md b/docs/examples/postgresql/list-restorations.md new file mode 100644 index 0000000..2c97a28 --- /dev/null +++ b/docs/examples/postgresql/list-restorations.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->listRestorations( + databaseId: '', + status: 'pending', // optional + type: 'backup', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/postgresql/list-specifications.md b/docs/examples/postgresql/list-specifications.md new file mode 100644 index 0000000..343beaf --- /dev/null +++ b/docs/examples/postgresql/list-specifications.md @@ -0,0 +1,15 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->listSpecifications(); +``` diff --git a/docs/examples/postgresql/list.md b/docs/examples/postgresql/list.md new file mode 100644 index 0000000..090939e --- /dev/null +++ b/docs/examples/postgresql/list.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->list( + queries: [] // optional +); +``` diff --git a/docs/examples/postgresql/update-backup-policy.md b/docs/examples/postgresql/update-backup-policy.md new file mode 100644 index 0000000..65dd72f --- /dev/null +++ b/docs/examples/postgresql/update-backup-policy.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->updateBackupPolicy( + databaseId: '', + policyId: '', + name: '', // optional + schedule: '', // optional + retention: 1, // optional + enabled: false // optional +); +``` diff --git a/docs/examples/postgresql/update-backup-storage.md b/docs/examples/postgresql/update-backup-storage.md new file mode 100644 index 0000000..5d882b3 --- /dev/null +++ b/docs/examples/postgresql/update-backup-storage.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->updateBackupStorage( + databaseId: '', + provider: 's3', + bucket: '', + accessKey: '', + secretKey: '', + region: '', // optional + prefix: '', // optional + endpoint: '' // optional +); +``` diff --git a/docs/examples/postgresql/update-credentials.md b/docs/examples/postgresql/update-credentials.md new file mode 100644 index 0000000..18a84f5 --- /dev/null +++ b/docs/examples/postgresql/update-credentials.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->updateCredentials( + databaseId: '' +); +``` diff --git a/docs/examples/postgresql/update-maintenance.md b/docs/examples/postgresql/update-maintenance.md new file mode 100644 index 0000000..7554edf --- /dev/null +++ b/docs/examples/postgresql/update-maintenance.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->updateMaintenance( + databaseId: '', + day: 'sun', + hourUtc: 0 +); +``` diff --git a/docs/examples/postgresql/update-pooler.md b/docs/examples/postgresql/update-pooler.md new file mode 100644 index 0000000..f245baa --- /dev/null +++ b/docs/examples/postgresql/update-pooler.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->updatePooler( + databaseId: '', + mode: 'transaction', // optional + maxConnections: 10, // optional + defaultPoolSize: 1, // optional + readWriteSplitting: false, // optional + poolerCpuRequest: '', // optional + poolerCpuLimit: '', // optional + poolerMemoryRequest: '', // optional + poolerMemoryLimit: '' // optional +); +``` diff --git a/docs/examples/postgresql/update.md b/docs/examples/postgresql/update.md new file mode 100644 index 0000000..52f299c --- /dev/null +++ b/docs/examples/postgresql/update.md @@ -0,0 +1,37 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$postgresql = new Postgresql($client); + +$result = $postgresql->update( + databaseId: '', + name: '', // optional + status: 'ready', // optional + specification: '', // optional + replicas: 0, // optional + syncMode: 'async', // optional + networkIdleTimeoutSeconds: 60, // optional + networkIPAllowlist: [], // optional + idleTimeoutMinutes: 5, // optional + pitr: false, // optional + pitrRetentionDays: 1, // optional + storageAutoscaling: false, // optional + storageAutoscalingThresholdPercent: 50, // optional + storageAutoscalingMaxGb: 0, // optional + metricsTraceSampleRate: null, // optional + metricsSlowQueryLogThresholdMs: 0, // optional + sqlApiEnabled: false, // optional + sqlApiAllowedStatements: [], // optional + sqlApiMaxRows: 1, // optional + sqlApiMaxBytes: 1024, // optional + sqlApiTimeoutSeconds: 1 // optional +); +``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md index b2471e5..1bf09c4 100644 --- a/docs/examples/project/create-variable.md +++ b/docs/examples/project/create-variable.md @@ -13,7 +13,7 @@ $project = new Project($client); $result = $project->createVariable( variableId: '', - key: '', + key: '', value: '', secret: false // optional ); diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md index 9f8df03..e03c9b8 100644 --- a/docs/examples/project/update-o-auth-2-okta.md +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -14,7 +14,7 @@ $project = new Project($client); $result = $project->updateOAuth2Okta( clientId: '', // optional clientSecret: '', // optional - domain: '', // optional + domain: 'example.com', // optional authorizationServerId: '', // optional enabled: false // optional ); diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index 7099625..46c5569 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -13,8 +13,8 @@ $client = (new Client()) $project = new Project($client); $result = $project->updateSMTP( - host: '', // optional - port: null, // optional + host: 'example.com', // optional + port: 587, // optional username: '', // optional password: 'password', // optional senderEmail: 'email@example.com', // optional diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md index f127b21..6324678 100644 --- a/docs/examples/project/update-variable.md +++ b/docs/examples/project/update-variable.md @@ -13,7 +13,7 @@ $project = new Project($client); $result = $project->updateVariable( variableId: '', - key: '', // optional + key: '', // optional value: '', // optional secret: false // optional ); diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md index 94a1707..20afada 100644 --- a/docs/examples/proxy/create-api-rule.md +++ b/docs/examples/proxy/create-api-rule.md @@ -12,6 +12,6 @@ $client = (new Client()) $proxy = new Proxy($client); $result = $proxy->createAPIRule( - domain: '' + domain: 'example.com' ); ``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md index df22f3c..8e04ee2 100644 --- a/docs/examples/proxy/create-function-rule.md +++ b/docs/examples/proxy/create-function-rule.md @@ -12,7 +12,7 @@ $client = (new Client()) $proxy = new Proxy($client); $result = $proxy->createFunctionRule( - domain: '', + domain: 'example.com', functionId: '', branch: '' // optional ); diff --git a/docs/examples/proxy/create-invalidation.md b/docs/examples/proxy/create-invalidation.md index 6dd8879..fde01fc 100644 --- a/docs/examples/proxy/create-invalidation.md +++ b/docs/examples/proxy/create-invalidation.md @@ -13,7 +13,7 @@ $client = (new Client()) $proxy = new Proxy($client); $result = $proxy->createInvalidation( - domain: '', + domain: 'example.com', type: InvalidationType::TAG(), reference: '' // optional ); diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md index 8e08e4d..4753171 100644 --- a/docs/examples/proxy/create-redirect-rule.md +++ b/docs/examples/proxy/create-redirect-rule.md @@ -14,7 +14,7 @@ $client = (new Client()) $proxy = new Proxy($client); $result = $proxy->createRedirectRule( - domain: '', + domain: 'example.com', url: 'https://example.com', statusCode: StatusCode::MOVEDPERMANENTLY(), resourceId: '', diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md index 9502404..02b1b87 100644 --- a/docs/examples/proxy/create-site-rule.md +++ b/docs/examples/proxy/create-site-rule.md @@ -12,7 +12,7 @@ $client = (new Client()) $proxy = new Proxy($client); $result = $proxy->createSiteRule( - domain: '', + domain: 'example.com', siteId: '', branch: '' // optional ); diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index 20983b6..ea1baab 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -14,7 +14,7 @@ $sites = new Sites($client); $result = $sites->createVariable( siteId: '', variableId: '', - key: '', + key: '', value: '', secret: false // optional ); diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index a9c3448..d25a024 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -36,8 +36,8 @@ $result = $sites->create( providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional deploymentRetention: 0, // optional scopes: [ProjectKeyScopes::PROJECTREAD()] // optional ); diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 7d0e669..b1bc360 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -14,7 +14,7 @@ $sites = new Sites($client); $result = $sites->updateVariable( siteId: '', variableId: '', - key: '', // optional + key: '', // optional value: '', // optional secret: false // optional ); diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index ec1f360..16b5171 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -36,8 +36,8 @@ $result = $sites->update( providerRootDirectory: '', // optional providerBranches: [], // optional providerPaths: [], // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional + buildSpecification: 's-1vcpu-512mb', // optional + runtimeSpecification: 's-1vcpu-512mb', // optional deploymentRetention: 0, // optional scopes: [ProjectKeyScopes::PROJECTREAD()] // optional ); diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 730b72c..1a9387b 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -19,6 +19,6 @@ $result = $storage->createFile( fileId: '', file: InputFile::withPath('file.png'), permissions: [Permission::read(Role::any())], // optional - folder: '' // optional + folder: 'photos/2026' // optional ); ``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 57820b9..a2960d6 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -21,11 +21,11 @@ $result = $storage->getFilePreview( gravity: ImageGravity::CENTER(), // optional quality: -1, // optional borderWidth: 0, // optional - borderColor: '', // optional + borderColor: 'FFFFFF', // optional borderRadius: 0, // optional opacity: 0, // optional rotation: -360, // optional - background: '', // optional + background: 'FFFFFF', // optional output: ImageFormat::JPG(), // optional token: '' // optional ); diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md index e7e6b14..0ada6f9 100644 --- a/docs/examples/tablesdb/create-big-int-column.md +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -14,11 +14,11 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createBigIntColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - default: null, // optional + min: 0, // optional + max: 1000000, // optional + default: 0, // optional array: false // optional ); ``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index a149438..f73001e 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -14,7 +14,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createBooleanColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: false, // optional array: false // optional diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 8139ba1..d05fad4 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -14,7 +14,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createDatetimeColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', // optional array: false // optional diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index 1df1a06..6a23e2a 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -14,7 +14,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createEmailColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: 'email@example.com', // optional array: false // optional diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index f79751d..c9e3f5f 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -14,10 +14,10 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createEnumColumn( databaseId: '', tableId: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', // optional + default: 'active', // optional array: false // optional ); ``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index 2f5b542..9b194fc 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -14,11 +14,11 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createFloatColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - default: null, // optional + min: 0, // optional + max: 100, // optional + default: 10.5, // optional array: false // optional ); ``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 78cddc7..2b840eb 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -16,7 +16,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createIndex( databaseId: '', tableId: '', - key: '', + key: '', type: TablesDBIndexType::KEY(), columns: [], orders: [OrderBy::ASC()], // optional diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index e7bb5e9..f1fa521 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -14,11 +14,11 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createIntegerColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - min: null, // optional - max: null, // optional - default: null, // optional + min: 0, // optional + max: 100, // optional + default: 10, // optional array: false // optional ); ``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 42c1ca4..2d71039 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createIpColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', // optional + default: '192.0.2.0', // optional array: false // optional ); ``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index 652ce3f..4d22046 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -14,7 +14,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createLineColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] // optional ); diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index 83a999f..8d85330 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createLongtextColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index e51d2e5..8da9475 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createMediumtextColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 03c8fb7..76079b2 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -14,7 +14,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createPointColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: [1, 2] // optional ); diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index ee5f65f..7018c1e 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -14,7 +14,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createPolygonColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional ); diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 0e31aac..a7ddabc 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -19,8 +19,8 @@ $result = $tablesDB->createRelationshipColumn( relatedTableId: '', type: RelationshipType::ONETOONE(), twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional + key: '', // optional + twoWayKey: '', // optional onDelete: RelationMutate::CASCADE() // optional ); ``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 3235e0c..a5f1d5c 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -14,10 +14,10 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createStringColumn( databaseId: '', tableId: '', - key: '', + key: '', size: 1, required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index 592433a..b729dc5 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createTextColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index e8044ac..9c3b89a 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -14,7 +14,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createUrlColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: 'https://example.com', // optional array: false // optional diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index b3b557b..6afddbf 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -14,10 +14,10 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->createVarcharColumn( databaseId: '', tableId: '', - key: '', + key: '', size: 1, required: false, - default: '', // optional + default: 'Hello World', // optional array: false, // optional encrypt: false // optional ); diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index 57088a3..4cc4b38 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -15,9 +15,9 @@ $result = $tablesDB->decrementRowColumn( databaseId: '', tableId: '', rowId: '', - column: '', - value: null, // optional - min: null, // optional + column: '', + value: 1, // optional + min: 0, // optional transactionId: '' // optional ); ``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index 7764730..9f477a3 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -14,6 +14,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->deleteColumn( databaseId: '', tableId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index 29fe959..0072ae2 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -14,6 +14,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->deleteIndex( databaseId: '', tableId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 9151c4e..b7d8831 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -14,6 +14,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->getColumn( databaseId: '', tableId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 0e9834a..b09bf03 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -14,6 +14,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->getIndex( databaseId: '', tableId: '', - key: '' + key: '' ); ``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 0bcbe11..475409b 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -15,9 +15,9 @@ $result = $tablesDB->incrementRowColumn( databaseId: '', tableId: '', rowId: '', - column: '', - value: null, // optional - max: null, // optional + column: '', + value: 1, // optional + max: 100, // optional transactionId: '' // optional ); ``` diff --git a/docs/examples/tablesdb/list-operations.md b/docs/examples/tablesdb/list-operations.md index 9785761..f84e6b3 100644 --- a/docs/examples/tablesdb/list-operations.md +++ b/docs/examples/tablesdb/list-operations.md @@ -13,7 +13,7 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->listOperations( databaseId: '', - status: 'running', // optional + status: 'queued', // optional limit: 1, // optional offset: 0 // optional ); diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md index f606d03..e1e1aeb 100644 --- a/docs/examples/tablesdb/update-big-int-column.md +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -14,11 +14,11 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateBigIntColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + default: 0, + min: 0, // optional + max: 1000000, // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index 5aa0a76..a95d795 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateBooleanColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: false, - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 62c812f..c9c6de4 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateDatetimeColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 6587b10..8cc0428 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateEmailColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: 'email@example.com', - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index cac2539..9d657ba 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -14,10 +14,10 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateEnumColumn( databaseId: '', tableId: '', - key: '', - elements: [], + key: '', + elements: ["active", "inactive"], required: false, - default: '', - newKey: '' // optional + default: 'active', + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index 0851319..9ab8b20 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -14,11 +14,11 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateFloatColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + default: 10.5, + min: 0, // optional + max: 100, // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 5e595c5..1de8db1 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -14,11 +14,11 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateIntegerColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: null, - min: null, // optional - max: null, // optional - newKey: '' // optional + default: 10, + min: 0, // optional + max: 100, // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index 7a8a09a..f742db2 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateIpColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: '192.0.2.0', + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 674e1ae..5825715 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateLineColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md index 460b741..e8746eb 100644 --- a/docs/examples/tablesdb/update-longtext-column.md +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateLongtextColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: 'Hello World', + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md index d453928..45d60e4 100644 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateMediumtextColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: 'Hello World', + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index 8b36739..3b55a7a 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updatePointColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: [1, 2], // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 67f91c3..05be2de 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updatePolygonColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index 9c43918..f3e4e70 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -15,8 +15,8 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateRelationshipColumn( databaseId: '', tableId: '', - key: '', + key: '', onDelete: RelationMutate::CASCADE(), // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index b70a8c5..b1a7c85 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -14,10 +14,10 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateStringColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md index 1720878..df1fea5 100644 --- a/docs/examples/tablesdb/update-text-column.md +++ b/docs/examples/tablesdb/update-text-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateTextColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', - newKey: '' // optional + default: 'Hello World', + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index a8f0964..d674819 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -14,9 +14,9 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateUrlColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, default: 'https://example.com', - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md index db7b428..c6e46c7 100644 --- a/docs/examples/tablesdb/update-varchar-column.md +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -14,10 +14,10 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->updateVarcharColumn( databaseId: '', tableId: '', - key: '', + key: '', required: false, - default: '', + default: 'Hello World', size: 1, // optional - newKey: '' // optional + newKey: '' // optional ); ``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md index 2bb9fed..89870a3 100644 --- a/docs/examples/users/create-jwt.md +++ b/docs/examples/users/create-jwt.md @@ -13,7 +13,7 @@ $users = new Users($client); $result = $users->createJWT( userId: '', - sessionId: '', // optional + sessionId: 'recent()', // optional duration: 0 // optional ); ``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index d956516..d8be12e 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -16,10 +16,10 @@ $result = $users->createScryptUser( email: 'email@example.com', password: 'password', passwordSalt: '', - passwordCpu: null, - passwordMemory: null, - passwordParallel: null, - passwordLength: null, + passwordCpu: 8, + passwordMemory: 65536, + passwordParallel: 1, + passwordLength: 64, name: '' // optional ); ``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md new file mode 100644 index 0000000..c3ed662 --- /dev/null +++ b/docs/examples/vectorsdb/create-collection.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createCollection( + databaseId: '', + collectionId: '', + name: '', + dimension: 1, + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false // optional +); +``` diff --git a/docs/examples/vectorsdb/create-document.md b/docs/examples/vectorsdb/create-document.md new file mode 100644 index 0000000..e024efe --- /dev/null +++ b/docs/examples/vectorsdb/create-document.md @@ -0,0 +1,33 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [ + 'embeddings' => [ + '0' => 0.12, + '1' => -0.55, + '2' => 0.88, + '3' => 1.02 + ], + 'metadata' => [ + 'key' => 'value' + ] + ], + permissions: [Permission::read(Role::any())] // optional +); +``` diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md new file mode 100644 index 0000000..07b5894 --- /dev/null +++ b/docs/examples/vectorsdb/create-documents.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createDocuments( + databaseId: '', + collectionId: '', + documents: [] +); +``` diff --git a/docs/examples/vectorsdb/create-failover.md b/docs/examples/vectorsdb/create-failover.md new file mode 100644 index 0000000..7e5eeb3 --- /dev/null +++ b/docs/examples/vectorsdb/create-failover.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createFailover( + databaseId: '', + targetReplicaId: '' // optional +); +``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md new file mode 100644 index 0000000..d3e699c --- /dev/null +++ b/docs/examples/vectorsdb/create-index.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createIndex( + databaseId: '', + collectionId: '', + key: '', + type: VectorsDBIndexType::HNSWEUCLIDEAN(), + attributes: [], + orders: [OrderBy::ASC()], // optional + lengths: [] // optional +); +``` diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md new file mode 100644 index 0000000..c311d5e --- /dev/null +++ b/docs/examples/vectorsdb/create-operations.md @@ -0,0 +1,28 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createOperations( + transactionId: '', + operations: [ + { + "action": "create", + "databaseId": "", + "collectionId": "", + "documentId": "", + "data": { + "name": "Walter O'Brien" + } + } + ] // optional +); +``` diff --git a/docs/examples/vectorsdb/create-query.md b/docs/examples/vectorsdb/create-query.md new file mode 100644 index 0000000..baa9655 --- /dev/null +++ b/docs/examples/vectorsdb/create-query.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createQuery( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0 // optional +); +``` diff --git a/docs/examples/vectorsdb/create-transaction.md b/docs/examples/vectorsdb/create-transaction.md new file mode 100644 index 0000000..e8fd72e --- /dev/null +++ b/docs/examples/vectorsdb/create-transaction.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->createTransaction( + ttl: 60 // optional +); +``` diff --git a/docs/examples/vectorsdb/create.md b/docs/examples/vectorsdb/create.md new file mode 100644 index 0000000..e554bee --- /dev/null +++ b/docs/examples/vectorsdb/create.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->create( + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async' // optional +); +``` diff --git a/docs/examples/vectorsdb/delete-collection.md b/docs/examples/vectorsdb/delete-collection.md new file mode 100644 index 0000000..f92fc34 --- /dev/null +++ b/docs/examples/vectorsdb/delete-collection.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteCollection( + databaseId: '', + collectionId: '' +); +``` diff --git a/docs/examples/vectorsdb/delete-document.md b/docs/examples/vectorsdb/delete-document.md new file mode 100644 index 0000000..7d49681 --- /dev/null +++ b/docs/examples/vectorsdb/delete-document.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', + transactionId: '' // optional +); +``` diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md new file mode 100644 index 0000000..17b0831 --- /dev/null +++ b/docs/examples/vectorsdb/delete-documents.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/vectorsdb/delete-index.md b/docs/examples/vectorsdb/delete-index.md new file mode 100644 index 0000000..e5693e4 --- /dev/null +++ b/docs/examples/vectorsdb/delete-index.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteIndex( + databaseId: '', + collectionId: '', + key: '' +); +``` diff --git a/docs/examples/vectorsdb/delete-transaction.md b/docs/examples/vectorsdb/delete-transaction.md new file mode 100644 index 0000000..c3dee45 --- /dev/null +++ b/docs/examples/vectorsdb/delete-transaction.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->deleteTransaction( + transactionId: '' +); +``` diff --git a/docs/examples/vectorsdb/delete.md b/docs/examples/vectorsdb/delete.md new file mode 100644 index 0000000..2fed51f --- /dev/null +++ b/docs/examples/vectorsdb/delete.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->delete( + databaseId: '' +); +``` diff --git a/docs/examples/vectorsdb/get-collection.md b/docs/examples/vectorsdb/get-collection.md new file mode 100644 index 0000000..1d5f2ad --- /dev/null +++ b/docs/examples/vectorsdb/get-collection.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getCollection( + databaseId: '', + collectionId: '' +); +``` diff --git a/docs/examples/vectorsdb/get-document.md b/docs/examples/vectorsdb/get-document.md new file mode 100644 index 0000000..d3d4e5e --- /dev/null +++ b/docs/examples/vectorsdb/get-document.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getDocument( + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/vectorsdb/get-index.md b/docs/examples/vectorsdb/get-index.md new file mode 100644 index 0000000..1fd9bf9 --- /dev/null +++ b/docs/examples/vectorsdb/get-index.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getIndex( + databaseId: '', + collectionId: '', + key: '' +); +``` diff --git a/docs/examples/vectorsdb/get-replicas.md b/docs/examples/vectorsdb/get-replicas.md new file mode 100644 index 0000000..4612cae --- /dev/null +++ b/docs/examples/vectorsdb/get-replicas.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getReplicas( + databaseId: '' +); +``` diff --git a/docs/examples/vectorsdb/get-status.md b/docs/examples/vectorsdb/get-status.md new file mode 100644 index 0000000..ad313fc --- /dev/null +++ b/docs/examples/vectorsdb/get-status.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getStatus( + databaseId: '' +); +``` diff --git a/docs/examples/vectorsdb/get-transaction.md b/docs/examples/vectorsdb/get-transaction.md new file mode 100644 index 0000000..c6db892 --- /dev/null +++ b/docs/examples/vectorsdb/get-transaction.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->getTransaction( + transactionId: '' +); +``` diff --git a/docs/examples/vectorsdb/get.md b/docs/examples/vectorsdb/get.md new file mode 100644 index 0000000..7d61d87 --- /dev/null +++ b/docs/examples/vectorsdb/get.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->get( + databaseId: '' +); +``` diff --git a/docs/examples/vectorsdb/list-collections.md b/docs/examples/vectorsdb/list-collections.md new file mode 100644 index 0000000..7275e09 --- /dev/null +++ b/docs/examples/vectorsdb/list-collections.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listCollections( + databaseId: '', + queries: [], // optional + search: '', // optional + total: false // optional +); +``` diff --git a/docs/examples/vectorsdb/list-documents.md b/docs/examples/vectorsdb/list-documents.md new file mode 100644 index 0000000..d900961 --- /dev/null +++ b/docs/examples/vectorsdb/list-documents.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '', // optional + total: false, // optional + ttl: 0 // optional +); +``` diff --git a/docs/examples/vectorsdb/list-indexes.md b/docs/examples/vectorsdb/list-indexes.md new file mode 100644 index 0000000..e49f045 --- /dev/null +++ b/docs/examples/vectorsdb/list-indexes.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listIndexes( + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +); +``` diff --git a/docs/examples/vectorsdb/list-operations.md b/docs/examples/vectorsdb/list-operations.md new file mode 100644 index 0000000..fed2f5c --- /dev/null +++ b/docs/examples/vectorsdb/list-operations.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listOperations( + databaseId: '', + status: 'queued', // optional + limit: 1, // optional + offset: 0 // optional +); +``` diff --git a/docs/examples/vectorsdb/list-specifications.md b/docs/examples/vectorsdb/list-specifications.md new file mode 100644 index 0000000..149ad0c --- /dev/null +++ b/docs/examples/vectorsdb/list-specifications.md @@ -0,0 +1,15 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listSpecifications(); +``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md new file mode 100644 index 0000000..022bd60 --- /dev/null +++ b/docs/examples/vectorsdb/list-transactions.md @@ -0,0 +1,17 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->listTransactions( + queries: [] // optional +); +``` diff --git a/docs/examples/vectorsdb/list.md b/docs/examples/vectorsdb/list.md new file mode 100644 index 0000000..f649ab8 --- /dev/null +++ b/docs/examples/vectorsdb/list.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->list( + queries: [], // optional + total: false // optional +); +``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md new file mode 100644 index 0000000..7898ee0 --- /dev/null +++ b/docs/examples/vectorsdb/update-collection.md @@ -0,0 +1,25 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateCollection( + databaseId: '', + collectionId: '', + name: '', + dimension: 1, // optional + permissions: [Permission::read(Role::any())], // optional + documentSecurity: false, // optional + enabled: false // optional +); +``` diff --git a/docs/examples/vectorsdb/update-document.md b/docs/examples/vectorsdb/update-document.md new file mode 100644 index 0000000..e6ac13c --- /dev/null +++ b/docs/examples/vectorsdb/update-document.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/vectorsdb/update-documents.md b/docs/examples/vectorsdb/update-documents.md new file mode 100644 index 0000000..96ec4c3 --- /dev/null +++ b/docs/examples/vectorsdb/update-documents.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateDocuments( + databaseId: '', + collectionId: '', + data: [], // optional + queries: [], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/vectorsdb/update-transaction.md b/docs/examples/vectorsdb/update-transaction.md new file mode 100644 index 0000000..4481209 --- /dev/null +++ b/docs/examples/vectorsdb/update-transaction.md @@ -0,0 +1,19 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->updateTransaction( + transactionId: '', + commit: false, // optional + rollback: false // optional +); +``` diff --git a/docs/examples/vectorsdb/update.md b/docs/examples/vectorsdb/update.md new file mode 100644 index 0000000..977ef10 --- /dev/null +++ b/docs/examples/vectorsdb/update.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->update( + databaseId: '', + name: '', + enabled: false, // optional + specification: 'serverless', // optional + replicas: 0, // optional + syncMode: 'async' // optional +); +``` diff --git a/docs/examples/vectorsdb/upsert-document.md b/docs/examples/vectorsdb/upsert-document.md new file mode 100644 index 0000000..b7acca1 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-document.md @@ -0,0 +1,24 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->upsertDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: [], // optional + permissions: [Permission::read(Role::any())], // optional + transactionId: '' // optional +); +``` diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md new file mode 100644 index 0000000..11e5d31 --- /dev/null +++ b/docs/examples/vectorsdb/upsert-documents.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$vectorsDB = new VectorsDB($client); + +$result = $vectorsDB->upsertDocuments( + databaseId: '', + collectionId: '', + documents: [], + transactionId: '' // optional +); +``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index 2f99091..2b437a5 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -13,7 +13,7 @@ $webhooks = new Webhooks($client); $result = $webhooks->create( webhookId: '', - url: '', + url: 'https://example.com/webhook', name: '', events: [], enabled: false, // optional diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index eeecf88..95dafcf 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -14,7 +14,7 @@ $webhooks = new Webhooks($client); $result = $webhooks->update( webhookId: '', name: '', - url: '', + url: 'https://example.com/webhook', events: [], enabled: false, // optional tls: false, // optional diff --git a/docs/mongo.md b/docs/mongo.md new file mode 100644 index 0000000..7ec032f --- /dev/null +++ b/docs/mongo.md @@ -0,0 +1,478 @@ +# Mongo Service + + +```http request +GET https://cloud.appwrite.io/v1/mongo +``` + +** List all dedicated databases. Results support pagination. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/mongo +``` + +** Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | Database 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 display name. Max length: 128 chars. | | +| version | string | Database engine version. Defaults to latest for selected engine. | | +| specification | string | Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. | s-1vcpu-1gb | +| replicas | integer | Number of high availability replicas (0-5). High availability is enabled when greater than 0. | 0 | +| syncMode | string | Replication sync mode preference. Allowed values: async, sync, quorum. | | +| networkIdleTimeoutSeconds | integer | Connection idle timeout in seconds. | 900 | +| networkIPAllowlist | array | IP addresses/CIDR ranges allowed to connect. | | +| idleTimeoutMinutes | integer | Minutes of inactivity before container scales to zero. | 15 | +| pitr | boolean | Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. | 1 | +| pitrRetentionDays | integer | Number of days to retain PITR data. | 7 | +| storageAutoscaling | boolean | Enable automatic storage expansion when usage exceeds threshold. | | +| storageAutoscalingThresholdPercent | integer | Storage usage percentage (50-95) that triggers automatic expansion. | 85 | +| storageAutoscalingMaxGb | integer | Maximum storage size in GB for autoscaling. 0 means no limit. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/specifications +``` + +** List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. ** + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId} +``` + +** Get a dedicated database by its unique ID. Returns the database configuration and current status. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mongo/{databaseId} +``` + +** Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| name | string | Database display name. | | +| status | string | Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. | | +| specification | string | Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. | | +| replicas | integer | Number of high availability replicas (0-5). High availability is enabled when greater than 0. | | +| syncMode | string | Replication sync mode preference. Allowed values: async, sync, quorum. | | +| networkIdleTimeoutSeconds | integer | Connection idle timeout in seconds (60-86400). | | +| networkIPAllowlist | array | IP addresses/CIDR ranges allowed to connect. | | +| idleTimeoutMinutes | integer | Minutes before container scales to zero. | | +| pitr | boolean | Enable or disable point-in-time recovery (PITR). | | +| pitrRetentionDays | integer | Days to retain PITR data. | | +| storageAutoscaling | boolean | Enable automatic storage expansion when usage exceeds threshold. | | +| storageAutoscalingThresholdPercent | integer | Storage usage percentage (50-95) that triggers automatic expansion. | | +| storageAutoscalingMaxGb | integer | Maximum storage size in GB for autoscaling. 0 means no limit. | | +| metricsTraceSampleRate | number | Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. | | +| metricsSlowQueryLogThresholdMs | integer | Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. | | +| sqlApiEnabled | boolean | Enable the SQL API sidecar for this database. | | +| sqlApiAllowedStatements | array | Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. | | +| sqlApiMaxRows | integer | Maximum rows returned per SQL API execution (1-1000000). | | +| sqlApiMaxBytes | integer | Maximum serialised SQL API result payload in bytes (1024-104857600). | | +| sqlApiTimeoutSeconds | integer | Per-call SQL API execution timeout in seconds (1-300). | | + + +```http request +DELETE https://cloud.appwrite.io/v1/mongo/{databaseId} +``` + +** Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/backups +``` + +** List all backups for a dedicated database. Results can be filtered by status and type. ** + +### 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: status, type, databaseId | [] | + + +```http request +POST https://cloud.appwrite.io/v1/mongo/{databaseId}/backups +``` + +** Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| type | string | Backup type: full or incremental. | full | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/policies +``` + +** List scheduled backup policies for a dedicated database. ** + +### 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. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/policies +``` + +** Create a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | Policy 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 | Policy name. Max length: 128 chars. | | +| schedule | string | Schedule CRON syntax. | | +| retention | integer | Days to keep backups before deletion. | | +| type | string | Backup type: full or incremental. | full | +| enabled | boolean | Is policy enabled? When disabled, no backups will be taken. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/policies/{policyId} +``` + +** Get a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/policies/{policyId} +``` + +** Update a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | +| name | string | Policy name. Max length: 128 chars. | | +| schedule | string | Schedule CRON syntax. | | +| retention | integer | Days to keep backups before deletion. | | +| enabled | boolean | Is policy enabled? When disabled, no backups will be taken. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/policies/{policyId} +``` + +** Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/storage +``` + +** Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| provider | string | Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). | | +| bucket | string | Storage bucket or container name. | | +| region | string | Storage region. | | +| prefix | string | Object key prefix for backups. | backups/ | +| endpoint | string | Custom endpoint for S3-compatible storage (e.g. MinIO). | | +| accessKey | string | Access key or client ID for authentication. | | +| secretKey | string | Secret key or service account JSON for authentication. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/{backupId} +``` + +** Get details of a specific database backup including its status, size, and timestamps. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| backupId | string | **Required** Backup ID. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/mongo/{databaseId}/backups/{backupId} +``` + +** Delete a database backup. This will permanently remove the backup from storage and cannot be undone. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| backupId | string | **Required** Backup ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/branches +``` + +** List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/mongo/{databaseId}/branches +``` + +** Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| branchId | string | Branch 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. | | +| ttl | integer | Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). | 86400 | + + +```http request +DELETE https://cloud.appwrite.io/v1/mongo/{databaseId}/branches/{branchId} +``` + +** Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| branchId | string | **Required** Branch ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mongo/{databaseId}/credentials +``` + +** Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/mongo/{databaseId}/failovers +``` + +** Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetReplicaId | string | Target replica ID to promote. If not specified, the healthiest replica is selected. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mongo/{databaseId}/maintenance +``` + +** Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| day | string | Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. | | +| hourUtc | integer | Hour in UTC (0-23) for maintenance window start. | | + + +```http request +POST https://cloud.appwrite.io/v1/mongo/{databaseId}/migrations +``` + +** Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetType | string | Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). | | +| specification | string | Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/operations +``` + +** List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by operation status. | | +| limit | integer | Maximum number of operations to return. | 25 | +| offset | integer | Number of operations to skip. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/pitr +``` + +** Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/replicas +``` + +** Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/restorations +``` + +** List all restorations for a dedicated database. Results can be filtered by status and type. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by restoration status. | | +| type | string | Filter by restoration type. | | +| limit | integer | Maximum number of restorations to return. | 25 | +| offset | integer | Number of restorations to skip. | 0 | + + +```http request +POST https://cloud.appwrite.io/v1/mongo/{databaseId}/restorations +``` + +** Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| type | string | Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. | backup | +| backupId | string | Backup ID to restore from (required for backup type). | | +| targetDatabaseId | string | Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. | | +| targetTime | string | Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/restorations/{restorationId} +``` + +** Get details of a specific database restoration including its status, type, and timestamps. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| restorationId | string | **Required** Restoration ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mongo/{databaseId}/status +``` + +** Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/mongo/{databaseId}/upgrades +``` + +** Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetVersion | string | Target engine version to upgrade to. | | + diff --git a/docs/mysql.md b/docs/mysql.md new file mode 100644 index 0000000..c88ce40 --- /dev/null +++ b/docs/mysql.md @@ -0,0 +1,528 @@ +# Mysql Service + + +```http request +GET https://cloud.appwrite.io/v1/mysql +``` + +** List all dedicated databases. Results support pagination. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/mysql +``` + +** Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | Database 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 display name. Max length: 128 chars. | | +| version | string | Database engine version. Defaults to latest for selected engine. | | +| specification | string | Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. | s-1vcpu-1gb | +| replicas | integer | Number of high availability replicas (0-5). High availability is enabled when greater than 0. | 0 | +| syncMode | string | Replication sync mode preference. Allowed values: async, sync, quorum. | | +| networkIdleTimeoutSeconds | integer | Connection idle timeout in seconds. | 900 | +| networkIPAllowlist | array | IP addresses/CIDR ranges allowed to connect. | | +| idleTimeoutMinutes | integer | Minutes of inactivity before container scales to zero. | 15 | +| pitr | boolean | Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. | 1 | +| pitrRetentionDays | integer | Number of days to retain PITR data. | 7 | +| storageAutoscaling | boolean | Enable automatic storage expansion when usage exceeds threshold. | | +| storageAutoscalingThresholdPercent | integer | Storage usage percentage (50-95) that triggers automatic expansion. | 85 | +| storageAutoscalingMaxGb | integer | Maximum storage size in GB for autoscaling. 0 means no limit. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/specifications +``` + +** List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. ** + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId} +``` + +** Get a dedicated database by its unique ID. Returns the database configuration and current status. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mysql/{databaseId} +``` + +** Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| name | string | Database display name. | | +| status | string | Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. | | +| specification | string | Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. | | +| replicas | integer | Number of high availability replicas (0-5). High availability is enabled when greater than 0. | | +| syncMode | string | Replication sync mode preference. Allowed values: async, sync, quorum. | | +| networkIdleTimeoutSeconds | integer | Connection idle timeout in seconds (60-86400). | | +| networkIPAllowlist | array | IP addresses/CIDR ranges allowed to connect. | | +| idleTimeoutMinutes | integer | Minutes before container scales to zero. | | +| pitr | boolean | Enable or disable point-in-time recovery (PITR). | | +| pitrRetentionDays | integer | Days to retain PITR data. | | +| storageAutoscaling | boolean | Enable automatic storage expansion when usage exceeds threshold. | | +| storageAutoscalingThresholdPercent | integer | Storage usage percentage (50-95) that triggers automatic expansion. | | +| storageAutoscalingMaxGb | integer | Maximum storage size in GB for autoscaling. 0 means no limit. | | +| metricsTraceSampleRate | number | Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. | | +| metricsSlowQueryLogThresholdMs | integer | Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. | | +| sqlApiEnabled | boolean | Enable the SQL API sidecar for this database. | | +| sqlApiAllowedStatements | array | Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. | | +| sqlApiMaxRows | integer | Maximum rows returned per SQL API execution (1-1000000). | | +| sqlApiMaxBytes | integer | Maximum serialised SQL API result payload in bytes (1024-104857600). | | +| sqlApiTimeoutSeconds | integer | Per-call SQL API execution timeout in seconds (1-300). | | + + +```http request +DELETE https://cloud.appwrite.io/v1/mysql/{databaseId} +``` + +** Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/backups +``` + +** List all backups for a dedicated database. Results can be filtered by status and type. ** + +### 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: status, type, databaseId | [] | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/backups +``` + +** Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| type | string | Backup type: full or incremental. | full | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/policies +``` + +** List scheduled backup policies for a dedicated database. ** + +### 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. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/policies +``` + +** Create a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | Policy 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 | Policy name. Max length: 128 chars. | | +| schedule | string | Schedule CRON syntax. | | +| retention | integer | Days to keep backups before deletion. | | +| type | string | Backup type: full or incremental. | full | +| enabled | boolean | Is policy enabled? When disabled, no backups will be taken. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/policies/{policyId} +``` + +** Get a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/policies/{policyId} +``` + +** Update a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | +| name | string | Policy name. Max length: 128 chars. | | +| schedule | string | Schedule CRON syntax. | | +| retention | integer | Days to keep backups before deletion. | | +| enabled | boolean | Is policy enabled? When disabled, no backups will be taken. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/policies/{policyId} +``` + +** Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/storage +``` + +** Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| provider | string | Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). | | +| bucket | string | Storage bucket or container name. | | +| region | string | Storage region. | | +| prefix | string | Object key prefix for backups. | backups/ | +| endpoint | string | Custom endpoint for S3-compatible storage (e.g. MinIO). | | +| accessKey | string | Access key or client ID for authentication. | | +| secretKey | string | Secret key or service account JSON for authentication. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/{backupId} +``` + +** Get details of a specific database backup including its status, size, and timestamps. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| backupId | string | **Required** Backup ID. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/mysql/{databaseId}/backups/{backupId} +``` + +** Delete a database backup. This will permanently remove the backup from storage and cannot be undone. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| backupId | string | **Required** Backup ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/branches +``` + +** List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/branches +``` + +** Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| branchId | string | Branch 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. | | +| ttl | integer | Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). | 86400 | + + +```http request +DELETE https://cloud.appwrite.io/v1/mysql/{databaseId}/branches/{branchId} +``` + +** Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| branchId | string | **Required** Branch ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mysql/{databaseId}/credentials +``` + +** Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/executions +``` + +** Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| sql | string | SQL statement to execute. Exactly one statement per request. | | +| bindings | object | Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. | {} | +| timeoutSeconds | integer | Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. | | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/failovers +``` + +** Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetReplicaId | string | Target replica ID to promote. If not specified, the healthiest replica is selected. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mysql/{databaseId}/maintenance +``` + +** Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| day | string | Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. | | +| hourUtc | integer | Hour in UTC (0-23) for maintenance window start. | | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/migrations +``` + +** Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetType | string | Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). | | +| specification | string | Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/operations +``` + +** List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by operation status. | | +| limit | integer | Maximum number of operations to return. | 25 | +| offset | integer | Number of operations to skip. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/pitr +``` + +** Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/pooler +``` + +** Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/mysql/{databaseId}/pooler +``` + +** Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| mode | string | Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. | | +| maxConnections | integer | Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. | | +| defaultPoolSize | integer | Default pool size per user. | | +| readWriteSplitting | boolean | Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. | | +| poolerCpuRequest | string | Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). | | +| poolerCpuLimit | string | Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. | | +| poolerMemoryRequest | string | Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). | | +| poolerMemoryLimit | string | Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/replicas +``` + +** Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/restorations +``` + +** List all restorations for a dedicated database. Results can be filtered by status and type. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by restoration status. | | +| type | string | Filter by restoration type. | | +| limit | integer | Maximum number of restorations to return. | 25 | +| offset | integer | Number of restorations to skip. | 0 | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/restorations +``` + +** Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| type | string | Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. | backup | +| backupId | string | Backup ID to restore from (required for backup type). | | +| targetDatabaseId | string | Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. | | +| targetTime | string | Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/restorations/{restorationId} +``` + +** Get details of a specific database restoration including its status, type, and timestamps. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| restorationId | string | **Required** Restoration ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/mysql/{databaseId}/status +``` + +** Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/mysql/{databaseId}/upgrades +``` + +** Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetVersion | string | Target engine version to upgrade to. | | + diff --git a/docs/postgresql.md b/docs/postgresql.md new file mode 100644 index 0000000..982d69f --- /dev/null +++ b/docs/postgresql.md @@ -0,0 +1,569 @@ +# Postgresql Service + + +```http request +GET https://cloud.appwrite.io/v1/postgresql +``` + +** List all dedicated databases. Results support pagination. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql +``` + +** Create a new dedicated database with the chosen engine and configuration. Status will be 'provisioning' until the database is ready. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | Database 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 display name. Max length: 128 chars. | | +| version | string | Database engine version. Defaults to latest for selected engine. | | +| specification | string | Specification identifier. Drives the allocated CPU, memory, storage, storage class, and connection ceiling. | s-1vcpu-1gb | +| replicas | integer | Number of high availability replicas (0-5). High availability is enabled when greater than 0. | 0 | +| syncMode | string | Replication sync mode preference. Allowed values: async, sync, quorum. | | +| networkIdleTimeoutSeconds | integer | Connection idle timeout in seconds. | 900 | +| networkIPAllowlist | array | IP addresses/CIDR ranges allowed to connect. | | +| idleTimeoutMinutes | integer | Minutes of inactivity before container scales to zero. | 15 | +| pitr | boolean | Enable point-in-time recovery (PITR). Continuously archives changes so the database can be restored to any moment within the retention window. | 1 | +| pitrRetentionDays | integer | Number of days to retain PITR data. | 7 | +| storageAutoscaling | boolean | Enable automatic storage expansion when usage exceeds threshold. | | +| storageAutoscalingThresholdPercent | integer | Storage usage percentage (50-95) that triggers automatic expansion. | 85 | +| storageAutoscalingMaxGb | integer | Maximum storage size in GB for autoscaling. 0 means no limit. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/specifications +``` + +** List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. ** + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId} +``` + +** Get a dedicated database by its unique ID. Returns the database configuration and current status. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/postgresql/{databaseId} +``` + +** Update a dedicated database configuration. All changes are applied with zero downtime. Specification changes (cpu, memory, storage) are handled via rolling cutover. Storage expansion is done online. All other settings are applied in-place. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| name | string | Database display name. | | +| status | string | Database status. Allowed values: ready, paused, inactive. Set to "paused" to pause, "ready" to resume (also recovers a failed database whose infrastructure is healthy), or "inactive" to spin down a shared-pool database. | | +| specification | string | Specification. Changes cpu, memory, storage, connection ceiling, and node pool based on specification config. Resource changes are applied via rolling cutover with zero downtime. | | +| replicas | integer | Number of high availability replicas (0-5). High availability is enabled when greater than 0. | | +| syncMode | string | Replication sync mode preference. Allowed values: async, sync, quorum. | | +| networkIdleTimeoutSeconds | integer | Connection idle timeout in seconds (60-86400). | | +| networkIPAllowlist | array | IP addresses/CIDR ranges allowed to connect. | | +| idleTimeoutMinutes | integer | Minutes before container scales to zero. | | +| pitr | boolean | Enable or disable point-in-time recovery (PITR). | | +| pitrRetentionDays | integer | Days to retain PITR data. | | +| storageAutoscaling | boolean | Enable automatic storage expansion when usage exceeds threshold. | | +| storageAutoscalingThresholdPercent | integer | Storage usage percentage (50-95) that triggers automatic expansion. | | +| storageAutoscalingMaxGb | integer | Maximum storage size in GB for autoscaling. 0 means no limit. | | +| metricsTraceSampleRate | number | Fraction of queries to trace (0.0–1.0). Forwarded to the sidecar. | | +| metricsSlowQueryLogThresholdMs | integer | Threshold in ms above which queries are logged as slow. Forwarded to the sidecar. | | +| sqlApiEnabled | boolean | Enable the SQL API sidecar for this database. | | +| sqlApiAllowedStatements | array | Statement types the SQL API accepts. Allowed values: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE. | | +| sqlApiMaxRows | integer | Maximum rows returned per SQL API execution (1-1000000). | | +| sqlApiMaxBytes | integer | Maximum serialised SQL API result payload in bytes (1024-104857600). | | +| sqlApiTimeoutSeconds | integer | Per-call SQL API execution timeout in seconds (1-300). | | + + +```http request +DELETE https://cloud.appwrite.io/v1/postgresql/{databaseId} +``` + +** Delete a dedicated database. This action is irreversible. The database status will be set to 'deleting' and all resources will be cleaned up. Deletion is allowed from any state, and repeating the call re-dispatches the cleanup. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups +``` + +** List all backups for a dedicated database. Results can be filtered by status and type. ** + +### 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: status, type, databaseId | [] | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups +``` + +** Create a manual backup of a dedicated database. The backup will be created asynchronously and its status can be checked via the get backup endpoint. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| type | string | Backup type: full or incremental. | full | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/policies +``` + +** List scheduled backup policies for a dedicated database. ** + +### 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. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/policies +``` + +** Create a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | Policy 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 | Policy name. Max length: 128 chars. | | +| schedule | string | Schedule CRON syntax. | | +| retention | integer | Days to keep backups before deletion. | | +| type | string | Backup type: full or incremental. | full | +| enabled | boolean | Is policy enabled? When disabled, no backups will be taken. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/policies/{policyId} +``` + +** Get a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/policies/{policyId} +``` + +** Update a scheduled backup policy for a dedicated database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | +| name | string | Policy name. Max length: 128 chars. | | +| schedule | string | Schedule CRON syntax. | | +| retention | integer | Days to keep backups before deletion. | | +| enabled | boolean | Is policy enabled? When disabled, no backups will be taken. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/policies/{policyId} +``` + +** Delete a scheduled backup policy for a dedicated database. Backups already taken by the policy are kept until their retention expires. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| policyId | string | **Required** Policy ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/storage +``` + +** Configure off-cluster backup storage for a dedicated database. Supports S3, GCS, and Azure Blob Storage destinations. Backups will be stored to the configured destination in addition to on-cluster storage. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| provider | string | Storage provider for off-cluster backups. Allowed values: s3 (Amazon S3 or S3-compatible), gcs (Google Cloud Storage), azure (Azure Blob Storage). | | +| bucket | string | Storage bucket or container name. | | +| region | string | Storage region. | | +| prefix | string | Object key prefix for backups. | backups/ | +| endpoint | string | Custom endpoint for S3-compatible storage (e.g. MinIO). | | +| accessKey | string | Access key or client ID for authentication. | | +| secretKey | string | Secret key or service account JSON for authentication. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/{backupId} +``` + +** Get details of a specific database backup including its status, size, and timestamps. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| backupId | string | **Required** Backup ID. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/postgresql/{databaseId}/backups/{backupId} +``` + +** Delete a database backup. This will permanently remove the backup from storage and cannot be undone. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| backupId | string | **Required** Backup ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/branches +``` + +** List all ephemeral branches for a dedicated database. Returns branch metadata including ID, name, namespace, and expiration time. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/branches +``` + +** Create an ephemeral database branch from the primary via PVC snapshot. The branch is a full copy of the database at the current point in time, useful for testing schema migrations or running experiments without affecting production data. Branches expire after the configured TTL (default 24 hours). The branch is created asynchronously. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| branchId | string | Branch 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. | | +| ttl | integer | Time-to-live in seconds before the branch expires. Min 300 (5 min), max 604800 (7 days). Default: 86400 (24h). | 86400 | + + +```http request +DELETE https://cloud.appwrite.io/v1/postgresql/{databaseId}/branches/{branchId} +``` + +** Delete an ephemeral database branch. This removes the branch namespace, its PVC, and the associated VolumeSnapshot. The deletion runs asynchronously and is irreversible. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| branchId | string | **Required** Branch ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/postgresql/{databaseId}/credentials +``` + +** Rotate the primary connection credentials for a dedicated database. Generates a new password and updates the database atomically. Previous credentials stop working immediately. Returns the database with a refreshed connection string carrying the new password. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/executions +``` + +** Execute SQL through the console-facing Cloud endpoint. Cloud proxies through the edge platform to the per-database SQL API sidecar. Application traffic should bypass cloud entirely and POST directly to the per-database hostname: `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with an `X-Appwrite-Key` header — that path scales to the whole DB fleet without a per-query cloud round-trip. The statement type must be on the database's configured allow-list. Use bound parameters for any user-supplied values — the API does not interpolate raw strings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| sql | string | SQL statement to execute. Exactly one statement per request. | | +| bindings | object | Optional bound parameters. Pass either a positional list or a name => value map matching the placeholder style used in the SQL. | {} | +| timeoutSeconds | integer | Per-call execution timeout override. Must be less than or equal to the database's configured sqlApiTimeoutSeconds. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/extensions +``` + +** List installed and available extensions for a PostgreSQL database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/extensions +``` + +** Install a database extension. Only available for PostgreSQL databases. The install runs asynchronously; poll the extensions list endpoint for status. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| name | string | Extension name (e.g., pgvector, postgis, uuid-ossp). | | + + +```http request +DELETE https://cloud.appwrite.io/v1/postgresql/{databaseId}/extensions/{extensionName} +``` + +** Uninstall a database extension from a PostgreSQL database. The uninstall runs asynchronously; poll the extensions list endpoint for status. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| extensionName | string | **Required** Extension name to uninstall. | | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/failovers +``` + +** Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetReplicaId | string | Target replica ID to promote. If not specified, the healthiest replica is selected. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/postgresql/{databaseId}/maintenance +``` + +** Update the maintenance window for a dedicated database. Maintenance operations like minor version upgrades will be performed during this window. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| day | string | Day of the week for the maintenance window. Allowed values: sun, mon, tue, wed, thu, fri, sat. | | +| hourUtc | integer | Hour in UTC (0-23) for maintenance window start. | | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/migrations +``` + +** Migrate a database between shared and dedicated types. Shared to dedicated provisions an always-on dedicated instance; dedicated to shared converts to a serverless instance that scales to zero when idle. Data is copied to the target with a brief read-only window during cutover. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetType | string | Target database type to migrate to. Allowed values: shared (serverless, scales to zero when idle), dedicated (always-on with persistent resources). | | +| specification | string | Target specification to provision when migrating to dedicated. Ignored for shared. Defaults to the database's current specification. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/operations +``` + +** List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by operation status. | | +| limit | integer | Maximum number of operations to return. | 25 | +| offset | integer | Number of operations to skip. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/pitr +``` + +** Get available point-in-time recovery windows for a dedicated database. Returns the earliest and latest recovery points. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/pooler +``` + +** Get the connection pooler configuration for a dedicated database. Returns pooler mode, max connections, and pool size settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/postgresql/{databaseId}/pooler +``` + +** Update the connection pooler configuration for a dedicated database. Configure pool mode, max connections, and pool sizes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| mode | string | Connection pool mode. Allowed values: transaction, session. Transaction mode returns connections to the pool after each transaction; session mode holds connections for the entire session lifetime. | | +| maxConnections | integer | Client-connection ceiling the pooler accepts. Supported on MySQL and MariaDB only; the PostgreSQL pooler has no client cap, so set networkMaxConnections on the database instead. | | +| defaultPoolSize | integer | Default pool size per user. | | +| readWriteSplitting | boolean | Route SELECTs to HA replicas, writes and locked reads to the primary. Defaults to true when HA is enabled. | | +| poolerCpuRequest | string | Pooler sidecar CPU request override (Kubernetes quantity, e.g. "250m" or "1"). Leave null for the proportional default (5% of DB CPU, floor 100m). | | +| poolerCpuLimit | string | Pooler sidecar CPU limit override (Kubernetes quantity, e.g. "500m" or "1"). Leave null for the proportional default (10% of DB CPU, floor 200m). Changing this field rolls the database pod. | | +| poolerMemoryRequest | string | Pooler sidecar memory request override (Kubernetes quantity, e.g. "128Mi" or "1Gi"). Leave null for the proportional default (7.5% of DB memory, floor 64Mi). | | +| poolerMemoryLimit | string | Pooler sidecar memory limit override (Kubernetes quantity, e.g. "256Mi" or "1Gi"). Leave null for the proportional default (15% of DB memory, floor 128Mi). Changing this field rolls the database pod. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/replicas +``` + +** Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/restorations +``` + +** List all restorations for a dedicated database. Results can be filtered by status and type. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by restoration status. | | +| type | string | Filter by restoration type. | | +| limit | integer | Maximum number of restorations to return. | 25 | +| offset | integer | Number of restorations to skip. | 0 | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/restorations +``` + +** Restore a database from a backup or to a specific point in time (PITR). For backup restoration, provide a backupId. For PITR, provide a targetTime as an ISO 8601 datetime. PITR requires the database to have PITR enabled and is only available for enterprise databases. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| type | string | Restoration type. Allowed values: backup, pitr. Use "backup" to restore from a specific backup, or "pitr" for point-in-time recovery. | backup | +| backupId | string | Backup ID to restore from (required for backup type). | | +| targetDatabaseId | string | Existing database ID to restore into. The target must be distinct, ready, and use the same engine and version. | | +| targetTime | string | Target time for PITR (required for pitr type) as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) datetime. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/restorations/{restorationId} +``` + +** Get details of a specific database restoration including its status, type, and timestamps. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| restorationId | string | **Required** Restoration ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/postgresql/{databaseId}/status +``` + +** Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/postgresql/{databaseId}/upgrades +``` + +** Upgrade a dedicated database to a new engine version. Uses blue-green deployment for zero-downtime cutover. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetVersion | string | Target engine version to upgrade to. | | + diff --git a/docs/vectorsdb.md b/docs/vectorsdb.md new file mode 100644 index 0000000..c2db2cb --- /dev/null +++ b/docs/vectorsdb.md @@ -0,0 +1,559 @@ +# VectorsDB Service + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb +``` + +** Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: name | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb +``` + +** 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 | +| specification | string | Database specification. Defaults to `serverless`, which creates the database on the shared pool. Any other value provisions a dedicated database on that specification. | serverless | +| replicas | integer | Number of high availability replicas (0-5) for the dedicated database backing this database. Requires a dedicated `specification`; must be 0 for a serverless database. High availability is enabled when greater than 0. | 0 | +| syncMode | string | Replication sync mode for the dedicated database backing this database. Requires a dedicated `specification`; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/specifications +``` + +** List the dedicated database specifications available on the current plan. Each specification reports its resource limits, pricing, and whether it is enabled for the organization. ** + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/transactions +``` + +** List transactions across all databases. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). | [] | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/transactions +``` + +** Create a new transaction. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| ttl | integer | Seconds before the transaction expires. | 300 | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} +``` + +** Get a transaction by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} +``` + +** Update a transaction, to either commit or roll back its operations. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| commit | boolean | Commit transaction? | | +| rollback | boolean | Rollback transaction? | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId} +``` + +** Delete a transaction by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/transactions/{transactionId}/operations +``` + +** Create multiple operations in a single transaction. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| transactionId | string | **Required** Transaction ID. | | +| operations | array | Array of staged operations. | [] | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId} +``` + +** 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/vectorsdb/{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 | +| specification | string | Database specification. Resizing between dedicated specifications changes cpu, memory, storage and the connection ceiling via a rolling cutover with zero downtime. Moving a `serverless` database onto a dedicated specification is a data migration, not a resize. | | +| replicas | integer | Number of high availability replicas (0-5) for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification. High availability is enabled when greater than 0. | | +| syncMode | string | Replication sync mode for the dedicated database backing this database. Only valid when the database is backed by a dedicated specification; the mode is only in force once there is at least one replica. Allowed values: async, sync, quorum. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{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/vectorsdb/{databaseId}/collections +``` + +** Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity | [] | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections +``` + +** Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| name | string | Collection name. Max length: 128 chars. | | +| dimension | integer | Embedding dimension. | | +| permissions | array | An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} +``` + +** Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} +``` + +** Update a collection by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| name | string | Collection name. Max length: 128 chars. | | +| dimension | integer | Embedding dimensions. | | +| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| documentSecurity | boolean | Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| enabled | boolean | Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. | 1 | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId} +``` + +** Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Get a list of all the user's documents in a given collection. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 524288 characters long. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +| ttl | integer | TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). | 0 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documentId | string | Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | +| data | object | Document data as JSON object. | {} | +| permissions | array | An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. | | +| documents | array | Array of documents data as JSON objects. | [] | + + +```http request +PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documents | array | Array of document data as JSON objects. May contain partial documents. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| data | object | Document data as JSON object. Include only attribute and value pairs to be updated. | {} | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents +``` + +** Bulk delete documents using queries, if no queries are passed then all documents are deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/query +``` + +** Get a list of all the user's documents in a given collection using a POST request. This behaves identically to the list documents endpoint but accepts the queries in the request body, allowing much larger `queries` arrays than can fit in a URL query string. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 524288 characters long. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | +| ttl | integer | TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours). | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Get a document by its unique ID. This endpoint response returns a JSON object with the document data. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. | [] | +| transactionId | string | Transaction ID to read uncommitted changes within the transaction. | | + + +```http request +PUT https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include all required fields of the document to be created or updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. | | +| documentId | string | **Required** Document ID. | | +| data | object | Document data as JSON object. Include only fields and value pairs to be updated. | {} | +| permissions | array | An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId} +``` + +** Delete a document by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| documentId | string | **Required** Document ID. | | +| transactionId | string | Transaction ID for staging the operation. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes +``` + +** List indexes in the collection. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error | [] | +| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes +``` + +** Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. +Attributes can be `key`, `fulltext`, and `unique`. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Index Key. | | +| type | string | Index type. | | +| attributes | array | Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. | | +| orders | array | Array of index orders. Maximum of 100 orders are allowed. | [] | +| lengths | array | Length of index. Maximum of 100 | [] | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +** Get index by ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key} +``` + +** Delete an index. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Index Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/failovers +``` + +** Trigger a manual failover for a dedicated database with high availability enabled. Promotes a replica to primary. The failover runs asynchronously; poll the database document for status updates. A database left mid-operation also accepts this call as a repair once nothing is driving the operation it is stuck in. Repairing a failover that did not finish, a `failed` database, a stranded upgrade or migrate, or a stranded compute resize additionally requires `targetReplicaId` to name the member to promote, because the default target may be the member that operation already promoted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| targetReplicaId | string | Target replica ID to promote. If not specified, the healthiest replica is selected. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/operations +``` + +** List the lifecycle operations recorded for a dedicated database, newest first. Every provision, update, restore, backup and replication action is recorded here with its outcome, including an attempt that was abandoned because another worker took over the database. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| status | string | Filter by operation status. | | +| limit | integer | Maximum number of operations to return. | 25 | +| offset | integer | Number of operations to skip. | 0 | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/replicas +``` + +** Get high availability status for a dedicated database. Returns replica statuses, replication lag, and sync mode. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + + +```http request +GET https://cloud.appwrite.io/v1/vectorsdb/{databaseId}/status +``` + +** Get real-time health and status information for a dedicated database. Returns health status, readiness, uptime, connection info, replica status, and volume information. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | + diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 75d272a..562580f 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -43,11 +43,11 @@ class Client * */ protected array $headers = [ - 'user-agent' => 'AppwritePHPSDK/29.0.0 ()', + 'user-agent' => 'AppwritePHPSDK/30.0.0-rc.1 ()', 'x-sdk-name' => 'PHP', 'x-sdk-platform' => 'server', 'x-sdk-language' => 'php', - 'x-sdk-version' => '29.0.0', + 'x-sdk-version' => '30.0.0-rc.1', ]; /** diff --git a/src/Appwrite/Enums/Adapter.php b/src/Appwrite/Enums/Adapter.php index 3cfec56..862c792 100644 --- a/src/Appwrite/Enums/Adapter.php +++ b/src/Appwrite/Enums/Adapter.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function STATIC(): Adapter { - if (!isset(self::$STATIC)) { - self::$STATIC = new Adapter('static'); - } + self::$STATIC ??= new Adapter('static'); + return self::$STATIC; } public static function SSR(): Adapter { - if (!isset(self::$SSR)) { - self::$SSR = new Adapter('ssr'); - } + self::$SSR ??= new Adapter('ssr'); + return self::$SSR; } diff --git a/src/Appwrite/Enums/AttributeStatus.php b/src/Appwrite/Enums/AttributeStatus.php index f505813..6da1e31 100644 --- a/src/Appwrite/Enums/AttributeStatus.php +++ b/src/Appwrite/Enums/AttributeStatus.php @@ -31,37 +31,32 @@ public function jsonSerialize(): string public static function AVAILABLE(): AttributeStatus { - if (!isset(self::$AVAILABLE)) { - self::$AVAILABLE = new AttributeStatus('available'); - } + self::$AVAILABLE ??= new AttributeStatus('available'); + return self::$AVAILABLE; } public static function PROCESSING(): AttributeStatus { - if (!isset(self::$PROCESSING)) { - self::$PROCESSING = new AttributeStatus('processing'); - } + self::$PROCESSING ??= new AttributeStatus('processing'); + return self::$PROCESSING; } public static function DELETING(): AttributeStatus { - if (!isset(self::$DELETING)) { - self::$DELETING = new AttributeStatus('deleting'); - } + self::$DELETING ??= new AttributeStatus('deleting'); + return self::$DELETING; } public static function STUCK(): AttributeStatus { - if (!isset(self::$STUCK)) { - self::$STUCK = new AttributeStatus('stuck'); - } + self::$STUCK ??= new AttributeStatus('stuck'); + return self::$STUCK; } public static function FAILED(): AttributeStatus { - if (!isset(self::$FAILED)) { - self::$FAILED = new AttributeStatus('failed'); - } + self::$FAILED ??= new AttributeStatus('failed'); + return self::$FAILED; } diff --git a/src/Appwrite/Enums/AuthenticationFactor.php b/src/Appwrite/Enums/AuthenticationFactor.php index 601dbaf..d25fbec 100644 --- a/src/Appwrite/Enums/AuthenticationFactor.php +++ b/src/Appwrite/Enums/AuthenticationFactor.php @@ -31,37 +31,32 @@ public function jsonSerialize(): string public static function EMAIL(): AuthenticationFactor { - if (!isset(self::$EMAIL)) { - self::$EMAIL = new AuthenticationFactor('email'); - } + self::$EMAIL ??= new AuthenticationFactor('email'); + return self::$EMAIL; } public static function PHONE(): AuthenticationFactor { - if (!isset(self::$PHONE)) { - self::$PHONE = new AuthenticationFactor('phone'); - } + self::$PHONE ??= new AuthenticationFactor('phone'); + return self::$PHONE; } public static function TOTP(): AuthenticationFactor { - if (!isset(self::$TOTP)) { - self::$TOTP = new AuthenticationFactor('totp'); - } + self::$TOTP ??= new AuthenticationFactor('totp'); + return self::$TOTP; } public static function RECOVERYCODE(): AuthenticationFactor { - if (!isset(self::$RECOVERYCODE)) { - self::$RECOVERYCODE = new AuthenticationFactor('recoverycode'); - } + self::$RECOVERYCODE ??= new AuthenticationFactor('recoverycode'); + return self::$RECOVERYCODE; } public static function CUSTOM(): AuthenticationFactor { - if (!isset(self::$CUSTOM)) { - self::$CUSTOM = new AuthenticationFactor('custom'); - } + self::$CUSTOM ??= new AuthenticationFactor('custom'); + return self::$CUSTOM; } diff --git a/src/Appwrite/Enums/AuthenticatorType.php b/src/Appwrite/Enums/AuthenticatorType.php index 8d8b73a..219b55f 100644 --- a/src/Appwrite/Enums/AuthenticatorType.php +++ b/src/Appwrite/Enums/AuthenticatorType.php @@ -27,9 +27,8 @@ public function jsonSerialize(): string public static function TOTP(): AuthenticatorType { - if (!isset(self::$TOTP)) { - self::$TOTP = new AuthenticatorType('totp'); - } + self::$TOTP ??= new AuthenticatorType('totp'); + return self::$TOTP; } diff --git a/src/Appwrite/Enums/BackupServices.php b/src/Appwrite/Enums/BackupServices.php index 841ead2..64c6ed9 100644 --- a/src/Appwrite/Enums/BackupServices.php +++ b/src/Appwrite/Enums/BackupServices.php @@ -33,51 +33,44 @@ public function jsonSerialize(): string public static function DATABASES(): BackupServices { - if (!isset(self::$DATABASES)) { - self::$DATABASES = new BackupServices('databases'); - } + self::$DATABASES ??= new BackupServices('databases'); + return self::$DATABASES; } public static function TABLESDB(): BackupServices { - if (!isset(self::$TABLESDB)) { - self::$TABLESDB = new BackupServices('tablesdb'); - } + self::$TABLESDB ??= new BackupServices('tablesdb'); + return self::$TABLESDB; } public static function DOCUMENTSDB(): BackupServices { - if (!isset(self::$DOCUMENTSDB)) { - self::$DOCUMENTSDB = new BackupServices('documentsdb'); - } + self::$DOCUMENTSDB ??= new BackupServices('documentsdb'); + return self::$DOCUMENTSDB; } public static function VECTORSDB(): BackupServices { - if (!isset(self::$VECTORSDB)) { - self::$VECTORSDB = new BackupServices('vectorsdb'); - } + self::$VECTORSDB ??= new BackupServices('vectorsdb'); + return self::$VECTORSDB; } public static function DEDICATEDDATABASES(): BackupServices { - if (!isset(self::$DEDICATEDDATABASES)) { - self::$DEDICATEDDATABASES = new BackupServices('dedicatedDatabases'); - } + self::$DEDICATEDDATABASES ??= new BackupServices('dedicatedDatabases'); + return self::$DEDICATEDDATABASES; } public static function FUNCTIONS(): BackupServices { - if (!isset(self::$FUNCTIONS)) { - self::$FUNCTIONS = new BackupServices('functions'); - } + self::$FUNCTIONS ??= new BackupServices('functions'); + return self::$FUNCTIONS; } public static function STORAGE(): BackupServices { - if (!isset(self::$STORAGE)) { - self::$STORAGE = new BackupServices('storage'); - } + self::$STORAGE ??= new BackupServices('storage'); + return self::$STORAGE; } diff --git a/src/Appwrite/Enums/BillingPlanGroup.php b/src/Appwrite/Enums/BillingPlanGroup.php index 04bcb58..8ac322d 100644 --- a/src/Appwrite/Enums/BillingPlanGroup.php +++ b/src/Appwrite/Enums/BillingPlanGroup.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function STARTER(): BillingPlanGroup { - if (!isset(self::$STARTER)) { - self::$STARTER = new BillingPlanGroup('starter'); - } + self::$STARTER ??= new BillingPlanGroup('starter'); + return self::$STARTER; } public static function PRO(): BillingPlanGroup { - if (!isset(self::$PRO)) { - self::$PRO = new BillingPlanGroup('pro'); - } + self::$PRO ??= new BillingPlanGroup('pro'); + return self::$PRO; } public static function SCALE(): BillingPlanGroup { - if (!isset(self::$SCALE)) { - self::$SCALE = new BillingPlanGroup('scale'); - } + self::$SCALE ??= new BillingPlanGroup('scale'); + return self::$SCALE; } diff --git a/src/Appwrite/Enums/Browser.php b/src/Appwrite/Enums/Browser.php index e0d5419..5dc421a 100644 --- a/src/Appwrite/Enums/Browser.php +++ b/src/Appwrite/Enums/Browser.php @@ -40,100 +40,86 @@ public function jsonSerialize(): string public static function AVANTBROWSER(): Browser { - if (!isset(self::$AVANTBROWSER)) { - self::$AVANTBROWSER = new Browser('aa'); - } + self::$AVANTBROWSER ??= new Browser('aa'); + return self::$AVANTBROWSER; } public static function ANDROIDWEBVIEWBETA(): Browser { - if (!isset(self::$ANDROIDWEBVIEWBETA)) { - self::$ANDROIDWEBVIEWBETA = new Browser('an'); - } + self::$ANDROIDWEBVIEWBETA ??= new Browser('an'); + return self::$ANDROIDWEBVIEWBETA; } public static function GOOGLECHROME(): Browser { - if (!isset(self::$GOOGLECHROME)) { - self::$GOOGLECHROME = new Browser('ch'); - } + self::$GOOGLECHROME ??= new Browser('ch'); + return self::$GOOGLECHROME; } public static function GOOGLECHROMEIOS(): Browser { - if (!isset(self::$GOOGLECHROMEIOS)) { - self::$GOOGLECHROMEIOS = new Browser('ci'); - } + self::$GOOGLECHROMEIOS ??= new Browser('ci'); + return self::$GOOGLECHROMEIOS; } public static function GOOGLECHROMEMOBILE(): Browser { - if (!isset(self::$GOOGLECHROMEMOBILE)) { - self::$GOOGLECHROMEMOBILE = new Browser('cm'); - } + self::$GOOGLECHROMEMOBILE ??= new Browser('cm'); + return self::$GOOGLECHROMEMOBILE; } public static function CHROMIUM(): Browser { - if (!isset(self::$CHROMIUM)) { - self::$CHROMIUM = new Browser('cr'); - } + self::$CHROMIUM ??= new Browser('cr'); + return self::$CHROMIUM; } public static function MOZILLAFIREFOX(): Browser { - if (!isset(self::$MOZILLAFIREFOX)) { - self::$MOZILLAFIREFOX = new Browser('ff'); - } + self::$MOZILLAFIREFOX ??= new Browser('ff'); + return self::$MOZILLAFIREFOX; } public static function SAFARI(): Browser { - if (!isset(self::$SAFARI)) { - self::$SAFARI = new Browser('sf'); - } + self::$SAFARI ??= new Browser('sf'); + return self::$SAFARI; } public static function MOBILESAFARI(): Browser { - if (!isset(self::$MOBILESAFARI)) { - self::$MOBILESAFARI = new Browser('mf'); - } + self::$MOBILESAFARI ??= new Browser('mf'); + return self::$MOBILESAFARI; } public static function MICROSOFTEDGE(): Browser { - if (!isset(self::$MICROSOFTEDGE)) { - self::$MICROSOFTEDGE = new Browser('ps'); - } + self::$MICROSOFTEDGE ??= new Browser('ps'); + return self::$MICROSOFTEDGE; } public static function MICROSOFTEDGEIOS(): Browser { - if (!isset(self::$MICROSOFTEDGEIOS)) { - self::$MICROSOFTEDGEIOS = new Browser('oi'); - } + self::$MICROSOFTEDGEIOS ??= new Browser('oi'); + return self::$MICROSOFTEDGEIOS; } public static function OPERAMINI(): Browser { - if (!isset(self::$OPERAMINI)) { - self::$OPERAMINI = new Browser('om'); - } + self::$OPERAMINI ??= new Browser('om'); + return self::$OPERAMINI; } public static function OPERA(): Browser { - if (!isset(self::$OPERA)) { - self::$OPERA = new Browser('op'); - } + self::$OPERA ??= new Browser('op'); + return self::$OPERA; } public static function OPERANEXT(): Browser { - if (!isset(self::$OPERANEXT)) { - self::$OPERANEXT = new Browser('on'); - } + self::$OPERANEXT ??= new Browser('on'); + return self::$OPERANEXT; } diff --git a/src/Appwrite/Enums/BrowserPermission.php b/src/Appwrite/Enums/BrowserPermission.php index 003bb40..b6ec516 100644 --- a/src/Appwrite/Enums/BrowserPermission.php +++ b/src/Appwrite/Enums/BrowserPermission.php @@ -46,142 +46,122 @@ public function jsonSerialize(): string public static function GEOLOCATION(): BrowserPermission { - if (!isset(self::$GEOLOCATION)) { - self::$GEOLOCATION = new BrowserPermission('geolocation'); - } + self::$GEOLOCATION ??= new BrowserPermission('geolocation'); + return self::$GEOLOCATION; } public static function CAMERA(): BrowserPermission { - if (!isset(self::$CAMERA)) { - self::$CAMERA = new BrowserPermission('camera'); - } + self::$CAMERA ??= new BrowserPermission('camera'); + return self::$CAMERA; } public static function MICROPHONE(): BrowserPermission { - if (!isset(self::$MICROPHONE)) { - self::$MICROPHONE = new BrowserPermission('microphone'); - } + self::$MICROPHONE ??= new BrowserPermission('microphone'); + return self::$MICROPHONE; } public static function NOTIFICATIONS(): BrowserPermission { - if (!isset(self::$NOTIFICATIONS)) { - self::$NOTIFICATIONS = new BrowserPermission('notifications'); - } + self::$NOTIFICATIONS ??= new BrowserPermission('notifications'); + return self::$NOTIFICATIONS; } public static function MIDI(): BrowserPermission { - if (!isset(self::$MIDI)) { - self::$MIDI = new BrowserPermission('midi'); - } + self::$MIDI ??= new BrowserPermission('midi'); + return self::$MIDI; } public static function PUSH(): BrowserPermission { - if (!isset(self::$PUSH)) { - self::$PUSH = new BrowserPermission('push'); - } + self::$PUSH ??= new BrowserPermission('push'); + return self::$PUSH; } public static function CLIPBOARDREAD(): BrowserPermission { - if (!isset(self::$CLIPBOARDREAD)) { - self::$CLIPBOARDREAD = new BrowserPermission('clipboard-read'); - } + self::$CLIPBOARDREAD ??= new BrowserPermission('clipboard-read'); + return self::$CLIPBOARDREAD; } public static function CLIPBOARDWRITE(): BrowserPermission { - if (!isset(self::$CLIPBOARDWRITE)) { - self::$CLIPBOARDWRITE = new BrowserPermission('clipboard-write'); - } + self::$CLIPBOARDWRITE ??= new BrowserPermission('clipboard-write'); + return self::$CLIPBOARDWRITE; } public static function PAYMENTHANDLER(): BrowserPermission { - if (!isset(self::$PAYMENTHANDLER)) { - self::$PAYMENTHANDLER = new BrowserPermission('payment-handler'); - } + self::$PAYMENTHANDLER ??= new BrowserPermission('payment-handler'); + return self::$PAYMENTHANDLER; } public static function USB(): BrowserPermission { - if (!isset(self::$USB)) { - self::$USB = new BrowserPermission('usb'); - } + self::$USB ??= new BrowserPermission('usb'); + return self::$USB; } public static function BLUETOOTH(): BrowserPermission { - if (!isset(self::$BLUETOOTH)) { - self::$BLUETOOTH = new BrowserPermission('bluetooth'); - } + self::$BLUETOOTH ??= new BrowserPermission('bluetooth'); + return self::$BLUETOOTH; } public static function ACCELEROMETER(): BrowserPermission { - if (!isset(self::$ACCELEROMETER)) { - self::$ACCELEROMETER = new BrowserPermission('accelerometer'); - } + self::$ACCELEROMETER ??= new BrowserPermission('accelerometer'); + return self::$ACCELEROMETER; } public static function GYROSCOPE(): BrowserPermission { - if (!isset(self::$GYROSCOPE)) { - self::$GYROSCOPE = new BrowserPermission('gyroscope'); - } + self::$GYROSCOPE ??= new BrowserPermission('gyroscope'); + return self::$GYROSCOPE; } public static function MAGNETOMETER(): BrowserPermission { - if (!isset(self::$MAGNETOMETER)) { - self::$MAGNETOMETER = new BrowserPermission('magnetometer'); - } + self::$MAGNETOMETER ??= new BrowserPermission('magnetometer'); + return self::$MAGNETOMETER; } public static function AMBIENTLIGHTSENSOR(): BrowserPermission { - if (!isset(self::$AMBIENTLIGHTSENSOR)) { - self::$AMBIENTLIGHTSENSOR = new BrowserPermission('ambient-light-sensor'); - } + self::$AMBIENTLIGHTSENSOR ??= new BrowserPermission('ambient-light-sensor'); + return self::$AMBIENTLIGHTSENSOR; } public static function BACKGROUNDSYNC(): BrowserPermission { - if (!isset(self::$BACKGROUNDSYNC)) { - self::$BACKGROUNDSYNC = new BrowserPermission('background-sync'); - } + self::$BACKGROUNDSYNC ??= new BrowserPermission('background-sync'); + return self::$BACKGROUNDSYNC; } public static function PERSISTENTSTORAGE(): BrowserPermission { - if (!isset(self::$PERSISTENTSTORAGE)) { - self::$PERSISTENTSTORAGE = new BrowserPermission('persistent-storage'); - } + self::$PERSISTENTSTORAGE ??= new BrowserPermission('persistent-storage'); + return self::$PERSISTENTSTORAGE; } public static function SCREENWAKELOCK(): BrowserPermission { - if (!isset(self::$SCREENWAKELOCK)) { - self::$SCREENWAKELOCK = new BrowserPermission('screen-wake-lock'); - } + self::$SCREENWAKELOCK ??= new BrowserPermission('screen-wake-lock'); + return self::$SCREENWAKELOCK; } public static function WEBSHARE(): BrowserPermission { - if (!isset(self::$WEBSHARE)) { - self::$WEBSHARE = new BrowserPermission('web-share'); - } + self::$WEBSHARE ??= new BrowserPermission('web-share'); + return self::$WEBSHARE; } public static function XRSPATIALTRACKING(): BrowserPermission { - if (!isset(self::$XRSPATIALTRACKING)) { - self::$XRSPATIALTRACKING = new BrowserPermission('xr-spatial-tracking'); - } + self::$XRSPATIALTRACKING ??= new BrowserPermission('xr-spatial-tracking'); + return self::$XRSPATIALTRACKING; } diff --git a/src/Appwrite/Enums/BrowserTheme.php b/src/Appwrite/Enums/BrowserTheme.php index b0c284d..fc672f0 100644 --- a/src/Appwrite/Enums/BrowserTheme.php +++ b/src/Appwrite/Enums/BrowserTheme.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function LIGHT(): BrowserTheme { - if (!isset(self::$LIGHT)) { - self::$LIGHT = new BrowserTheme('light'); - } + self::$LIGHT ??= new BrowserTheme('light'); + return self::$LIGHT; } public static function DARK(): BrowserTheme { - if (!isset(self::$DARK)) { - self::$DARK = new BrowserTheme('dark'); - } + self::$DARK ??= new BrowserTheme('dark'); + return self::$DARK; } diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index 218a8c8..abde81d 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -119,653 +119,560 @@ public function jsonSerialize(): string public static function NODE145(): BuildRuntime { - if (!isset(self::$NODE145)) { - self::$NODE145 = new BuildRuntime('node-14.5'); - } + self::$NODE145 ??= new BuildRuntime('node-14.5'); + return self::$NODE145; } public static function NODE160(): BuildRuntime { - if (!isset(self::$NODE160)) { - self::$NODE160 = new BuildRuntime('node-16.0'); - } + self::$NODE160 ??= new BuildRuntime('node-16.0'); + return self::$NODE160; } public static function NODE180(): BuildRuntime { - if (!isset(self::$NODE180)) { - self::$NODE180 = new BuildRuntime('node-18.0'); - } + self::$NODE180 ??= new BuildRuntime('node-18.0'); + return self::$NODE180; } public static function NODE190(): BuildRuntime { - if (!isset(self::$NODE190)) { - self::$NODE190 = new BuildRuntime('node-19.0'); - } + self::$NODE190 ??= new BuildRuntime('node-19.0'); + return self::$NODE190; } public static function NODE200(): BuildRuntime { - if (!isset(self::$NODE200)) { - self::$NODE200 = new BuildRuntime('node-20.0'); - } + self::$NODE200 ??= new BuildRuntime('node-20.0'); + return self::$NODE200; } public static function NODE210(): BuildRuntime { - if (!isset(self::$NODE210)) { - self::$NODE210 = new BuildRuntime('node-21.0'); - } + self::$NODE210 ??= new BuildRuntime('node-21.0'); + return self::$NODE210; } public static function NODE22(): BuildRuntime { - if (!isset(self::$NODE22)) { - self::$NODE22 = new BuildRuntime('node-22'); - } + self::$NODE22 ??= new BuildRuntime('node-22'); + return self::$NODE22; } public static function NODE23(): BuildRuntime { - if (!isset(self::$NODE23)) { - self::$NODE23 = new BuildRuntime('node-23'); - } + self::$NODE23 ??= new BuildRuntime('node-23'); + return self::$NODE23; } public static function NODE24(): BuildRuntime { - if (!isset(self::$NODE24)) { - self::$NODE24 = new BuildRuntime('node-24'); - } + self::$NODE24 ??= new BuildRuntime('node-24'); + return self::$NODE24; } public static function NODE25(): BuildRuntime { - if (!isset(self::$NODE25)) { - self::$NODE25 = new BuildRuntime('node-25'); - } + self::$NODE25 ??= new BuildRuntime('node-25'); + return self::$NODE25; } public static function NODE26(): BuildRuntime { - if (!isset(self::$NODE26)) { - self::$NODE26 = new BuildRuntime('node-26'); - } + self::$NODE26 ??= new BuildRuntime('node-26'); + return self::$NODE26; } public static function PHP80(): BuildRuntime { - if (!isset(self::$PHP80)) { - self::$PHP80 = new BuildRuntime('php-8.0'); - } + self::$PHP80 ??= new BuildRuntime('php-8.0'); + return self::$PHP80; } public static function PHP81(): BuildRuntime { - if (!isset(self::$PHP81)) { - self::$PHP81 = new BuildRuntime('php-8.1'); - } + self::$PHP81 ??= new BuildRuntime('php-8.1'); + return self::$PHP81; } public static function PHP82(): BuildRuntime { - if (!isset(self::$PHP82)) { - self::$PHP82 = new BuildRuntime('php-8.2'); - } + self::$PHP82 ??= new BuildRuntime('php-8.2'); + return self::$PHP82; } public static function PHP83(): BuildRuntime { - if (!isset(self::$PHP83)) { - self::$PHP83 = new BuildRuntime('php-8.3'); - } + self::$PHP83 ??= new BuildRuntime('php-8.3'); + return self::$PHP83; } public static function PHP84(): BuildRuntime { - if (!isset(self::$PHP84)) { - self::$PHP84 = new BuildRuntime('php-8.4'); - } + self::$PHP84 ??= new BuildRuntime('php-8.4'); + return self::$PHP84; } public static function RUBY30(): BuildRuntime { - if (!isset(self::$RUBY30)) { - self::$RUBY30 = new BuildRuntime('ruby-3.0'); - } + self::$RUBY30 ??= new BuildRuntime('ruby-3.0'); + return self::$RUBY30; } public static function RUBY31(): BuildRuntime { - if (!isset(self::$RUBY31)) { - self::$RUBY31 = new BuildRuntime('ruby-3.1'); - } + self::$RUBY31 ??= new BuildRuntime('ruby-3.1'); + return self::$RUBY31; } public static function RUBY32(): BuildRuntime { - if (!isset(self::$RUBY32)) { - self::$RUBY32 = new BuildRuntime('ruby-3.2'); - } + self::$RUBY32 ??= new BuildRuntime('ruby-3.2'); + return self::$RUBY32; } public static function RUBY33(): BuildRuntime { - if (!isset(self::$RUBY33)) { - self::$RUBY33 = new BuildRuntime('ruby-3.3'); - } + self::$RUBY33 ??= new BuildRuntime('ruby-3.3'); + return self::$RUBY33; } public static function RUBY34(): BuildRuntime { - if (!isset(self::$RUBY34)) { - self::$RUBY34 = new BuildRuntime('ruby-3.4'); - } + self::$RUBY34 ??= new BuildRuntime('ruby-3.4'); + return self::$RUBY34; } public static function RUBY40(): BuildRuntime { - if (!isset(self::$RUBY40)) { - self::$RUBY40 = new BuildRuntime('ruby-4.0'); - } + self::$RUBY40 ??= new BuildRuntime('ruby-4.0'); + return self::$RUBY40; } public static function PYTHON38(): BuildRuntime { - if (!isset(self::$PYTHON38)) { - self::$PYTHON38 = new BuildRuntime('python-3.8'); - } + self::$PYTHON38 ??= new BuildRuntime('python-3.8'); + return self::$PYTHON38; } public static function PYTHON39(): BuildRuntime { - if (!isset(self::$PYTHON39)) { - self::$PYTHON39 = new BuildRuntime('python-3.9'); - } + self::$PYTHON39 ??= new BuildRuntime('python-3.9'); + return self::$PYTHON39; } public static function PYTHON310(): BuildRuntime { - if (!isset(self::$PYTHON310)) { - self::$PYTHON310 = new BuildRuntime('python-3.10'); - } + self::$PYTHON310 ??= new BuildRuntime('python-3.10'); + return self::$PYTHON310; } public static function PYTHON311(): BuildRuntime { - if (!isset(self::$PYTHON311)) { - self::$PYTHON311 = new BuildRuntime('python-3.11'); - } + self::$PYTHON311 ??= new BuildRuntime('python-3.11'); + return self::$PYTHON311; } public static function PYTHON312(): BuildRuntime { - if (!isset(self::$PYTHON312)) { - self::$PYTHON312 = new BuildRuntime('python-3.12'); - } + self::$PYTHON312 ??= new BuildRuntime('python-3.12'); + return self::$PYTHON312; } public static function PYTHON313(): BuildRuntime { - if (!isset(self::$PYTHON313)) { - self::$PYTHON313 = new BuildRuntime('python-3.13'); - } + self::$PYTHON313 ??= new BuildRuntime('python-3.13'); + return self::$PYTHON313; } public static function PYTHON314(): BuildRuntime { - if (!isset(self::$PYTHON314)) { - self::$PYTHON314 = new BuildRuntime('python-3.14'); - } + self::$PYTHON314 ??= new BuildRuntime('python-3.14'); + return self::$PYTHON314; } public static function PYTHONML311(): BuildRuntime { - if (!isset(self::$PYTHONML311)) { - self::$PYTHONML311 = new BuildRuntime('python-ml-3.11'); - } + self::$PYTHONML311 ??= new BuildRuntime('python-ml-3.11'); + return self::$PYTHONML311; } public static function PYTHONML312(): BuildRuntime { - if (!isset(self::$PYTHONML312)) { - self::$PYTHONML312 = new BuildRuntime('python-ml-3.12'); - } + self::$PYTHONML312 ??= new BuildRuntime('python-ml-3.12'); + return self::$PYTHONML312; } public static function PYTHONML313(): BuildRuntime { - if (!isset(self::$PYTHONML313)) { - self::$PYTHONML313 = new BuildRuntime('python-ml-3.13'); - } + self::$PYTHONML313 ??= new BuildRuntime('python-ml-3.13'); + return self::$PYTHONML313; } public static function DENO140(): BuildRuntime { - if (!isset(self::$DENO140)) { - self::$DENO140 = new BuildRuntime('deno-1.40'); - } + self::$DENO140 ??= new BuildRuntime('deno-1.40'); + return self::$DENO140; } public static function DENO146(): BuildRuntime { - if (!isset(self::$DENO146)) { - self::$DENO146 = new BuildRuntime('deno-1.46'); - } + self::$DENO146 ??= new BuildRuntime('deno-1.46'); + return self::$DENO146; } public static function DENO20(): BuildRuntime { - if (!isset(self::$DENO20)) { - self::$DENO20 = new BuildRuntime('deno-2.0'); - } + self::$DENO20 ??= new BuildRuntime('deno-2.0'); + return self::$DENO20; } public static function DENO25(): BuildRuntime { - if (!isset(self::$DENO25)) { - self::$DENO25 = new BuildRuntime('deno-2.5'); - } + self::$DENO25 ??= new BuildRuntime('deno-2.5'); + return self::$DENO25; } public static function DENO26(): BuildRuntime { - if (!isset(self::$DENO26)) { - self::$DENO26 = new BuildRuntime('deno-2.6'); - } + self::$DENO26 ??= new BuildRuntime('deno-2.6'); + return self::$DENO26; } public static function DART215(): BuildRuntime { - if (!isset(self::$DART215)) { - self::$DART215 = new BuildRuntime('dart-2.15'); - } + self::$DART215 ??= new BuildRuntime('dart-2.15'); + return self::$DART215; } public static function DART216(): BuildRuntime { - if (!isset(self::$DART216)) { - self::$DART216 = new BuildRuntime('dart-2.16'); - } + self::$DART216 ??= new BuildRuntime('dart-2.16'); + return self::$DART216; } public static function DART217(): BuildRuntime { - if (!isset(self::$DART217)) { - self::$DART217 = new BuildRuntime('dart-2.17'); - } + self::$DART217 ??= new BuildRuntime('dart-2.17'); + return self::$DART217; } public static function DART218(): BuildRuntime { - if (!isset(self::$DART218)) { - self::$DART218 = new BuildRuntime('dart-2.18'); - } + self::$DART218 ??= new BuildRuntime('dart-2.18'); + return self::$DART218; } public static function DART219(): BuildRuntime { - if (!isset(self::$DART219)) { - self::$DART219 = new BuildRuntime('dart-2.19'); - } + self::$DART219 ??= new BuildRuntime('dart-2.19'); + return self::$DART219; } public static function DART30(): BuildRuntime { - if (!isset(self::$DART30)) { - self::$DART30 = new BuildRuntime('dart-3.0'); - } + self::$DART30 ??= new BuildRuntime('dart-3.0'); + return self::$DART30; } public static function DART31(): BuildRuntime { - if (!isset(self::$DART31)) { - self::$DART31 = new BuildRuntime('dart-3.1'); - } + self::$DART31 ??= new BuildRuntime('dart-3.1'); + return self::$DART31; } public static function DART33(): BuildRuntime { - if (!isset(self::$DART33)) { - self::$DART33 = new BuildRuntime('dart-3.3'); - } + self::$DART33 ??= new BuildRuntime('dart-3.3'); + return self::$DART33; } public static function DART35(): BuildRuntime { - if (!isset(self::$DART35)) { - self::$DART35 = new BuildRuntime('dart-3.5'); - } + self::$DART35 ??= new BuildRuntime('dart-3.5'); + return self::$DART35; } public static function DART38(): BuildRuntime { - if (!isset(self::$DART38)) { - self::$DART38 = new BuildRuntime('dart-3.8'); - } + self::$DART38 ??= new BuildRuntime('dart-3.8'); + return self::$DART38; } public static function DART39(): BuildRuntime { - if (!isset(self::$DART39)) { - self::$DART39 = new BuildRuntime('dart-3.9'); - } + self::$DART39 ??= new BuildRuntime('dart-3.9'); + return self::$DART39; } public static function DART310(): BuildRuntime { - if (!isset(self::$DART310)) { - self::$DART310 = new BuildRuntime('dart-3.10'); - } + self::$DART310 ??= new BuildRuntime('dart-3.10'); + return self::$DART310; } public static function DART311(): BuildRuntime { - if (!isset(self::$DART311)) { - self::$DART311 = new BuildRuntime('dart-3.11'); - } + self::$DART311 ??= new BuildRuntime('dart-3.11'); + return self::$DART311; } public static function DART312(): BuildRuntime { - if (!isset(self::$DART312)) { - self::$DART312 = new BuildRuntime('dart-3.12'); - } + self::$DART312 ??= new BuildRuntime('dart-3.12'); + return self::$DART312; } public static function DOTNET60(): BuildRuntime { - if (!isset(self::$DOTNET60)) { - self::$DOTNET60 = new BuildRuntime('dotnet-6.0'); - } + self::$DOTNET60 ??= new BuildRuntime('dotnet-6.0'); + return self::$DOTNET60; } public static function DOTNET70(): BuildRuntime { - if (!isset(self::$DOTNET70)) { - self::$DOTNET70 = new BuildRuntime('dotnet-7.0'); - } + self::$DOTNET70 ??= new BuildRuntime('dotnet-7.0'); + return self::$DOTNET70; } public static function DOTNET80(): BuildRuntime { - if (!isset(self::$DOTNET80)) { - self::$DOTNET80 = new BuildRuntime('dotnet-8.0'); - } + self::$DOTNET80 ??= new BuildRuntime('dotnet-8.0'); + return self::$DOTNET80; } public static function DOTNET10(): BuildRuntime { - if (!isset(self::$DOTNET10)) { - self::$DOTNET10 = new BuildRuntime('dotnet-10'); - } + self::$DOTNET10 ??= new BuildRuntime('dotnet-10'); + return self::$DOTNET10; } public static function JAVA80(): BuildRuntime { - if (!isset(self::$JAVA80)) { - self::$JAVA80 = new BuildRuntime('java-8.0'); - } + self::$JAVA80 ??= new BuildRuntime('java-8.0'); + return self::$JAVA80; } public static function JAVA110(): BuildRuntime { - if (!isset(self::$JAVA110)) { - self::$JAVA110 = new BuildRuntime('java-11.0'); - } + self::$JAVA110 ??= new BuildRuntime('java-11.0'); + return self::$JAVA110; } public static function JAVA170(): BuildRuntime { - if (!isset(self::$JAVA170)) { - self::$JAVA170 = new BuildRuntime('java-17.0'); - } + self::$JAVA170 ??= new BuildRuntime('java-17.0'); + return self::$JAVA170; } public static function JAVA180(): BuildRuntime { - if (!isset(self::$JAVA180)) { - self::$JAVA180 = new BuildRuntime('java-18.0'); - } + self::$JAVA180 ??= new BuildRuntime('java-18.0'); + return self::$JAVA180; } public static function JAVA210(): BuildRuntime { - if (!isset(self::$JAVA210)) { - self::$JAVA210 = new BuildRuntime('java-21.0'); - } + self::$JAVA210 ??= new BuildRuntime('java-21.0'); + return self::$JAVA210; } public static function JAVA22(): BuildRuntime { - if (!isset(self::$JAVA22)) { - self::$JAVA22 = new BuildRuntime('java-22'); - } + self::$JAVA22 ??= new BuildRuntime('java-22'); + return self::$JAVA22; } public static function JAVA25(): BuildRuntime { - if (!isset(self::$JAVA25)) { - self::$JAVA25 = new BuildRuntime('java-25'); - } + self::$JAVA25 ??= new BuildRuntime('java-25'); + return self::$JAVA25; } public static function SWIFT55(): BuildRuntime { - if (!isset(self::$SWIFT55)) { - self::$SWIFT55 = new BuildRuntime('swift-5.5'); - } + self::$SWIFT55 ??= new BuildRuntime('swift-5.5'); + return self::$SWIFT55; } public static function SWIFT58(): BuildRuntime { - if (!isset(self::$SWIFT58)) { - self::$SWIFT58 = new BuildRuntime('swift-5.8'); - } + self::$SWIFT58 ??= new BuildRuntime('swift-5.8'); + return self::$SWIFT58; } public static function SWIFT59(): BuildRuntime { - if (!isset(self::$SWIFT59)) { - self::$SWIFT59 = new BuildRuntime('swift-5.9'); - } + self::$SWIFT59 ??= new BuildRuntime('swift-5.9'); + return self::$SWIFT59; } public static function SWIFT510(): BuildRuntime { - if (!isset(self::$SWIFT510)) { - self::$SWIFT510 = new BuildRuntime('swift-5.10'); - } + self::$SWIFT510 ??= new BuildRuntime('swift-5.10'); + return self::$SWIFT510; } public static function SWIFT62(): BuildRuntime { - if (!isset(self::$SWIFT62)) { - self::$SWIFT62 = new BuildRuntime('swift-6.2'); - } + self::$SWIFT62 ??= new BuildRuntime('swift-6.2'); + return self::$SWIFT62; } public static function KOTLIN16(): BuildRuntime { - if (!isset(self::$KOTLIN16)) { - self::$KOTLIN16 = new BuildRuntime('kotlin-1.6'); - } + self::$KOTLIN16 ??= new BuildRuntime('kotlin-1.6'); + return self::$KOTLIN16; } public static function KOTLIN18(): BuildRuntime { - if (!isset(self::$KOTLIN18)) { - self::$KOTLIN18 = new BuildRuntime('kotlin-1.8'); - } + self::$KOTLIN18 ??= new BuildRuntime('kotlin-1.8'); + return self::$KOTLIN18; } public static function KOTLIN19(): BuildRuntime { - if (!isset(self::$KOTLIN19)) { - self::$KOTLIN19 = new BuildRuntime('kotlin-1.9'); - } + self::$KOTLIN19 ??= new BuildRuntime('kotlin-1.9'); + return self::$KOTLIN19; } public static function KOTLIN20(): BuildRuntime { - if (!isset(self::$KOTLIN20)) { - self::$KOTLIN20 = new BuildRuntime('kotlin-2.0'); - } + self::$KOTLIN20 ??= new BuildRuntime('kotlin-2.0'); + return self::$KOTLIN20; } public static function KOTLIN23(): BuildRuntime { - if (!isset(self::$KOTLIN23)) { - self::$KOTLIN23 = new BuildRuntime('kotlin-2.3'); - } + self::$KOTLIN23 ??= new BuildRuntime('kotlin-2.3'); + return self::$KOTLIN23; } public static function CPP17(): BuildRuntime { - if (!isset(self::$CPP17)) { - self::$CPP17 = new BuildRuntime('cpp-17'); - } + self::$CPP17 ??= new BuildRuntime('cpp-17'); + return self::$CPP17; } public static function CPP20(): BuildRuntime { - if (!isset(self::$CPP20)) { - self::$CPP20 = new BuildRuntime('cpp-20'); - } + self::$CPP20 ??= new BuildRuntime('cpp-20'); + return self::$CPP20; } public static function BUN10(): BuildRuntime { - if (!isset(self::$BUN10)) { - self::$BUN10 = new BuildRuntime('bun-1.0'); - } + self::$BUN10 ??= new BuildRuntime('bun-1.0'); + return self::$BUN10; } public static function BUN11(): BuildRuntime { - if (!isset(self::$BUN11)) { - self::$BUN11 = new BuildRuntime('bun-1.1'); - } + self::$BUN11 ??= new BuildRuntime('bun-1.1'); + return self::$BUN11; } public static function BUN12(): BuildRuntime { - if (!isset(self::$BUN12)) { - self::$BUN12 = new BuildRuntime('bun-1.2'); - } + self::$BUN12 ??= new BuildRuntime('bun-1.2'); + return self::$BUN12; } public static function BUN13(): BuildRuntime { - if (!isset(self::$BUN13)) { - self::$BUN13 = new BuildRuntime('bun-1.3'); - } + self::$BUN13 ??= new BuildRuntime('bun-1.3'); + return self::$BUN13; } public static function BUN14(): BuildRuntime { - if (!isset(self::$BUN14)) { - self::$BUN14 = new BuildRuntime('bun-1.4'); - } + self::$BUN14 ??= new BuildRuntime('bun-1.4'); + return self::$BUN14; } public static function GO123(): BuildRuntime { - if (!isset(self::$GO123)) { - self::$GO123 = new BuildRuntime('go-1.23'); - } + self::$GO123 ??= new BuildRuntime('go-1.23'); + return self::$GO123; } public static function GO124(): BuildRuntime { - if (!isset(self::$GO124)) { - self::$GO124 = new BuildRuntime('go-1.24'); - } + self::$GO124 ??= new BuildRuntime('go-1.24'); + return self::$GO124; } public static function GO125(): BuildRuntime { - if (!isset(self::$GO125)) { - self::$GO125 = new BuildRuntime('go-1.25'); - } + self::$GO125 ??= new BuildRuntime('go-1.25'); + return self::$GO125; } public static function GO126(): BuildRuntime { - if (!isset(self::$GO126)) { - self::$GO126 = new BuildRuntime('go-1.26'); - } + self::$GO126 ??= new BuildRuntime('go-1.26'); + return self::$GO126; } public static function RUST183(): BuildRuntime { - if (!isset(self::$RUST183)) { - self::$RUST183 = new BuildRuntime('rust-1.83'); - } + self::$RUST183 ??= new BuildRuntime('rust-1.83'); + return self::$RUST183; } public static function STATIC1(): BuildRuntime { - if (!isset(self::$STATIC1)) { - self::$STATIC1 = new BuildRuntime('static-1'); - } + self::$STATIC1 ??= new BuildRuntime('static-1'); + return self::$STATIC1; } public static function FLUTTER324(): BuildRuntime { - if (!isset(self::$FLUTTER324)) { - self::$FLUTTER324 = new BuildRuntime('flutter-3.24'); - } + self::$FLUTTER324 ??= new BuildRuntime('flutter-3.24'); + return self::$FLUTTER324; } public static function FLUTTER327(): BuildRuntime { - if (!isset(self::$FLUTTER327)) { - self::$FLUTTER327 = new BuildRuntime('flutter-3.27'); - } + self::$FLUTTER327 ??= new BuildRuntime('flutter-3.27'); + return self::$FLUTTER327; } public static function FLUTTER329(): BuildRuntime { - if (!isset(self::$FLUTTER329)) { - self::$FLUTTER329 = new BuildRuntime('flutter-3.29'); - } + self::$FLUTTER329 ??= new BuildRuntime('flutter-3.29'); + return self::$FLUTTER329; } public static function FLUTTER332(): BuildRuntime { - if (!isset(self::$FLUTTER332)) { - self::$FLUTTER332 = new BuildRuntime('flutter-3.32'); - } + self::$FLUTTER332 ??= new BuildRuntime('flutter-3.32'); + return self::$FLUTTER332; } public static function FLUTTER335(): BuildRuntime { - if (!isset(self::$FLUTTER335)) { - self::$FLUTTER335 = new BuildRuntime('flutter-3.35'); - } + self::$FLUTTER335 ??= new BuildRuntime('flutter-3.35'); + return self::$FLUTTER335; } public static function FLUTTER338(): BuildRuntime { - if (!isset(self::$FLUTTER338)) { - self::$FLUTTER338 = new BuildRuntime('flutter-3.38'); - } + self::$FLUTTER338 ??= new BuildRuntime('flutter-3.38'); + return self::$FLUTTER338; } public static function FLUTTER341(): BuildRuntime { - if (!isset(self::$FLUTTER341)) { - self::$FLUTTER341 = new BuildRuntime('flutter-3.41'); - } + self::$FLUTTER341 ??= new BuildRuntime('flutter-3.41'); + return self::$FLUTTER341; } public static function FLUTTER344(): BuildRuntime { - if (!isset(self::$FLUTTER344)) { - self::$FLUTTER344 = new BuildRuntime('flutter-3.44'); - } + self::$FLUTTER344 ??= new BuildRuntime('flutter-3.44'); + return self::$FLUTTER344; } diff --git a/src/Appwrite/Enums/ColumnStatus.php b/src/Appwrite/Enums/ColumnStatus.php index a601711..1bfead0 100644 --- a/src/Appwrite/Enums/ColumnStatus.php +++ b/src/Appwrite/Enums/ColumnStatus.php @@ -31,37 +31,32 @@ public function jsonSerialize(): string public static function AVAILABLE(): ColumnStatus { - if (!isset(self::$AVAILABLE)) { - self::$AVAILABLE = new ColumnStatus('available'); - } + self::$AVAILABLE ??= new ColumnStatus('available'); + return self::$AVAILABLE; } public static function PROCESSING(): ColumnStatus { - if (!isset(self::$PROCESSING)) { - self::$PROCESSING = new ColumnStatus('processing'); - } + self::$PROCESSING ??= new ColumnStatus('processing'); + return self::$PROCESSING; } public static function DELETING(): ColumnStatus { - if (!isset(self::$DELETING)) { - self::$DELETING = new ColumnStatus('deleting'); - } + self::$DELETING ??= new ColumnStatus('deleting'); + return self::$DELETING; } public static function STUCK(): ColumnStatus { - if (!isset(self::$STUCK)) { - self::$STUCK = new ColumnStatus('stuck'); - } + self::$STUCK ??= new ColumnStatus('stuck'); + return self::$STUCK; } public static function FAILED(): ColumnStatus { - if (!isset(self::$FAILED)) { - self::$FAILED = new ColumnStatus('failed'); - } + self::$FAILED ??= new ColumnStatus('failed'); + return self::$FAILED; } diff --git a/src/Appwrite/Enums/Compression.php b/src/Appwrite/Enums/Compression.php index fad5e5f..400bfb5 100644 --- a/src/Appwrite/Enums/Compression.php +++ b/src/Appwrite/Enums/Compression.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function NONE(): Compression { - if (!isset(self::$NONE)) { - self::$NONE = new Compression('none'); - } + self::$NONE ??= new Compression('none'); + return self::$NONE; } public static function GZIP(): Compression { - if (!isset(self::$GZIP)) { - self::$GZIP = new Compression('gzip'); - } + self::$GZIP ??= new Compression('gzip'); + return self::$GZIP; } public static function ZSTD(): Compression { - if (!isset(self::$ZSTD)) { - self::$ZSTD = new Compression('zstd'); - } + self::$ZSTD ??= new Compression('zstd'); + return self::$ZSTD; } diff --git a/src/Appwrite/Enums/CreditCard.php b/src/Appwrite/Enums/CreditCard.php index a99bca6..382aa52 100644 --- a/src/Appwrite/Enums/CreditCard.php +++ b/src/Appwrite/Enums/CreditCard.php @@ -43,121 +43,104 @@ public function jsonSerialize(): string public static function AMERICANEXPRESS(): CreditCard { - if (!isset(self::$AMERICANEXPRESS)) { - self::$AMERICANEXPRESS = new CreditCard('amex'); - } + self::$AMERICANEXPRESS ??= new CreditCard('amex'); + return self::$AMERICANEXPRESS; } public static function ARGENCARD(): CreditCard { - if (!isset(self::$ARGENCARD)) { - self::$ARGENCARD = new CreditCard('argencard'); - } + self::$ARGENCARD ??= new CreditCard('argencard'); + return self::$ARGENCARD; } public static function CABAL(): CreditCard { - if (!isset(self::$CABAL)) { - self::$CABAL = new CreditCard('cabal'); - } + self::$CABAL ??= new CreditCard('cabal'); + return self::$CABAL; } public static function CENCOSUD(): CreditCard { - if (!isset(self::$CENCOSUD)) { - self::$CENCOSUD = new CreditCard('cencosud'); - } + self::$CENCOSUD ??= new CreditCard('cencosud'); + return self::$CENCOSUD; } public static function DINERSCLUB(): CreditCard { - if (!isset(self::$DINERSCLUB)) { - self::$DINERSCLUB = new CreditCard('diners'); - } + self::$DINERSCLUB ??= new CreditCard('diners'); + return self::$DINERSCLUB; } public static function DISCOVER(): CreditCard { - if (!isset(self::$DISCOVER)) { - self::$DISCOVER = new CreditCard('discover'); - } + self::$DISCOVER ??= new CreditCard('discover'); + return self::$DISCOVER; } public static function ELO(): CreditCard { - if (!isset(self::$ELO)) { - self::$ELO = new CreditCard('elo'); - } + self::$ELO ??= new CreditCard('elo'); + return self::$ELO; } public static function HIPERCARD(): CreditCard { - if (!isset(self::$HIPERCARD)) { - self::$HIPERCARD = new CreditCard('hipercard'); - } + self::$HIPERCARD ??= new CreditCard('hipercard'); + return self::$HIPERCARD; } public static function JCB(): CreditCard { - if (!isset(self::$JCB)) { - self::$JCB = new CreditCard('jcb'); - } + self::$JCB ??= new CreditCard('jcb'); + return self::$JCB; } public static function MASTERCARD(): CreditCard { - if (!isset(self::$MASTERCARD)) { - self::$MASTERCARD = new CreditCard('mastercard'); - } + self::$MASTERCARD ??= new CreditCard('mastercard'); + return self::$MASTERCARD; } public static function NARANJA(): CreditCard { - if (!isset(self::$NARANJA)) { - self::$NARANJA = new CreditCard('naranja'); - } + self::$NARANJA ??= new CreditCard('naranja'); + return self::$NARANJA; } public static function TARJETASHOPPING(): CreditCard { - if (!isset(self::$TARJETASHOPPING)) { - self::$TARJETASHOPPING = new CreditCard('targeta-shopping'); - } + self::$TARJETASHOPPING ??= new CreditCard('targeta-shopping'); + return self::$TARJETASHOPPING; } public static function UNIONPAY(): CreditCard { - if (!isset(self::$UNIONPAY)) { - self::$UNIONPAY = new CreditCard('unionpay'); - } + self::$UNIONPAY ??= new CreditCard('unionpay'); + return self::$UNIONPAY; } public static function VISA(): CreditCard { - if (!isset(self::$VISA)) { - self::$VISA = new CreditCard('visa'); - } + self::$VISA ??= new CreditCard('visa'); + return self::$VISA; } public static function MIR(): CreditCard { - if (!isset(self::$MIR)) { - self::$MIR = new CreditCard('mir'); - } + self::$MIR ??= new CreditCard('mir'); + return self::$MIR; } public static function MAESTRO(): CreditCard { - if (!isset(self::$MAESTRO)) { - self::$MAESTRO = new CreditCard('maestro'); - } + self::$MAESTRO ??= new CreditCard('maestro'); + return self::$MAESTRO; } public static function RUPAY(): CreditCard { - if (!isset(self::$RUPAY)) { - self::$RUPAY = new CreditCard('rupay'); - } + self::$RUPAY ??= new CreditCard('rupay'); + return self::$RUPAY; } diff --git a/src/Appwrite/Enums/DatabaseStatus.php b/src/Appwrite/Enums/DatabaseStatus.php index d6e2edc..dff75a8 100644 --- a/src/Appwrite/Enums/DatabaseStatus.php +++ b/src/Appwrite/Enums/DatabaseStatus.php @@ -40,100 +40,86 @@ public function jsonSerialize(): string public static function PROVISIONING(): DatabaseStatus { - if (!isset(self::$PROVISIONING)) { - self::$PROVISIONING = new DatabaseStatus('provisioning'); - } + self::$PROVISIONING ??= new DatabaseStatus('provisioning'); + return self::$PROVISIONING; } public static function READY(): DatabaseStatus { - if (!isset(self::$READY)) { - self::$READY = new DatabaseStatus('ready'); - } + self::$READY ??= new DatabaseStatus('ready'); + return self::$READY; } public static function INACTIVE(): DatabaseStatus { - if (!isset(self::$INACTIVE)) { - self::$INACTIVE = new DatabaseStatus('inactive'); - } + self::$INACTIVE ??= new DatabaseStatus('inactive'); + return self::$INACTIVE; } public static function PAUSED(): DatabaseStatus { - if (!isset(self::$PAUSED)) { - self::$PAUSED = new DatabaseStatus('paused'); - } + self::$PAUSED ??= new DatabaseStatus('paused'); + return self::$PAUSED; } public static function FAILED(): DatabaseStatus { - if (!isset(self::$FAILED)) { - self::$FAILED = new DatabaseStatus('failed'); - } + self::$FAILED ??= new DatabaseStatus('failed'); + return self::$FAILED; } public static function DELETING(): DatabaseStatus { - if (!isset(self::$DELETING)) { - self::$DELETING = new DatabaseStatus('deleting'); - } + self::$DELETING ??= new DatabaseStatus('deleting'); + return self::$DELETING; } public static function DELETED(): DatabaseStatus { - if (!isset(self::$DELETED)) { - self::$DELETED = new DatabaseStatus('deleted'); - } + self::$DELETED ??= new DatabaseStatus('deleted'); + return self::$DELETED; } public static function RESTORING(): DatabaseStatus { - if (!isset(self::$RESTORING)) { - self::$RESTORING = new DatabaseStatus('restoring'); - } + self::$RESTORING ??= new DatabaseStatus('restoring'); + return self::$RESTORING; } public static function SCALING(): DatabaseStatus { - if (!isset(self::$SCALING)) { - self::$SCALING = new DatabaseStatus('scaling'); - } + self::$SCALING ??= new DatabaseStatus('scaling'); + return self::$SCALING; } public static function UPGRADING(): DatabaseStatus { - if (!isset(self::$UPGRADING)) { - self::$UPGRADING = new DatabaseStatus('upgrading'); - } + self::$UPGRADING ??= new DatabaseStatus('upgrading'); + return self::$UPGRADING; } public static function MIGRATING(): DatabaseStatus { - if (!isset(self::$MIGRATING)) { - self::$MIGRATING = new DatabaseStatus('migrating'); - } + self::$MIGRATING ??= new DatabaseStatus('migrating'); + return self::$MIGRATING; } public static function PAUSING(): DatabaseStatus { - if (!isset(self::$PAUSING)) { - self::$PAUSING = new DatabaseStatus('pausing'); - } + self::$PAUSING ??= new DatabaseStatus('pausing'); + return self::$PAUSING; } public static function RESUMING(): DatabaseStatus { - if (!isset(self::$RESUMING)) { - self::$RESUMING = new DatabaseStatus('resuming'); - } + self::$RESUMING ??= new DatabaseStatus('resuming'); + return self::$RESUMING; } public static function FAILINGOVER(): DatabaseStatus { - if (!isset(self::$FAILINGOVER)) { - self::$FAILINGOVER = new DatabaseStatus('failing-over'); - } + self::$FAILINGOVER ??= new DatabaseStatus('failing-over'); + return self::$FAILINGOVER; } diff --git a/src/Appwrite/Enums/DatabaseType.php b/src/Appwrite/Enums/DatabaseType.php index 9a33656..646a345 100644 --- a/src/Appwrite/Enums/DatabaseType.php +++ b/src/Appwrite/Enums/DatabaseType.php @@ -33,51 +33,44 @@ public function jsonSerialize(): string public static function LEGACY(): DatabaseType { - if (!isset(self::$LEGACY)) { - self::$LEGACY = new DatabaseType('legacy'); - } + self::$LEGACY ??= new DatabaseType('legacy'); + return self::$LEGACY; } public static function TABLESDB(): DatabaseType { - if (!isset(self::$TABLESDB)) { - self::$TABLESDB = new DatabaseType('tablesdb'); - } + self::$TABLESDB ??= new DatabaseType('tablesdb'); + return self::$TABLESDB; } public static function DOCUMENTSDB(): DatabaseType { - if (!isset(self::$DOCUMENTSDB)) { - self::$DOCUMENTSDB = new DatabaseType('documentsdb'); - } + self::$DOCUMENTSDB ??= new DatabaseType('documentsdb'); + return self::$DOCUMENTSDB; } public static function VECTORSDB(): DatabaseType { - if (!isset(self::$VECTORSDB)) { - self::$VECTORSDB = new DatabaseType('vectorsdb'); - } + self::$VECTORSDB ??= new DatabaseType('vectorsdb'); + return self::$VECTORSDB; } public static function MYSQL(): DatabaseType { - if (!isset(self::$MYSQL)) { - self::$MYSQL = new DatabaseType('mysql'); - } + self::$MYSQL ??= new DatabaseType('mysql'); + return self::$MYSQL; } public static function POSTGRESQL(): DatabaseType { - if (!isset(self::$POSTGRESQL)) { - self::$POSTGRESQL = new DatabaseType('postgresql'); - } + self::$POSTGRESQL ??= new DatabaseType('postgresql'); + return self::$POSTGRESQL; } public static function MONGODB(): DatabaseType { - if (!isset(self::$MONGODB)) { - self::$MONGODB = new DatabaseType('mongodb'); - } + self::$MONGODB ??= new DatabaseType('mongodb'); + return self::$MONGODB; } diff --git a/src/Appwrite/Enums/DatabasesIndexType.php b/src/Appwrite/Enums/DatabasesIndexType.php index d4e6eda..bdc8602 100644 --- a/src/Appwrite/Enums/DatabasesIndexType.php +++ b/src/Appwrite/Enums/DatabasesIndexType.php @@ -30,30 +30,26 @@ public function jsonSerialize(): string public static function KEY(): DatabasesIndexType { - if (!isset(self::$KEY)) { - self::$KEY = new DatabasesIndexType('key'); - } + self::$KEY ??= new DatabasesIndexType('key'); + return self::$KEY; } public static function FULLTEXT(): DatabasesIndexType { - if (!isset(self::$FULLTEXT)) { - self::$FULLTEXT = new DatabasesIndexType('fulltext'); - } + self::$FULLTEXT ??= new DatabasesIndexType('fulltext'); + return self::$FULLTEXT; } public static function UNIQUE(): DatabasesIndexType { - if (!isset(self::$UNIQUE)) { - self::$UNIQUE = new DatabasesIndexType('unique'); - } + self::$UNIQUE ??= new DatabasesIndexType('unique'); + return self::$UNIQUE; } public static function SPATIAL(): DatabasesIndexType { - if (!isset(self::$SPATIAL)) { - self::$SPATIAL = new DatabasesIndexType('spatial'); - } + self::$SPATIAL ??= new DatabasesIndexType('spatial'); + return self::$SPATIAL; } diff --git a/src/Appwrite/Enums/DeploymentDownloadType.php b/src/Appwrite/Enums/DeploymentDownloadType.php index 4e84800..0894063 100644 --- a/src/Appwrite/Enums/DeploymentDownloadType.php +++ b/src/Appwrite/Enums/DeploymentDownloadType.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function SOURCE(): DeploymentDownloadType { - if (!isset(self::$SOURCE)) { - self::$SOURCE = new DeploymentDownloadType('source'); - } + self::$SOURCE ??= new DeploymentDownloadType('source'); + return self::$SOURCE; } public static function OUTPUT(): DeploymentDownloadType { - if (!isset(self::$OUTPUT)) { - self::$OUTPUT = new DeploymentDownloadType('output'); - } + self::$OUTPUT ??= new DeploymentDownloadType('output'); + return self::$OUTPUT; } diff --git a/src/Appwrite/Enums/DeploymentStatus.php b/src/Appwrite/Enums/DeploymentStatus.php index 34f9706..c521dbb 100644 --- a/src/Appwrite/Enums/DeploymentStatus.php +++ b/src/Appwrite/Enums/DeploymentStatus.php @@ -32,44 +32,38 @@ public function jsonSerialize(): string public static function WAITING(): DeploymentStatus { - if (!isset(self::$WAITING)) { - self::$WAITING = new DeploymentStatus('waiting'); - } + self::$WAITING ??= new DeploymentStatus('waiting'); + return self::$WAITING; } public static function PROCESSING(): DeploymentStatus { - if (!isset(self::$PROCESSING)) { - self::$PROCESSING = new DeploymentStatus('processing'); - } + self::$PROCESSING ??= new DeploymentStatus('processing'); + return self::$PROCESSING; } public static function BUILDING(): DeploymentStatus { - if (!isset(self::$BUILDING)) { - self::$BUILDING = new DeploymentStatus('building'); - } + self::$BUILDING ??= new DeploymentStatus('building'); + return self::$BUILDING; } public static function READY(): DeploymentStatus { - if (!isset(self::$READY)) { - self::$READY = new DeploymentStatus('ready'); - } + self::$READY ??= new DeploymentStatus('ready'); + return self::$READY; } public static function CANCELED(): DeploymentStatus { - if (!isset(self::$CANCELED)) { - self::$CANCELED = new DeploymentStatus('canceled'); - } + self::$CANCELED ??= new DeploymentStatus('canceled'); + return self::$CANCELED; } public static function FAILED(): DeploymentStatus { - if (!isset(self::$FAILED)) { - self::$FAILED = new DeploymentStatus('failed'); - } + self::$FAILED ??= new DeploymentStatus('failed'); + return self::$FAILED; } diff --git a/src/Appwrite/Enums/DocumentsDBIndexType.php b/src/Appwrite/Enums/DocumentsDBIndexType.php new file mode 100644 index 0000000..0753519 --- /dev/null +++ b/src/Appwrite/Enums/DocumentsDBIndexType.php @@ -0,0 +1,58 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function KEY(): DocumentsDBIndexType + { + self::$KEY ??= new DocumentsDBIndexType('key'); + + return self::$KEY; + } + public static function FULLTEXT(): DocumentsDBIndexType + { + self::$FULLTEXT ??= new DocumentsDBIndexType('fulltext'); + + return self::$FULLTEXT; + } + public static function UNIQUE(): DocumentsDBIndexType + { + self::$UNIQUE ??= new DocumentsDBIndexType('unique'); + + return self::$UNIQUE; + } + + public static function from(string $value): self + { + return match ($value) { + 'key' => self::KEY(), + 'fulltext' => self::FULLTEXT(), + 'unique' => self::UNIQUE(), + default => throw new \InvalidArgumentException('Unknown DocumentsDBIndexType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Enums/EmbeddingModel.php b/src/Appwrite/Enums/EmbeddingModel.php index 3ffa7a7..c1be8f7 100644 --- a/src/Appwrite/Enums/EmbeddingModel.php +++ b/src/Appwrite/Enums/EmbeddingModel.php @@ -10,9 +10,7 @@ class EmbeddingModel implements JsonSerializable, Stringable { private static EmbeddingModel $NOMICEMBEDTEXT; - private static EmbeddingModel $EMBEDDINGGEMMA; private static EmbeddingModel $ALLMINILM; - private static EmbeddingModel $BGESMALL; private function __construct(private readonly string $value) { @@ -30,40 +28,22 @@ public function jsonSerialize(): string public static function NOMICEMBEDTEXT(): EmbeddingModel { - if (!isset(self::$NOMICEMBEDTEXT)) { - self::$NOMICEMBEDTEXT = new EmbeddingModel('nomic-embed-text'); - } + self::$NOMICEMBEDTEXT ??= new EmbeddingModel('nomic-embed-text'); + return self::$NOMICEMBEDTEXT; } - public static function EMBEDDINGGEMMA(): EmbeddingModel - { - if (!isset(self::$EMBEDDINGGEMMA)) { - self::$EMBEDDINGGEMMA = new EmbeddingModel('embedding-gemma'); - } - return self::$EMBEDDINGGEMMA; - } public static function ALLMINILM(): EmbeddingModel { - if (!isset(self::$ALLMINILM)) { - self::$ALLMINILM = new EmbeddingModel('all-minilm'); - } + self::$ALLMINILM ??= new EmbeddingModel('all-minilm'); + return self::$ALLMINILM; } - public static function BGESMALL(): EmbeddingModel - { - if (!isset(self::$BGESMALL)) { - self::$BGESMALL = new EmbeddingModel('bge-small'); - } - return self::$BGESMALL; - } public static function from(string $value): self { return match ($value) { 'nomic-embed-text' => self::NOMICEMBEDTEXT(), - 'embedding-gemma' => self::EMBEDDINGGEMMA(), 'all-minilm' => self::ALLMINILM(), - 'bge-small' => self::BGESMALL(), default => throw new \InvalidArgumentException('Unknown EmbeddingModel value: ' . $value), }; } diff --git a/src/Appwrite/Enums/ExecutionMethod.php b/src/Appwrite/Enums/ExecutionMethod.php index e8a9c82..45b900a 100644 --- a/src/Appwrite/Enums/ExecutionMethod.php +++ b/src/Appwrite/Enums/ExecutionMethod.php @@ -33,51 +33,44 @@ public function jsonSerialize(): string public static function GET(): ExecutionMethod { - if (!isset(self::$GET)) { - self::$GET = new ExecutionMethod('GET'); - } + self::$GET ??= new ExecutionMethod('GET'); + return self::$GET; } public static function POST(): ExecutionMethod { - if (!isset(self::$POST)) { - self::$POST = new ExecutionMethod('POST'); - } + self::$POST ??= new ExecutionMethod('POST'); + return self::$POST; } public static function PUT(): ExecutionMethod { - if (!isset(self::$PUT)) { - self::$PUT = new ExecutionMethod('PUT'); - } + self::$PUT ??= new ExecutionMethod('PUT'); + return self::$PUT; } public static function PATCH(): ExecutionMethod { - if (!isset(self::$PATCH)) { - self::$PATCH = new ExecutionMethod('PATCH'); - } + self::$PATCH ??= new ExecutionMethod('PATCH'); + return self::$PATCH; } public static function DELETE(): ExecutionMethod { - if (!isset(self::$DELETE)) { - self::$DELETE = new ExecutionMethod('DELETE'); - } + self::$DELETE ??= new ExecutionMethod('DELETE'); + return self::$DELETE; } public static function OPTIONS(): ExecutionMethod { - if (!isset(self::$OPTIONS)) { - self::$OPTIONS = new ExecutionMethod('OPTIONS'); - } + self::$OPTIONS ??= new ExecutionMethod('OPTIONS'); + return self::$OPTIONS; } public static function HEAD(): ExecutionMethod { - if (!isset(self::$HEAD)) { - self::$HEAD = new ExecutionMethod('HEAD'); - } + self::$HEAD ??= new ExecutionMethod('HEAD'); + return self::$HEAD; } diff --git a/src/Appwrite/Enums/ExecutionResourceType.php b/src/Appwrite/Enums/ExecutionResourceType.php index 948e561..2e6a487 100644 --- a/src/Appwrite/Enums/ExecutionResourceType.php +++ b/src/Appwrite/Enums/ExecutionResourceType.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function FUNCTIONS(): ExecutionResourceType { - if (!isset(self::$FUNCTIONS)) { - self::$FUNCTIONS = new ExecutionResourceType('functions'); - } + self::$FUNCTIONS ??= new ExecutionResourceType('functions'); + return self::$FUNCTIONS; } public static function SITES(): ExecutionResourceType { - if (!isset(self::$SITES)) { - self::$SITES = new ExecutionResourceType('sites'); - } + self::$SITES ??= new ExecutionResourceType('sites'); + return self::$SITES; } diff --git a/src/Appwrite/Enums/ExecutionStatus.php b/src/Appwrite/Enums/ExecutionStatus.php index c7cae79..11c4bfc 100644 --- a/src/Appwrite/Enums/ExecutionStatus.php +++ b/src/Appwrite/Enums/ExecutionStatus.php @@ -31,37 +31,32 @@ public function jsonSerialize(): string public static function WAITING(): ExecutionStatus { - if (!isset(self::$WAITING)) { - self::$WAITING = new ExecutionStatus('waiting'); - } + self::$WAITING ??= new ExecutionStatus('waiting'); + return self::$WAITING; } public static function PROCESSING(): ExecutionStatus { - if (!isset(self::$PROCESSING)) { - self::$PROCESSING = new ExecutionStatus('processing'); - } + self::$PROCESSING ??= new ExecutionStatus('processing'); + return self::$PROCESSING; } public static function COMPLETED(): ExecutionStatus { - if (!isset(self::$COMPLETED)) { - self::$COMPLETED = new ExecutionStatus('completed'); - } + self::$COMPLETED ??= new ExecutionStatus('completed'); + return self::$COMPLETED; } public static function FAILED(): ExecutionStatus { - if (!isset(self::$FAILED)) { - self::$FAILED = new ExecutionStatus('failed'); - } + self::$FAILED ??= new ExecutionStatus('failed'); + return self::$FAILED; } public static function SCHEDULED(): ExecutionStatus { - if (!isset(self::$SCHEDULED)) { - self::$SCHEDULED = new ExecutionStatus('scheduled'); - } + self::$SCHEDULED ??= new ExecutionStatus('scheduled'); + return self::$SCHEDULED; } diff --git a/src/Appwrite/Enums/ExecutionTrigger.php b/src/Appwrite/Enums/ExecutionTrigger.php index 26487f4..fccf3f2 100644 --- a/src/Appwrite/Enums/ExecutionTrigger.php +++ b/src/Appwrite/Enums/ExecutionTrigger.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function HTTP(): ExecutionTrigger { - if (!isset(self::$HTTP)) { - self::$HTTP = new ExecutionTrigger('http'); - } + self::$HTTP ??= new ExecutionTrigger('http'); + return self::$HTTP; } public static function SCHEDULE(): ExecutionTrigger { - if (!isset(self::$SCHEDULE)) { - self::$SCHEDULE = new ExecutionTrigger('schedule'); - } + self::$SCHEDULE ??= new ExecutionTrigger('schedule'); + return self::$SCHEDULE; } public static function EVENT(): ExecutionTrigger { - if (!isset(self::$EVENT)) { - self::$EVENT = new ExecutionTrigger('event'); - } + self::$EVENT ??= new ExecutionTrigger('event'); + return self::$EVENT; } diff --git a/src/Appwrite/Enums/Flag.php b/src/Appwrite/Enums/Flag.php index a4d6c50..8aa0c3b 100644 --- a/src/Appwrite/Enums/Flag.php +++ b/src/Appwrite/Enums/Flag.php @@ -221,1367 +221,1172 @@ public function jsonSerialize(): string public static function AFGHANISTAN(): Flag { - if (!isset(self::$AFGHANISTAN)) { - self::$AFGHANISTAN = new Flag('af'); - } + self::$AFGHANISTAN ??= new Flag('af'); + return self::$AFGHANISTAN; } public static function ANGOLA(): Flag { - if (!isset(self::$ANGOLA)) { - self::$ANGOLA = new Flag('ao'); - } + self::$ANGOLA ??= new Flag('ao'); + return self::$ANGOLA; } public static function ALBANIA(): Flag { - if (!isset(self::$ALBANIA)) { - self::$ALBANIA = new Flag('al'); - } + self::$ALBANIA ??= new Flag('al'); + return self::$ALBANIA; } public static function ANDORRA(): Flag { - if (!isset(self::$ANDORRA)) { - self::$ANDORRA = new Flag('ad'); - } + self::$ANDORRA ??= new Flag('ad'); + return self::$ANDORRA; } public static function UNITEDARABEMIRATES(): Flag { - if (!isset(self::$UNITEDARABEMIRATES)) { - self::$UNITEDARABEMIRATES = new Flag('ae'); - } + self::$UNITEDARABEMIRATES ??= new Flag('ae'); + return self::$UNITEDARABEMIRATES; } public static function ARGENTINA(): Flag { - if (!isset(self::$ARGENTINA)) { - self::$ARGENTINA = new Flag('ar'); - } + self::$ARGENTINA ??= new Flag('ar'); + return self::$ARGENTINA; } public static function ARMENIA(): Flag { - if (!isset(self::$ARMENIA)) { - self::$ARMENIA = new Flag('am'); - } + self::$ARMENIA ??= new Flag('am'); + return self::$ARMENIA; } public static function ANTIGUAANDBARBUDA(): Flag { - if (!isset(self::$ANTIGUAANDBARBUDA)) { - self::$ANTIGUAANDBARBUDA = new Flag('ag'); - } + self::$ANTIGUAANDBARBUDA ??= new Flag('ag'); + return self::$ANTIGUAANDBARBUDA; } public static function AUSTRALIA(): Flag { - if (!isset(self::$AUSTRALIA)) { - self::$AUSTRALIA = new Flag('au'); - } + self::$AUSTRALIA ??= new Flag('au'); + return self::$AUSTRALIA; } public static function AUSTRIA(): Flag { - if (!isset(self::$AUSTRIA)) { - self::$AUSTRIA = new Flag('at'); - } + self::$AUSTRIA ??= new Flag('at'); + return self::$AUSTRIA; } public static function AZERBAIJAN(): Flag { - if (!isset(self::$AZERBAIJAN)) { - self::$AZERBAIJAN = new Flag('az'); - } + self::$AZERBAIJAN ??= new Flag('az'); + return self::$AZERBAIJAN; } public static function BURUNDI(): Flag { - if (!isset(self::$BURUNDI)) { - self::$BURUNDI = new Flag('bi'); - } + self::$BURUNDI ??= new Flag('bi'); + return self::$BURUNDI; } public static function BELGIUM(): Flag { - if (!isset(self::$BELGIUM)) { - self::$BELGIUM = new Flag('be'); - } + self::$BELGIUM ??= new Flag('be'); + return self::$BELGIUM; } public static function BENIN(): Flag { - if (!isset(self::$BENIN)) { - self::$BENIN = new Flag('bj'); - } + self::$BENIN ??= new Flag('bj'); + return self::$BENIN; } public static function BURKINAFASO(): Flag { - if (!isset(self::$BURKINAFASO)) { - self::$BURKINAFASO = new Flag('bf'); - } + self::$BURKINAFASO ??= new Flag('bf'); + return self::$BURKINAFASO; } public static function BANGLADESH(): Flag { - if (!isset(self::$BANGLADESH)) { - self::$BANGLADESH = new Flag('bd'); - } + self::$BANGLADESH ??= new Flag('bd'); + return self::$BANGLADESH; } public static function BULGARIA(): Flag { - if (!isset(self::$BULGARIA)) { - self::$BULGARIA = new Flag('bg'); - } + self::$BULGARIA ??= new Flag('bg'); + return self::$BULGARIA; } public static function BAHRAIN(): Flag { - if (!isset(self::$BAHRAIN)) { - self::$BAHRAIN = new Flag('bh'); - } + self::$BAHRAIN ??= new Flag('bh'); + return self::$BAHRAIN; } public static function BAHAMAS(): Flag { - if (!isset(self::$BAHAMAS)) { - self::$BAHAMAS = new Flag('bs'); - } + self::$BAHAMAS ??= new Flag('bs'); + return self::$BAHAMAS; } public static function BOSNIAANDHERZEGOVINA(): Flag { - if (!isset(self::$BOSNIAANDHERZEGOVINA)) { - self::$BOSNIAANDHERZEGOVINA = new Flag('ba'); - } + self::$BOSNIAANDHERZEGOVINA ??= new Flag('ba'); + return self::$BOSNIAANDHERZEGOVINA; } public static function BELARUS(): Flag { - if (!isset(self::$BELARUS)) { - self::$BELARUS = new Flag('by'); - } + self::$BELARUS ??= new Flag('by'); + return self::$BELARUS; } public static function BELIZE(): Flag { - if (!isset(self::$BELIZE)) { - self::$BELIZE = new Flag('bz'); - } + self::$BELIZE ??= new Flag('bz'); + return self::$BELIZE; } public static function BOLIVIA(): Flag { - if (!isset(self::$BOLIVIA)) { - self::$BOLIVIA = new Flag('bo'); - } + self::$BOLIVIA ??= new Flag('bo'); + return self::$BOLIVIA; } public static function BRAZIL(): Flag { - if (!isset(self::$BRAZIL)) { - self::$BRAZIL = new Flag('br'); - } + self::$BRAZIL ??= new Flag('br'); + return self::$BRAZIL; } public static function BARBADOS(): Flag { - if (!isset(self::$BARBADOS)) { - self::$BARBADOS = new Flag('bb'); - } + self::$BARBADOS ??= new Flag('bb'); + return self::$BARBADOS; } public static function BRUNEIDARUSSALAM(): Flag { - if (!isset(self::$BRUNEIDARUSSALAM)) { - self::$BRUNEIDARUSSALAM = new Flag('bn'); - } + self::$BRUNEIDARUSSALAM ??= new Flag('bn'); + return self::$BRUNEIDARUSSALAM; } public static function BHUTAN(): Flag { - if (!isset(self::$BHUTAN)) { - self::$BHUTAN = new Flag('bt'); - } + self::$BHUTAN ??= new Flag('bt'); + return self::$BHUTAN; } public static function BOTSWANA(): Flag { - if (!isset(self::$BOTSWANA)) { - self::$BOTSWANA = new Flag('bw'); - } + self::$BOTSWANA ??= new Flag('bw'); + return self::$BOTSWANA; } public static function CENTRALAFRICANREPUBLIC(): Flag { - if (!isset(self::$CENTRALAFRICANREPUBLIC)) { - self::$CENTRALAFRICANREPUBLIC = new Flag('cf'); - } + self::$CENTRALAFRICANREPUBLIC ??= new Flag('cf'); + return self::$CENTRALAFRICANREPUBLIC; } public static function CANADA(): Flag { - if (!isset(self::$CANADA)) { - self::$CANADA = new Flag('ca'); - } + self::$CANADA ??= new Flag('ca'); + return self::$CANADA; } public static function SWITZERLAND(): Flag { - if (!isset(self::$SWITZERLAND)) { - self::$SWITZERLAND = new Flag('ch'); - } + self::$SWITZERLAND ??= new Flag('ch'); + return self::$SWITZERLAND; } public static function CHILE(): Flag { - if (!isset(self::$CHILE)) { - self::$CHILE = new Flag('cl'); - } + self::$CHILE ??= new Flag('cl'); + return self::$CHILE; } public static function CHINA(): Flag { - if (!isset(self::$CHINA)) { - self::$CHINA = new Flag('cn'); - } + self::$CHINA ??= new Flag('cn'); + return self::$CHINA; } public static function CTEDIVOIRE(): Flag { - if (!isset(self::$CTEDIVOIRE)) { - self::$CTEDIVOIRE = new Flag('ci'); - } + self::$CTEDIVOIRE ??= new Flag('ci'); + return self::$CTEDIVOIRE; } public static function CAMEROON(): Flag { - if (!isset(self::$CAMEROON)) { - self::$CAMEROON = new Flag('cm'); - } + self::$CAMEROON ??= new Flag('cm'); + return self::$CAMEROON; } public static function DEMOCRATICREPUBLICOFTHECONGO(): Flag { - if (!isset(self::$DEMOCRATICREPUBLICOFTHECONGO)) { - self::$DEMOCRATICREPUBLICOFTHECONGO = new Flag('cd'); - } + self::$DEMOCRATICREPUBLICOFTHECONGO ??= new Flag('cd'); + return self::$DEMOCRATICREPUBLICOFTHECONGO; } public static function REPUBLICOFTHECONGO(): Flag { - if (!isset(self::$REPUBLICOFTHECONGO)) { - self::$REPUBLICOFTHECONGO = new Flag('cg'); - } + self::$REPUBLICOFTHECONGO ??= new Flag('cg'); + return self::$REPUBLICOFTHECONGO; } public static function COLOMBIA(): Flag { - if (!isset(self::$COLOMBIA)) { - self::$COLOMBIA = new Flag('co'); - } + self::$COLOMBIA ??= new Flag('co'); + return self::$COLOMBIA; } public static function COMOROS(): Flag { - if (!isset(self::$COMOROS)) { - self::$COMOROS = new Flag('km'); - } + self::$COMOROS ??= new Flag('km'); + return self::$COMOROS; } public static function CAPEVERDE(): Flag { - if (!isset(self::$CAPEVERDE)) { - self::$CAPEVERDE = new Flag('cv'); - } + self::$CAPEVERDE ??= new Flag('cv'); + return self::$CAPEVERDE; } public static function COSTARICA(): Flag { - if (!isset(self::$COSTARICA)) { - self::$COSTARICA = new Flag('cr'); - } + self::$COSTARICA ??= new Flag('cr'); + return self::$COSTARICA; } public static function CUBA(): Flag { - if (!isset(self::$CUBA)) { - self::$CUBA = new Flag('cu'); - } + self::$CUBA ??= new Flag('cu'); + return self::$CUBA; } public static function CYPRUS(): Flag { - if (!isset(self::$CYPRUS)) { - self::$CYPRUS = new Flag('cy'); - } + self::$CYPRUS ??= new Flag('cy'); + return self::$CYPRUS; } public static function CZECHREPUBLIC(): Flag { - if (!isset(self::$CZECHREPUBLIC)) { - self::$CZECHREPUBLIC = new Flag('cz'); - } + self::$CZECHREPUBLIC ??= new Flag('cz'); + return self::$CZECHREPUBLIC; } public static function GERMANY(): Flag { - if (!isset(self::$GERMANY)) { - self::$GERMANY = new Flag('de'); - } + self::$GERMANY ??= new Flag('de'); + return self::$GERMANY; } public static function DJIBOUTI(): Flag { - if (!isset(self::$DJIBOUTI)) { - self::$DJIBOUTI = new Flag('dj'); - } + self::$DJIBOUTI ??= new Flag('dj'); + return self::$DJIBOUTI; } public static function DOMINICA(): Flag { - if (!isset(self::$DOMINICA)) { - self::$DOMINICA = new Flag('dm'); - } + self::$DOMINICA ??= new Flag('dm'); + return self::$DOMINICA; } public static function DENMARK(): Flag { - if (!isset(self::$DENMARK)) { - self::$DENMARK = new Flag('dk'); - } + self::$DENMARK ??= new Flag('dk'); + return self::$DENMARK; } public static function DOMINICANREPUBLIC(): Flag { - if (!isset(self::$DOMINICANREPUBLIC)) { - self::$DOMINICANREPUBLIC = new Flag('do'); - } + self::$DOMINICANREPUBLIC ??= new Flag('do'); + return self::$DOMINICANREPUBLIC; } public static function ALGERIA(): Flag { - if (!isset(self::$ALGERIA)) { - self::$ALGERIA = new Flag('dz'); - } + self::$ALGERIA ??= new Flag('dz'); + return self::$ALGERIA; } public static function ECUADOR(): Flag { - if (!isset(self::$ECUADOR)) { - self::$ECUADOR = new Flag('ec'); - } + self::$ECUADOR ??= new Flag('ec'); + return self::$ECUADOR; } public static function EGYPT(): Flag { - if (!isset(self::$EGYPT)) { - self::$EGYPT = new Flag('eg'); - } + self::$EGYPT ??= new Flag('eg'); + return self::$EGYPT; } public static function ERITREA(): Flag { - if (!isset(self::$ERITREA)) { - self::$ERITREA = new Flag('er'); - } + self::$ERITREA ??= new Flag('er'); + return self::$ERITREA; } public static function SPAIN(): Flag { - if (!isset(self::$SPAIN)) { - self::$SPAIN = new Flag('es'); - } + self::$SPAIN ??= new Flag('es'); + return self::$SPAIN; } public static function ESTONIA(): Flag { - if (!isset(self::$ESTONIA)) { - self::$ESTONIA = new Flag('ee'); - } + self::$ESTONIA ??= new Flag('ee'); + return self::$ESTONIA; } public static function ETHIOPIA(): Flag { - if (!isset(self::$ETHIOPIA)) { - self::$ETHIOPIA = new Flag('et'); - } + self::$ETHIOPIA ??= new Flag('et'); + return self::$ETHIOPIA; } public static function FINLAND(): Flag { - if (!isset(self::$FINLAND)) { - self::$FINLAND = new Flag('fi'); - } + self::$FINLAND ??= new Flag('fi'); + return self::$FINLAND; } public static function FIJI(): Flag { - if (!isset(self::$FIJI)) { - self::$FIJI = new Flag('fj'); - } + self::$FIJI ??= new Flag('fj'); + return self::$FIJI; } public static function FRANCE(): Flag { - if (!isset(self::$FRANCE)) { - self::$FRANCE = new Flag('fr'); - } + self::$FRANCE ??= new Flag('fr'); + return self::$FRANCE; } public static function MICRONESIAFEDERATEDSTATESOF(): Flag { - if (!isset(self::$MICRONESIAFEDERATEDSTATESOF)) { - self::$MICRONESIAFEDERATEDSTATESOF = new Flag('fm'); - } + self::$MICRONESIAFEDERATEDSTATESOF ??= new Flag('fm'); + return self::$MICRONESIAFEDERATEDSTATESOF; } public static function GABON(): Flag { - if (!isset(self::$GABON)) { - self::$GABON = new Flag('ga'); - } + self::$GABON ??= new Flag('ga'); + return self::$GABON; } public static function UNITEDKINGDOM(): Flag { - if (!isset(self::$UNITEDKINGDOM)) { - self::$UNITEDKINGDOM = new Flag('gb'); - } + self::$UNITEDKINGDOM ??= new Flag('gb'); + return self::$UNITEDKINGDOM; } public static function GEORGIA(): Flag { - if (!isset(self::$GEORGIA)) { - self::$GEORGIA = new Flag('ge'); - } + self::$GEORGIA ??= new Flag('ge'); + return self::$GEORGIA; } public static function GHANA(): Flag { - if (!isset(self::$GHANA)) { - self::$GHANA = new Flag('gh'); - } + self::$GHANA ??= new Flag('gh'); + return self::$GHANA; } public static function GUINEA(): Flag { - if (!isset(self::$GUINEA)) { - self::$GUINEA = new Flag('gn'); - } + self::$GUINEA ??= new Flag('gn'); + return self::$GUINEA; } public static function GAMBIA(): Flag { - if (!isset(self::$GAMBIA)) { - self::$GAMBIA = new Flag('gm'); - } + self::$GAMBIA ??= new Flag('gm'); + return self::$GAMBIA; } public static function GUINEABISSAU(): Flag { - if (!isset(self::$GUINEABISSAU)) { - self::$GUINEABISSAU = new Flag('gw'); - } + self::$GUINEABISSAU ??= new Flag('gw'); + return self::$GUINEABISSAU; } public static function EQUATORIALGUINEA(): Flag { - if (!isset(self::$EQUATORIALGUINEA)) { - self::$EQUATORIALGUINEA = new Flag('gq'); - } + self::$EQUATORIALGUINEA ??= new Flag('gq'); + return self::$EQUATORIALGUINEA; } public static function GREECE(): Flag { - if (!isset(self::$GREECE)) { - self::$GREECE = new Flag('gr'); - } + self::$GREECE ??= new Flag('gr'); + return self::$GREECE; } public static function GRENADA(): Flag { - if (!isset(self::$GRENADA)) { - self::$GRENADA = new Flag('gd'); - } + self::$GRENADA ??= new Flag('gd'); + return self::$GRENADA; } public static function GUATEMALA(): Flag { - if (!isset(self::$GUATEMALA)) { - self::$GUATEMALA = new Flag('gt'); - } + self::$GUATEMALA ??= new Flag('gt'); + return self::$GUATEMALA; } public static function GUYANA(): Flag { - if (!isset(self::$GUYANA)) { - self::$GUYANA = new Flag('gy'); - } + self::$GUYANA ??= new Flag('gy'); + return self::$GUYANA; } public static function HONDURAS(): Flag { - if (!isset(self::$HONDURAS)) { - self::$HONDURAS = new Flag('hn'); - } + self::$HONDURAS ??= new Flag('hn'); + return self::$HONDURAS; } public static function CROATIA(): Flag { - if (!isset(self::$CROATIA)) { - self::$CROATIA = new Flag('hr'); - } + self::$CROATIA ??= new Flag('hr'); + return self::$CROATIA; } public static function HAITI(): Flag { - if (!isset(self::$HAITI)) { - self::$HAITI = new Flag('ht'); - } + self::$HAITI ??= new Flag('ht'); + return self::$HAITI; } public static function HUNGARY(): Flag { - if (!isset(self::$HUNGARY)) { - self::$HUNGARY = new Flag('hu'); - } + self::$HUNGARY ??= new Flag('hu'); + return self::$HUNGARY; } public static function INDONESIA(): Flag { - if (!isset(self::$INDONESIA)) { - self::$INDONESIA = new Flag('id'); - } + self::$INDONESIA ??= new Flag('id'); + return self::$INDONESIA; } public static function INDIA(): Flag { - if (!isset(self::$INDIA)) { - self::$INDIA = new Flag('in'); - } + self::$INDIA ??= new Flag('in'); + return self::$INDIA; } public static function IRELAND(): Flag { - if (!isset(self::$IRELAND)) { - self::$IRELAND = new Flag('ie'); - } + self::$IRELAND ??= new Flag('ie'); + return self::$IRELAND; } public static function IRANISLAMICREPUBLICOF(): Flag { - if (!isset(self::$IRANISLAMICREPUBLICOF)) { - self::$IRANISLAMICREPUBLICOF = new Flag('ir'); - } + self::$IRANISLAMICREPUBLICOF ??= new Flag('ir'); + return self::$IRANISLAMICREPUBLICOF; } public static function IRAQ(): Flag { - if (!isset(self::$IRAQ)) { - self::$IRAQ = new Flag('iq'); - } + self::$IRAQ ??= new Flag('iq'); + return self::$IRAQ; } public static function ICELAND(): Flag { - if (!isset(self::$ICELAND)) { - self::$ICELAND = new Flag('is'); - } + self::$ICELAND ??= new Flag('is'); + return self::$ICELAND; } public static function ISRAEL(): Flag { - if (!isset(self::$ISRAEL)) { - self::$ISRAEL = new Flag('il'); - } + self::$ISRAEL ??= new Flag('il'); + return self::$ISRAEL; } public static function ITALY(): Flag { - if (!isset(self::$ITALY)) { - self::$ITALY = new Flag('it'); - } + self::$ITALY ??= new Flag('it'); + return self::$ITALY; } public static function JAMAICA(): Flag { - if (!isset(self::$JAMAICA)) { - self::$JAMAICA = new Flag('jm'); - } + self::$JAMAICA ??= new Flag('jm'); + return self::$JAMAICA; } public static function JORDAN(): Flag { - if (!isset(self::$JORDAN)) { - self::$JORDAN = new Flag('jo'); - } + self::$JORDAN ??= new Flag('jo'); + return self::$JORDAN; } public static function JAPAN(): Flag { - if (!isset(self::$JAPAN)) { - self::$JAPAN = new Flag('jp'); - } + self::$JAPAN ??= new Flag('jp'); + return self::$JAPAN; } public static function KAZAKHSTAN(): Flag { - if (!isset(self::$KAZAKHSTAN)) { - self::$KAZAKHSTAN = new Flag('kz'); - } + self::$KAZAKHSTAN ??= new Flag('kz'); + return self::$KAZAKHSTAN; } public static function KENYA(): Flag { - if (!isset(self::$KENYA)) { - self::$KENYA = new Flag('ke'); - } + self::$KENYA ??= new Flag('ke'); + return self::$KENYA; } public static function KYRGYZSTAN(): Flag { - if (!isset(self::$KYRGYZSTAN)) { - self::$KYRGYZSTAN = new Flag('kg'); - } + self::$KYRGYZSTAN ??= new Flag('kg'); + return self::$KYRGYZSTAN; } public static function CAMBODIA(): Flag { - if (!isset(self::$CAMBODIA)) { - self::$CAMBODIA = new Flag('kh'); - } + self::$CAMBODIA ??= new Flag('kh'); + return self::$CAMBODIA; } public static function KIRIBATI(): Flag { - if (!isset(self::$KIRIBATI)) { - self::$KIRIBATI = new Flag('ki'); - } + self::$KIRIBATI ??= new Flag('ki'); + return self::$KIRIBATI; } public static function SAINTKITTSANDNEVIS(): Flag { - if (!isset(self::$SAINTKITTSANDNEVIS)) { - self::$SAINTKITTSANDNEVIS = new Flag('kn'); - } + self::$SAINTKITTSANDNEVIS ??= new Flag('kn'); + return self::$SAINTKITTSANDNEVIS; } public static function SOUTHKOREA(): Flag { - if (!isset(self::$SOUTHKOREA)) { - self::$SOUTHKOREA = new Flag('kr'); - } + self::$SOUTHKOREA ??= new Flag('kr'); + return self::$SOUTHKOREA; } public static function KUWAIT(): Flag { - if (!isset(self::$KUWAIT)) { - self::$KUWAIT = new Flag('kw'); - } + self::$KUWAIT ??= new Flag('kw'); + return self::$KUWAIT; } public static function LAOPEOPLESDEMOCRATICREPUBLIC(): Flag { - if (!isset(self::$LAOPEOPLESDEMOCRATICREPUBLIC)) { - self::$LAOPEOPLESDEMOCRATICREPUBLIC = new Flag('la'); - } + self::$LAOPEOPLESDEMOCRATICREPUBLIC ??= new Flag('la'); + return self::$LAOPEOPLESDEMOCRATICREPUBLIC; } public static function LEBANON(): Flag { - if (!isset(self::$LEBANON)) { - self::$LEBANON = new Flag('lb'); - } + self::$LEBANON ??= new Flag('lb'); + return self::$LEBANON; } public static function LIBERIA(): Flag { - if (!isset(self::$LIBERIA)) { - self::$LIBERIA = new Flag('lr'); - } + self::$LIBERIA ??= new Flag('lr'); + return self::$LIBERIA; } public static function LIBYA(): Flag { - if (!isset(self::$LIBYA)) { - self::$LIBYA = new Flag('ly'); - } + self::$LIBYA ??= new Flag('ly'); + return self::$LIBYA; } public static function SAINTLUCIA(): Flag { - if (!isset(self::$SAINTLUCIA)) { - self::$SAINTLUCIA = new Flag('lc'); - } + self::$SAINTLUCIA ??= new Flag('lc'); + return self::$SAINTLUCIA; } public static function LIECHTENSTEIN(): Flag { - if (!isset(self::$LIECHTENSTEIN)) { - self::$LIECHTENSTEIN = new Flag('li'); - } + self::$LIECHTENSTEIN ??= new Flag('li'); + return self::$LIECHTENSTEIN; } public static function SRILANKA(): Flag { - if (!isset(self::$SRILANKA)) { - self::$SRILANKA = new Flag('lk'); - } + self::$SRILANKA ??= new Flag('lk'); + return self::$SRILANKA; } public static function LESOTHO(): Flag { - if (!isset(self::$LESOTHO)) { - self::$LESOTHO = new Flag('ls'); - } + self::$LESOTHO ??= new Flag('ls'); + return self::$LESOTHO; } public static function LITHUANIA(): Flag { - if (!isset(self::$LITHUANIA)) { - self::$LITHUANIA = new Flag('lt'); - } + self::$LITHUANIA ??= new Flag('lt'); + return self::$LITHUANIA; } public static function LUXEMBOURG(): Flag { - if (!isset(self::$LUXEMBOURG)) { - self::$LUXEMBOURG = new Flag('lu'); - } + self::$LUXEMBOURG ??= new Flag('lu'); + return self::$LUXEMBOURG; } public static function LATVIA(): Flag { - if (!isset(self::$LATVIA)) { - self::$LATVIA = new Flag('lv'); - } + self::$LATVIA ??= new Flag('lv'); + return self::$LATVIA; } public static function MOROCCO(): Flag { - if (!isset(self::$MOROCCO)) { - self::$MOROCCO = new Flag('ma'); - } + self::$MOROCCO ??= new Flag('ma'); + return self::$MOROCCO; } public static function MONACO(): Flag { - if (!isset(self::$MONACO)) { - self::$MONACO = new Flag('mc'); - } + self::$MONACO ??= new Flag('mc'); + return self::$MONACO; } public static function MOLDOVA(): Flag { - if (!isset(self::$MOLDOVA)) { - self::$MOLDOVA = new Flag('md'); - } + self::$MOLDOVA ??= new Flag('md'); + return self::$MOLDOVA; } public static function MADAGASCAR(): Flag { - if (!isset(self::$MADAGASCAR)) { - self::$MADAGASCAR = new Flag('mg'); - } + self::$MADAGASCAR ??= new Flag('mg'); + return self::$MADAGASCAR; } public static function MALDIVES(): Flag { - if (!isset(self::$MALDIVES)) { - self::$MALDIVES = new Flag('mv'); - } + self::$MALDIVES ??= new Flag('mv'); + return self::$MALDIVES; } public static function MEXICO(): Flag { - if (!isset(self::$MEXICO)) { - self::$MEXICO = new Flag('mx'); - } + self::$MEXICO ??= new Flag('mx'); + return self::$MEXICO; } public static function MARSHALLISLANDS(): Flag { - if (!isset(self::$MARSHALLISLANDS)) { - self::$MARSHALLISLANDS = new Flag('mh'); - } + self::$MARSHALLISLANDS ??= new Flag('mh'); + return self::$MARSHALLISLANDS; } public static function NORTHMACEDONIA(): Flag { - if (!isset(self::$NORTHMACEDONIA)) { - self::$NORTHMACEDONIA = new Flag('mk'); - } + self::$NORTHMACEDONIA ??= new Flag('mk'); + return self::$NORTHMACEDONIA; } public static function MALI(): Flag { - if (!isset(self::$MALI)) { - self::$MALI = new Flag('ml'); - } + self::$MALI ??= new Flag('ml'); + return self::$MALI; } public static function MALTA(): Flag { - if (!isset(self::$MALTA)) { - self::$MALTA = new Flag('mt'); - } + self::$MALTA ??= new Flag('mt'); + return self::$MALTA; } public static function MYANMAR(): Flag { - if (!isset(self::$MYANMAR)) { - self::$MYANMAR = new Flag('mm'); - } + self::$MYANMAR ??= new Flag('mm'); + return self::$MYANMAR; } public static function MONTENEGRO(): Flag { - if (!isset(self::$MONTENEGRO)) { - self::$MONTENEGRO = new Flag('me'); - } + self::$MONTENEGRO ??= new Flag('me'); + return self::$MONTENEGRO; } public static function MONGOLIA(): Flag { - if (!isset(self::$MONGOLIA)) { - self::$MONGOLIA = new Flag('mn'); - } + self::$MONGOLIA ??= new Flag('mn'); + return self::$MONGOLIA; } public static function MOZAMBIQUE(): Flag { - if (!isset(self::$MOZAMBIQUE)) { - self::$MOZAMBIQUE = new Flag('mz'); - } + self::$MOZAMBIQUE ??= new Flag('mz'); + return self::$MOZAMBIQUE; } public static function MAURITANIA(): Flag { - if (!isset(self::$MAURITANIA)) { - self::$MAURITANIA = new Flag('mr'); - } + self::$MAURITANIA ??= new Flag('mr'); + return self::$MAURITANIA; } public static function MAURITIUS(): Flag { - if (!isset(self::$MAURITIUS)) { - self::$MAURITIUS = new Flag('mu'); - } + self::$MAURITIUS ??= new Flag('mu'); + return self::$MAURITIUS; } public static function MALAWI(): Flag { - if (!isset(self::$MALAWI)) { - self::$MALAWI = new Flag('mw'); - } + self::$MALAWI ??= new Flag('mw'); + return self::$MALAWI; } public static function MALAYSIA(): Flag { - if (!isset(self::$MALAYSIA)) { - self::$MALAYSIA = new Flag('my'); - } + self::$MALAYSIA ??= new Flag('my'); + return self::$MALAYSIA; } public static function NAMIBIA(): Flag { - if (!isset(self::$NAMIBIA)) { - self::$NAMIBIA = new Flag('na'); - } + self::$NAMIBIA ??= new Flag('na'); + return self::$NAMIBIA; } public static function NIGER(): Flag { - if (!isset(self::$NIGER)) { - self::$NIGER = new Flag('ne'); - } + self::$NIGER ??= new Flag('ne'); + return self::$NIGER; } public static function NIGERIA(): Flag { - if (!isset(self::$NIGERIA)) { - self::$NIGERIA = new Flag('ng'); - } + self::$NIGERIA ??= new Flag('ng'); + return self::$NIGERIA; } public static function NICARAGUA(): Flag { - if (!isset(self::$NICARAGUA)) { - self::$NICARAGUA = new Flag('ni'); - } + self::$NICARAGUA ??= new Flag('ni'); + return self::$NICARAGUA; } public static function NETHERLANDS(): Flag { - if (!isset(self::$NETHERLANDS)) { - self::$NETHERLANDS = new Flag('nl'); - } + self::$NETHERLANDS ??= new Flag('nl'); + return self::$NETHERLANDS; } public static function NORWAY(): Flag { - if (!isset(self::$NORWAY)) { - self::$NORWAY = new Flag('no'); - } + self::$NORWAY ??= new Flag('no'); + return self::$NORWAY; } public static function NEPAL(): Flag { - if (!isset(self::$NEPAL)) { - self::$NEPAL = new Flag('np'); - } + self::$NEPAL ??= new Flag('np'); + return self::$NEPAL; } public static function NAURU(): Flag { - if (!isset(self::$NAURU)) { - self::$NAURU = new Flag('nr'); - } + self::$NAURU ??= new Flag('nr'); + return self::$NAURU; } public static function NEWZEALAND(): Flag { - if (!isset(self::$NEWZEALAND)) { - self::$NEWZEALAND = new Flag('nz'); - } + self::$NEWZEALAND ??= new Flag('nz'); + return self::$NEWZEALAND; } public static function OMAN(): Flag { - if (!isset(self::$OMAN)) { - self::$OMAN = new Flag('om'); - } + self::$OMAN ??= new Flag('om'); + return self::$OMAN; } public static function PAKISTAN(): Flag { - if (!isset(self::$PAKISTAN)) { - self::$PAKISTAN = new Flag('pk'); - } + self::$PAKISTAN ??= new Flag('pk'); + return self::$PAKISTAN; } public static function PANAMA(): Flag { - if (!isset(self::$PANAMA)) { - self::$PANAMA = new Flag('pa'); - } + self::$PANAMA ??= new Flag('pa'); + return self::$PANAMA; } public static function PERU(): Flag { - if (!isset(self::$PERU)) { - self::$PERU = new Flag('pe'); - } + self::$PERU ??= new Flag('pe'); + return self::$PERU; } public static function PHILIPPINES(): Flag { - if (!isset(self::$PHILIPPINES)) { - self::$PHILIPPINES = new Flag('ph'); - } + self::$PHILIPPINES ??= new Flag('ph'); + return self::$PHILIPPINES; } public static function PALAU(): Flag { - if (!isset(self::$PALAU)) { - self::$PALAU = new Flag('pw'); - } + self::$PALAU ??= new Flag('pw'); + return self::$PALAU; } public static function PAPUANEWGUINEA(): Flag { - if (!isset(self::$PAPUANEWGUINEA)) { - self::$PAPUANEWGUINEA = new Flag('pg'); - } + self::$PAPUANEWGUINEA ??= new Flag('pg'); + return self::$PAPUANEWGUINEA; } public static function POLAND(): Flag { - if (!isset(self::$POLAND)) { - self::$POLAND = new Flag('pl'); - } + self::$POLAND ??= new Flag('pl'); + return self::$POLAND; } public static function FRENCHPOLYNESIA(): Flag { - if (!isset(self::$FRENCHPOLYNESIA)) { - self::$FRENCHPOLYNESIA = new Flag('pf'); - } + self::$FRENCHPOLYNESIA ??= new Flag('pf'); + return self::$FRENCHPOLYNESIA; } public static function NORTHKOREA(): Flag { - if (!isset(self::$NORTHKOREA)) { - self::$NORTHKOREA = new Flag('kp'); - } + self::$NORTHKOREA ??= new Flag('kp'); + return self::$NORTHKOREA; } public static function PORTUGAL(): Flag { - if (!isset(self::$PORTUGAL)) { - self::$PORTUGAL = new Flag('pt'); - } + self::$PORTUGAL ??= new Flag('pt'); + return self::$PORTUGAL; } public static function PARAGUAY(): Flag { - if (!isset(self::$PARAGUAY)) { - self::$PARAGUAY = new Flag('py'); - } + self::$PARAGUAY ??= new Flag('py'); + return self::$PARAGUAY; } public static function QATAR(): Flag { - if (!isset(self::$QATAR)) { - self::$QATAR = new Flag('qa'); - } + self::$QATAR ??= new Flag('qa'); + return self::$QATAR; } public static function ROMANIA(): Flag { - if (!isset(self::$ROMANIA)) { - self::$ROMANIA = new Flag('ro'); - } + self::$ROMANIA ??= new Flag('ro'); + return self::$ROMANIA; } public static function RUSSIA(): Flag { - if (!isset(self::$RUSSIA)) { - self::$RUSSIA = new Flag('ru'); - } + self::$RUSSIA ??= new Flag('ru'); + return self::$RUSSIA; } public static function RWANDA(): Flag { - if (!isset(self::$RWANDA)) { - self::$RWANDA = new Flag('rw'); - } + self::$RWANDA ??= new Flag('rw'); + return self::$RWANDA; } public static function SAUDIARABIA(): Flag { - if (!isset(self::$SAUDIARABIA)) { - self::$SAUDIARABIA = new Flag('sa'); - } + self::$SAUDIARABIA ??= new Flag('sa'); + return self::$SAUDIARABIA; } public static function SUDAN(): Flag { - if (!isset(self::$SUDAN)) { - self::$SUDAN = new Flag('sd'); - } + self::$SUDAN ??= new Flag('sd'); + return self::$SUDAN; } public static function SENEGAL(): Flag { - if (!isset(self::$SENEGAL)) { - self::$SENEGAL = new Flag('sn'); - } + self::$SENEGAL ??= new Flag('sn'); + return self::$SENEGAL; } public static function SINGAPORE(): Flag { - if (!isset(self::$SINGAPORE)) { - self::$SINGAPORE = new Flag('sg'); - } + self::$SINGAPORE ??= new Flag('sg'); + return self::$SINGAPORE; } public static function SOLOMONISLANDS(): Flag { - if (!isset(self::$SOLOMONISLANDS)) { - self::$SOLOMONISLANDS = new Flag('sb'); - } + self::$SOLOMONISLANDS ??= new Flag('sb'); + return self::$SOLOMONISLANDS; } public static function SIERRALEONE(): Flag { - if (!isset(self::$SIERRALEONE)) { - self::$SIERRALEONE = new Flag('sl'); - } + self::$SIERRALEONE ??= new Flag('sl'); + return self::$SIERRALEONE; } public static function ELSALVADOR(): Flag { - if (!isset(self::$ELSALVADOR)) { - self::$ELSALVADOR = new Flag('sv'); - } + self::$ELSALVADOR ??= new Flag('sv'); + return self::$ELSALVADOR; } public static function SANMARINO(): Flag { - if (!isset(self::$SANMARINO)) { - self::$SANMARINO = new Flag('sm'); - } + self::$SANMARINO ??= new Flag('sm'); + return self::$SANMARINO; } public static function SOMALIA(): Flag { - if (!isset(self::$SOMALIA)) { - self::$SOMALIA = new Flag('so'); - } + self::$SOMALIA ??= new Flag('so'); + return self::$SOMALIA; } public static function SERBIA(): Flag { - if (!isset(self::$SERBIA)) { - self::$SERBIA = new Flag('rs'); - } + self::$SERBIA ??= new Flag('rs'); + return self::$SERBIA; } public static function SOUTHSUDAN(): Flag { - if (!isset(self::$SOUTHSUDAN)) { - self::$SOUTHSUDAN = new Flag('ss'); - } + self::$SOUTHSUDAN ??= new Flag('ss'); + return self::$SOUTHSUDAN; } public static function SAOTOMEANDPRINCIPE(): Flag { - if (!isset(self::$SAOTOMEANDPRINCIPE)) { - self::$SAOTOMEANDPRINCIPE = new Flag('st'); - } + self::$SAOTOMEANDPRINCIPE ??= new Flag('st'); + return self::$SAOTOMEANDPRINCIPE; } public static function SURINAME(): Flag { - if (!isset(self::$SURINAME)) { - self::$SURINAME = new Flag('sr'); - } + self::$SURINAME ??= new Flag('sr'); + return self::$SURINAME; } public static function SLOVAKIA(): Flag { - if (!isset(self::$SLOVAKIA)) { - self::$SLOVAKIA = new Flag('sk'); - } + self::$SLOVAKIA ??= new Flag('sk'); + return self::$SLOVAKIA; } public static function SLOVENIA(): Flag { - if (!isset(self::$SLOVENIA)) { - self::$SLOVENIA = new Flag('si'); - } + self::$SLOVENIA ??= new Flag('si'); + return self::$SLOVENIA; } public static function SWEDEN(): Flag { - if (!isset(self::$SWEDEN)) { - self::$SWEDEN = new Flag('se'); - } + self::$SWEDEN ??= new Flag('se'); + return self::$SWEDEN; } public static function ESWATINI(): Flag { - if (!isset(self::$ESWATINI)) { - self::$ESWATINI = new Flag('sz'); - } + self::$ESWATINI ??= new Flag('sz'); + return self::$ESWATINI; } public static function SEYCHELLES(): Flag { - if (!isset(self::$SEYCHELLES)) { - self::$SEYCHELLES = new Flag('sc'); - } + self::$SEYCHELLES ??= new Flag('sc'); + return self::$SEYCHELLES; } public static function SYRIA(): Flag { - if (!isset(self::$SYRIA)) { - self::$SYRIA = new Flag('sy'); - } + self::$SYRIA ??= new Flag('sy'); + return self::$SYRIA; } public static function CHAD(): Flag { - if (!isset(self::$CHAD)) { - self::$CHAD = new Flag('td'); - } + self::$CHAD ??= new Flag('td'); + return self::$CHAD; } public static function TOGO(): Flag { - if (!isset(self::$TOGO)) { - self::$TOGO = new Flag('tg'); - } + self::$TOGO ??= new Flag('tg'); + return self::$TOGO; } public static function THAILAND(): Flag { - if (!isset(self::$THAILAND)) { - self::$THAILAND = new Flag('th'); - } + self::$THAILAND ??= new Flag('th'); + return self::$THAILAND; } public static function TAJIKISTAN(): Flag { - if (!isset(self::$TAJIKISTAN)) { - self::$TAJIKISTAN = new Flag('tj'); - } + self::$TAJIKISTAN ??= new Flag('tj'); + return self::$TAJIKISTAN; } public static function TURKMENISTAN(): Flag { - if (!isset(self::$TURKMENISTAN)) { - self::$TURKMENISTAN = new Flag('tm'); - } + self::$TURKMENISTAN ??= new Flag('tm'); + return self::$TURKMENISTAN; } public static function TIMORLESTE(): Flag { - if (!isset(self::$TIMORLESTE)) { - self::$TIMORLESTE = new Flag('tl'); - } + self::$TIMORLESTE ??= new Flag('tl'); + return self::$TIMORLESTE; } public static function TONGA(): Flag { - if (!isset(self::$TONGA)) { - self::$TONGA = new Flag('to'); - } + self::$TONGA ??= new Flag('to'); + return self::$TONGA; } public static function TRINIDADANDTOBAGO(): Flag { - if (!isset(self::$TRINIDADANDTOBAGO)) { - self::$TRINIDADANDTOBAGO = new Flag('tt'); - } + self::$TRINIDADANDTOBAGO ??= new Flag('tt'); + return self::$TRINIDADANDTOBAGO; } public static function TUNISIA(): Flag { - if (!isset(self::$TUNISIA)) { - self::$TUNISIA = new Flag('tn'); - } + self::$TUNISIA ??= new Flag('tn'); + return self::$TUNISIA; } public static function TURKEY(): Flag { - if (!isset(self::$TURKEY)) { - self::$TURKEY = new Flag('tr'); - } + self::$TURKEY ??= new Flag('tr'); + return self::$TURKEY; } public static function TUVALU(): Flag { - if (!isset(self::$TUVALU)) { - self::$TUVALU = new Flag('tv'); - } + self::$TUVALU ??= new Flag('tv'); + return self::$TUVALU; } public static function TANZANIA(): Flag { - if (!isset(self::$TANZANIA)) { - self::$TANZANIA = new Flag('tz'); - } + self::$TANZANIA ??= new Flag('tz'); + return self::$TANZANIA; } public static function UGANDA(): Flag { - if (!isset(self::$UGANDA)) { - self::$UGANDA = new Flag('ug'); - } + self::$UGANDA ??= new Flag('ug'); + return self::$UGANDA; } public static function UKRAINE(): Flag { - if (!isset(self::$UKRAINE)) { - self::$UKRAINE = new Flag('ua'); - } + self::$UKRAINE ??= new Flag('ua'); + return self::$UKRAINE; } public static function URUGUAY(): Flag { - if (!isset(self::$URUGUAY)) { - self::$URUGUAY = new Flag('uy'); - } + self::$URUGUAY ??= new Flag('uy'); + return self::$URUGUAY; } public static function UNITEDSTATES(): Flag { - if (!isset(self::$UNITEDSTATES)) { - self::$UNITEDSTATES = new Flag('us'); - } + self::$UNITEDSTATES ??= new Flag('us'); + return self::$UNITEDSTATES; } public static function UZBEKISTAN(): Flag { - if (!isset(self::$UZBEKISTAN)) { - self::$UZBEKISTAN = new Flag('uz'); - } + self::$UZBEKISTAN ??= new Flag('uz'); + return self::$UZBEKISTAN; } public static function VATICANCITY(): Flag { - if (!isset(self::$VATICANCITY)) { - self::$VATICANCITY = new Flag('va'); - } + self::$VATICANCITY ??= new Flag('va'); + return self::$VATICANCITY; } public static function SAINTVINCENTANDTHEGRENADINES(): Flag { - if (!isset(self::$SAINTVINCENTANDTHEGRENADINES)) { - self::$SAINTVINCENTANDTHEGRENADINES = new Flag('vc'); - } + self::$SAINTVINCENTANDTHEGRENADINES ??= new Flag('vc'); + return self::$SAINTVINCENTANDTHEGRENADINES; } public static function VENEZUELA(): Flag { - if (!isset(self::$VENEZUELA)) { - self::$VENEZUELA = new Flag('ve'); - } + self::$VENEZUELA ??= new Flag('ve'); + return self::$VENEZUELA; } public static function VIETNAM(): Flag { - if (!isset(self::$VIETNAM)) { - self::$VIETNAM = new Flag('vn'); - } + self::$VIETNAM ??= new Flag('vn'); + return self::$VIETNAM; } public static function VANUATU(): Flag { - if (!isset(self::$VANUATU)) { - self::$VANUATU = new Flag('vu'); - } + self::$VANUATU ??= new Flag('vu'); + return self::$VANUATU; } public static function SAMOA(): Flag { - if (!isset(self::$SAMOA)) { - self::$SAMOA = new Flag('ws'); - } + self::$SAMOA ??= new Flag('ws'); + return self::$SAMOA; } public static function YEMEN(): Flag { - if (!isset(self::$YEMEN)) { - self::$YEMEN = new Flag('ye'); - } + self::$YEMEN ??= new Flag('ye'); + return self::$YEMEN; } public static function SOUTHAFRICA(): Flag { - if (!isset(self::$SOUTHAFRICA)) { - self::$SOUTHAFRICA = new Flag('za'); - } + self::$SOUTHAFRICA ??= new Flag('za'); + return self::$SOUTHAFRICA; } public static function ZAMBIA(): Flag { - if (!isset(self::$ZAMBIA)) { - self::$ZAMBIA = new Flag('zm'); - } + self::$ZAMBIA ??= new Flag('zm'); + return self::$ZAMBIA; } public static function ZIMBABWE(): Flag { - if (!isset(self::$ZIMBABWE)) { - self::$ZIMBABWE = new Flag('zw'); - } + self::$ZIMBABWE ??= new Flag('zw'); + return self::$ZIMBABWE; } diff --git a/src/Appwrite/Enums/Framework.php b/src/Appwrite/Enums/Framework.php index 6a620c7..bcea65b 100644 --- a/src/Appwrite/Enums/Framework.php +++ b/src/Appwrite/Enums/Framework.php @@ -41,107 +41,92 @@ public function jsonSerialize(): string public static function ANALOG(): Framework { - if (!isset(self::$ANALOG)) { - self::$ANALOG = new Framework('analog'); - } + self::$ANALOG ??= new Framework('analog'); + return self::$ANALOG; } public static function ANGULAR(): Framework { - if (!isset(self::$ANGULAR)) { - self::$ANGULAR = new Framework('angular'); - } + self::$ANGULAR ??= new Framework('angular'); + return self::$ANGULAR; } public static function NEXTJS(): Framework { - if (!isset(self::$NEXTJS)) { - self::$NEXTJS = new Framework('nextjs'); - } + self::$NEXTJS ??= new Framework('nextjs'); + return self::$NEXTJS; } public static function REACT(): Framework { - if (!isset(self::$REACT)) { - self::$REACT = new Framework('react'); - } + self::$REACT ??= new Framework('react'); + return self::$REACT; } public static function NUXT(): Framework { - if (!isset(self::$NUXT)) { - self::$NUXT = new Framework('nuxt'); - } + self::$NUXT ??= new Framework('nuxt'); + return self::$NUXT; } public static function VUE(): Framework { - if (!isset(self::$VUE)) { - self::$VUE = new Framework('vue'); - } + self::$VUE ??= new Framework('vue'); + return self::$VUE; } public static function SVELTEKIT(): Framework { - if (!isset(self::$SVELTEKIT)) { - self::$SVELTEKIT = new Framework('sveltekit'); - } + self::$SVELTEKIT ??= new Framework('sveltekit'); + return self::$SVELTEKIT; } public static function ASTRO(): Framework { - if (!isset(self::$ASTRO)) { - self::$ASTRO = new Framework('astro'); - } + self::$ASTRO ??= new Framework('astro'); + return self::$ASTRO; } public static function TANSTACKSTART(): Framework { - if (!isset(self::$TANSTACKSTART)) { - self::$TANSTACKSTART = new Framework('tanstack-start'); - } + self::$TANSTACKSTART ??= new Framework('tanstack-start'); + return self::$TANSTACKSTART; } public static function REMIX(): Framework { - if (!isset(self::$REMIX)) { - self::$REMIX = new Framework('remix'); - } + self::$REMIX ??= new Framework('remix'); + return self::$REMIX; } public static function LYNX(): Framework { - if (!isset(self::$LYNX)) { - self::$LYNX = new Framework('lynx'); - } + self::$LYNX ??= new Framework('lynx'); + return self::$LYNX; } public static function FLUTTER(): Framework { - if (!isset(self::$FLUTTER)) { - self::$FLUTTER = new Framework('flutter'); - } + self::$FLUTTER ??= new Framework('flutter'); + return self::$FLUTTER; } public static function REACTNATIVE(): Framework { - if (!isset(self::$REACTNATIVE)) { - self::$REACTNATIVE = new Framework('react-native'); - } + self::$REACTNATIVE ??= new Framework('react-native'); + return self::$REACTNATIVE; } public static function VITE(): Framework { - if (!isset(self::$VITE)) { - self::$VITE = new Framework('vite'); - } + self::$VITE ??= new Framework('vite'); + return self::$VITE; } public static function OTHER(): Framework { - if (!isset(self::$OTHER)) { - self::$OTHER = new Framework('other'); - } + self::$OTHER ??= new Framework('other'); + return self::$OTHER; } diff --git a/src/Appwrite/Enums/ImageFormat.php b/src/Appwrite/Enums/ImageFormat.php index 7132ce5..79161a3 100644 --- a/src/Appwrite/Enums/ImageFormat.php +++ b/src/Appwrite/Enums/ImageFormat.php @@ -33,51 +33,44 @@ public function jsonSerialize(): string public static function JPG(): ImageFormat { - if (!isset(self::$JPG)) { - self::$JPG = new ImageFormat('jpg'); - } + self::$JPG ??= new ImageFormat('jpg'); + return self::$JPG; } public static function JPEG(): ImageFormat { - if (!isset(self::$JPEG)) { - self::$JPEG = new ImageFormat('jpeg'); - } + self::$JPEG ??= new ImageFormat('jpeg'); + return self::$JPEG; } public static function PNG(): ImageFormat { - if (!isset(self::$PNG)) { - self::$PNG = new ImageFormat('png'); - } + self::$PNG ??= new ImageFormat('png'); + return self::$PNG; } public static function WEBP(): ImageFormat { - if (!isset(self::$WEBP)) { - self::$WEBP = new ImageFormat('webp'); - } + self::$WEBP ??= new ImageFormat('webp'); + return self::$WEBP; } public static function HEIC(): ImageFormat { - if (!isset(self::$HEIC)) { - self::$HEIC = new ImageFormat('heic'); - } + self::$HEIC ??= new ImageFormat('heic'); + return self::$HEIC; } public static function AVIF(): ImageFormat { - if (!isset(self::$AVIF)) { - self::$AVIF = new ImageFormat('avif'); - } + self::$AVIF ??= new ImageFormat('avif'); + return self::$AVIF; } public static function GIF(): ImageFormat { - if (!isset(self::$GIF)) { - self::$GIF = new ImageFormat('gif'); - } + self::$GIF ??= new ImageFormat('gif'); + return self::$GIF; } diff --git a/src/Appwrite/Enums/ImageGravity.php b/src/Appwrite/Enums/ImageGravity.php index 384fc1a..871f515 100644 --- a/src/Appwrite/Enums/ImageGravity.php +++ b/src/Appwrite/Enums/ImageGravity.php @@ -35,65 +35,56 @@ public function jsonSerialize(): string public static function CENTER(): ImageGravity { - if (!isset(self::$CENTER)) { - self::$CENTER = new ImageGravity('center'); - } + self::$CENTER ??= new ImageGravity('center'); + return self::$CENTER; } public static function TOPLEFT(): ImageGravity { - if (!isset(self::$TOPLEFT)) { - self::$TOPLEFT = new ImageGravity('top-left'); - } + self::$TOPLEFT ??= new ImageGravity('top-left'); + return self::$TOPLEFT; } public static function TOP(): ImageGravity { - if (!isset(self::$TOP)) { - self::$TOP = new ImageGravity('top'); - } + self::$TOP ??= new ImageGravity('top'); + return self::$TOP; } public static function TOPRIGHT(): ImageGravity { - if (!isset(self::$TOPRIGHT)) { - self::$TOPRIGHT = new ImageGravity('top-right'); - } + self::$TOPRIGHT ??= new ImageGravity('top-right'); + return self::$TOPRIGHT; } public static function LEFT(): ImageGravity { - if (!isset(self::$LEFT)) { - self::$LEFT = new ImageGravity('left'); - } + self::$LEFT ??= new ImageGravity('left'); + return self::$LEFT; } public static function RIGHT(): ImageGravity { - if (!isset(self::$RIGHT)) { - self::$RIGHT = new ImageGravity('right'); - } + self::$RIGHT ??= new ImageGravity('right'); + return self::$RIGHT; } public static function BOTTOMLEFT(): ImageGravity { - if (!isset(self::$BOTTOMLEFT)) { - self::$BOTTOMLEFT = new ImageGravity('bottom-left'); - } + self::$BOTTOMLEFT ??= new ImageGravity('bottom-left'); + return self::$BOTTOMLEFT; } public static function BOTTOM(): ImageGravity { - if (!isset(self::$BOTTOM)) { - self::$BOTTOM = new ImageGravity('bottom'); - } + self::$BOTTOM ??= new ImageGravity('bottom'); + return self::$BOTTOM; } public static function BOTTOMRIGHT(): ImageGravity { - if (!isset(self::$BOTTOMRIGHT)) { - self::$BOTTOMRIGHT = new ImageGravity('bottom-right'); - } + self::$BOTTOMRIGHT ??= new ImageGravity('bottom-right'); + return self::$BOTTOMRIGHT; } diff --git a/src/Appwrite/Enums/IndexStatus.php b/src/Appwrite/Enums/IndexStatus.php index fc07936..397efa4 100644 --- a/src/Appwrite/Enums/IndexStatus.php +++ b/src/Appwrite/Enums/IndexStatus.php @@ -31,37 +31,32 @@ public function jsonSerialize(): string public static function AVAILABLE(): IndexStatus { - if (!isset(self::$AVAILABLE)) { - self::$AVAILABLE = new IndexStatus('available'); - } + self::$AVAILABLE ??= new IndexStatus('available'); + return self::$AVAILABLE; } public static function PROCESSING(): IndexStatus { - if (!isset(self::$PROCESSING)) { - self::$PROCESSING = new IndexStatus('processing'); - } + self::$PROCESSING ??= new IndexStatus('processing'); + return self::$PROCESSING; } public static function DELETING(): IndexStatus { - if (!isset(self::$DELETING)) { - self::$DELETING = new IndexStatus('deleting'); - } + self::$DELETING ??= new IndexStatus('deleting'); + return self::$DELETING; } public static function STUCK(): IndexStatus { - if (!isset(self::$STUCK)) { - self::$STUCK = new IndexStatus('stuck'); - } + self::$STUCK ??= new IndexStatus('stuck'); + return self::$STUCK; } public static function FAILED(): IndexStatus { - if (!isset(self::$FAILED)) { - self::$FAILED = new IndexStatus('failed'); - } + self::$FAILED ??= new IndexStatus('failed'); + return self::$FAILED; } diff --git a/src/Appwrite/Enums/InvalidationType.php b/src/Appwrite/Enums/InvalidationType.php index dd15761..cb66f2a 100644 --- a/src/Appwrite/Enums/InvalidationType.php +++ b/src/Appwrite/Enums/InvalidationType.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function TAG(): InvalidationType { - if (!isset(self::$TAG)) { - self::$TAG = new InvalidationType('tag'); - } + self::$TAG ??= new InvalidationType('tag'); + return self::$TAG; } public static function PATH(): InvalidationType { - if (!isset(self::$PATH)) { - self::$PATH = new InvalidationType('path'); - } + self::$PATH ??= new InvalidationType('path'); + return self::$PATH; } public static function ALL(): InvalidationType { - if (!isset(self::$ALL)) { - self::$ALL = new InvalidationType('all'); - } + self::$ALL ??= new InvalidationType('all'); + return self::$ALL; } diff --git a/src/Appwrite/Enums/MessagePriority.php b/src/Appwrite/Enums/MessagePriority.php index f08e7bf..171493b 100644 --- a/src/Appwrite/Enums/MessagePriority.php +++ b/src/Appwrite/Enums/MessagePriority.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function NORMAL(): MessagePriority { - if (!isset(self::$NORMAL)) { - self::$NORMAL = new MessagePriority('normal'); - } + self::$NORMAL ??= new MessagePriority('normal'); + return self::$NORMAL; } public static function HIGH(): MessagePriority { - if (!isset(self::$HIGH)) { - self::$HIGH = new MessagePriority('high'); - } + self::$HIGH ??= new MessagePriority('high'); + return self::$HIGH; } diff --git a/src/Appwrite/Enums/MessageStatus.php b/src/Appwrite/Enums/MessageStatus.php index 188c52a..650ffef 100644 --- a/src/Appwrite/Enums/MessageStatus.php +++ b/src/Appwrite/Enums/MessageStatus.php @@ -31,37 +31,32 @@ public function jsonSerialize(): string public static function DRAFT(): MessageStatus { - if (!isset(self::$DRAFT)) { - self::$DRAFT = new MessageStatus('draft'); - } + self::$DRAFT ??= new MessageStatus('draft'); + return self::$DRAFT; } public static function PROCESSING(): MessageStatus { - if (!isset(self::$PROCESSING)) { - self::$PROCESSING = new MessageStatus('processing'); - } + self::$PROCESSING ??= new MessageStatus('processing'); + return self::$PROCESSING; } public static function SCHEDULED(): MessageStatus { - if (!isset(self::$SCHEDULED)) { - self::$SCHEDULED = new MessageStatus('scheduled'); - } + self::$SCHEDULED ??= new MessageStatus('scheduled'); + return self::$SCHEDULED; } public static function SENT(): MessageStatus { - if (!isset(self::$SENT)) { - self::$SENT = new MessageStatus('sent'); - } + self::$SENT ??= new MessageStatus('sent'); + return self::$SENT; } public static function FAILED(): MessageStatus { - if (!isset(self::$FAILED)) { - self::$FAILED = new MessageStatus('failed'); - } + self::$FAILED ??= new MessageStatus('failed'); + return self::$FAILED; } diff --git a/src/Appwrite/Enums/MessagingProviderType.php b/src/Appwrite/Enums/MessagingProviderType.php index 012eed7..1673cd7 100644 --- a/src/Appwrite/Enums/MessagingProviderType.php +++ b/src/Appwrite/Enums/MessagingProviderType.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function EMAIL(): MessagingProviderType { - if (!isset(self::$EMAIL)) { - self::$EMAIL = new MessagingProviderType('email'); - } + self::$EMAIL ??= new MessagingProviderType('email'); + return self::$EMAIL; } public static function SMS(): MessagingProviderType { - if (!isset(self::$SMS)) { - self::$SMS = new MessagingProviderType('sms'); - } + self::$SMS ??= new MessagingProviderType('sms'); + return self::$SMS; } public static function PUSH(): MessagingProviderType { - if (!isset(self::$PUSH)) { - self::$PUSH = new MessagingProviderType('push'); - } + self::$PUSH ??= new MessagingProviderType('push'); + return self::$PUSH; } diff --git a/src/Appwrite/Enums/OAuth2GooglePrompt.php b/src/Appwrite/Enums/OAuth2GooglePrompt.php index 5ed839f..f17a07e 100644 --- a/src/Appwrite/Enums/OAuth2GooglePrompt.php +++ b/src/Appwrite/Enums/OAuth2GooglePrompt.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function NONE(): OAuth2GooglePrompt { - if (!isset(self::$NONE)) { - self::$NONE = new OAuth2GooglePrompt('none'); - } + self::$NONE ??= new OAuth2GooglePrompt('none'); + return self::$NONE; } public static function CONSENT(): OAuth2GooglePrompt { - if (!isset(self::$CONSENT)) { - self::$CONSENT = new OAuth2GooglePrompt('consent'); - } + self::$CONSENT ??= new OAuth2GooglePrompt('consent'); + return self::$CONSENT; } public static function SELECTACCOUNT(): OAuth2GooglePrompt { - if (!isset(self::$SELECTACCOUNT)) { - self::$SELECTACCOUNT = new OAuth2GooglePrompt('select_account'); - } + self::$SELECTACCOUNT ??= new OAuth2GooglePrompt('select_account'); + return self::$SELECTACCOUNT; } diff --git a/src/Appwrite/Enums/OAuth2OidcPrompt.php b/src/Appwrite/Enums/OAuth2OidcPrompt.php index 979febd..2857fcf 100644 --- a/src/Appwrite/Enums/OAuth2OidcPrompt.php +++ b/src/Appwrite/Enums/OAuth2OidcPrompt.php @@ -30,30 +30,26 @@ public function jsonSerialize(): string public static function NONE(): OAuth2OidcPrompt { - if (!isset(self::$NONE)) { - self::$NONE = new OAuth2OidcPrompt('none'); - } + self::$NONE ??= new OAuth2OidcPrompt('none'); + return self::$NONE; } public static function LOGIN(): OAuth2OidcPrompt { - if (!isset(self::$LOGIN)) { - self::$LOGIN = new OAuth2OidcPrompt('login'); - } + self::$LOGIN ??= new OAuth2OidcPrompt('login'); + return self::$LOGIN; } public static function CONSENT(): OAuth2OidcPrompt { - if (!isset(self::$CONSENT)) { - self::$CONSENT = new OAuth2OidcPrompt('consent'); - } + self::$CONSENT ??= new OAuth2OidcPrompt('consent'); + return self::$CONSENT; } public static function SELECTACCOUNT(): OAuth2OidcPrompt { - if (!isset(self::$SELECTACCOUNT)) { - self::$SELECTACCOUNT = new OAuth2OidcPrompt('select_account'); - } + self::$SELECTACCOUNT ??= new OAuth2OidcPrompt('select_account'); + return self::$SELECTACCOUNT; } diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index 0c8ab75..69900ef 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -71,317 +71,272 @@ public function jsonSerialize(): string public static function AMAZON(): OAuthProvider { - if (!isset(self::$AMAZON)) { - self::$AMAZON = new OAuthProvider('amazon'); - } + self::$AMAZON ??= new OAuthProvider('amazon'); + return self::$AMAZON; } public static function APPLE(): OAuthProvider { - if (!isset(self::$APPLE)) { - self::$APPLE = new OAuthProvider('apple'); - } + self::$APPLE ??= new OAuthProvider('apple'); + return self::$APPLE; } public static function APPWRITE(): OAuthProvider { - if (!isset(self::$APPWRITE)) { - self::$APPWRITE = new OAuthProvider('appwrite'); - } + self::$APPWRITE ??= new OAuthProvider('appwrite'); + return self::$APPWRITE; } public static function AUTH0(): OAuthProvider { - if (!isset(self::$AUTH0)) { - self::$AUTH0 = new OAuthProvider('auth0'); - } + self::$AUTH0 ??= new OAuthProvider('auth0'); + return self::$AUTH0; } public static function AUTHENTIK(): OAuthProvider { - if (!isset(self::$AUTHENTIK)) { - self::$AUTHENTIK = new OAuthProvider('authentik'); - } + self::$AUTHENTIK ??= new OAuthProvider('authentik'); + return self::$AUTHENTIK; } public static function AUTODESK(): OAuthProvider { - if (!isset(self::$AUTODESK)) { - self::$AUTODESK = new OAuthProvider('autodesk'); - } + self::$AUTODESK ??= new OAuthProvider('autodesk'); + return self::$AUTODESK; } public static function BITBUCKET(): OAuthProvider { - if (!isset(self::$BITBUCKET)) { - self::$BITBUCKET = new OAuthProvider('bitbucket'); - } + self::$BITBUCKET ??= new OAuthProvider('bitbucket'); + return self::$BITBUCKET; } public static function BITLY(): OAuthProvider { - if (!isset(self::$BITLY)) { - self::$BITLY = new OAuthProvider('bitly'); - } + self::$BITLY ??= new OAuthProvider('bitly'); + return self::$BITLY; } public static function BOX(): OAuthProvider { - if (!isset(self::$BOX)) { - self::$BOX = new OAuthProvider('box'); - } + self::$BOX ??= new OAuthProvider('box'); + return self::$BOX; } public static function DAILYMOTION(): OAuthProvider { - if (!isset(self::$DAILYMOTION)) { - self::$DAILYMOTION = new OAuthProvider('dailymotion'); - } + self::$DAILYMOTION ??= new OAuthProvider('dailymotion'); + return self::$DAILYMOTION; } public static function DISCORD(): OAuthProvider { - if (!isset(self::$DISCORD)) { - self::$DISCORD = new OAuthProvider('discord'); - } + self::$DISCORD ??= new OAuthProvider('discord'); + return self::$DISCORD; } public static function DISQUS(): OAuthProvider { - if (!isset(self::$DISQUS)) { - self::$DISQUS = new OAuthProvider('disqus'); - } + self::$DISQUS ??= new OAuthProvider('disqus'); + return self::$DISQUS; } public static function DROPBOX(): OAuthProvider { - if (!isset(self::$DROPBOX)) { - self::$DROPBOX = new OAuthProvider('dropbox'); - } + self::$DROPBOX ??= new OAuthProvider('dropbox'); + return self::$DROPBOX; } public static function ETSY(): OAuthProvider { - if (!isset(self::$ETSY)) { - self::$ETSY = new OAuthProvider('etsy'); - } + self::$ETSY ??= new OAuthProvider('etsy'); + return self::$ETSY; } public static function FACEBOOK(): OAuthProvider { - if (!isset(self::$FACEBOOK)) { - self::$FACEBOOK = new OAuthProvider('facebook'); - } + self::$FACEBOOK ??= new OAuthProvider('facebook'); + return self::$FACEBOOK; } public static function FIGMA(): OAuthProvider { - if (!isset(self::$FIGMA)) { - self::$FIGMA = new OAuthProvider('figma'); - } + self::$FIGMA ??= new OAuthProvider('figma'); + return self::$FIGMA; } public static function FUSIONAUTH(): OAuthProvider { - if (!isset(self::$FUSIONAUTH)) { - self::$FUSIONAUTH = new OAuthProvider('fusionauth'); - } + self::$FUSIONAUTH ??= new OAuthProvider('fusionauth'); + return self::$FUSIONAUTH; } public static function GITHUB(): OAuthProvider { - if (!isset(self::$GITHUB)) { - self::$GITHUB = new OAuthProvider('github'); - } + self::$GITHUB ??= new OAuthProvider('github'); + return self::$GITHUB; } public static function GITLAB(): OAuthProvider { - if (!isset(self::$GITLAB)) { - self::$GITLAB = new OAuthProvider('gitlab'); - } + self::$GITLAB ??= new OAuthProvider('gitlab'); + return self::$GITLAB; } public static function GOOGLE(): OAuthProvider { - if (!isset(self::$GOOGLE)) { - self::$GOOGLE = new OAuthProvider('google'); - } + self::$GOOGLE ??= new OAuthProvider('google'); + return self::$GOOGLE; } public static function HUGGINGFACE(): OAuthProvider { - if (!isset(self::$HUGGINGFACE)) { - self::$HUGGINGFACE = new OAuthProvider('huggingface'); - } + self::$HUGGINGFACE ??= new OAuthProvider('huggingface'); + return self::$HUGGINGFACE; } public static function KEYCLOAK(): OAuthProvider { - if (!isset(self::$KEYCLOAK)) { - self::$KEYCLOAK = new OAuthProvider('keycloak'); - } + self::$KEYCLOAK ??= new OAuthProvider('keycloak'); + return self::$KEYCLOAK; } public static function KICK(): OAuthProvider { - if (!isset(self::$KICK)) { - self::$KICK = new OAuthProvider('kick'); - } + self::$KICK ??= new OAuthProvider('kick'); + return self::$KICK; } public static function LINKEDIN(): OAuthProvider { - if (!isset(self::$LINKEDIN)) { - self::$LINKEDIN = new OAuthProvider('linkedin'); - } + self::$LINKEDIN ??= new OAuthProvider('linkedin'); + return self::$LINKEDIN; } public static function MICROSOFT(): OAuthProvider { - if (!isset(self::$MICROSOFT)) { - self::$MICROSOFT = new OAuthProvider('microsoft'); - } + self::$MICROSOFT ??= new OAuthProvider('microsoft'); + return self::$MICROSOFT; } public static function NOTION(): OAuthProvider { - if (!isset(self::$NOTION)) { - self::$NOTION = new OAuthProvider('notion'); - } + self::$NOTION ??= new OAuthProvider('notion'); + return self::$NOTION; } public static function OIDC(): OAuthProvider { - if (!isset(self::$OIDC)) { - self::$OIDC = new OAuthProvider('oidc'); - } + self::$OIDC ??= new OAuthProvider('oidc'); + return self::$OIDC; } public static function OKTA(): OAuthProvider { - if (!isset(self::$OKTA)) { - self::$OKTA = new OAuthProvider('okta'); - } + self::$OKTA ??= new OAuthProvider('okta'); + return self::$OKTA; } public static function PAYPAL(): OAuthProvider { - if (!isset(self::$PAYPAL)) { - self::$PAYPAL = new OAuthProvider('paypal'); - } + self::$PAYPAL ??= new OAuthProvider('paypal'); + return self::$PAYPAL; } public static function PAYPALSANDBOX(): OAuthProvider { - if (!isset(self::$PAYPALSANDBOX)) { - self::$PAYPALSANDBOX = new OAuthProvider('paypalSandbox'); - } + self::$PAYPALSANDBOX ??= new OAuthProvider('paypalSandbox'); + return self::$PAYPALSANDBOX; } public static function PODIO(): OAuthProvider { - if (!isset(self::$PODIO)) { - self::$PODIO = new OAuthProvider('podio'); - } + self::$PODIO ??= new OAuthProvider('podio'); + return self::$PODIO; } public static function SALESFORCE(): OAuthProvider { - if (!isset(self::$SALESFORCE)) { - self::$SALESFORCE = new OAuthProvider('salesforce'); - } + self::$SALESFORCE ??= new OAuthProvider('salesforce'); + return self::$SALESFORCE; } public static function SLACK(): OAuthProvider { - if (!isset(self::$SLACK)) { - self::$SLACK = new OAuthProvider('slack'); - } + self::$SLACK ??= new OAuthProvider('slack'); + return self::$SLACK; } public static function SPOTIFY(): OAuthProvider { - if (!isset(self::$SPOTIFY)) { - self::$SPOTIFY = new OAuthProvider('spotify'); - } + self::$SPOTIFY ??= new OAuthProvider('spotify'); + return self::$SPOTIFY; } public static function STRIPE(): OAuthProvider { - if (!isset(self::$STRIPE)) { - self::$STRIPE = new OAuthProvider('stripe'); - } + self::$STRIPE ??= new OAuthProvider('stripe'); + return self::$STRIPE; } public static function TRADESHIFT(): OAuthProvider { - if (!isset(self::$TRADESHIFT)) { - self::$TRADESHIFT = new OAuthProvider('tradeshift'); - } + self::$TRADESHIFT ??= new OAuthProvider('tradeshift'); + return self::$TRADESHIFT; } public static function TRADESHIFTBOX(): OAuthProvider { - if (!isset(self::$TRADESHIFTBOX)) { - self::$TRADESHIFTBOX = new OAuthProvider('tradeshiftBox'); - } + self::$TRADESHIFTBOX ??= new OAuthProvider('tradeshiftBox'); + return self::$TRADESHIFTBOX; } public static function TWITCH(): OAuthProvider { - if (!isset(self::$TWITCH)) { - self::$TWITCH = new OAuthProvider('twitch'); - } + self::$TWITCH ??= new OAuthProvider('twitch'); + return self::$TWITCH; } public static function WORDPRESS(): OAuthProvider { - if (!isset(self::$WORDPRESS)) { - self::$WORDPRESS = new OAuthProvider('wordpress'); - } + self::$WORDPRESS ??= new OAuthProvider('wordpress'); + return self::$WORDPRESS; } public static function X(): OAuthProvider { - if (!isset(self::$X)) { - self::$X = new OAuthProvider('x'); - } + self::$X ??= new OAuthProvider('x'); + return self::$X; } public static function YAHOO(): OAuthProvider { - if (!isset(self::$YAHOO)) { - self::$YAHOO = new OAuthProvider('yahoo'); - } + self::$YAHOO ??= new OAuthProvider('yahoo'); + return self::$YAHOO; } public static function YAMMER(): OAuthProvider { - if (!isset(self::$YAMMER)) { - self::$YAMMER = new OAuthProvider('yammer'); - } + self::$YAMMER ??= new OAuthProvider('yammer'); + return self::$YAMMER; } public static function YANDEX(): OAuthProvider { - if (!isset(self::$YANDEX)) { - self::$YANDEX = new OAuthProvider('yandex'); - } + self::$YANDEX ??= new OAuthProvider('yandex'); + return self::$YANDEX; } public static function ZOHO(): OAuthProvider { - if (!isset(self::$ZOHO)) { - self::$ZOHO = new OAuthProvider('zoho'); - } + self::$ZOHO ??= new OAuthProvider('zoho'); + return self::$ZOHO; } public static function ZOOM(): OAuthProvider { - if (!isset(self::$ZOOM)) { - self::$ZOOM = new OAuthProvider('zoom'); - } + self::$ZOOM ??= new OAuthProvider('zoom'); + return self::$ZOOM; } diff --git a/src/Appwrite/Enums/OrderBy.php b/src/Appwrite/Enums/OrderBy.php index c6060b3..df03fdf 100644 --- a/src/Appwrite/Enums/OrderBy.php +++ b/src/Appwrite/Enums/OrderBy.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function ASC(): OrderBy { - if (!isset(self::$ASC)) { - self::$ASC = new OrderBy('asc'); - } + self::$ASC ??= new OrderBy('asc'); + return self::$ASC; } public static function DESC(): OrderBy { - if (!isset(self::$DESC)) { - self::$DESC = new OrderBy('desc'); - } + self::$DESC ??= new OrderBy('desc'); + return self::$DESC; } diff --git a/src/Appwrite/Enums/OrganizationKeyScopes.php b/src/Appwrite/Enums/OrganizationKeyScopes.php index 3b70fd2..b28e58e 100644 --- a/src/Appwrite/Enums/OrganizationKeyScopes.php +++ b/src/Appwrite/Enums/OrganizationKeyScopes.php @@ -42,114 +42,98 @@ public function jsonSerialize(): string public static function PROJECTSREAD(): OrganizationKeyScopes { - if (!isset(self::$PROJECTSREAD)) { - self::$PROJECTSREAD = new OrganizationKeyScopes('projects.read'); - } + self::$PROJECTSREAD ??= new OrganizationKeyScopes('projects.read'); + return self::$PROJECTSREAD; } public static function PROJECTSWRITE(): OrganizationKeyScopes { - if (!isset(self::$PROJECTSWRITE)) { - self::$PROJECTSWRITE = new OrganizationKeyScopes('projects.write'); - } + self::$PROJECTSWRITE ??= new OrganizationKeyScopes('projects.write'); + return self::$PROJECTSWRITE; } public static function DEVKEYSREAD(): OrganizationKeyScopes { - if (!isset(self::$DEVKEYSREAD)) { - self::$DEVKEYSREAD = new OrganizationKeyScopes('devKeys.read'); - } + self::$DEVKEYSREAD ??= new OrganizationKeyScopes('devKeys.read'); + return self::$DEVKEYSREAD; } public static function DEVKEYSWRITE(): OrganizationKeyScopes { - if (!isset(self::$DEVKEYSWRITE)) { - self::$DEVKEYSWRITE = new OrganizationKeyScopes('devKeys.write'); - } + self::$DEVKEYSWRITE ??= new OrganizationKeyScopes('devKeys.write'); + return self::$DEVKEYSWRITE; } public static function ORGANIZATIONKEYSREAD(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONKEYSREAD)) { - self::$ORGANIZATIONKEYSREAD = new OrganizationKeyScopes('organization.keys.read'); - } + self::$ORGANIZATIONKEYSREAD ??= new OrganizationKeyScopes('organization.keys.read'); + return self::$ORGANIZATIONKEYSREAD; } public static function ORGANIZATIONKEYSWRITE(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONKEYSWRITE)) { - self::$ORGANIZATIONKEYSWRITE = new OrganizationKeyScopes('organization.keys.write'); - } + self::$ORGANIZATIONKEYSWRITE ??= new OrganizationKeyScopes('organization.keys.write'); + return self::$ORGANIZATIONKEYSWRITE; } public static function ORGANIZATIONINSTALLATIONSREAD(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONINSTALLATIONSREAD)) { - self::$ORGANIZATIONINSTALLATIONSREAD = new OrganizationKeyScopes('organization.installations.read'); - } + self::$ORGANIZATIONINSTALLATIONSREAD ??= new OrganizationKeyScopes('organization.installations.read'); + return self::$ORGANIZATIONINSTALLATIONSREAD; } public static function ORGANIZATIONINSTALLATIONSWRITE(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONINSTALLATIONSWRITE)) { - self::$ORGANIZATIONINSTALLATIONSWRITE = new OrganizationKeyScopes('organization.installations.write'); - } + self::$ORGANIZATIONINSTALLATIONSWRITE ??= new OrganizationKeyScopes('organization.installations.write'); + return self::$ORGANIZATIONINSTALLATIONSWRITE; } public static function ORGANIZATIONMEMBERSHIPSREAD(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONMEMBERSHIPSREAD)) { - self::$ORGANIZATIONMEMBERSHIPSREAD = new OrganizationKeyScopes('organization.memberships.read'); - } + self::$ORGANIZATIONMEMBERSHIPSREAD ??= new OrganizationKeyScopes('organization.memberships.read'); + return self::$ORGANIZATIONMEMBERSHIPSREAD; } public static function ORGANIZATIONMEMBERSHIPSWRITE(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONMEMBERSHIPSWRITE)) { - self::$ORGANIZATIONMEMBERSHIPSWRITE = new OrganizationKeyScopes('organization.memberships.write'); - } + self::$ORGANIZATIONMEMBERSHIPSWRITE ??= new OrganizationKeyScopes('organization.memberships.write'); + return self::$ORGANIZATIONMEMBERSHIPSWRITE; } public static function ORGANIZATIONREAD(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONREAD)) { - self::$ORGANIZATIONREAD = new OrganizationKeyScopes('organization.read'); - } + self::$ORGANIZATIONREAD ??= new OrganizationKeyScopes('organization.read'); + return self::$ORGANIZATIONREAD; } public static function ORGANIZATIONWRITE(): OrganizationKeyScopes { - if (!isset(self::$ORGANIZATIONWRITE)) { - self::$ORGANIZATIONWRITE = new OrganizationKeyScopes('organization.write'); - } + self::$ORGANIZATIONWRITE ??= new OrganizationKeyScopes('organization.write'); + return self::$ORGANIZATIONWRITE; } public static function DOMAINSREAD(): OrganizationKeyScopes { - if (!isset(self::$DOMAINSREAD)) { - self::$DOMAINSREAD = new OrganizationKeyScopes('domains.read'); - } + self::$DOMAINSREAD ??= new OrganizationKeyScopes('domains.read'); + return self::$DOMAINSREAD; } public static function DOMAINSWRITE(): OrganizationKeyScopes { - if (!isset(self::$DOMAINSWRITE)) { - self::$DOMAINSWRITE = new OrganizationKeyScopes('domains.write'); - } + self::$DOMAINSWRITE ??= new OrganizationKeyScopes('domains.write'); + return self::$DOMAINSWRITE; } public static function KEYSREAD(): OrganizationKeyScopes { - if (!isset(self::$KEYSREAD)) { - self::$KEYSREAD = new OrganizationKeyScopes('keys.read'); - } + self::$KEYSREAD ??= new OrganizationKeyScopes('keys.read'); + return self::$KEYSREAD; } public static function KEYSWRITE(): OrganizationKeyScopes { - if (!isset(self::$KEYSWRITE)) { - self::$KEYSWRITE = new OrganizationKeyScopes('keys.write'); - } + self::$KEYSWRITE ??= new OrganizationKeyScopes('keys.write'); + return self::$KEYSWRITE; } diff --git a/src/Appwrite/Enums/PasswordHash.php b/src/Appwrite/Enums/PasswordHash.php index 4ac4aba..9d46206 100644 --- a/src/Appwrite/Enums/PasswordHash.php +++ b/src/Appwrite/Enums/PasswordHash.php @@ -37,79 +37,68 @@ public function jsonSerialize(): string public static function SHA1(): PasswordHash { - if (!isset(self::$SHA1)) { - self::$SHA1 = new PasswordHash('sha1'); - } + self::$SHA1 ??= new PasswordHash('sha1'); + return self::$SHA1; } public static function SHA224(): PasswordHash { - if (!isset(self::$SHA224)) { - self::$SHA224 = new PasswordHash('sha224'); - } + self::$SHA224 ??= new PasswordHash('sha224'); + return self::$SHA224; } public static function SHA256(): PasswordHash { - if (!isset(self::$SHA256)) { - self::$SHA256 = new PasswordHash('sha256'); - } + self::$SHA256 ??= new PasswordHash('sha256'); + return self::$SHA256; } public static function SHA384(): PasswordHash { - if (!isset(self::$SHA384)) { - self::$SHA384 = new PasswordHash('sha384'); - } + self::$SHA384 ??= new PasswordHash('sha384'); + return self::$SHA384; } public static function SHA512224(): PasswordHash { - if (!isset(self::$SHA512224)) { - self::$SHA512224 = new PasswordHash('sha512/224'); - } + self::$SHA512224 ??= new PasswordHash('sha512/224'); + return self::$SHA512224; } public static function SHA512256(): PasswordHash { - if (!isset(self::$SHA512256)) { - self::$SHA512256 = new PasswordHash('sha512/256'); - } + self::$SHA512256 ??= new PasswordHash('sha512/256'); + return self::$SHA512256; } public static function SHA512(): PasswordHash { - if (!isset(self::$SHA512)) { - self::$SHA512 = new PasswordHash('sha512'); - } + self::$SHA512 ??= new PasswordHash('sha512'); + return self::$SHA512; } public static function SHA3224(): PasswordHash { - if (!isset(self::$SHA3224)) { - self::$SHA3224 = new PasswordHash('sha3-224'); - } + self::$SHA3224 ??= new PasswordHash('sha3-224'); + return self::$SHA3224; } public static function SHA3256(): PasswordHash { - if (!isset(self::$SHA3256)) { - self::$SHA3256 = new PasswordHash('sha3-256'); - } + self::$SHA3256 ??= new PasswordHash('sha3-256'); + return self::$SHA3256; } public static function SHA3384(): PasswordHash { - if (!isset(self::$SHA3384)) { - self::$SHA3384 = new PasswordHash('sha3-384'); - } + self::$SHA3384 ??= new PasswordHash('sha3-384'); + return self::$SHA3384; } public static function SHA3512(): PasswordHash { - if (!isset(self::$SHA3512)) { - self::$SHA3512 = new PasswordHash('sha3-512'); - } + self::$SHA3512 ??= new PasswordHash('sha3-512'); + return self::$SHA3512; } diff --git a/src/Appwrite/Enums/PlatformType.php b/src/Appwrite/Enums/PlatformType.php index 255ec61..fb7bbdc 100644 --- a/src/Appwrite/Enums/PlatformType.php +++ b/src/Appwrite/Enums/PlatformType.php @@ -31,37 +31,32 @@ public function jsonSerialize(): string public static function WINDOWS(): PlatformType { - if (!isset(self::$WINDOWS)) { - self::$WINDOWS = new PlatformType('windows'); - } + self::$WINDOWS ??= new PlatformType('windows'); + return self::$WINDOWS; } public static function APPLE(): PlatformType { - if (!isset(self::$APPLE)) { - self::$APPLE = new PlatformType('apple'); - } + self::$APPLE ??= new PlatformType('apple'); + return self::$APPLE; } public static function ANDROID(): PlatformType { - if (!isset(self::$ANDROID)) { - self::$ANDROID = new PlatformType('android'); - } + self::$ANDROID ??= new PlatformType('android'); + return self::$ANDROID; } public static function LINUX(): PlatformType { - if (!isset(self::$LINUX)) { - self::$LINUX = new PlatformType('linux'); - } + self::$LINUX ??= new PlatformType('linux'); + return self::$LINUX; } public static function WEB(): PlatformType { - if (!isset(self::$WEB)) { - self::$WEB = new PlatformType('web'); - } + self::$WEB ??= new PlatformType('web'); + return self::$WEB; } diff --git a/src/Appwrite/Enums/ProjectAuthMethodId.php b/src/Appwrite/Enums/ProjectAuthMethodId.php index 46f1bac..bd8fd7e 100644 --- a/src/Appwrite/Enums/ProjectAuthMethodId.php +++ b/src/Appwrite/Enums/ProjectAuthMethodId.php @@ -33,51 +33,44 @@ public function jsonSerialize(): string public static function EMAILPASSWORD(): ProjectAuthMethodId { - if (!isset(self::$EMAILPASSWORD)) { - self::$EMAILPASSWORD = new ProjectAuthMethodId('email-password'); - } + self::$EMAILPASSWORD ??= new ProjectAuthMethodId('email-password'); + return self::$EMAILPASSWORD; } public static function MAGICURL(): ProjectAuthMethodId { - if (!isset(self::$MAGICURL)) { - self::$MAGICURL = new ProjectAuthMethodId('magic-url'); - } + self::$MAGICURL ??= new ProjectAuthMethodId('magic-url'); + return self::$MAGICURL; } public static function EMAILOTP(): ProjectAuthMethodId { - if (!isset(self::$EMAILOTP)) { - self::$EMAILOTP = new ProjectAuthMethodId('email-otp'); - } + self::$EMAILOTP ??= new ProjectAuthMethodId('email-otp'); + return self::$EMAILOTP; } public static function ANONYMOUS(): ProjectAuthMethodId { - if (!isset(self::$ANONYMOUS)) { - self::$ANONYMOUS = new ProjectAuthMethodId('anonymous'); - } + self::$ANONYMOUS ??= new ProjectAuthMethodId('anonymous'); + return self::$ANONYMOUS; } public static function INVITES(): ProjectAuthMethodId { - if (!isset(self::$INVITES)) { - self::$INVITES = new ProjectAuthMethodId('invites'); - } + self::$INVITES ??= new ProjectAuthMethodId('invites'); + return self::$INVITES; } public static function JWT(): ProjectAuthMethodId { - if (!isset(self::$JWT)) { - self::$JWT = new ProjectAuthMethodId('jwt'); - } + self::$JWT ??= new ProjectAuthMethodId('jwt'); + return self::$JWT; } public static function PHONE(): ProjectAuthMethodId { - if (!isset(self::$PHONE)) { - self::$PHONE = new ProjectAuthMethodId('phone'); - } + self::$PHONE ??= new ProjectAuthMethodId('phone'); + return self::$PHONE; } diff --git a/src/Appwrite/Enums/ProjectEmailTemplateId.php b/src/Appwrite/Enums/ProjectEmailTemplateId.php index 1a2eb11..4e18247 100644 --- a/src/Appwrite/Enums/ProjectEmailTemplateId.php +++ b/src/Appwrite/Enums/ProjectEmailTemplateId.php @@ -33,51 +33,44 @@ public function jsonSerialize(): string public static function VERIFICATION(): ProjectEmailTemplateId { - if (!isset(self::$VERIFICATION)) { - self::$VERIFICATION = new ProjectEmailTemplateId('verification'); - } + self::$VERIFICATION ??= new ProjectEmailTemplateId('verification'); + return self::$VERIFICATION; } public static function MAGICSESSION(): ProjectEmailTemplateId { - if (!isset(self::$MAGICSESSION)) { - self::$MAGICSESSION = new ProjectEmailTemplateId('magicSession'); - } + self::$MAGICSESSION ??= new ProjectEmailTemplateId('magicSession'); + return self::$MAGICSESSION; } public static function RECOVERY(): ProjectEmailTemplateId { - if (!isset(self::$RECOVERY)) { - self::$RECOVERY = new ProjectEmailTemplateId('recovery'); - } + self::$RECOVERY ??= new ProjectEmailTemplateId('recovery'); + return self::$RECOVERY; } public static function INVITATION(): ProjectEmailTemplateId { - if (!isset(self::$INVITATION)) { - self::$INVITATION = new ProjectEmailTemplateId('invitation'); - } + self::$INVITATION ??= new ProjectEmailTemplateId('invitation'); + return self::$INVITATION; } public static function MFACHALLENGE(): ProjectEmailTemplateId { - if (!isset(self::$MFACHALLENGE)) { - self::$MFACHALLENGE = new ProjectEmailTemplateId('mfaChallenge'); - } + self::$MFACHALLENGE ??= new ProjectEmailTemplateId('mfaChallenge'); + return self::$MFACHALLENGE; } public static function SESSIONALERT(): ProjectEmailTemplateId { - if (!isset(self::$SESSIONALERT)) { - self::$SESSIONALERT = new ProjectEmailTemplateId('sessionAlert'); - } + self::$SESSIONALERT ??= new ProjectEmailTemplateId('sessionAlert'); + return self::$SESSIONALERT; } public static function OTPSESSION(): ProjectEmailTemplateId { - if (!isset(self::$OTPSESSION)) { - self::$OTPSESSION = new ProjectEmailTemplateId('otpSession'); - } + self::$OTPSESSION ??= new ProjectEmailTemplateId('otpSession'); + return self::$OTPSESSION; } diff --git a/src/Appwrite/Enums/ProjectEmailTemplateLocale.php b/src/Appwrite/Enums/ProjectEmailTemplateLocale.php index c8bfcfe..8307909 100644 --- a/src/Appwrite/Enums/ProjectEmailTemplateLocale.php +++ b/src/Appwrite/Enums/ProjectEmailTemplateLocale.php @@ -157,919 +157,788 @@ public function jsonSerialize(): string public static function AF(): ProjectEmailTemplateLocale { - if (!isset(self::$AF)) { - self::$AF = new ProjectEmailTemplateLocale('af'); - } + self::$AF ??= new ProjectEmailTemplateLocale('af'); + return self::$AF; } public static function ARAE(): ProjectEmailTemplateLocale { - if (!isset(self::$ARAE)) { - self::$ARAE = new ProjectEmailTemplateLocale('ar-ae'); - } + self::$ARAE ??= new ProjectEmailTemplateLocale('ar-ae'); + return self::$ARAE; } public static function ARBH(): ProjectEmailTemplateLocale { - if (!isset(self::$ARBH)) { - self::$ARBH = new ProjectEmailTemplateLocale('ar-bh'); - } + self::$ARBH ??= new ProjectEmailTemplateLocale('ar-bh'); + return self::$ARBH; } public static function ARDZ(): ProjectEmailTemplateLocale { - if (!isset(self::$ARDZ)) { - self::$ARDZ = new ProjectEmailTemplateLocale('ar-dz'); - } + self::$ARDZ ??= new ProjectEmailTemplateLocale('ar-dz'); + return self::$ARDZ; } public static function AREG(): ProjectEmailTemplateLocale { - if (!isset(self::$AREG)) { - self::$AREG = new ProjectEmailTemplateLocale('ar-eg'); - } + self::$AREG ??= new ProjectEmailTemplateLocale('ar-eg'); + return self::$AREG; } public static function ARIQ(): ProjectEmailTemplateLocale { - if (!isset(self::$ARIQ)) { - self::$ARIQ = new ProjectEmailTemplateLocale('ar-iq'); - } + self::$ARIQ ??= new ProjectEmailTemplateLocale('ar-iq'); + return self::$ARIQ; } public static function ARJO(): ProjectEmailTemplateLocale { - if (!isset(self::$ARJO)) { - self::$ARJO = new ProjectEmailTemplateLocale('ar-jo'); - } + self::$ARJO ??= new ProjectEmailTemplateLocale('ar-jo'); + return self::$ARJO; } public static function ARKW(): ProjectEmailTemplateLocale { - if (!isset(self::$ARKW)) { - self::$ARKW = new ProjectEmailTemplateLocale('ar-kw'); - } + self::$ARKW ??= new ProjectEmailTemplateLocale('ar-kw'); + return self::$ARKW; } public static function ARLB(): ProjectEmailTemplateLocale { - if (!isset(self::$ARLB)) { - self::$ARLB = new ProjectEmailTemplateLocale('ar-lb'); - } + self::$ARLB ??= new ProjectEmailTemplateLocale('ar-lb'); + return self::$ARLB; } public static function ARLY(): ProjectEmailTemplateLocale { - if (!isset(self::$ARLY)) { - self::$ARLY = new ProjectEmailTemplateLocale('ar-ly'); - } + self::$ARLY ??= new ProjectEmailTemplateLocale('ar-ly'); + return self::$ARLY; } public static function ARMA(): ProjectEmailTemplateLocale { - if (!isset(self::$ARMA)) { - self::$ARMA = new ProjectEmailTemplateLocale('ar-ma'); - } + self::$ARMA ??= new ProjectEmailTemplateLocale('ar-ma'); + return self::$ARMA; } public static function AROM(): ProjectEmailTemplateLocale { - if (!isset(self::$AROM)) { - self::$AROM = new ProjectEmailTemplateLocale('ar-om'); - } + self::$AROM ??= new ProjectEmailTemplateLocale('ar-om'); + return self::$AROM; } public static function ARQA(): ProjectEmailTemplateLocale { - if (!isset(self::$ARQA)) { - self::$ARQA = new ProjectEmailTemplateLocale('ar-qa'); - } + self::$ARQA ??= new ProjectEmailTemplateLocale('ar-qa'); + return self::$ARQA; } public static function ARSA(): ProjectEmailTemplateLocale { - if (!isset(self::$ARSA)) { - self::$ARSA = new ProjectEmailTemplateLocale('ar-sa'); - } + self::$ARSA ??= new ProjectEmailTemplateLocale('ar-sa'); + return self::$ARSA; } public static function ARSY(): ProjectEmailTemplateLocale { - if (!isset(self::$ARSY)) { - self::$ARSY = new ProjectEmailTemplateLocale('ar-sy'); - } + self::$ARSY ??= new ProjectEmailTemplateLocale('ar-sy'); + return self::$ARSY; } public static function ARTN(): ProjectEmailTemplateLocale { - if (!isset(self::$ARTN)) { - self::$ARTN = new ProjectEmailTemplateLocale('ar-tn'); - } + self::$ARTN ??= new ProjectEmailTemplateLocale('ar-tn'); + return self::$ARTN; } public static function ARYE(): ProjectEmailTemplateLocale { - if (!isset(self::$ARYE)) { - self::$ARYE = new ProjectEmailTemplateLocale('ar-ye'); - } + self::$ARYE ??= new ProjectEmailTemplateLocale('ar-ye'); + return self::$ARYE; } public static function AS(): ProjectEmailTemplateLocale { - if (!isset(self::$AS)) { - self::$AS = new ProjectEmailTemplateLocale('as'); - } + self::$AS ??= new ProjectEmailTemplateLocale('as'); + return self::$AS; } public static function AZ(): ProjectEmailTemplateLocale { - if (!isset(self::$AZ)) { - self::$AZ = new ProjectEmailTemplateLocale('az'); - } + self::$AZ ??= new ProjectEmailTemplateLocale('az'); + return self::$AZ; } public static function BE(): ProjectEmailTemplateLocale { - if (!isset(self::$BE)) { - self::$BE = new ProjectEmailTemplateLocale('be'); - } + self::$BE ??= new ProjectEmailTemplateLocale('be'); + return self::$BE; } public static function BG(): ProjectEmailTemplateLocale { - if (!isset(self::$BG)) { - self::$BG = new ProjectEmailTemplateLocale('bg'); - } + self::$BG ??= new ProjectEmailTemplateLocale('bg'); + return self::$BG; } public static function BH(): ProjectEmailTemplateLocale { - if (!isset(self::$BH)) { - self::$BH = new ProjectEmailTemplateLocale('bh'); - } + self::$BH ??= new ProjectEmailTemplateLocale('bh'); + return self::$BH; } public static function BN(): ProjectEmailTemplateLocale { - if (!isset(self::$BN)) { - self::$BN = new ProjectEmailTemplateLocale('bn'); - } + self::$BN ??= new ProjectEmailTemplateLocale('bn'); + return self::$BN; } public static function BS(): ProjectEmailTemplateLocale { - if (!isset(self::$BS)) { - self::$BS = new ProjectEmailTemplateLocale('bs'); - } + self::$BS ??= new ProjectEmailTemplateLocale('bs'); + return self::$BS; } public static function CA(): ProjectEmailTemplateLocale { - if (!isset(self::$CA)) { - self::$CA = new ProjectEmailTemplateLocale('ca'); - } + self::$CA ??= new ProjectEmailTemplateLocale('ca'); + return self::$CA; } public static function CS(): ProjectEmailTemplateLocale { - if (!isset(self::$CS)) { - self::$CS = new ProjectEmailTemplateLocale('cs'); - } + self::$CS ??= new ProjectEmailTemplateLocale('cs'); + return self::$CS; } public static function CY(): ProjectEmailTemplateLocale { - if (!isset(self::$CY)) { - self::$CY = new ProjectEmailTemplateLocale('cy'); - } + self::$CY ??= new ProjectEmailTemplateLocale('cy'); + return self::$CY; } public static function DA(): ProjectEmailTemplateLocale { - if (!isset(self::$DA)) { - self::$DA = new ProjectEmailTemplateLocale('da'); - } + self::$DA ??= new ProjectEmailTemplateLocale('da'); + return self::$DA; } public static function DE(): ProjectEmailTemplateLocale { - if (!isset(self::$DE)) { - self::$DE = new ProjectEmailTemplateLocale('de'); - } + self::$DE ??= new ProjectEmailTemplateLocale('de'); + return self::$DE; } public static function DEAT(): ProjectEmailTemplateLocale { - if (!isset(self::$DEAT)) { - self::$DEAT = new ProjectEmailTemplateLocale('de-at'); - } + self::$DEAT ??= new ProjectEmailTemplateLocale('de-at'); + return self::$DEAT; } public static function DECH(): ProjectEmailTemplateLocale { - if (!isset(self::$DECH)) { - self::$DECH = new ProjectEmailTemplateLocale('de-ch'); - } + self::$DECH ??= new ProjectEmailTemplateLocale('de-ch'); + return self::$DECH; } public static function DELI(): ProjectEmailTemplateLocale { - if (!isset(self::$DELI)) { - self::$DELI = new ProjectEmailTemplateLocale('de-li'); - } + self::$DELI ??= new ProjectEmailTemplateLocale('de-li'); + return self::$DELI; } public static function DELU(): ProjectEmailTemplateLocale { - if (!isset(self::$DELU)) { - self::$DELU = new ProjectEmailTemplateLocale('de-lu'); - } + self::$DELU ??= new ProjectEmailTemplateLocale('de-lu'); + return self::$DELU; } public static function EL(): ProjectEmailTemplateLocale { - if (!isset(self::$EL)) { - self::$EL = new ProjectEmailTemplateLocale('el'); - } + self::$EL ??= new ProjectEmailTemplateLocale('el'); + return self::$EL; } public static function EN(): ProjectEmailTemplateLocale { - if (!isset(self::$EN)) { - self::$EN = new ProjectEmailTemplateLocale('en'); - } + self::$EN ??= new ProjectEmailTemplateLocale('en'); + return self::$EN; } public static function ENAU(): ProjectEmailTemplateLocale { - if (!isset(self::$ENAU)) { - self::$ENAU = new ProjectEmailTemplateLocale('en-au'); - } + self::$ENAU ??= new ProjectEmailTemplateLocale('en-au'); + return self::$ENAU; } public static function ENBZ(): ProjectEmailTemplateLocale { - if (!isset(self::$ENBZ)) { - self::$ENBZ = new ProjectEmailTemplateLocale('en-bz'); - } + self::$ENBZ ??= new ProjectEmailTemplateLocale('en-bz'); + return self::$ENBZ; } public static function ENCA(): ProjectEmailTemplateLocale { - if (!isset(self::$ENCA)) { - self::$ENCA = new ProjectEmailTemplateLocale('en-ca'); - } + self::$ENCA ??= new ProjectEmailTemplateLocale('en-ca'); + return self::$ENCA; } public static function ENGB(): ProjectEmailTemplateLocale { - if (!isset(self::$ENGB)) { - self::$ENGB = new ProjectEmailTemplateLocale('en-gb'); - } + self::$ENGB ??= new ProjectEmailTemplateLocale('en-gb'); + return self::$ENGB; } public static function ENIE(): ProjectEmailTemplateLocale { - if (!isset(self::$ENIE)) { - self::$ENIE = new ProjectEmailTemplateLocale('en-ie'); - } + self::$ENIE ??= new ProjectEmailTemplateLocale('en-ie'); + return self::$ENIE; } public static function ENJM(): ProjectEmailTemplateLocale { - if (!isset(self::$ENJM)) { - self::$ENJM = new ProjectEmailTemplateLocale('en-jm'); - } + self::$ENJM ??= new ProjectEmailTemplateLocale('en-jm'); + return self::$ENJM; } public static function ENNZ(): ProjectEmailTemplateLocale { - if (!isset(self::$ENNZ)) { - self::$ENNZ = new ProjectEmailTemplateLocale('en-nz'); - } + self::$ENNZ ??= new ProjectEmailTemplateLocale('en-nz'); + return self::$ENNZ; } public static function ENTT(): ProjectEmailTemplateLocale { - if (!isset(self::$ENTT)) { - self::$ENTT = new ProjectEmailTemplateLocale('en-tt'); - } + self::$ENTT ??= new ProjectEmailTemplateLocale('en-tt'); + return self::$ENTT; } public static function ENUS(): ProjectEmailTemplateLocale { - if (!isset(self::$ENUS)) { - self::$ENUS = new ProjectEmailTemplateLocale('en-us'); - } + self::$ENUS ??= new ProjectEmailTemplateLocale('en-us'); + return self::$ENUS; } public static function ENZA(): ProjectEmailTemplateLocale { - if (!isset(self::$ENZA)) { - self::$ENZA = new ProjectEmailTemplateLocale('en-za'); - } + self::$ENZA ??= new ProjectEmailTemplateLocale('en-za'); + return self::$ENZA; } public static function EO(): ProjectEmailTemplateLocale { - if (!isset(self::$EO)) { - self::$EO = new ProjectEmailTemplateLocale('eo'); - } + self::$EO ??= new ProjectEmailTemplateLocale('eo'); + return self::$EO; } public static function ES(): ProjectEmailTemplateLocale { - if (!isset(self::$ES)) { - self::$ES = new ProjectEmailTemplateLocale('es'); - } + self::$ES ??= new ProjectEmailTemplateLocale('es'); + return self::$ES; } public static function ESAR(): ProjectEmailTemplateLocale { - if (!isset(self::$ESAR)) { - self::$ESAR = new ProjectEmailTemplateLocale('es-ar'); - } + self::$ESAR ??= new ProjectEmailTemplateLocale('es-ar'); + return self::$ESAR; } public static function ESBO(): ProjectEmailTemplateLocale { - if (!isset(self::$ESBO)) { - self::$ESBO = new ProjectEmailTemplateLocale('es-bo'); - } + self::$ESBO ??= new ProjectEmailTemplateLocale('es-bo'); + return self::$ESBO; } public static function ESCL(): ProjectEmailTemplateLocale { - if (!isset(self::$ESCL)) { - self::$ESCL = new ProjectEmailTemplateLocale('es-cl'); - } + self::$ESCL ??= new ProjectEmailTemplateLocale('es-cl'); + return self::$ESCL; } public static function ESCO(): ProjectEmailTemplateLocale { - if (!isset(self::$ESCO)) { - self::$ESCO = new ProjectEmailTemplateLocale('es-co'); - } + self::$ESCO ??= new ProjectEmailTemplateLocale('es-co'); + return self::$ESCO; } public static function ESCR(): ProjectEmailTemplateLocale { - if (!isset(self::$ESCR)) { - self::$ESCR = new ProjectEmailTemplateLocale('es-cr'); - } + self::$ESCR ??= new ProjectEmailTemplateLocale('es-cr'); + return self::$ESCR; } public static function ESDO(): ProjectEmailTemplateLocale { - if (!isset(self::$ESDO)) { - self::$ESDO = new ProjectEmailTemplateLocale('es-do'); - } + self::$ESDO ??= new ProjectEmailTemplateLocale('es-do'); + return self::$ESDO; } public static function ESEC(): ProjectEmailTemplateLocale { - if (!isset(self::$ESEC)) { - self::$ESEC = new ProjectEmailTemplateLocale('es-ec'); - } + self::$ESEC ??= new ProjectEmailTemplateLocale('es-ec'); + return self::$ESEC; } public static function ESGT(): ProjectEmailTemplateLocale { - if (!isset(self::$ESGT)) { - self::$ESGT = new ProjectEmailTemplateLocale('es-gt'); - } + self::$ESGT ??= new ProjectEmailTemplateLocale('es-gt'); + return self::$ESGT; } public static function ESHN(): ProjectEmailTemplateLocale { - if (!isset(self::$ESHN)) { - self::$ESHN = new ProjectEmailTemplateLocale('es-hn'); - } + self::$ESHN ??= new ProjectEmailTemplateLocale('es-hn'); + return self::$ESHN; } public static function ESMX(): ProjectEmailTemplateLocale { - if (!isset(self::$ESMX)) { - self::$ESMX = new ProjectEmailTemplateLocale('es-mx'); - } + self::$ESMX ??= new ProjectEmailTemplateLocale('es-mx'); + return self::$ESMX; } public static function ESNI(): ProjectEmailTemplateLocale { - if (!isset(self::$ESNI)) { - self::$ESNI = new ProjectEmailTemplateLocale('es-ni'); - } + self::$ESNI ??= new ProjectEmailTemplateLocale('es-ni'); + return self::$ESNI; } public static function ESPA(): ProjectEmailTemplateLocale { - if (!isset(self::$ESPA)) { - self::$ESPA = new ProjectEmailTemplateLocale('es-pa'); - } + self::$ESPA ??= new ProjectEmailTemplateLocale('es-pa'); + return self::$ESPA; } public static function ESPE(): ProjectEmailTemplateLocale { - if (!isset(self::$ESPE)) { - self::$ESPE = new ProjectEmailTemplateLocale('es-pe'); - } + self::$ESPE ??= new ProjectEmailTemplateLocale('es-pe'); + return self::$ESPE; } public static function ESPR(): ProjectEmailTemplateLocale { - if (!isset(self::$ESPR)) { - self::$ESPR = new ProjectEmailTemplateLocale('es-pr'); - } + self::$ESPR ??= new ProjectEmailTemplateLocale('es-pr'); + return self::$ESPR; } public static function ESPY(): ProjectEmailTemplateLocale { - if (!isset(self::$ESPY)) { - self::$ESPY = new ProjectEmailTemplateLocale('es-py'); - } + self::$ESPY ??= new ProjectEmailTemplateLocale('es-py'); + return self::$ESPY; } public static function ESSV(): ProjectEmailTemplateLocale { - if (!isset(self::$ESSV)) { - self::$ESSV = new ProjectEmailTemplateLocale('es-sv'); - } + self::$ESSV ??= new ProjectEmailTemplateLocale('es-sv'); + return self::$ESSV; } public static function ESUY(): ProjectEmailTemplateLocale { - if (!isset(self::$ESUY)) { - self::$ESUY = new ProjectEmailTemplateLocale('es-uy'); - } + self::$ESUY ??= new ProjectEmailTemplateLocale('es-uy'); + return self::$ESUY; } public static function ESVE(): ProjectEmailTemplateLocale { - if (!isset(self::$ESVE)) { - self::$ESVE = new ProjectEmailTemplateLocale('es-ve'); - } + self::$ESVE ??= new ProjectEmailTemplateLocale('es-ve'); + return self::$ESVE; } public static function ET(): ProjectEmailTemplateLocale { - if (!isset(self::$ET)) { - self::$ET = new ProjectEmailTemplateLocale('et'); - } + self::$ET ??= new ProjectEmailTemplateLocale('et'); + return self::$ET; } public static function EU(): ProjectEmailTemplateLocale { - if (!isset(self::$EU)) { - self::$EU = new ProjectEmailTemplateLocale('eu'); - } + self::$EU ??= new ProjectEmailTemplateLocale('eu'); + return self::$EU; } public static function FA(): ProjectEmailTemplateLocale { - if (!isset(self::$FA)) { - self::$FA = new ProjectEmailTemplateLocale('fa'); - } + self::$FA ??= new ProjectEmailTemplateLocale('fa'); + return self::$FA; } public static function FI(): ProjectEmailTemplateLocale { - if (!isset(self::$FI)) { - self::$FI = new ProjectEmailTemplateLocale('fi'); - } + self::$FI ??= new ProjectEmailTemplateLocale('fi'); + return self::$FI; } public static function FO(): ProjectEmailTemplateLocale { - if (!isset(self::$FO)) { - self::$FO = new ProjectEmailTemplateLocale('fo'); - } + self::$FO ??= new ProjectEmailTemplateLocale('fo'); + return self::$FO; } public static function FR(): ProjectEmailTemplateLocale { - if (!isset(self::$FR)) { - self::$FR = new ProjectEmailTemplateLocale('fr'); - } + self::$FR ??= new ProjectEmailTemplateLocale('fr'); + return self::$FR; } public static function FRBE(): ProjectEmailTemplateLocale { - if (!isset(self::$FRBE)) { - self::$FRBE = new ProjectEmailTemplateLocale('fr-be'); - } + self::$FRBE ??= new ProjectEmailTemplateLocale('fr-be'); + return self::$FRBE; } public static function FRCA(): ProjectEmailTemplateLocale { - if (!isset(self::$FRCA)) { - self::$FRCA = new ProjectEmailTemplateLocale('fr-ca'); - } + self::$FRCA ??= new ProjectEmailTemplateLocale('fr-ca'); + return self::$FRCA; } public static function FRCH(): ProjectEmailTemplateLocale { - if (!isset(self::$FRCH)) { - self::$FRCH = new ProjectEmailTemplateLocale('fr-ch'); - } + self::$FRCH ??= new ProjectEmailTemplateLocale('fr-ch'); + return self::$FRCH; } public static function FRLU(): ProjectEmailTemplateLocale { - if (!isset(self::$FRLU)) { - self::$FRLU = new ProjectEmailTemplateLocale('fr-lu'); - } + self::$FRLU ??= new ProjectEmailTemplateLocale('fr-lu'); + return self::$FRLU; } public static function GA(): ProjectEmailTemplateLocale { - if (!isset(self::$GA)) { - self::$GA = new ProjectEmailTemplateLocale('ga'); - } + self::$GA ??= new ProjectEmailTemplateLocale('ga'); + return self::$GA; } public static function GD(): ProjectEmailTemplateLocale { - if (!isset(self::$GD)) { - self::$GD = new ProjectEmailTemplateLocale('gd'); - } + self::$GD ??= new ProjectEmailTemplateLocale('gd'); + return self::$GD; } public static function HE(): ProjectEmailTemplateLocale { - if (!isset(self::$HE)) { - self::$HE = new ProjectEmailTemplateLocale('he'); - } + self::$HE ??= new ProjectEmailTemplateLocale('he'); + return self::$HE; } public static function HI(): ProjectEmailTemplateLocale { - if (!isset(self::$HI)) { - self::$HI = new ProjectEmailTemplateLocale('hi'); - } + self::$HI ??= new ProjectEmailTemplateLocale('hi'); + return self::$HI; } public static function HR(): ProjectEmailTemplateLocale { - if (!isset(self::$HR)) { - self::$HR = new ProjectEmailTemplateLocale('hr'); - } + self::$HR ??= new ProjectEmailTemplateLocale('hr'); + return self::$HR; } public static function HU(): ProjectEmailTemplateLocale { - if (!isset(self::$HU)) { - self::$HU = new ProjectEmailTemplateLocale('hu'); - } + self::$HU ??= new ProjectEmailTemplateLocale('hu'); + return self::$HU; } public static function ID(): ProjectEmailTemplateLocale { - if (!isset(self::$ID)) { - self::$ID = new ProjectEmailTemplateLocale('id'); - } + self::$ID ??= new ProjectEmailTemplateLocale('id'); + return self::$ID; } public static function IS(): ProjectEmailTemplateLocale { - if (!isset(self::$IS)) { - self::$IS = new ProjectEmailTemplateLocale('is'); - } + self::$IS ??= new ProjectEmailTemplateLocale('is'); + return self::$IS; } public static function IT(): ProjectEmailTemplateLocale { - if (!isset(self::$IT)) { - self::$IT = new ProjectEmailTemplateLocale('it'); - } + self::$IT ??= new ProjectEmailTemplateLocale('it'); + return self::$IT; } public static function ITCH(): ProjectEmailTemplateLocale { - if (!isset(self::$ITCH)) { - self::$ITCH = new ProjectEmailTemplateLocale('it-ch'); - } + self::$ITCH ??= new ProjectEmailTemplateLocale('it-ch'); + return self::$ITCH; } public static function JA(): ProjectEmailTemplateLocale { - if (!isset(self::$JA)) { - self::$JA = new ProjectEmailTemplateLocale('ja'); - } + self::$JA ??= new ProjectEmailTemplateLocale('ja'); + return self::$JA; } public static function JI(): ProjectEmailTemplateLocale { - if (!isset(self::$JI)) { - self::$JI = new ProjectEmailTemplateLocale('ji'); - } + self::$JI ??= new ProjectEmailTemplateLocale('ji'); + return self::$JI; } public static function KO(): ProjectEmailTemplateLocale { - if (!isset(self::$KO)) { - self::$KO = new ProjectEmailTemplateLocale('ko'); - } + self::$KO ??= new ProjectEmailTemplateLocale('ko'); + return self::$KO; } public static function KU(): ProjectEmailTemplateLocale { - if (!isset(self::$KU)) { - self::$KU = new ProjectEmailTemplateLocale('ku'); - } + self::$KU ??= new ProjectEmailTemplateLocale('ku'); + return self::$KU; } public static function LT(): ProjectEmailTemplateLocale { - if (!isset(self::$LT)) { - self::$LT = new ProjectEmailTemplateLocale('lt'); - } + self::$LT ??= new ProjectEmailTemplateLocale('lt'); + return self::$LT; } public static function LV(): ProjectEmailTemplateLocale { - if (!isset(self::$LV)) { - self::$LV = new ProjectEmailTemplateLocale('lv'); - } + self::$LV ??= new ProjectEmailTemplateLocale('lv'); + return self::$LV; } public static function MK(): ProjectEmailTemplateLocale { - if (!isset(self::$MK)) { - self::$MK = new ProjectEmailTemplateLocale('mk'); - } + self::$MK ??= new ProjectEmailTemplateLocale('mk'); + return self::$MK; } public static function ML(): ProjectEmailTemplateLocale { - if (!isset(self::$ML)) { - self::$ML = new ProjectEmailTemplateLocale('ml'); - } + self::$ML ??= new ProjectEmailTemplateLocale('ml'); + return self::$ML; } public static function MS(): ProjectEmailTemplateLocale { - if (!isset(self::$MS)) { - self::$MS = new ProjectEmailTemplateLocale('ms'); - } + self::$MS ??= new ProjectEmailTemplateLocale('ms'); + return self::$MS; } public static function MT(): ProjectEmailTemplateLocale { - if (!isset(self::$MT)) { - self::$MT = new ProjectEmailTemplateLocale('mt'); - } + self::$MT ??= new ProjectEmailTemplateLocale('mt'); + return self::$MT; } public static function NB(): ProjectEmailTemplateLocale { - if (!isset(self::$NB)) { - self::$NB = new ProjectEmailTemplateLocale('nb'); - } + self::$NB ??= new ProjectEmailTemplateLocale('nb'); + return self::$NB; } public static function NE(): ProjectEmailTemplateLocale { - if (!isset(self::$NE)) { - self::$NE = new ProjectEmailTemplateLocale('ne'); - } + self::$NE ??= new ProjectEmailTemplateLocale('ne'); + return self::$NE; } public static function NL(): ProjectEmailTemplateLocale { - if (!isset(self::$NL)) { - self::$NL = new ProjectEmailTemplateLocale('nl'); - } + self::$NL ??= new ProjectEmailTemplateLocale('nl'); + return self::$NL; } public static function NLBE(): ProjectEmailTemplateLocale { - if (!isset(self::$NLBE)) { - self::$NLBE = new ProjectEmailTemplateLocale('nl-be'); - } + self::$NLBE ??= new ProjectEmailTemplateLocale('nl-be'); + return self::$NLBE; } public static function NN(): ProjectEmailTemplateLocale { - if (!isset(self::$NN)) { - self::$NN = new ProjectEmailTemplateLocale('nn'); - } + self::$NN ??= new ProjectEmailTemplateLocale('nn'); + return self::$NN; } public static function NO(): ProjectEmailTemplateLocale { - if (!isset(self::$NO)) { - self::$NO = new ProjectEmailTemplateLocale('no'); - } + self::$NO ??= new ProjectEmailTemplateLocale('no'); + return self::$NO; } public static function PA(): ProjectEmailTemplateLocale { - if (!isset(self::$PA)) { - self::$PA = new ProjectEmailTemplateLocale('pa'); - } + self::$PA ??= new ProjectEmailTemplateLocale('pa'); + return self::$PA; } public static function PL(): ProjectEmailTemplateLocale { - if (!isset(self::$PL)) { - self::$PL = new ProjectEmailTemplateLocale('pl'); - } + self::$PL ??= new ProjectEmailTemplateLocale('pl'); + return self::$PL; } public static function PT(): ProjectEmailTemplateLocale { - if (!isset(self::$PT)) { - self::$PT = new ProjectEmailTemplateLocale('pt'); - } + self::$PT ??= new ProjectEmailTemplateLocale('pt'); + return self::$PT; } public static function PTBR(): ProjectEmailTemplateLocale { - if (!isset(self::$PTBR)) { - self::$PTBR = new ProjectEmailTemplateLocale('pt-br'); - } + self::$PTBR ??= new ProjectEmailTemplateLocale('pt-br'); + return self::$PTBR; } public static function RM(): ProjectEmailTemplateLocale { - if (!isset(self::$RM)) { - self::$RM = new ProjectEmailTemplateLocale('rm'); - } + self::$RM ??= new ProjectEmailTemplateLocale('rm'); + return self::$RM; } public static function RO(): ProjectEmailTemplateLocale { - if (!isset(self::$RO)) { - self::$RO = new ProjectEmailTemplateLocale('ro'); - } + self::$RO ??= new ProjectEmailTemplateLocale('ro'); + return self::$RO; } public static function ROMD(): ProjectEmailTemplateLocale { - if (!isset(self::$ROMD)) { - self::$ROMD = new ProjectEmailTemplateLocale('ro-md'); - } + self::$ROMD ??= new ProjectEmailTemplateLocale('ro-md'); + return self::$ROMD; } public static function RU(): ProjectEmailTemplateLocale { - if (!isset(self::$RU)) { - self::$RU = new ProjectEmailTemplateLocale('ru'); - } + self::$RU ??= new ProjectEmailTemplateLocale('ru'); + return self::$RU; } public static function RUMD(): ProjectEmailTemplateLocale { - if (!isset(self::$RUMD)) { - self::$RUMD = new ProjectEmailTemplateLocale('ru-md'); - } + self::$RUMD ??= new ProjectEmailTemplateLocale('ru-md'); + return self::$RUMD; } public static function SB(): ProjectEmailTemplateLocale { - if (!isset(self::$SB)) { - self::$SB = new ProjectEmailTemplateLocale('sb'); - } + self::$SB ??= new ProjectEmailTemplateLocale('sb'); + return self::$SB; } public static function SK(): ProjectEmailTemplateLocale { - if (!isset(self::$SK)) { - self::$SK = new ProjectEmailTemplateLocale('sk'); - } + self::$SK ??= new ProjectEmailTemplateLocale('sk'); + return self::$SK; } public static function SL(): ProjectEmailTemplateLocale { - if (!isset(self::$SL)) { - self::$SL = new ProjectEmailTemplateLocale('sl'); - } + self::$SL ??= new ProjectEmailTemplateLocale('sl'); + return self::$SL; } public static function SQ(): ProjectEmailTemplateLocale { - if (!isset(self::$SQ)) { - self::$SQ = new ProjectEmailTemplateLocale('sq'); - } + self::$SQ ??= new ProjectEmailTemplateLocale('sq'); + return self::$SQ; } public static function SR(): ProjectEmailTemplateLocale { - if (!isset(self::$SR)) { - self::$SR = new ProjectEmailTemplateLocale('sr'); - } + self::$SR ??= new ProjectEmailTemplateLocale('sr'); + return self::$SR; } public static function SV(): ProjectEmailTemplateLocale { - if (!isset(self::$SV)) { - self::$SV = new ProjectEmailTemplateLocale('sv'); - } + self::$SV ??= new ProjectEmailTemplateLocale('sv'); + return self::$SV; } public static function SVFI(): ProjectEmailTemplateLocale { - if (!isset(self::$SVFI)) { - self::$SVFI = new ProjectEmailTemplateLocale('sv-fi'); - } + self::$SVFI ??= new ProjectEmailTemplateLocale('sv-fi'); + return self::$SVFI; } public static function TH(): ProjectEmailTemplateLocale { - if (!isset(self::$TH)) { - self::$TH = new ProjectEmailTemplateLocale('th'); - } + self::$TH ??= new ProjectEmailTemplateLocale('th'); + return self::$TH; } public static function TN(): ProjectEmailTemplateLocale { - if (!isset(self::$TN)) { - self::$TN = new ProjectEmailTemplateLocale('tn'); - } + self::$TN ??= new ProjectEmailTemplateLocale('tn'); + return self::$TN; } public static function TR(): ProjectEmailTemplateLocale { - if (!isset(self::$TR)) { - self::$TR = new ProjectEmailTemplateLocale('tr'); - } + self::$TR ??= new ProjectEmailTemplateLocale('tr'); + return self::$TR; } public static function TS(): ProjectEmailTemplateLocale { - if (!isset(self::$TS)) { - self::$TS = new ProjectEmailTemplateLocale('ts'); - } + self::$TS ??= new ProjectEmailTemplateLocale('ts'); + return self::$TS; } public static function UA(): ProjectEmailTemplateLocale { - if (!isset(self::$UA)) { - self::$UA = new ProjectEmailTemplateLocale('ua'); - } + self::$UA ??= new ProjectEmailTemplateLocale('ua'); + return self::$UA; } public static function UR(): ProjectEmailTemplateLocale { - if (!isset(self::$UR)) { - self::$UR = new ProjectEmailTemplateLocale('ur'); - } + self::$UR ??= new ProjectEmailTemplateLocale('ur'); + return self::$UR; } public static function VE(): ProjectEmailTemplateLocale { - if (!isset(self::$VE)) { - self::$VE = new ProjectEmailTemplateLocale('ve'); - } + self::$VE ??= new ProjectEmailTemplateLocale('ve'); + return self::$VE; } public static function VI(): ProjectEmailTemplateLocale { - if (!isset(self::$VI)) { - self::$VI = new ProjectEmailTemplateLocale('vi'); - } + self::$VI ??= new ProjectEmailTemplateLocale('vi'); + return self::$VI; } public static function XH(): ProjectEmailTemplateLocale { - if (!isset(self::$XH)) { - self::$XH = new ProjectEmailTemplateLocale('xh'); - } + self::$XH ??= new ProjectEmailTemplateLocale('xh'); + return self::$XH; } public static function ZHCN(): ProjectEmailTemplateLocale { - if (!isset(self::$ZHCN)) { - self::$ZHCN = new ProjectEmailTemplateLocale('zh-cn'); - } + self::$ZHCN ??= new ProjectEmailTemplateLocale('zh-cn'); + return self::$ZHCN; } public static function ZHHK(): ProjectEmailTemplateLocale { - if (!isset(self::$ZHHK)) { - self::$ZHHK = new ProjectEmailTemplateLocale('zh-hk'); - } + self::$ZHHK ??= new ProjectEmailTemplateLocale('zh-hk'); + return self::$ZHHK; } public static function ZHSG(): ProjectEmailTemplateLocale { - if (!isset(self::$ZHSG)) { - self::$ZHSG = new ProjectEmailTemplateLocale('zh-sg'); - } + self::$ZHSG ??= new ProjectEmailTemplateLocale('zh-sg'); + return self::$ZHSG; } public static function ZHTW(): ProjectEmailTemplateLocale { - if (!isset(self::$ZHTW)) { - self::$ZHTW = new ProjectEmailTemplateLocale('zh-tw'); - } + self::$ZHTW ??= new ProjectEmailTemplateLocale('zh-tw'); + return self::$ZHTW; } public static function ZU(): ProjectEmailTemplateLocale { - if (!isset(self::$ZU)) { - self::$ZU = new ProjectEmailTemplateLocale('zu'); - } + self::$ZU ??= new ProjectEmailTemplateLocale('zu'); + return self::$ZU; } diff --git a/src/Appwrite/Enums/ProjectKeyScopes.php b/src/Appwrite/Enums/ProjectKeyScopes.php index 1a7d9db..408eb9c 100644 --- a/src/Appwrite/Enums/ProjectKeyScopes.php +++ b/src/Appwrite/Enums/ProjectKeyScopes.php @@ -51,6 +51,18 @@ class ProjectKeyScopes implements JsonSerializable, Stringable private static ProjectKeyScopes $ATTRIBUTESWRITE; private static ProjectKeyScopes $DOCUMENTSREAD; private static ProjectKeyScopes $DOCUMENTSWRITE; + private static ProjectKeyScopes $DOCUMENTSDBREAD; + private static ProjectKeyScopes $DOCUMENTSDBWRITE; + private static ProjectKeyScopes $DOCUMENTSDBCOLLECTIONSREAD; + private static ProjectKeyScopes $DOCUMENTSDBCOLLECTIONSWRITE; + private static ProjectKeyScopes $DOCUMENTSDBDOCUMENTSREAD; + private static ProjectKeyScopes $DOCUMENTSDBDOCUMENTSWRITE; + private static ProjectKeyScopes $VECTORSDBREAD; + private static ProjectKeyScopes $VECTORSDBWRITE; + private static ProjectKeyScopes $VECTORSDBCOLLECTIONSREAD; + private static ProjectKeyScopes $VECTORSDBCOLLECTIONSWRITE; + private static ProjectKeyScopes $VECTORSDBDOCUMENTSREAD; + private static ProjectKeyScopes $VECTORSDBDOCUMENTSWRITE; private static ProjectKeyScopes $BUCKETSREAD; private static ProjectKeyScopes $BUCKETSWRITE; private static ProjectKeyScopes $FILESREAD; @@ -131,737 +143,704 @@ public function jsonSerialize(): string public static function PROJECTREAD(): ProjectKeyScopes { - if (!isset(self::$PROJECTREAD)) { - self::$PROJECTREAD = new ProjectKeyScopes('project.read'); - } + self::$PROJECTREAD ??= new ProjectKeyScopes('project.read'); + return self::$PROJECTREAD; } public static function PROJECTWRITE(): ProjectKeyScopes { - if (!isset(self::$PROJECTWRITE)) { - self::$PROJECTWRITE = new ProjectKeyScopes('project.write'); - } + self::$PROJECTWRITE ??= new ProjectKeyScopes('project.write'); + return self::$PROJECTWRITE; } public static function USAGEREAD(): ProjectKeyScopes { - if (!isset(self::$USAGEREAD)) { - self::$USAGEREAD = new ProjectKeyScopes('usage.read'); - } + self::$USAGEREAD ??= new ProjectKeyScopes('usage.read'); + return self::$USAGEREAD; } public static function KEYSREAD(): ProjectKeyScopes { - if (!isset(self::$KEYSREAD)) { - self::$KEYSREAD = new ProjectKeyScopes('keys.read'); - } + self::$KEYSREAD ??= new ProjectKeyScopes('keys.read'); + return self::$KEYSREAD; } public static function KEYSWRITE(): ProjectKeyScopes { - if (!isset(self::$KEYSWRITE)) { - self::$KEYSWRITE = new ProjectKeyScopes('keys.write'); - } + self::$KEYSWRITE ??= new ProjectKeyScopes('keys.write'); + return self::$KEYSWRITE; } public static function PLATFORMSREAD(): ProjectKeyScopes { - if (!isset(self::$PLATFORMSREAD)) { - self::$PLATFORMSREAD = new ProjectKeyScopes('platforms.read'); - } + self::$PLATFORMSREAD ??= new ProjectKeyScopes('platforms.read'); + return self::$PLATFORMSREAD; } public static function PLATFORMSWRITE(): ProjectKeyScopes { - if (!isset(self::$PLATFORMSWRITE)) { - self::$PLATFORMSWRITE = new ProjectKeyScopes('platforms.write'); - } + self::$PLATFORMSWRITE ??= new ProjectKeyScopes('platforms.write'); + return self::$PLATFORMSWRITE; } public static function MOCKSREAD(): ProjectKeyScopes { - if (!isset(self::$MOCKSREAD)) { - self::$MOCKSREAD = new ProjectKeyScopes('mocks.read'); - } + self::$MOCKSREAD ??= new ProjectKeyScopes('mocks.read'); + return self::$MOCKSREAD; } public static function MOCKSWRITE(): ProjectKeyScopes { - if (!isset(self::$MOCKSWRITE)) { - self::$MOCKSWRITE = new ProjectKeyScopes('mocks.write'); - } + self::$MOCKSWRITE ??= new ProjectKeyScopes('mocks.write'); + return self::$MOCKSWRITE; } public static function POLICIESREAD(): ProjectKeyScopes { - if (!isset(self::$POLICIESREAD)) { - self::$POLICIESREAD = new ProjectKeyScopes('policies.read'); - } + self::$POLICIESREAD ??= new ProjectKeyScopes('policies.read'); + return self::$POLICIESREAD; } public static function POLICIESWRITE(): ProjectKeyScopes { - if (!isset(self::$POLICIESWRITE)) { - self::$POLICIESWRITE = new ProjectKeyScopes('policies.write'); - } + self::$POLICIESWRITE ??= new ProjectKeyScopes('policies.write'); + return self::$POLICIESWRITE; } public static function PROJECTPOLICIESREAD(): ProjectKeyScopes { - if (!isset(self::$PROJECTPOLICIESREAD)) { - self::$PROJECTPOLICIESREAD = new ProjectKeyScopes('project.policies.read'); - } + self::$PROJECTPOLICIESREAD ??= new ProjectKeyScopes('project.policies.read'); + return self::$PROJECTPOLICIESREAD; } public static function PROJECTPOLICIESWRITE(): ProjectKeyScopes { - if (!isset(self::$PROJECTPOLICIESWRITE)) { - self::$PROJECTPOLICIESWRITE = new ProjectKeyScopes('project.policies.write'); - } + self::$PROJECTPOLICIESWRITE ??= new ProjectKeyScopes('project.policies.write'); + return self::$PROJECTPOLICIESWRITE; } public static function PROJECTOAUTH2READ(): ProjectKeyScopes { - if (!isset(self::$PROJECTOAUTH2READ)) { - self::$PROJECTOAUTH2READ = new ProjectKeyScopes('project.oauth2.read'); - } + self::$PROJECTOAUTH2READ ??= new ProjectKeyScopes('project.oauth2.read'); + return self::$PROJECTOAUTH2READ; } public static function PROJECTOAUTH2WRITE(): ProjectKeyScopes { - if (!isset(self::$PROJECTOAUTH2WRITE)) { - self::$PROJECTOAUTH2WRITE = new ProjectKeyScopes('project.oauth2.write'); - } + self::$PROJECTOAUTH2WRITE ??= new ProjectKeyScopes('project.oauth2.write'); + return self::$PROJECTOAUTH2WRITE; } public static function TEMPLATESREAD(): ProjectKeyScopes { - if (!isset(self::$TEMPLATESREAD)) { - self::$TEMPLATESREAD = new ProjectKeyScopes('templates.read'); - } + self::$TEMPLATESREAD ??= new ProjectKeyScopes('templates.read'); + return self::$TEMPLATESREAD; } public static function TEMPLATESWRITE(): ProjectKeyScopes { - if (!isset(self::$TEMPLATESWRITE)) { - self::$TEMPLATESWRITE = new ProjectKeyScopes('templates.write'); - } + self::$TEMPLATESWRITE ??= new ProjectKeyScopes('templates.write'); + return self::$TEMPLATESWRITE; } public static function STAGESREAD(): ProjectKeyScopes { - if (!isset(self::$STAGESREAD)) { - self::$STAGESREAD = new ProjectKeyScopes('stages.read'); - } + self::$STAGESREAD ??= new ProjectKeyScopes('stages.read'); + return self::$STAGESREAD; } public static function STAGESWRITE(): ProjectKeyScopes { - if (!isset(self::$STAGESWRITE)) { - self::$STAGESWRITE = new ProjectKeyScopes('stages.write'); - } + self::$STAGESWRITE ??= new ProjectKeyScopes('stages.write'); + return self::$STAGESWRITE; } public static function USERSREAD(): ProjectKeyScopes { - if (!isset(self::$USERSREAD)) { - self::$USERSREAD = new ProjectKeyScopes('users.read'); - } + self::$USERSREAD ??= new ProjectKeyScopes('users.read'); + return self::$USERSREAD; } public static function USERSWRITE(): ProjectKeyScopes { - if (!isset(self::$USERSWRITE)) { - self::$USERSWRITE = new ProjectKeyScopes('users.write'); - } + self::$USERSWRITE ??= new ProjectKeyScopes('users.write'); + return self::$USERSWRITE; } public static function SESSIONSREAD(): ProjectKeyScopes { - if (!isset(self::$SESSIONSREAD)) { - self::$SESSIONSREAD = new ProjectKeyScopes('sessions.read'); - } + self::$SESSIONSREAD ??= new ProjectKeyScopes('sessions.read'); + return self::$SESSIONSREAD; } public static function SESSIONSWRITE(): ProjectKeyScopes { - if (!isset(self::$SESSIONSWRITE)) { - self::$SESSIONSWRITE = new ProjectKeyScopes('sessions.write'); - } + self::$SESSIONSWRITE ??= new ProjectKeyScopes('sessions.write'); + return self::$SESSIONSWRITE; } public static function TEAMSREAD(): ProjectKeyScopes { - if (!isset(self::$TEAMSREAD)) { - self::$TEAMSREAD = new ProjectKeyScopes('teams.read'); - } + self::$TEAMSREAD ??= new ProjectKeyScopes('teams.read'); + return self::$TEAMSREAD; } public static function TEAMSWRITE(): ProjectKeyScopes { - if (!isset(self::$TEAMSWRITE)) { - self::$TEAMSWRITE = new ProjectKeyScopes('teams.write'); - } + self::$TEAMSWRITE ??= new ProjectKeyScopes('teams.write'); + return self::$TEAMSWRITE; } public static function DATABASESREAD(): ProjectKeyScopes { - if (!isset(self::$DATABASESREAD)) { - self::$DATABASESREAD = new ProjectKeyScopes('databases.read'); - } + self::$DATABASESREAD ??= new ProjectKeyScopes('databases.read'); + return self::$DATABASESREAD; } public static function DATABASESWRITE(): ProjectKeyScopes { - if (!isset(self::$DATABASESWRITE)) { - self::$DATABASESWRITE = new ProjectKeyScopes('databases.write'); - } + self::$DATABASESWRITE ??= new ProjectKeyScopes('databases.write'); + return self::$DATABASESWRITE; } public static function TABLESREAD(): ProjectKeyScopes { - if (!isset(self::$TABLESREAD)) { - self::$TABLESREAD = new ProjectKeyScopes('tables.read'); - } + self::$TABLESREAD ??= new ProjectKeyScopes('tables.read'); + return self::$TABLESREAD; } public static function TABLESWRITE(): ProjectKeyScopes { - if (!isset(self::$TABLESWRITE)) { - self::$TABLESWRITE = new ProjectKeyScopes('tables.write'); - } + self::$TABLESWRITE ??= new ProjectKeyScopes('tables.write'); + return self::$TABLESWRITE; } public static function COLUMNSREAD(): ProjectKeyScopes { - if (!isset(self::$COLUMNSREAD)) { - self::$COLUMNSREAD = new ProjectKeyScopes('columns.read'); - } + self::$COLUMNSREAD ??= new ProjectKeyScopes('columns.read'); + return self::$COLUMNSREAD; } public static function COLUMNSWRITE(): ProjectKeyScopes { - if (!isset(self::$COLUMNSWRITE)) { - self::$COLUMNSWRITE = new ProjectKeyScopes('columns.write'); - } + self::$COLUMNSWRITE ??= new ProjectKeyScopes('columns.write'); + return self::$COLUMNSWRITE; } public static function INDEXESREAD(): ProjectKeyScopes { - if (!isset(self::$INDEXESREAD)) { - self::$INDEXESREAD = new ProjectKeyScopes('indexes.read'); - } + self::$INDEXESREAD ??= new ProjectKeyScopes('indexes.read'); + return self::$INDEXESREAD; } public static function INDEXESWRITE(): ProjectKeyScopes { - if (!isset(self::$INDEXESWRITE)) { - self::$INDEXESWRITE = new ProjectKeyScopes('indexes.write'); - } + self::$INDEXESWRITE ??= new ProjectKeyScopes('indexes.write'); + return self::$INDEXESWRITE; } public static function ROWSREAD(): ProjectKeyScopes { - if (!isset(self::$ROWSREAD)) { - self::$ROWSREAD = new ProjectKeyScopes('rows.read'); - } + self::$ROWSREAD ??= new ProjectKeyScopes('rows.read'); + return self::$ROWSREAD; } public static function ROWSWRITE(): ProjectKeyScopes { - if (!isset(self::$ROWSWRITE)) { - self::$ROWSWRITE = new ProjectKeyScopes('rows.write'); - } + self::$ROWSWRITE ??= new ProjectKeyScopes('rows.write'); + return self::$ROWSWRITE; } public static function EMBEDDINGSWRITE(): ProjectKeyScopes { - if (!isset(self::$EMBEDDINGSWRITE)) { - self::$EMBEDDINGSWRITE = new ProjectKeyScopes('embeddings.write'); - } + self::$EMBEDDINGSWRITE ??= new ProjectKeyScopes('embeddings.write'); + return self::$EMBEDDINGSWRITE; } public static function COLLECTIONSREAD(): ProjectKeyScopes { - if (!isset(self::$COLLECTIONSREAD)) { - self::$COLLECTIONSREAD = new ProjectKeyScopes('collections.read'); - } + self::$COLLECTIONSREAD ??= new ProjectKeyScopes('collections.read'); + return self::$COLLECTIONSREAD; } public static function COLLECTIONSWRITE(): ProjectKeyScopes { - if (!isset(self::$COLLECTIONSWRITE)) { - self::$COLLECTIONSWRITE = new ProjectKeyScopes('collections.write'); - } + self::$COLLECTIONSWRITE ??= new ProjectKeyScopes('collections.write'); + return self::$COLLECTIONSWRITE; } public static function ATTRIBUTESREAD(): ProjectKeyScopes { - if (!isset(self::$ATTRIBUTESREAD)) { - self::$ATTRIBUTESREAD = new ProjectKeyScopes('attributes.read'); - } + self::$ATTRIBUTESREAD ??= new ProjectKeyScopes('attributes.read'); + return self::$ATTRIBUTESREAD; } public static function ATTRIBUTESWRITE(): ProjectKeyScopes { - if (!isset(self::$ATTRIBUTESWRITE)) { - self::$ATTRIBUTESWRITE = new ProjectKeyScopes('attributes.write'); - } + self::$ATTRIBUTESWRITE ??= new ProjectKeyScopes('attributes.write'); + return self::$ATTRIBUTESWRITE; } public static function DOCUMENTSREAD(): ProjectKeyScopes { - if (!isset(self::$DOCUMENTSREAD)) { - self::$DOCUMENTSREAD = new ProjectKeyScopes('documents.read'); - } + self::$DOCUMENTSREAD ??= new ProjectKeyScopes('documents.read'); + return self::$DOCUMENTSREAD; } public static function DOCUMENTSWRITE(): ProjectKeyScopes { - if (!isset(self::$DOCUMENTSWRITE)) { - self::$DOCUMENTSWRITE = new ProjectKeyScopes('documents.write'); - } + self::$DOCUMENTSWRITE ??= new ProjectKeyScopes('documents.write'); + return self::$DOCUMENTSWRITE; } + public static function DOCUMENTSDBREAD(): ProjectKeyScopes + { + self::$DOCUMENTSDBREAD ??= new ProjectKeyScopes('documentsdb.read'); + + return self::$DOCUMENTSDBREAD; + } + public static function DOCUMENTSDBWRITE(): ProjectKeyScopes + { + self::$DOCUMENTSDBWRITE ??= new ProjectKeyScopes('documentsdb.write'); + + return self::$DOCUMENTSDBWRITE; + } + public static function DOCUMENTSDBCOLLECTIONSREAD(): ProjectKeyScopes + { + self::$DOCUMENTSDBCOLLECTIONSREAD ??= new ProjectKeyScopes('documentsdb.collections.read'); + + return self::$DOCUMENTSDBCOLLECTIONSREAD; + } + public static function DOCUMENTSDBCOLLECTIONSWRITE(): ProjectKeyScopes + { + self::$DOCUMENTSDBCOLLECTIONSWRITE ??= new ProjectKeyScopes('documentsdb.collections.write'); + + return self::$DOCUMENTSDBCOLLECTIONSWRITE; + } + public static function DOCUMENTSDBDOCUMENTSREAD(): ProjectKeyScopes + { + self::$DOCUMENTSDBDOCUMENTSREAD ??= new ProjectKeyScopes('documentsdb.documents.read'); + + return self::$DOCUMENTSDBDOCUMENTSREAD; + } + public static function DOCUMENTSDBDOCUMENTSWRITE(): ProjectKeyScopes + { + self::$DOCUMENTSDBDOCUMENTSWRITE ??= new ProjectKeyScopes('documentsdb.documents.write'); + + return self::$DOCUMENTSDBDOCUMENTSWRITE; + } + public static function VECTORSDBREAD(): ProjectKeyScopes + { + self::$VECTORSDBREAD ??= new ProjectKeyScopes('vectorsdb.read'); + + return self::$VECTORSDBREAD; + } + public static function VECTORSDBWRITE(): ProjectKeyScopes + { + self::$VECTORSDBWRITE ??= new ProjectKeyScopes('vectorsdb.write'); + + return self::$VECTORSDBWRITE; + } + public static function VECTORSDBCOLLECTIONSREAD(): ProjectKeyScopes + { + self::$VECTORSDBCOLLECTIONSREAD ??= new ProjectKeyScopes('vectorsdb.collections.read'); + + return self::$VECTORSDBCOLLECTIONSREAD; + } + public static function VECTORSDBCOLLECTIONSWRITE(): ProjectKeyScopes + { + self::$VECTORSDBCOLLECTIONSWRITE ??= new ProjectKeyScopes('vectorsdb.collections.write'); + + return self::$VECTORSDBCOLLECTIONSWRITE; + } + public static function VECTORSDBDOCUMENTSREAD(): ProjectKeyScopes + { + self::$VECTORSDBDOCUMENTSREAD ??= new ProjectKeyScopes('vectorsdb.documents.read'); + + return self::$VECTORSDBDOCUMENTSREAD; + } + public static function VECTORSDBDOCUMENTSWRITE(): ProjectKeyScopes + { + self::$VECTORSDBDOCUMENTSWRITE ??= new ProjectKeyScopes('vectorsdb.documents.write'); + + return self::$VECTORSDBDOCUMENTSWRITE; + } public static function BUCKETSREAD(): ProjectKeyScopes { - if (!isset(self::$BUCKETSREAD)) { - self::$BUCKETSREAD = new ProjectKeyScopes('buckets.read'); - } + self::$BUCKETSREAD ??= new ProjectKeyScopes('buckets.read'); + return self::$BUCKETSREAD; } public static function BUCKETSWRITE(): ProjectKeyScopes { - if (!isset(self::$BUCKETSWRITE)) { - self::$BUCKETSWRITE = new ProjectKeyScopes('buckets.write'); - } + self::$BUCKETSWRITE ??= new ProjectKeyScopes('buckets.write'); + return self::$BUCKETSWRITE; } public static function FILESREAD(): ProjectKeyScopes { - if (!isset(self::$FILESREAD)) { - self::$FILESREAD = new ProjectKeyScopes('files.read'); - } + self::$FILESREAD ??= new ProjectKeyScopes('files.read'); + return self::$FILESREAD; } public static function FILESWRITE(): ProjectKeyScopes { - if (!isset(self::$FILESWRITE)) { - self::$FILESWRITE = new ProjectKeyScopes('files.write'); - } + self::$FILESWRITE ??= new ProjectKeyScopes('files.write'); + return self::$FILESWRITE; } public static function TOKENSREAD(): ProjectKeyScopes { - if (!isset(self::$TOKENSREAD)) { - self::$TOKENSREAD = new ProjectKeyScopes('tokens.read'); - } + self::$TOKENSREAD ??= new ProjectKeyScopes('tokens.read'); + return self::$TOKENSREAD; } public static function TOKENSWRITE(): ProjectKeyScopes { - if (!isset(self::$TOKENSWRITE)) { - self::$TOKENSWRITE = new ProjectKeyScopes('tokens.write'); - } + self::$TOKENSWRITE ??= new ProjectKeyScopes('tokens.write'); + return self::$TOKENSWRITE; } public static function FUNCTIONSREAD(): ProjectKeyScopes { - if (!isset(self::$FUNCTIONSREAD)) { - self::$FUNCTIONSREAD = new ProjectKeyScopes('functions.read'); - } + self::$FUNCTIONSREAD ??= new ProjectKeyScopes('functions.read'); + return self::$FUNCTIONSREAD; } public static function FUNCTIONSWRITE(): ProjectKeyScopes { - if (!isset(self::$FUNCTIONSWRITE)) { - self::$FUNCTIONSWRITE = new ProjectKeyScopes('functions.write'); - } + self::$FUNCTIONSWRITE ??= new ProjectKeyScopes('functions.write'); + return self::$FUNCTIONSWRITE; } public static function EXECUTIONSREAD(): ProjectKeyScopes { - if (!isset(self::$EXECUTIONSREAD)) { - self::$EXECUTIONSREAD = new ProjectKeyScopes('executions.read'); - } + self::$EXECUTIONSREAD ??= new ProjectKeyScopes('executions.read'); + return self::$EXECUTIONSREAD; } public static function EXECUTIONSWRITE(): ProjectKeyScopes { - if (!isset(self::$EXECUTIONSWRITE)) { - self::$EXECUTIONSWRITE = new ProjectKeyScopes('executions.write'); - } + self::$EXECUTIONSWRITE ??= new ProjectKeyScopes('executions.write'); + return self::$EXECUTIONSWRITE; } public static function EXECUTIONREAD(): ProjectKeyScopes { - if (!isset(self::$EXECUTIONREAD)) { - self::$EXECUTIONREAD = new ProjectKeyScopes('execution.read'); - } + self::$EXECUTIONREAD ??= new ProjectKeyScopes('execution.read'); + return self::$EXECUTIONREAD; } public static function EXECUTIONWRITE(): ProjectKeyScopes { - if (!isset(self::$EXECUTIONWRITE)) { - self::$EXECUTIONWRITE = new ProjectKeyScopes('execution.write'); - } + self::$EXECUTIONWRITE ??= new ProjectKeyScopes('execution.write'); + return self::$EXECUTIONWRITE; } public static function SITESREAD(): ProjectKeyScopes { - if (!isset(self::$SITESREAD)) { - self::$SITESREAD = new ProjectKeyScopes('sites.read'); - } + self::$SITESREAD ??= new ProjectKeyScopes('sites.read'); + return self::$SITESREAD; } public static function SITESWRITE(): ProjectKeyScopes { - if (!isset(self::$SITESWRITE)) { - self::$SITESWRITE = new ProjectKeyScopes('sites.write'); - } + self::$SITESWRITE ??= new ProjectKeyScopes('sites.write'); + return self::$SITESWRITE; } public static function LOGREAD(): ProjectKeyScopes { - if (!isset(self::$LOGREAD)) { - self::$LOGREAD = new ProjectKeyScopes('log.read'); - } + self::$LOGREAD ??= new ProjectKeyScopes('log.read'); + return self::$LOGREAD; } public static function LOGWRITE(): ProjectKeyScopes { - if (!isset(self::$LOGWRITE)) { - self::$LOGWRITE = new ProjectKeyScopes('log.write'); - } + self::$LOGWRITE ??= new ProjectKeyScopes('log.write'); + return self::$LOGWRITE; } public static function PROVIDERSREAD(): ProjectKeyScopes { - if (!isset(self::$PROVIDERSREAD)) { - self::$PROVIDERSREAD = new ProjectKeyScopes('providers.read'); - } + self::$PROVIDERSREAD ??= new ProjectKeyScopes('providers.read'); + return self::$PROVIDERSREAD; } public static function PROVIDERSWRITE(): ProjectKeyScopes { - if (!isset(self::$PROVIDERSWRITE)) { - self::$PROVIDERSWRITE = new ProjectKeyScopes('providers.write'); - } + self::$PROVIDERSWRITE ??= new ProjectKeyScopes('providers.write'); + return self::$PROVIDERSWRITE; } public static function TOPICSREAD(): ProjectKeyScopes { - if (!isset(self::$TOPICSREAD)) { - self::$TOPICSREAD = new ProjectKeyScopes('topics.read'); - } + self::$TOPICSREAD ??= new ProjectKeyScopes('topics.read'); + return self::$TOPICSREAD; } public static function TOPICSWRITE(): ProjectKeyScopes { - if (!isset(self::$TOPICSWRITE)) { - self::$TOPICSWRITE = new ProjectKeyScopes('topics.write'); - } + self::$TOPICSWRITE ??= new ProjectKeyScopes('topics.write'); + return self::$TOPICSWRITE; } public static function SUBSCRIBERSREAD(): ProjectKeyScopes { - if (!isset(self::$SUBSCRIBERSREAD)) { - self::$SUBSCRIBERSREAD = new ProjectKeyScopes('subscribers.read'); - } + self::$SUBSCRIBERSREAD ??= new ProjectKeyScopes('subscribers.read'); + return self::$SUBSCRIBERSREAD; } public static function SUBSCRIBERSWRITE(): ProjectKeyScopes { - if (!isset(self::$SUBSCRIBERSWRITE)) { - self::$SUBSCRIBERSWRITE = new ProjectKeyScopes('subscribers.write'); - } + self::$SUBSCRIBERSWRITE ??= new ProjectKeyScopes('subscribers.write'); + return self::$SUBSCRIBERSWRITE; } public static function TARGETSREAD(): ProjectKeyScopes { - if (!isset(self::$TARGETSREAD)) { - self::$TARGETSREAD = new ProjectKeyScopes('targets.read'); - } + self::$TARGETSREAD ??= new ProjectKeyScopes('targets.read'); + return self::$TARGETSREAD; } public static function TARGETSWRITE(): ProjectKeyScopes { - if (!isset(self::$TARGETSWRITE)) { - self::$TARGETSWRITE = new ProjectKeyScopes('targets.write'); - } + self::$TARGETSWRITE ??= new ProjectKeyScopes('targets.write'); + return self::$TARGETSWRITE; } public static function MESSAGESREAD(): ProjectKeyScopes { - if (!isset(self::$MESSAGESREAD)) { - self::$MESSAGESREAD = new ProjectKeyScopes('messages.read'); - } + self::$MESSAGESREAD ??= new ProjectKeyScopes('messages.read'); + return self::$MESSAGESREAD; } public static function MESSAGESWRITE(): ProjectKeyScopes { - if (!isset(self::$MESSAGESWRITE)) { - self::$MESSAGESWRITE = new ProjectKeyScopes('messages.write'); - } + self::$MESSAGESWRITE ??= new ProjectKeyScopes('messages.write'); + return self::$MESSAGESWRITE; } public static function RULESREAD(): ProjectKeyScopes { - if (!isset(self::$RULESREAD)) { - self::$RULESREAD = new ProjectKeyScopes('rules.read'); - } + self::$RULESREAD ??= new ProjectKeyScopes('rules.read'); + return self::$RULESREAD; } public static function RULESWRITE(): ProjectKeyScopes { - if (!isset(self::$RULESWRITE)) { - self::$RULESWRITE = new ProjectKeyScopes('rules.write'); - } + self::$RULESWRITE ??= new ProjectKeyScopes('rules.write'); + return self::$RULESWRITE; } public static function WEBHOOKSREAD(): ProjectKeyScopes { - if (!isset(self::$WEBHOOKSREAD)) { - self::$WEBHOOKSREAD = new ProjectKeyScopes('webhooks.read'); - } + self::$WEBHOOKSREAD ??= new ProjectKeyScopes('webhooks.read'); + return self::$WEBHOOKSREAD; } public static function WEBHOOKSWRITE(): ProjectKeyScopes { - if (!isset(self::$WEBHOOKSWRITE)) { - self::$WEBHOOKSWRITE = new ProjectKeyScopes('webhooks.write'); - } + self::$WEBHOOKSWRITE ??= new ProjectKeyScopes('webhooks.write'); + return self::$WEBHOOKSWRITE; } public static function LOCALEREAD(): ProjectKeyScopes { - if (!isset(self::$LOCALEREAD)) { - self::$LOCALEREAD = new ProjectKeyScopes('locale.read'); - } + self::$LOCALEREAD ??= new ProjectKeyScopes('locale.read'); + return self::$LOCALEREAD; } public static function AVATARSREAD(): ProjectKeyScopes { - if (!isset(self::$AVATARSREAD)) { - self::$AVATARSREAD = new ProjectKeyScopes('avatars.read'); - } + self::$AVATARSREAD ??= new ProjectKeyScopes('avatars.read'); + return self::$AVATARSREAD; } public static function HEALTHREAD(): ProjectKeyScopes { - if (!isset(self::$HEALTHREAD)) { - self::$HEALTHREAD = new ProjectKeyScopes('health.read'); - } + self::$HEALTHREAD ??= new ProjectKeyScopes('health.read'); + return self::$HEALTHREAD; } public static function ASSISTANTREAD(): ProjectKeyScopes { - if (!isset(self::$ASSISTANTREAD)) { - self::$ASSISTANTREAD = new ProjectKeyScopes('assistant.read'); - } + self::$ASSISTANTREAD ??= new ProjectKeyScopes('assistant.read'); + return self::$ASSISTANTREAD; } public static function MIGRATIONSREAD(): ProjectKeyScopes { - if (!isset(self::$MIGRATIONSREAD)) { - self::$MIGRATIONSREAD = new ProjectKeyScopes('migrations.read'); - } + self::$MIGRATIONSREAD ??= new ProjectKeyScopes('migrations.read'); + return self::$MIGRATIONSREAD; } public static function MIGRATIONSWRITE(): ProjectKeyScopes { - if (!isset(self::$MIGRATIONSWRITE)) { - self::$MIGRATIONSWRITE = new ProjectKeyScopes('migrations.write'); - } + self::$MIGRATIONSWRITE ??= new ProjectKeyScopes('migrations.write'); + return self::$MIGRATIONSWRITE; } public static function SCHEDULESREAD(): ProjectKeyScopes { - if (!isset(self::$SCHEDULESREAD)) { - self::$SCHEDULESREAD = new ProjectKeyScopes('schedules.read'); - } + self::$SCHEDULESREAD ??= new ProjectKeyScopes('schedules.read'); + return self::$SCHEDULESREAD; } public static function SCHEDULESWRITE(): ProjectKeyScopes { - if (!isset(self::$SCHEDULESWRITE)) { - self::$SCHEDULESWRITE = new ProjectKeyScopes('schedules.write'); - } + self::$SCHEDULESWRITE ??= new ProjectKeyScopes('schedules.write'); + return self::$SCHEDULESWRITE; } public static function VCSREAD(): ProjectKeyScopes { - if (!isset(self::$VCSREAD)) { - self::$VCSREAD = new ProjectKeyScopes('vcs.read'); - } + self::$VCSREAD ??= new ProjectKeyScopes('vcs.read'); + return self::$VCSREAD; } public static function VCSWRITE(): ProjectKeyScopes { - if (!isset(self::$VCSWRITE)) { - self::$VCSWRITE = new ProjectKeyScopes('vcs.write'); - } + self::$VCSWRITE ??= new ProjectKeyScopes('vcs.write'); + return self::$VCSWRITE; } public static function INSIGHTSREAD(): ProjectKeyScopes { - if (!isset(self::$INSIGHTSREAD)) { - self::$INSIGHTSREAD = new ProjectKeyScopes('insights.read'); - } + self::$INSIGHTSREAD ??= new ProjectKeyScopes('insights.read'); + return self::$INSIGHTSREAD; } public static function INSIGHTSWRITE(): ProjectKeyScopes { - if (!isset(self::$INSIGHTSWRITE)) { - self::$INSIGHTSWRITE = new ProjectKeyScopes('insights.write'); - } + self::$INSIGHTSWRITE ??= new ProjectKeyScopes('insights.write'); + return self::$INSIGHTSWRITE; } public static function REPORTSREAD(): ProjectKeyScopes { - if (!isset(self::$REPORTSREAD)) { - self::$REPORTSREAD = new ProjectKeyScopes('reports.read'); - } + self::$REPORTSREAD ??= new ProjectKeyScopes('reports.read'); + return self::$REPORTSREAD; } public static function REPORTSWRITE(): ProjectKeyScopes { - if (!isset(self::$REPORTSWRITE)) { - self::$REPORTSWRITE = new ProjectKeyScopes('reports.write'); - } + self::$REPORTSWRITE ??= new ProjectKeyScopes('reports.write'); + return self::$REPORTSWRITE; } public static function PRESENCESREAD(): ProjectKeyScopes { - if (!isset(self::$PRESENCESREAD)) { - self::$PRESENCESREAD = new ProjectKeyScopes('presences.read'); - } + self::$PRESENCESREAD ??= new ProjectKeyScopes('presences.read'); + return self::$PRESENCESREAD; } public static function PRESENCESWRITE(): ProjectKeyScopes { - if (!isset(self::$PRESENCESWRITE)) { - self::$PRESENCESWRITE = new ProjectKeyScopes('presences.write'); - } + self::$PRESENCESWRITE ??= new ProjectKeyScopes('presences.write'); + return self::$PRESENCESWRITE; } public static function BACKUPSPOLICIESREAD(): ProjectKeyScopes { - if (!isset(self::$BACKUPSPOLICIESREAD)) { - self::$BACKUPSPOLICIESREAD = new ProjectKeyScopes('backups.policies.read'); - } + self::$BACKUPSPOLICIESREAD ??= new ProjectKeyScopes('backups.policies.read'); + return self::$BACKUPSPOLICIESREAD; } public static function BACKUPSPOLICIESWRITE(): ProjectKeyScopes { - if (!isset(self::$BACKUPSPOLICIESWRITE)) { - self::$BACKUPSPOLICIESWRITE = new ProjectKeyScopes('backups.policies.write'); - } + self::$BACKUPSPOLICIESWRITE ??= new ProjectKeyScopes('backups.policies.write'); + return self::$BACKUPSPOLICIESWRITE; } public static function ARCHIVESREAD(): ProjectKeyScopes { - if (!isset(self::$ARCHIVESREAD)) { - self::$ARCHIVESREAD = new ProjectKeyScopes('archives.read'); - } + self::$ARCHIVESREAD ??= new ProjectKeyScopes('archives.read'); + return self::$ARCHIVESREAD; } public static function ARCHIVESWRITE(): ProjectKeyScopes { - if (!isset(self::$ARCHIVESWRITE)) { - self::$ARCHIVESWRITE = new ProjectKeyScopes('archives.write'); - } + self::$ARCHIVESWRITE ??= new ProjectKeyScopes('archives.write'); + return self::$ARCHIVESWRITE; } public static function RESTORATIONSREAD(): ProjectKeyScopes { - if (!isset(self::$RESTORATIONSREAD)) { - self::$RESTORATIONSREAD = new ProjectKeyScopes('restorations.read'); - } + self::$RESTORATIONSREAD ??= new ProjectKeyScopes('restorations.read'); + return self::$RESTORATIONSREAD; } public static function RESTORATIONSWRITE(): ProjectKeyScopes { - if (!isset(self::$RESTORATIONSWRITE)) { - self::$RESTORATIONSWRITE = new ProjectKeyScopes('restorations.write'); - } + self::$RESTORATIONSWRITE ??= new ProjectKeyScopes('restorations.write'); + return self::$RESTORATIONSWRITE; } public static function DOMAINSREAD(): ProjectKeyScopes { - if (!isset(self::$DOMAINSREAD)) { - self::$DOMAINSREAD = new ProjectKeyScopes('domains.read'); - } + self::$DOMAINSREAD ??= new ProjectKeyScopes('domains.read'); + return self::$DOMAINSREAD; } public static function DOMAINSWRITE(): ProjectKeyScopes { - if (!isset(self::$DOMAINSWRITE)) { - self::$DOMAINSWRITE = new ProjectKeyScopes('domains.write'); - } + self::$DOMAINSWRITE ??= new ProjectKeyScopes('domains.write'); + return self::$DOMAINSWRITE; } public static function WAFRULESREAD(): ProjectKeyScopes { - if (!isset(self::$WAFRULESREAD)) { - self::$WAFRULESREAD = new ProjectKeyScopes('wafRules.read'); - } + self::$WAFRULESREAD ??= new ProjectKeyScopes('wafRules.read'); + return self::$WAFRULESREAD; } public static function WAFRULESWRITE(): ProjectKeyScopes { - if (!isset(self::$WAFRULESWRITE)) { - self::$WAFRULESWRITE = new ProjectKeyScopes('wafRules.write'); - } + self::$WAFRULESWRITE ??= new ProjectKeyScopes('wafRules.write'); + return self::$WAFRULESWRITE; } public static function EVENTSREAD(): ProjectKeyScopes { - if (!isset(self::$EVENTSREAD)) { - self::$EVENTSREAD = new ProjectKeyScopes('events.read'); - } + self::$EVENTSREAD ??= new ProjectKeyScopes('events.read'); + return self::$EVENTSREAD; } public static function PROXYINVALIDATIONSWRITE(): ProjectKeyScopes { - if (!isset(self::$PROXYINVALIDATIONSWRITE)) { - self::$PROXYINVALIDATIONSWRITE = new ProjectKeyScopes('proxy.invalidations.write'); - } + self::$PROXYINVALIDATIONSWRITE ??= new ProjectKeyScopes('proxy.invalidations.write'); + return self::$PROXYINVALIDATIONSWRITE; } public static function APPSREAD(): ProjectKeyScopes { - if (!isset(self::$APPSREAD)) { - self::$APPSREAD = new ProjectKeyScopes('apps.read'); - } + self::$APPSREAD ??= new ProjectKeyScopes('apps.read'); + return self::$APPSREAD; } public static function APPSWRITE(): ProjectKeyScopes { - if (!isset(self::$APPSWRITE)) { - self::$APPSWRITE = new ProjectKeyScopes('apps.write'); - } + self::$APPSWRITE ??= new ProjectKeyScopes('apps.write'); + return self::$APPSWRITE; } public static function OAUTH2READ(): ProjectKeyScopes { - if (!isset(self::$OAUTH2READ)) { - self::$OAUTH2READ = new ProjectKeyScopes('oauth2.read'); - } + self::$OAUTH2READ ??= new ProjectKeyScopes('oauth2.read'); + return self::$OAUTH2READ; } public static function OAUTH2WRITE(): ProjectKeyScopes { - if (!isset(self::$OAUTH2WRITE)) { - self::$OAUTH2WRITE = new ProjectKeyScopes('oauth2.write'); - } + self::$OAUTH2WRITE ??= new ProjectKeyScopes('oauth2.write'); + return self::$OAUTH2WRITE; } public static function OAUTH2INTROSPECT(): ProjectKeyScopes { - if (!isset(self::$OAUTH2INTROSPECT)) { - self::$OAUTH2INTROSPECT = new ProjectKeyScopes('oauth2.introspect'); - } + self::$OAUTH2INTROSPECT ??= new ProjectKeyScopes('oauth2.introspect'); + return self::$OAUTH2INTROSPECT; } @@ -910,6 +889,18 @@ public static function from(string $value): self 'attributes.write' => self::ATTRIBUTESWRITE(), 'documents.read' => self::DOCUMENTSREAD(), 'documents.write' => self::DOCUMENTSWRITE(), + 'documentsdb.read' => self::DOCUMENTSDBREAD(), + 'documentsdb.write' => self::DOCUMENTSDBWRITE(), + 'documentsdb.collections.read' => self::DOCUMENTSDBCOLLECTIONSREAD(), + 'documentsdb.collections.write' => self::DOCUMENTSDBCOLLECTIONSWRITE(), + 'documentsdb.documents.read' => self::DOCUMENTSDBDOCUMENTSREAD(), + 'documentsdb.documents.write' => self::DOCUMENTSDBDOCUMENTSWRITE(), + 'vectorsdb.read' => self::VECTORSDBREAD(), + 'vectorsdb.write' => self::VECTORSDBWRITE(), + 'vectorsdb.collections.read' => self::VECTORSDBCOLLECTIONSREAD(), + 'vectorsdb.collections.write' => self::VECTORSDBCOLLECTIONSWRITE(), + 'vectorsdb.documents.read' => self::VECTORSDBDOCUMENTSREAD(), + 'vectorsdb.documents.write' => self::VECTORSDBDOCUMENTSWRITE(), 'buckets.read' => self::BUCKETSREAD(), 'buckets.write' => self::BUCKETSWRITE(), 'files.read' => self::FILESREAD(), diff --git a/src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php b/src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php index bcff0b4..a88cbf5 100644 --- a/src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php +++ b/src/Appwrite/Enums/ProjectOAuth2GooglePrompt.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function NONE(): ProjectOAuth2GooglePrompt { - if (!isset(self::$NONE)) { - self::$NONE = new ProjectOAuth2GooglePrompt('none'); - } + self::$NONE ??= new ProjectOAuth2GooglePrompt('none'); + return self::$NONE; } public static function CONSENT(): ProjectOAuth2GooglePrompt { - if (!isset(self::$CONSENT)) { - self::$CONSENT = new ProjectOAuth2GooglePrompt('consent'); - } + self::$CONSENT ??= new ProjectOAuth2GooglePrompt('consent'); + return self::$CONSENT; } public static function SELECTACCOUNT(): ProjectOAuth2GooglePrompt { - if (!isset(self::$SELECTACCOUNT)) { - self::$SELECTACCOUNT = new ProjectOAuth2GooglePrompt('select_account'); - } + self::$SELECTACCOUNT ??= new ProjectOAuth2GooglePrompt('select_account'); + return self::$SELECTACCOUNT; } diff --git a/src/Appwrite/Enums/ProjectOAuth2OidcPrompt.php b/src/Appwrite/Enums/ProjectOAuth2OidcPrompt.php index 579084b..5a1a3e3 100644 --- a/src/Appwrite/Enums/ProjectOAuth2OidcPrompt.php +++ b/src/Appwrite/Enums/ProjectOAuth2OidcPrompt.php @@ -30,30 +30,26 @@ public function jsonSerialize(): string public static function NONE(): ProjectOAuth2OidcPrompt { - if (!isset(self::$NONE)) { - self::$NONE = new ProjectOAuth2OidcPrompt('none'); - } + self::$NONE ??= new ProjectOAuth2OidcPrompt('none'); + return self::$NONE; } public static function LOGIN(): ProjectOAuth2OidcPrompt { - if (!isset(self::$LOGIN)) { - self::$LOGIN = new ProjectOAuth2OidcPrompt('login'); - } + self::$LOGIN ??= new ProjectOAuth2OidcPrompt('login'); + return self::$LOGIN; } public static function CONSENT(): ProjectOAuth2OidcPrompt { - if (!isset(self::$CONSENT)) { - self::$CONSENT = new ProjectOAuth2OidcPrompt('consent'); - } + self::$CONSENT ??= new ProjectOAuth2OidcPrompt('consent'); + return self::$CONSENT; } public static function SELECTACCOUNT(): ProjectOAuth2OidcPrompt { - if (!isset(self::$SELECTACCOUNT)) { - self::$SELECTACCOUNT = new ProjectOAuth2OidcPrompt('select_account'); - } + self::$SELECTACCOUNT ??= new ProjectOAuth2OidcPrompt('select_account'); + return self::$SELECTACCOUNT; } diff --git a/src/Appwrite/Enums/ProjectOAuthProviderId.php b/src/Appwrite/Enums/ProjectOAuthProviderId.php index 2f838e7..71c58df 100644 --- a/src/Appwrite/Enums/ProjectOAuthProviderId.php +++ b/src/Appwrite/Enums/ProjectOAuthProviderId.php @@ -71,317 +71,272 @@ public function jsonSerialize(): string public static function AMAZON(): ProjectOAuthProviderId { - if (!isset(self::$AMAZON)) { - self::$AMAZON = new ProjectOAuthProviderId('amazon'); - } + self::$AMAZON ??= new ProjectOAuthProviderId('amazon'); + return self::$AMAZON; } public static function APPLE(): ProjectOAuthProviderId { - if (!isset(self::$APPLE)) { - self::$APPLE = new ProjectOAuthProviderId('apple'); - } + self::$APPLE ??= new ProjectOAuthProviderId('apple'); + return self::$APPLE; } public static function APPWRITE(): ProjectOAuthProviderId { - if (!isset(self::$APPWRITE)) { - self::$APPWRITE = new ProjectOAuthProviderId('appwrite'); - } + self::$APPWRITE ??= new ProjectOAuthProviderId('appwrite'); + return self::$APPWRITE; } public static function AUTH0(): ProjectOAuthProviderId { - if (!isset(self::$AUTH0)) { - self::$AUTH0 = new ProjectOAuthProviderId('auth0'); - } + self::$AUTH0 ??= new ProjectOAuthProviderId('auth0'); + return self::$AUTH0; } public static function AUTHENTIK(): ProjectOAuthProviderId { - if (!isset(self::$AUTHENTIK)) { - self::$AUTHENTIK = new ProjectOAuthProviderId('authentik'); - } + self::$AUTHENTIK ??= new ProjectOAuthProviderId('authentik'); + return self::$AUTHENTIK; } public static function AUTODESK(): ProjectOAuthProviderId { - if (!isset(self::$AUTODESK)) { - self::$AUTODESK = new ProjectOAuthProviderId('autodesk'); - } + self::$AUTODESK ??= new ProjectOAuthProviderId('autodesk'); + return self::$AUTODESK; } public static function BITBUCKET(): ProjectOAuthProviderId { - if (!isset(self::$BITBUCKET)) { - self::$BITBUCKET = new ProjectOAuthProviderId('bitbucket'); - } + self::$BITBUCKET ??= new ProjectOAuthProviderId('bitbucket'); + return self::$BITBUCKET; } public static function BITLY(): ProjectOAuthProviderId { - if (!isset(self::$BITLY)) { - self::$BITLY = new ProjectOAuthProviderId('bitly'); - } + self::$BITLY ??= new ProjectOAuthProviderId('bitly'); + return self::$BITLY; } public static function BOX(): ProjectOAuthProviderId { - if (!isset(self::$BOX)) { - self::$BOX = new ProjectOAuthProviderId('box'); - } + self::$BOX ??= new ProjectOAuthProviderId('box'); + return self::$BOX; } public static function DAILYMOTION(): ProjectOAuthProviderId { - if (!isset(self::$DAILYMOTION)) { - self::$DAILYMOTION = new ProjectOAuthProviderId('dailymotion'); - } + self::$DAILYMOTION ??= new ProjectOAuthProviderId('dailymotion'); + return self::$DAILYMOTION; } public static function DISCORD(): ProjectOAuthProviderId { - if (!isset(self::$DISCORD)) { - self::$DISCORD = new ProjectOAuthProviderId('discord'); - } + self::$DISCORD ??= new ProjectOAuthProviderId('discord'); + return self::$DISCORD; } public static function DISQUS(): ProjectOAuthProviderId { - if (!isset(self::$DISQUS)) { - self::$DISQUS = new ProjectOAuthProviderId('disqus'); - } + self::$DISQUS ??= new ProjectOAuthProviderId('disqus'); + return self::$DISQUS; } public static function DROPBOX(): ProjectOAuthProviderId { - if (!isset(self::$DROPBOX)) { - self::$DROPBOX = new ProjectOAuthProviderId('dropbox'); - } + self::$DROPBOX ??= new ProjectOAuthProviderId('dropbox'); + return self::$DROPBOX; } public static function ETSY(): ProjectOAuthProviderId { - if (!isset(self::$ETSY)) { - self::$ETSY = new ProjectOAuthProviderId('etsy'); - } + self::$ETSY ??= new ProjectOAuthProviderId('etsy'); + return self::$ETSY; } public static function FACEBOOK(): ProjectOAuthProviderId { - if (!isset(self::$FACEBOOK)) { - self::$FACEBOOK = new ProjectOAuthProviderId('facebook'); - } + self::$FACEBOOK ??= new ProjectOAuthProviderId('facebook'); + return self::$FACEBOOK; } public static function FIGMA(): ProjectOAuthProviderId { - if (!isset(self::$FIGMA)) { - self::$FIGMA = new ProjectOAuthProviderId('figma'); - } + self::$FIGMA ??= new ProjectOAuthProviderId('figma'); + return self::$FIGMA; } public static function FUSIONAUTH(): ProjectOAuthProviderId { - if (!isset(self::$FUSIONAUTH)) { - self::$FUSIONAUTH = new ProjectOAuthProviderId('fusionauth'); - } + self::$FUSIONAUTH ??= new ProjectOAuthProviderId('fusionauth'); + return self::$FUSIONAUTH; } public static function GITHUB(): ProjectOAuthProviderId { - if (!isset(self::$GITHUB)) { - self::$GITHUB = new ProjectOAuthProviderId('github'); - } + self::$GITHUB ??= new ProjectOAuthProviderId('github'); + return self::$GITHUB; } public static function GITLAB(): ProjectOAuthProviderId { - if (!isset(self::$GITLAB)) { - self::$GITLAB = new ProjectOAuthProviderId('gitlab'); - } + self::$GITLAB ??= new ProjectOAuthProviderId('gitlab'); + return self::$GITLAB; } public static function GOOGLE(): ProjectOAuthProviderId { - if (!isset(self::$GOOGLE)) { - self::$GOOGLE = new ProjectOAuthProviderId('google'); - } + self::$GOOGLE ??= new ProjectOAuthProviderId('google'); + return self::$GOOGLE; } public static function HUGGINGFACE(): ProjectOAuthProviderId { - if (!isset(self::$HUGGINGFACE)) { - self::$HUGGINGFACE = new ProjectOAuthProviderId('huggingface'); - } + self::$HUGGINGFACE ??= new ProjectOAuthProviderId('huggingface'); + return self::$HUGGINGFACE; } public static function KEYCLOAK(): ProjectOAuthProviderId { - if (!isset(self::$KEYCLOAK)) { - self::$KEYCLOAK = new ProjectOAuthProviderId('keycloak'); - } + self::$KEYCLOAK ??= new ProjectOAuthProviderId('keycloak'); + return self::$KEYCLOAK; } public static function KICK(): ProjectOAuthProviderId { - if (!isset(self::$KICK)) { - self::$KICK = new ProjectOAuthProviderId('kick'); - } + self::$KICK ??= new ProjectOAuthProviderId('kick'); + return self::$KICK; } public static function LINKEDIN(): ProjectOAuthProviderId { - if (!isset(self::$LINKEDIN)) { - self::$LINKEDIN = new ProjectOAuthProviderId('linkedin'); - } + self::$LINKEDIN ??= new ProjectOAuthProviderId('linkedin'); + return self::$LINKEDIN; } public static function MICROSOFT(): ProjectOAuthProviderId { - if (!isset(self::$MICROSOFT)) { - self::$MICROSOFT = new ProjectOAuthProviderId('microsoft'); - } + self::$MICROSOFT ??= new ProjectOAuthProviderId('microsoft'); + return self::$MICROSOFT; } public static function NOTION(): ProjectOAuthProviderId { - if (!isset(self::$NOTION)) { - self::$NOTION = new ProjectOAuthProviderId('notion'); - } + self::$NOTION ??= new ProjectOAuthProviderId('notion'); + return self::$NOTION; } public static function OIDC(): ProjectOAuthProviderId { - if (!isset(self::$OIDC)) { - self::$OIDC = new ProjectOAuthProviderId('oidc'); - } + self::$OIDC ??= new ProjectOAuthProviderId('oidc'); + return self::$OIDC; } public static function OKTA(): ProjectOAuthProviderId { - if (!isset(self::$OKTA)) { - self::$OKTA = new ProjectOAuthProviderId('okta'); - } + self::$OKTA ??= new ProjectOAuthProviderId('okta'); + return self::$OKTA; } public static function PAYPAL(): ProjectOAuthProviderId { - if (!isset(self::$PAYPAL)) { - self::$PAYPAL = new ProjectOAuthProviderId('paypal'); - } + self::$PAYPAL ??= new ProjectOAuthProviderId('paypal'); + return self::$PAYPAL; } public static function PAYPALSANDBOX(): ProjectOAuthProviderId { - if (!isset(self::$PAYPALSANDBOX)) { - self::$PAYPALSANDBOX = new ProjectOAuthProviderId('paypalSandbox'); - } + self::$PAYPALSANDBOX ??= new ProjectOAuthProviderId('paypalSandbox'); + return self::$PAYPALSANDBOX; } public static function PODIO(): ProjectOAuthProviderId { - if (!isset(self::$PODIO)) { - self::$PODIO = new ProjectOAuthProviderId('podio'); - } + self::$PODIO ??= new ProjectOAuthProviderId('podio'); + return self::$PODIO; } public static function SALESFORCE(): ProjectOAuthProviderId { - if (!isset(self::$SALESFORCE)) { - self::$SALESFORCE = new ProjectOAuthProviderId('salesforce'); - } + self::$SALESFORCE ??= new ProjectOAuthProviderId('salesforce'); + return self::$SALESFORCE; } public static function SLACK(): ProjectOAuthProviderId { - if (!isset(self::$SLACK)) { - self::$SLACK = new ProjectOAuthProviderId('slack'); - } + self::$SLACK ??= new ProjectOAuthProviderId('slack'); + return self::$SLACK; } public static function SPOTIFY(): ProjectOAuthProviderId { - if (!isset(self::$SPOTIFY)) { - self::$SPOTIFY = new ProjectOAuthProviderId('spotify'); - } + self::$SPOTIFY ??= new ProjectOAuthProviderId('spotify'); + return self::$SPOTIFY; } public static function STRIPE(): ProjectOAuthProviderId { - if (!isset(self::$STRIPE)) { - self::$STRIPE = new ProjectOAuthProviderId('stripe'); - } + self::$STRIPE ??= new ProjectOAuthProviderId('stripe'); + return self::$STRIPE; } public static function TRADESHIFT(): ProjectOAuthProviderId { - if (!isset(self::$TRADESHIFT)) { - self::$TRADESHIFT = new ProjectOAuthProviderId('tradeshift'); - } + self::$TRADESHIFT ??= new ProjectOAuthProviderId('tradeshift'); + return self::$TRADESHIFT; } public static function TRADESHIFTBOX(): ProjectOAuthProviderId { - if (!isset(self::$TRADESHIFTBOX)) { - self::$TRADESHIFTBOX = new ProjectOAuthProviderId('tradeshiftBox'); - } + self::$TRADESHIFTBOX ??= new ProjectOAuthProviderId('tradeshiftBox'); + return self::$TRADESHIFTBOX; } public static function TWITCH(): ProjectOAuthProviderId { - if (!isset(self::$TWITCH)) { - self::$TWITCH = new ProjectOAuthProviderId('twitch'); - } + self::$TWITCH ??= new ProjectOAuthProviderId('twitch'); + return self::$TWITCH; } public static function WORDPRESS(): ProjectOAuthProviderId { - if (!isset(self::$WORDPRESS)) { - self::$WORDPRESS = new ProjectOAuthProviderId('wordpress'); - } + self::$WORDPRESS ??= new ProjectOAuthProviderId('wordpress'); + return self::$WORDPRESS; } public static function X(): ProjectOAuthProviderId { - if (!isset(self::$X)) { - self::$X = new ProjectOAuthProviderId('x'); - } + self::$X ??= new ProjectOAuthProviderId('x'); + return self::$X; } public static function YAHOO(): ProjectOAuthProviderId { - if (!isset(self::$YAHOO)) { - self::$YAHOO = new ProjectOAuthProviderId('yahoo'); - } + self::$YAHOO ??= new ProjectOAuthProviderId('yahoo'); + return self::$YAHOO; } public static function YAMMER(): ProjectOAuthProviderId { - if (!isset(self::$YAMMER)) { - self::$YAMMER = new ProjectOAuthProviderId('yammer'); - } + self::$YAMMER ??= new ProjectOAuthProviderId('yammer'); + return self::$YAMMER; } public static function YANDEX(): ProjectOAuthProviderId { - if (!isset(self::$YANDEX)) { - self::$YANDEX = new ProjectOAuthProviderId('yandex'); - } + self::$YANDEX ??= new ProjectOAuthProviderId('yandex'); + return self::$YANDEX; } public static function ZOHO(): ProjectOAuthProviderId { - if (!isset(self::$ZOHO)) { - self::$ZOHO = new ProjectOAuthProviderId('zoho'); - } + self::$ZOHO ??= new ProjectOAuthProviderId('zoho'); + return self::$ZOHO; } public static function ZOOM(): ProjectOAuthProviderId { - if (!isset(self::$ZOOM)) { - self::$ZOOM = new ProjectOAuthProviderId('zoom'); - } + self::$ZOOM ??= new ProjectOAuthProviderId('zoom'); + return self::$ZOOM; } diff --git a/src/Appwrite/Enums/ProjectPolicyId.php b/src/Appwrite/Enums/ProjectPolicyId.php index 575f8b4..975051b 100644 --- a/src/Appwrite/Enums/ProjectPolicyId.php +++ b/src/Appwrite/Enums/ProjectPolicyId.php @@ -41,107 +41,92 @@ public function jsonSerialize(): string public static function PASSWORDDICTIONARY(): ProjectPolicyId { - if (!isset(self::$PASSWORDDICTIONARY)) { - self::$PASSWORDDICTIONARY = new ProjectPolicyId('password-dictionary'); - } + self::$PASSWORDDICTIONARY ??= new ProjectPolicyId('password-dictionary'); + return self::$PASSWORDDICTIONARY; } public static function PASSWORDHISTORY(): ProjectPolicyId { - if (!isset(self::$PASSWORDHISTORY)) { - self::$PASSWORDHISTORY = new ProjectPolicyId('password-history'); - } + self::$PASSWORDHISTORY ??= new ProjectPolicyId('password-history'); + return self::$PASSWORDHISTORY; } public static function PASSWORDSTRENGTH(): ProjectPolicyId { - if (!isset(self::$PASSWORDSTRENGTH)) { - self::$PASSWORDSTRENGTH = new ProjectPolicyId('password-strength'); - } + self::$PASSWORDSTRENGTH ??= new ProjectPolicyId('password-strength'); + return self::$PASSWORDSTRENGTH; } public static function PASSWORDPERSONALDATA(): ProjectPolicyId { - if (!isset(self::$PASSWORDPERSONALDATA)) { - self::$PASSWORDPERSONALDATA = new ProjectPolicyId('password-personal-data'); - } + self::$PASSWORDPERSONALDATA ??= new ProjectPolicyId('password-personal-data'); + return self::$PASSWORDPERSONALDATA; } public static function SESSIONALERT(): ProjectPolicyId { - if (!isset(self::$SESSIONALERT)) { - self::$SESSIONALERT = new ProjectPolicyId('session-alert'); - } + self::$SESSIONALERT ??= new ProjectPolicyId('session-alert'); + return self::$SESSIONALERT; } public static function SESSIONDURATION(): ProjectPolicyId { - if (!isset(self::$SESSIONDURATION)) { - self::$SESSIONDURATION = new ProjectPolicyId('session-duration'); - } + self::$SESSIONDURATION ??= new ProjectPolicyId('session-duration'); + return self::$SESSIONDURATION; } public static function SESSIONINVALIDATION(): ProjectPolicyId { - if (!isset(self::$SESSIONINVALIDATION)) { - self::$SESSIONINVALIDATION = new ProjectPolicyId('session-invalidation'); - } + self::$SESSIONINVALIDATION ??= new ProjectPolicyId('session-invalidation'); + return self::$SESSIONINVALIDATION; } public static function SESSIONLIMIT(): ProjectPolicyId { - if (!isset(self::$SESSIONLIMIT)) { - self::$SESSIONLIMIT = new ProjectPolicyId('session-limit'); - } + self::$SESSIONLIMIT ??= new ProjectPolicyId('session-limit'); + return self::$SESSIONLIMIT; } public static function USERLIMIT(): ProjectPolicyId { - if (!isset(self::$USERLIMIT)) { - self::$USERLIMIT = new ProjectPolicyId('user-limit'); - } + self::$USERLIMIT ??= new ProjectPolicyId('user-limit'); + return self::$USERLIMIT; } public static function MEMBERSHIPPRIVACY(): ProjectPolicyId { - if (!isset(self::$MEMBERSHIPPRIVACY)) { - self::$MEMBERSHIPPRIVACY = new ProjectPolicyId('membership-privacy'); - } + self::$MEMBERSHIPPRIVACY ??= new ProjectPolicyId('membership-privacy'); + return self::$MEMBERSHIPPRIVACY; } public static function MFAFACTORS(): ProjectPolicyId { - if (!isset(self::$MFAFACTORS)) { - self::$MFAFACTORS = new ProjectPolicyId('mfa-factors'); - } + self::$MFAFACTORS ??= new ProjectPolicyId('mfa-factors'); + return self::$MFAFACTORS; } public static function DENYALIASEDEMAIL(): ProjectPolicyId { - if (!isset(self::$DENYALIASEDEMAIL)) { - self::$DENYALIASEDEMAIL = new ProjectPolicyId('deny-aliased-email'); - } + self::$DENYALIASEDEMAIL ??= new ProjectPolicyId('deny-aliased-email'); + return self::$DENYALIASEDEMAIL; } public static function DENYDISPOSABLEEMAIL(): ProjectPolicyId { - if (!isset(self::$DENYDISPOSABLEEMAIL)) { - self::$DENYDISPOSABLEEMAIL = new ProjectPolicyId('deny-disposable-email'); - } + self::$DENYDISPOSABLEEMAIL ??= new ProjectPolicyId('deny-disposable-email'); + return self::$DENYDISPOSABLEEMAIL; } public static function DENYFREEEMAIL(): ProjectPolicyId { - if (!isset(self::$DENYFREEEMAIL)) { - self::$DENYFREEEMAIL = new ProjectPolicyId('deny-free-email'); - } + self::$DENYFREEEMAIL ??= new ProjectPolicyId('deny-free-email'); + return self::$DENYFREEEMAIL; } public static function DENYCORPORATEEMAIL(): ProjectPolicyId { - if (!isset(self::$DENYCORPORATEEMAIL)) { - self::$DENYCORPORATEEMAIL = new ProjectPolicyId('deny-corporate-email'); - } + self::$DENYCORPORATEEMAIL ??= new ProjectPolicyId('deny-corporate-email'); + return self::$DENYCORPORATEEMAIL; } diff --git a/src/Appwrite/Enums/ProjectProtocolId.php b/src/Appwrite/Enums/ProjectProtocolId.php index 9dda110..0bac637 100644 --- a/src/Appwrite/Enums/ProjectProtocolId.php +++ b/src/Appwrite/Enums/ProjectProtocolId.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function REST(): ProjectProtocolId { - if (!isset(self::$REST)) { - self::$REST = new ProjectProtocolId('rest'); - } + self::$REST ??= new ProjectProtocolId('rest'); + return self::$REST; } public static function GRAPHQL(): ProjectProtocolId { - if (!isset(self::$GRAPHQL)) { - self::$GRAPHQL = new ProjectProtocolId('graphql'); - } + self::$GRAPHQL ??= new ProjectProtocolId('graphql'); + return self::$GRAPHQL; } public static function WEBSOCKET(): ProjectProtocolId { - if (!isset(self::$WEBSOCKET)) { - self::$WEBSOCKET = new ProjectProtocolId('websocket'); - } + self::$WEBSOCKET ??= new ProjectProtocolId('websocket'); + return self::$WEBSOCKET; } diff --git a/src/Appwrite/Enums/ProjectSMTPSecure.php b/src/Appwrite/Enums/ProjectSMTPSecure.php index 8a6d1b0..8f40033 100644 --- a/src/Appwrite/Enums/ProjectSMTPSecure.php +++ b/src/Appwrite/Enums/ProjectSMTPSecure.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function TLS(): ProjectSMTPSecure { - if (!isset(self::$TLS)) { - self::$TLS = new ProjectSMTPSecure('tls'); - } + self::$TLS ??= new ProjectSMTPSecure('tls'); + return self::$TLS; } public static function SSL(): ProjectSMTPSecure { - if (!isset(self::$SSL)) { - self::$SSL = new ProjectSMTPSecure('ssl'); - } + self::$SSL ??= new ProjectSMTPSecure('ssl'); + return self::$SSL; } diff --git a/src/Appwrite/Enums/ProjectServiceId.php b/src/Appwrite/Enums/ProjectServiceId.php index 42ab4db..395e521 100644 --- a/src/Appwrite/Enums/ProjectServiceId.php +++ b/src/Appwrite/Enums/ProjectServiceId.php @@ -45,135 +45,116 @@ public function jsonSerialize(): string public static function ACCOUNT(): ProjectServiceId { - if (!isset(self::$ACCOUNT)) { - self::$ACCOUNT = new ProjectServiceId('account'); - } + self::$ACCOUNT ??= new ProjectServiceId('account'); + return self::$ACCOUNT; } public static function AVATARS(): ProjectServiceId { - if (!isset(self::$AVATARS)) { - self::$AVATARS = new ProjectServiceId('avatars'); - } + self::$AVATARS ??= new ProjectServiceId('avatars'); + return self::$AVATARS; } public static function DATABASES(): ProjectServiceId { - if (!isset(self::$DATABASES)) { - self::$DATABASES = new ProjectServiceId('databases'); - } + self::$DATABASES ??= new ProjectServiceId('databases'); + return self::$DATABASES; } public static function TABLESDB(): ProjectServiceId { - if (!isset(self::$TABLESDB)) { - self::$TABLESDB = new ProjectServiceId('tablesdb'); - } + self::$TABLESDB ??= new ProjectServiceId('tablesdb'); + return self::$TABLESDB; } public static function LOCALE(): ProjectServiceId { - if (!isset(self::$LOCALE)) { - self::$LOCALE = new ProjectServiceId('locale'); - } + self::$LOCALE ??= new ProjectServiceId('locale'); + return self::$LOCALE; } public static function HEALTH(): ProjectServiceId { - if (!isset(self::$HEALTH)) { - self::$HEALTH = new ProjectServiceId('health'); - } + self::$HEALTH ??= new ProjectServiceId('health'); + return self::$HEALTH; } public static function PROJECT(): ProjectServiceId { - if (!isset(self::$PROJECT)) { - self::$PROJECT = new ProjectServiceId('project'); - } + self::$PROJECT ??= new ProjectServiceId('project'); + return self::$PROJECT; } public static function STORAGE(): ProjectServiceId { - if (!isset(self::$STORAGE)) { - self::$STORAGE = new ProjectServiceId('storage'); - } + self::$STORAGE ??= new ProjectServiceId('storage'); + return self::$STORAGE; } public static function TEAMS(): ProjectServiceId { - if (!isset(self::$TEAMS)) { - self::$TEAMS = new ProjectServiceId('teams'); - } + self::$TEAMS ??= new ProjectServiceId('teams'); + return self::$TEAMS; } public static function USERS(): ProjectServiceId { - if (!isset(self::$USERS)) { - self::$USERS = new ProjectServiceId('users'); - } + self::$USERS ??= new ProjectServiceId('users'); + return self::$USERS; } public static function VCS(): ProjectServiceId { - if (!isset(self::$VCS)) { - self::$VCS = new ProjectServiceId('vcs'); - } + self::$VCS ??= new ProjectServiceId('vcs'); + return self::$VCS; } public static function SITES(): ProjectServiceId { - if (!isset(self::$SITES)) { - self::$SITES = new ProjectServiceId('sites'); - } + self::$SITES ??= new ProjectServiceId('sites'); + return self::$SITES; } public static function FUNCTIONS(): ProjectServiceId { - if (!isset(self::$FUNCTIONS)) { - self::$FUNCTIONS = new ProjectServiceId('functions'); - } + self::$FUNCTIONS ??= new ProjectServiceId('functions'); + return self::$FUNCTIONS; } public static function PROXY(): ProjectServiceId { - if (!isset(self::$PROXY)) { - self::$PROXY = new ProjectServiceId('proxy'); - } + self::$PROXY ??= new ProjectServiceId('proxy'); + return self::$PROXY; } public static function GRAPHQL(): ProjectServiceId { - if (!isset(self::$GRAPHQL)) { - self::$GRAPHQL = new ProjectServiceId('graphql'); - } + self::$GRAPHQL ??= new ProjectServiceId('graphql'); + return self::$GRAPHQL; } public static function MIGRATIONS(): ProjectServiceId { - if (!isset(self::$MIGRATIONS)) { - self::$MIGRATIONS = new ProjectServiceId('migrations'); - } + self::$MIGRATIONS ??= new ProjectServiceId('migrations'); + return self::$MIGRATIONS; } public static function MESSAGING(): ProjectServiceId { - if (!isset(self::$MESSAGING)) { - self::$MESSAGING = new ProjectServiceId('messaging'); - } + self::$MESSAGING ??= new ProjectServiceId('messaging'); + return self::$MESSAGING; } public static function ADVISOR(): ProjectServiceId { - if (!isset(self::$ADVISOR)) { - self::$ADVISOR = new ProjectServiceId('advisor'); - } + self::$ADVISOR ??= new ProjectServiceId('advisor'); + return self::$ADVISOR; } public static function OAUTH2(): ProjectServiceId { - if (!isset(self::$OAUTH2)) { - self::$OAUTH2 = new ProjectServiceId('oauth2'); - } + self::$OAUTH2 ??= new ProjectServiceId('oauth2'); + return self::$OAUTH2; } diff --git a/src/Appwrite/Enums/ProxyResourceType.php b/src/Appwrite/Enums/ProxyResourceType.php index d588cf8..0870127 100644 --- a/src/Appwrite/Enums/ProxyResourceType.php +++ b/src/Appwrite/Enums/ProxyResourceType.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function SITE(): ProxyResourceType { - if (!isset(self::$SITE)) { - self::$SITE = new ProxyResourceType('site'); - } + self::$SITE ??= new ProxyResourceType('site'); + return self::$SITE; } public static function FUNCTIONMODEL(): ProxyResourceType { - if (!isset(self::$FUNCTIONMODEL)) { - self::$FUNCTIONMODEL = new ProxyResourceType('function'); - } + self::$FUNCTIONMODEL ??= new ProxyResourceType('function'); + return self::$FUNCTIONMODEL; } diff --git a/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php b/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php index c9b572b..2054942 100644 --- a/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php +++ b/src/Appwrite/Enums/ProxyRuleDeploymentResourceType.php @@ -28,16 +28,14 @@ public function jsonSerialize(): string public static function FUNCTION(): ProxyRuleDeploymentResourceType { - if (!isset(self::$FUNCTION)) { - self::$FUNCTION = new ProxyRuleDeploymentResourceType('function'); - } + self::$FUNCTION ??= new ProxyRuleDeploymentResourceType('function'); + return self::$FUNCTION; } public static function SITE(): ProxyRuleDeploymentResourceType { - if (!isset(self::$SITE)) { - self::$SITE = new ProxyRuleDeploymentResourceType('site'); - } + self::$SITE ??= new ProxyRuleDeploymentResourceType('site'); + return self::$SITE; } diff --git a/src/Appwrite/Enums/ProxyRuleStatus.php b/src/Appwrite/Enums/ProxyRuleStatus.php index b49ad0a..2a6e455 100644 --- a/src/Appwrite/Enums/ProxyRuleStatus.php +++ b/src/Appwrite/Enums/ProxyRuleStatus.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function UNVERIFIED(): ProxyRuleStatus { - if (!isset(self::$UNVERIFIED)) { - self::$UNVERIFIED = new ProxyRuleStatus('unverified'); - } + self::$UNVERIFIED ??= new ProxyRuleStatus('unverified'); + return self::$UNVERIFIED; } public static function VERIFYING(): ProxyRuleStatus { - if (!isset(self::$VERIFYING)) { - self::$VERIFYING = new ProxyRuleStatus('verifying'); - } + self::$VERIFYING ??= new ProxyRuleStatus('verifying'); + return self::$VERIFYING; } public static function VERIFIED(): ProxyRuleStatus { - if (!isset(self::$VERIFIED)) { - self::$VERIFIED = new ProxyRuleStatus('verified'); - } + self::$VERIFIED ??= new ProxyRuleStatus('verified'); + return self::$VERIFIED; } diff --git a/src/Appwrite/Enums/Region.php b/src/Appwrite/Enums/Region.php index b0a7214..e6fa9c2 100644 --- a/src/Appwrite/Enums/Region.php +++ b/src/Appwrite/Enums/Region.php @@ -32,44 +32,38 @@ public function jsonSerialize(): string public static function FRA(): Region { - if (!isset(self::$FRA)) { - self::$FRA = new Region('fra'); - } + self::$FRA ??= new Region('fra'); + return self::$FRA; } public static function NYC(): Region { - if (!isset(self::$NYC)) { - self::$NYC = new Region('nyc'); - } + self::$NYC ??= new Region('nyc'); + return self::$NYC; } public static function SYD(): Region { - if (!isset(self::$SYD)) { - self::$SYD = new Region('syd'); - } + self::$SYD ??= new Region('syd'); + return self::$SYD; } public static function SFO(): Region { - if (!isset(self::$SFO)) { - self::$SFO = new Region('sfo'); - } + self::$SFO ??= new Region('sfo'); + return self::$SFO; } public static function SGP(): Region { - if (!isset(self::$SGP)) { - self::$SGP = new Region('sgp'); - } + self::$SGP ??= new Region('sgp'); + return self::$SGP; } public static function TOR(): Region { - if (!isset(self::$TOR)) { - self::$TOR = new Region('tor'); - } + self::$TOR ??= new Region('tor'); + return self::$TOR; } diff --git a/src/Appwrite/Enums/RelationMutate.php b/src/Appwrite/Enums/RelationMutate.php index fee5320..06188c2 100644 --- a/src/Appwrite/Enums/RelationMutate.php +++ b/src/Appwrite/Enums/RelationMutate.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function CASCADE(): RelationMutate { - if (!isset(self::$CASCADE)) { - self::$CASCADE = new RelationMutate('cascade'); - } + self::$CASCADE ??= new RelationMutate('cascade'); + return self::$CASCADE; } public static function RESTRICT(): RelationMutate { - if (!isset(self::$RESTRICT)) { - self::$RESTRICT = new RelationMutate('restrict'); - } + self::$RESTRICT ??= new RelationMutate('restrict'); + return self::$RESTRICT; } public static function SETNULL(): RelationMutate { - if (!isset(self::$SETNULL)) { - self::$SETNULL = new RelationMutate('setNull'); - } + self::$SETNULL ??= new RelationMutate('setNull'); + return self::$SETNULL; } diff --git a/src/Appwrite/Enums/RelationshipType.php b/src/Appwrite/Enums/RelationshipType.php index 64a7e2e..e33f257 100644 --- a/src/Appwrite/Enums/RelationshipType.php +++ b/src/Appwrite/Enums/RelationshipType.php @@ -30,30 +30,26 @@ public function jsonSerialize(): string public static function ONETOONE(): RelationshipType { - if (!isset(self::$ONETOONE)) { - self::$ONETOONE = new RelationshipType('oneToOne'); - } + self::$ONETOONE ??= new RelationshipType('oneToOne'); + return self::$ONETOONE; } public static function MANYTOONE(): RelationshipType { - if (!isset(self::$MANYTOONE)) { - self::$MANYTOONE = new RelationshipType('manyToOne'); - } + self::$MANYTOONE ??= new RelationshipType('manyToOne'); + return self::$MANYTOONE; } public static function MANYTOMANY(): RelationshipType { - if (!isset(self::$MANYTOMANY)) { - self::$MANYTOMANY = new RelationshipType('manyToMany'); - } + self::$MANYTOMANY ??= new RelationshipType('manyToMany'); + return self::$MANYTOMANY; } public static function ONETOMANY(): RelationshipType { - if (!isset(self::$ONETOMANY)) { - self::$ONETOMANY = new RelationshipType('oneToMany'); - } + self::$ONETOMANY ??= new RelationshipType('oneToMany'); + return self::$ONETOMANY; } diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index f2ed8a4..d07d3d9 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -119,653 +119,560 @@ public function jsonSerialize(): string public static function NODE145(): Runtime { - if (!isset(self::$NODE145)) { - self::$NODE145 = new Runtime('node-14.5'); - } + self::$NODE145 ??= new Runtime('node-14.5'); + return self::$NODE145; } public static function NODE160(): Runtime { - if (!isset(self::$NODE160)) { - self::$NODE160 = new Runtime('node-16.0'); - } + self::$NODE160 ??= new Runtime('node-16.0'); + return self::$NODE160; } public static function NODE180(): Runtime { - if (!isset(self::$NODE180)) { - self::$NODE180 = new Runtime('node-18.0'); - } + self::$NODE180 ??= new Runtime('node-18.0'); + return self::$NODE180; } public static function NODE190(): Runtime { - if (!isset(self::$NODE190)) { - self::$NODE190 = new Runtime('node-19.0'); - } + self::$NODE190 ??= new Runtime('node-19.0'); + return self::$NODE190; } public static function NODE200(): Runtime { - if (!isset(self::$NODE200)) { - self::$NODE200 = new Runtime('node-20.0'); - } + self::$NODE200 ??= new Runtime('node-20.0'); + return self::$NODE200; } public static function NODE210(): Runtime { - if (!isset(self::$NODE210)) { - self::$NODE210 = new Runtime('node-21.0'); - } + self::$NODE210 ??= new Runtime('node-21.0'); + return self::$NODE210; } public static function NODE22(): Runtime { - if (!isset(self::$NODE22)) { - self::$NODE22 = new Runtime('node-22'); - } + self::$NODE22 ??= new Runtime('node-22'); + return self::$NODE22; } public static function NODE23(): Runtime { - if (!isset(self::$NODE23)) { - self::$NODE23 = new Runtime('node-23'); - } + self::$NODE23 ??= new Runtime('node-23'); + return self::$NODE23; } public static function NODE24(): Runtime { - if (!isset(self::$NODE24)) { - self::$NODE24 = new Runtime('node-24'); - } + self::$NODE24 ??= new Runtime('node-24'); + return self::$NODE24; } public static function NODE25(): Runtime { - if (!isset(self::$NODE25)) { - self::$NODE25 = new Runtime('node-25'); - } + self::$NODE25 ??= new Runtime('node-25'); + return self::$NODE25; } public static function NODE26(): Runtime { - if (!isset(self::$NODE26)) { - self::$NODE26 = new Runtime('node-26'); - } + self::$NODE26 ??= new Runtime('node-26'); + return self::$NODE26; } public static function PHP80(): Runtime { - if (!isset(self::$PHP80)) { - self::$PHP80 = new Runtime('php-8.0'); - } + self::$PHP80 ??= new Runtime('php-8.0'); + return self::$PHP80; } public static function PHP81(): Runtime { - if (!isset(self::$PHP81)) { - self::$PHP81 = new Runtime('php-8.1'); - } + self::$PHP81 ??= new Runtime('php-8.1'); + return self::$PHP81; } public static function PHP82(): Runtime { - if (!isset(self::$PHP82)) { - self::$PHP82 = new Runtime('php-8.2'); - } + self::$PHP82 ??= new Runtime('php-8.2'); + return self::$PHP82; } public static function PHP83(): Runtime { - if (!isset(self::$PHP83)) { - self::$PHP83 = new Runtime('php-8.3'); - } + self::$PHP83 ??= new Runtime('php-8.3'); + return self::$PHP83; } public static function PHP84(): Runtime { - if (!isset(self::$PHP84)) { - self::$PHP84 = new Runtime('php-8.4'); - } + self::$PHP84 ??= new Runtime('php-8.4'); + return self::$PHP84; } public static function RUBY30(): Runtime { - if (!isset(self::$RUBY30)) { - self::$RUBY30 = new Runtime('ruby-3.0'); - } + self::$RUBY30 ??= new Runtime('ruby-3.0'); + return self::$RUBY30; } public static function RUBY31(): Runtime { - if (!isset(self::$RUBY31)) { - self::$RUBY31 = new Runtime('ruby-3.1'); - } + self::$RUBY31 ??= new Runtime('ruby-3.1'); + return self::$RUBY31; } public static function RUBY32(): Runtime { - if (!isset(self::$RUBY32)) { - self::$RUBY32 = new Runtime('ruby-3.2'); - } + self::$RUBY32 ??= new Runtime('ruby-3.2'); + return self::$RUBY32; } public static function RUBY33(): Runtime { - if (!isset(self::$RUBY33)) { - self::$RUBY33 = new Runtime('ruby-3.3'); - } + self::$RUBY33 ??= new Runtime('ruby-3.3'); + return self::$RUBY33; } public static function RUBY34(): Runtime { - if (!isset(self::$RUBY34)) { - self::$RUBY34 = new Runtime('ruby-3.4'); - } + self::$RUBY34 ??= new Runtime('ruby-3.4'); + return self::$RUBY34; } public static function RUBY40(): Runtime { - if (!isset(self::$RUBY40)) { - self::$RUBY40 = new Runtime('ruby-4.0'); - } + self::$RUBY40 ??= new Runtime('ruby-4.0'); + return self::$RUBY40; } public static function PYTHON38(): Runtime { - if (!isset(self::$PYTHON38)) { - self::$PYTHON38 = new Runtime('python-3.8'); - } + self::$PYTHON38 ??= new Runtime('python-3.8'); + return self::$PYTHON38; } public static function PYTHON39(): Runtime { - if (!isset(self::$PYTHON39)) { - self::$PYTHON39 = new Runtime('python-3.9'); - } + self::$PYTHON39 ??= new Runtime('python-3.9'); + return self::$PYTHON39; } public static function PYTHON310(): Runtime { - if (!isset(self::$PYTHON310)) { - self::$PYTHON310 = new Runtime('python-3.10'); - } + self::$PYTHON310 ??= new Runtime('python-3.10'); + return self::$PYTHON310; } public static function PYTHON311(): Runtime { - if (!isset(self::$PYTHON311)) { - self::$PYTHON311 = new Runtime('python-3.11'); - } + self::$PYTHON311 ??= new Runtime('python-3.11'); + return self::$PYTHON311; } public static function PYTHON312(): Runtime { - if (!isset(self::$PYTHON312)) { - self::$PYTHON312 = new Runtime('python-3.12'); - } + self::$PYTHON312 ??= new Runtime('python-3.12'); + return self::$PYTHON312; } public static function PYTHON313(): Runtime { - if (!isset(self::$PYTHON313)) { - self::$PYTHON313 = new Runtime('python-3.13'); - } + self::$PYTHON313 ??= new Runtime('python-3.13'); + return self::$PYTHON313; } public static function PYTHON314(): Runtime { - if (!isset(self::$PYTHON314)) { - self::$PYTHON314 = new Runtime('python-3.14'); - } + self::$PYTHON314 ??= new Runtime('python-3.14'); + return self::$PYTHON314; } public static function PYTHONML311(): Runtime { - if (!isset(self::$PYTHONML311)) { - self::$PYTHONML311 = new Runtime('python-ml-3.11'); - } + self::$PYTHONML311 ??= new Runtime('python-ml-3.11'); + return self::$PYTHONML311; } public static function PYTHONML312(): Runtime { - if (!isset(self::$PYTHONML312)) { - self::$PYTHONML312 = new Runtime('python-ml-3.12'); - } + self::$PYTHONML312 ??= new Runtime('python-ml-3.12'); + return self::$PYTHONML312; } public static function PYTHONML313(): Runtime { - if (!isset(self::$PYTHONML313)) { - self::$PYTHONML313 = new Runtime('python-ml-3.13'); - } + self::$PYTHONML313 ??= new Runtime('python-ml-3.13'); + return self::$PYTHONML313; } public static function DENO140(): Runtime { - if (!isset(self::$DENO140)) { - self::$DENO140 = new Runtime('deno-1.40'); - } + self::$DENO140 ??= new Runtime('deno-1.40'); + return self::$DENO140; } public static function DENO146(): Runtime { - if (!isset(self::$DENO146)) { - self::$DENO146 = new Runtime('deno-1.46'); - } + self::$DENO146 ??= new Runtime('deno-1.46'); + return self::$DENO146; } public static function DENO20(): Runtime { - if (!isset(self::$DENO20)) { - self::$DENO20 = new Runtime('deno-2.0'); - } + self::$DENO20 ??= new Runtime('deno-2.0'); + return self::$DENO20; } public static function DENO25(): Runtime { - if (!isset(self::$DENO25)) { - self::$DENO25 = new Runtime('deno-2.5'); - } + self::$DENO25 ??= new Runtime('deno-2.5'); + return self::$DENO25; } public static function DENO26(): Runtime { - if (!isset(self::$DENO26)) { - self::$DENO26 = new Runtime('deno-2.6'); - } + self::$DENO26 ??= new Runtime('deno-2.6'); + return self::$DENO26; } public static function DART215(): Runtime { - if (!isset(self::$DART215)) { - self::$DART215 = new Runtime('dart-2.15'); - } + self::$DART215 ??= new Runtime('dart-2.15'); + return self::$DART215; } public static function DART216(): Runtime { - if (!isset(self::$DART216)) { - self::$DART216 = new Runtime('dart-2.16'); - } + self::$DART216 ??= new Runtime('dart-2.16'); + return self::$DART216; } public static function DART217(): Runtime { - if (!isset(self::$DART217)) { - self::$DART217 = new Runtime('dart-2.17'); - } + self::$DART217 ??= new Runtime('dart-2.17'); + return self::$DART217; } public static function DART218(): Runtime { - if (!isset(self::$DART218)) { - self::$DART218 = new Runtime('dart-2.18'); - } + self::$DART218 ??= new Runtime('dart-2.18'); + return self::$DART218; } public static function DART219(): Runtime { - if (!isset(self::$DART219)) { - self::$DART219 = new Runtime('dart-2.19'); - } + self::$DART219 ??= new Runtime('dart-2.19'); + return self::$DART219; } public static function DART30(): Runtime { - if (!isset(self::$DART30)) { - self::$DART30 = new Runtime('dart-3.0'); - } + self::$DART30 ??= new Runtime('dart-3.0'); + return self::$DART30; } public static function DART31(): Runtime { - if (!isset(self::$DART31)) { - self::$DART31 = new Runtime('dart-3.1'); - } + self::$DART31 ??= new Runtime('dart-3.1'); + return self::$DART31; } public static function DART33(): Runtime { - if (!isset(self::$DART33)) { - self::$DART33 = new Runtime('dart-3.3'); - } + self::$DART33 ??= new Runtime('dart-3.3'); + return self::$DART33; } public static function DART35(): Runtime { - if (!isset(self::$DART35)) { - self::$DART35 = new Runtime('dart-3.5'); - } + self::$DART35 ??= new Runtime('dart-3.5'); + return self::$DART35; } public static function DART38(): Runtime { - if (!isset(self::$DART38)) { - self::$DART38 = new Runtime('dart-3.8'); - } + self::$DART38 ??= new Runtime('dart-3.8'); + return self::$DART38; } public static function DART39(): Runtime { - if (!isset(self::$DART39)) { - self::$DART39 = new Runtime('dart-3.9'); - } + self::$DART39 ??= new Runtime('dart-3.9'); + return self::$DART39; } public static function DART310(): Runtime { - if (!isset(self::$DART310)) { - self::$DART310 = new Runtime('dart-3.10'); - } + self::$DART310 ??= new Runtime('dart-3.10'); + return self::$DART310; } public static function DART311(): Runtime { - if (!isset(self::$DART311)) { - self::$DART311 = new Runtime('dart-3.11'); - } + self::$DART311 ??= new Runtime('dart-3.11'); + return self::$DART311; } public static function DART312(): Runtime { - if (!isset(self::$DART312)) { - self::$DART312 = new Runtime('dart-3.12'); - } + self::$DART312 ??= new Runtime('dart-3.12'); + return self::$DART312; } public static function DOTNET60(): Runtime { - if (!isset(self::$DOTNET60)) { - self::$DOTNET60 = new Runtime('dotnet-6.0'); - } + self::$DOTNET60 ??= new Runtime('dotnet-6.0'); + return self::$DOTNET60; } public static function DOTNET70(): Runtime { - if (!isset(self::$DOTNET70)) { - self::$DOTNET70 = new Runtime('dotnet-7.0'); - } + self::$DOTNET70 ??= new Runtime('dotnet-7.0'); + return self::$DOTNET70; } public static function DOTNET80(): Runtime { - if (!isset(self::$DOTNET80)) { - self::$DOTNET80 = new Runtime('dotnet-8.0'); - } + self::$DOTNET80 ??= new Runtime('dotnet-8.0'); + return self::$DOTNET80; } public static function DOTNET10(): Runtime { - if (!isset(self::$DOTNET10)) { - self::$DOTNET10 = new Runtime('dotnet-10'); - } + self::$DOTNET10 ??= new Runtime('dotnet-10'); + return self::$DOTNET10; } public static function JAVA80(): Runtime { - if (!isset(self::$JAVA80)) { - self::$JAVA80 = new Runtime('java-8.0'); - } + self::$JAVA80 ??= new Runtime('java-8.0'); + return self::$JAVA80; } public static function JAVA110(): Runtime { - if (!isset(self::$JAVA110)) { - self::$JAVA110 = new Runtime('java-11.0'); - } + self::$JAVA110 ??= new Runtime('java-11.0'); + return self::$JAVA110; } public static function JAVA170(): Runtime { - if (!isset(self::$JAVA170)) { - self::$JAVA170 = new Runtime('java-17.0'); - } + self::$JAVA170 ??= new Runtime('java-17.0'); + return self::$JAVA170; } public static function JAVA180(): Runtime { - if (!isset(self::$JAVA180)) { - self::$JAVA180 = new Runtime('java-18.0'); - } + self::$JAVA180 ??= new Runtime('java-18.0'); + return self::$JAVA180; } public static function JAVA210(): Runtime { - if (!isset(self::$JAVA210)) { - self::$JAVA210 = new Runtime('java-21.0'); - } + self::$JAVA210 ??= new Runtime('java-21.0'); + return self::$JAVA210; } public static function JAVA22(): Runtime { - if (!isset(self::$JAVA22)) { - self::$JAVA22 = new Runtime('java-22'); - } + self::$JAVA22 ??= new Runtime('java-22'); + return self::$JAVA22; } public static function JAVA25(): Runtime { - if (!isset(self::$JAVA25)) { - self::$JAVA25 = new Runtime('java-25'); - } + self::$JAVA25 ??= new Runtime('java-25'); + return self::$JAVA25; } public static function SWIFT55(): Runtime { - if (!isset(self::$SWIFT55)) { - self::$SWIFT55 = new Runtime('swift-5.5'); - } + self::$SWIFT55 ??= new Runtime('swift-5.5'); + return self::$SWIFT55; } public static function SWIFT58(): Runtime { - if (!isset(self::$SWIFT58)) { - self::$SWIFT58 = new Runtime('swift-5.8'); - } + self::$SWIFT58 ??= new Runtime('swift-5.8'); + return self::$SWIFT58; } public static function SWIFT59(): Runtime { - if (!isset(self::$SWIFT59)) { - self::$SWIFT59 = new Runtime('swift-5.9'); - } + self::$SWIFT59 ??= new Runtime('swift-5.9'); + return self::$SWIFT59; } public static function SWIFT510(): Runtime { - if (!isset(self::$SWIFT510)) { - self::$SWIFT510 = new Runtime('swift-5.10'); - } + self::$SWIFT510 ??= new Runtime('swift-5.10'); + return self::$SWIFT510; } public static function SWIFT62(): Runtime { - if (!isset(self::$SWIFT62)) { - self::$SWIFT62 = new Runtime('swift-6.2'); - } + self::$SWIFT62 ??= new Runtime('swift-6.2'); + return self::$SWIFT62; } public static function KOTLIN16(): Runtime { - if (!isset(self::$KOTLIN16)) { - self::$KOTLIN16 = new Runtime('kotlin-1.6'); - } + self::$KOTLIN16 ??= new Runtime('kotlin-1.6'); + return self::$KOTLIN16; } public static function KOTLIN18(): Runtime { - if (!isset(self::$KOTLIN18)) { - self::$KOTLIN18 = new Runtime('kotlin-1.8'); - } + self::$KOTLIN18 ??= new Runtime('kotlin-1.8'); + return self::$KOTLIN18; } public static function KOTLIN19(): Runtime { - if (!isset(self::$KOTLIN19)) { - self::$KOTLIN19 = new Runtime('kotlin-1.9'); - } + self::$KOTLIN19 ??= new Runtime('kotlin-1.9'); + return self::$KOTLIN19; } public static function KOTLIN20(): Runtime { - if (!isset(self::$KOTLIN20)) { - self::$KOTLIN20 = new Runtime('kotlin-2.0'); - } + self::$KOTLIN20 ??= new Runtime('kotlin-2.0'); + return self::$KOTLIN20; } public static function KOTLIN23(): Runtime { - if (!isset(self::$KOTLIN23)) { - self::$KOTLIN23 = new Runtime('kotlin-2.3'); - } + self::$KOTLIN23 ??= new Runtime('kotlin-2.3'); + return self::$KOTLIN23; } public static function CPP17(): Runtime { - if (!isset(self::$CPP17)) { - self::$CPP17 = new Runtime('cpp-17'); - } + self::$CPP17 ??= new Runtime('cpp-17'); + return self::$CPP17; } public static function CPP20(): Runtime { - if (!isset(self::$CPP20)) { - self::$CPP20 = new Runtime('cpp-20'); - } + self::$CPP20 ??= new Runtime('cpp-20'); + return self::$CPP20; } public static function BUN10(): Runtime { - if (!isset(self::$BUN10)) { - self::$BUN10 = new Runtime('bun-1.0'); - } + self::$BUN10 ??= new Runtime('bun-1.0'); + return self::$BUN10; } public static function BUN11(): Runtime { - if (!isset(self::$BUN11)) { - self::$BUN11 = new Runtime('bun-1.1'); - } + self::$BUN11 ??= new Runtime('bun-1.1'); + return self::$BUN11; } public static function BUN12(): Runtime { - if (!isset(self::$BUN12)) { - self::$BUN12 = new Runtime('bun-1.2'); - } + self::$BUN12 ??= new Runtime('bun-1.2'); + return self::$BUN12; } public static function BUN13(): Runtime { - if (!isset(self::$BUN13)) { - self::$BUN13 = new Runtime('bun-1.3'); - } + self::$BUN13 ??= new Runtime('bun-1.3'); + return self::$BUN13; } public static function BUN14(): Runtime { - if (!isset(self::$BUN14)) { - self::$BUN14 = new Runtime('bun-1.4'); - } + self::$BUN14 ??= new Runtime('bun-1.4'); + return self::$BUN14; } public static function GO123(): Runtime { - if (!isset(self::$GO123)) { - self::$GO123 = new Runtime('go-1.23'); - } + self::$GO123 ??= new Runtime('go-1.23'); + return self::$GO123; } public static function GO124(): Runtime { - if (!isset(self::$GO124)) { - self::$GO124 = new Runtime('go-1.24'); - } + self::$GO124 ??= new Runtime('go-1.24'); + return self::$GO124; } public static function GO125(): Runtime { - if (!isset(self::$GO125)) { - self::$GO125 = new Runtime('go-1.25'); - } + self::$GO125 ??= new Runtime('go-1.25'); + return self::$GO125; } public static function GO126(): Runtime { - if (!isset(self::$GO126)) { - self::$GO126 = new Runtime('go-1.26'); - } + self::$GO126 ??= new Runtime('go-1.26'); + return self::$GO126; } public static function RUST183(): Runtime { - if (!isset(self::$RUST183)) { - self::$RUST183 = new Runtime('rust-1.83'); - } + self::$RUST183 ??= new Runtime('rust-1.83'); + return self::$RUST183; } public static function STATIC1(): Runtime { - if (!isset(self::$STATIC1)) { - self::$STATIC1 = new Runtime('static-1'); - } + self::$STATIC1 ??= new Runtime('static-1'); + return self::$STATIC1; } public static function FLUTTER324(): Runtime { - if (!isset(self::$FLUTTER324)) { - self::$FLUTTER324 = new Runtime('flutter-3.24'); - } + self::$FLUTTER324 ??= new Runtime('flutter-3.24'); + return self::$FLUTTER324; } public static function FLUTTER327(): Runtime { - if (!isset(self::$FLUTTER327)) { - self::$FLUTTER327 = new Runtime('flutter-3.27'); - } + self::$FLUTTER327 ??= new Runtime('flutter-3.27'); + return self::$FLUTTER327; } public static function FLUTTER329(): Runtime { - if (!isset(self::$FLUTTER329)) { - self::$FLUTTER329 = new Runtime('flutter-3.29'); - } + self::$FLUTTER329 ??= new Runtime('flutter-3.29'); + return self::$FLUTTER329; } public static function FLUTTER332(): Runtime { - if (!isset(self::$FLUTTER332)) { - self::$FLUTTER332 = new Runtime('flutter-3.32'); - } + self::$FLUTTER332 ??= new Runtime('flutter-3.32'); + return self::$FLUTTER332; } public static function FLUTTER335(): Runtime { - if (!isset(self::$FLUTTER335)) { - self::$FLUTTER335 = new Runtime('flutter-3.35'); - } + self::$FLUTTER335 ??= new Runtime('flutter-3.35'); + return self::$FLUTTER335; } public static function FLUTTER338(): Runtime { - if (!isset(self::$FLUTTER338)) { - self::$FLUTTER338 = new Runtime('flutter-3.38'); - } + self::$FLUTTER338 ??= new Runtime('flutter-3.38'); + return self::$FLUTTER338; } public static function FLUTTER341(): Runtime { - if (!isset(self::$FLUTTER341)) { - self::$FLUTTER341 = new Runtime('flutter-3.41'); - } + self::$FLUTTER341 ??= new Runtime('flutter-3.41'); + return self::$FLUTTER341; } public static function FLUTTER344(): Runtime { - if (!isset(self::$FLUTTER344)) { - self::$FLUTTER344 = new Runtime('flutter-3.44'); - } + self::$FLUTTER344 ??= new Runtime('flutter-3.44'); + return self::$FLUTTER344; } diff --git a/src/Appwrite/Enums/SmtpEncryption.php b/src/Appwrite/Enums/SmtpEncryption.php index fc5e6f8..4c0f64d 100644 --- a/src/Appwrite/Enums/SmtpEncryption.php +++ b/src/Appwrite/Enums/SmtpEncryption.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function NONE(): SmtpEncryption { - if (!isset(self::$NONE)) { - self::$NONE = new SmtpEncryption('none'); - } + self::$NONE ??= new SmtpEncryption('none'); + return self::$NONE; } public static function SSL(): SmtpEncryption { - if (!isset(self::$SSL)) { - self::$SSL = new SmtpEncryption('ssl'); - } + self::$SSL ??= new SmtpEncryption('ssl'); + return self::$SSL; } public static function TLS(): SmtpEncryption { - if (!isset(self::$TLS)) { - self::$TLS = new SmtpEncryption('tls'); - } + self::$TLS ??= new SmtpEncryption('tls'); + return self::$TLS; } diff --git a/src/Appwrite/Enums/StatusCode.php b/src/Appwrite/Enums/StatusCode.php index 76dbda8..6175655 100644 --- a/src/Appwrite/Enums/StatusCode.php +++ b/src/Appwrite/Enums/StatusCode.php @@ -30,30 +30,26 @@ public function jsonSerialize(): string public static function MOVEDPERMANENTLY(): StatusCode { - if (!isset(self::$MOVEDPERMANENTLY)) { - self::$MOVEDPERMANENTLY = new StatusCode('301'); - } + self::$MOVEDPERMANENTLY ??= new StatusCode('301'); + return self::$MOVEDPERMANENTLY; } public static function FOUND(): StatusCode { - if (!isset(self::$FOUND)) { - self::$FOUND = new StatusCode('302'); - } + self::$FOUND ??= new StatusCode('302'); + return self::$FOUND; } public static function TEMPORARYREDIRECT(): StatusCode { - if (!isset(self::$TEMPORARYREDIRECT)) { - self::$TEMPORARYREDIRECT = new StatusCode('307'); - } + self::$TEMPORARYREDIRECT ??= new StatusCode('307'); + return self::$TEMPORARYREDIRECT; } public static function PERMANENTREDIRECT(): StatusCode { - if (!isset(self::$PERMANENTREDIRECT)) { - self::$PERMANENTREDIRECT = new StatusCode('308'); - } + self::$PERMANENTREDIRECT ??= new StatusCode('308'); + return self::$PERMANENTREDIRECT; } diff --git a/src/Appwrite/Enums/TablesDBIndexType.php b/src/Appwrite/Enums/TablesDBIndexType.php index 32425ed..1399870 100644 --- a/src/Appwrite/Enums/TablesDBIndexType.php +++ b/src/Appwrite/Enums/TablesDBIndexType.php @@ -30,30 +30,26 @@ public function jsonSerialize(): string public static function KEY(): TablesDBIndexType { - if (!isset(self::$KEY)) { - self::$KEY = new TablesDBIndexType('key'); - } + self::$KEY ??= new TablesDBIndexType('key'); + return self::$KEY; } public static function FULLTEXT(): TablesDBIndexType { - if (!isset(self::$FULLTEXT)) { - self::$FULLTEXT = new TablesDBIndexType('fulltext'); - } + self::$FULLTEXT ??= new TablesDBIndexType('fulltext'); + return self::$FULLTEXT; } public static function UNIQUE(): TablesDBIndexType { - if (!isset(self::$UNIQUE)) { - self::$UNIQUE = new TablesDBIndexType('unique'); - } + self::$UNIQUE ??= new TablesDBIndexType('unique'); + return self::$UNIQUE; } public static function SPATIAL(): TablesDBIndexType { - if (!isset(self::$SPATIAL)) { - self::$SPATIAL = new TablesDBIndexType('spatial'); - } + self::$SPATIAL ??= new TablesDBIndexType('spatial'); + return self::$SPATIAL; } diff --git a/src/Appwrite/Enums/TemplateReferenceType.php b/src/Appwrite/Enums/TemplateReferenceType.php index 765e85d..eea2c50 100644 --- a/src/Appwrite/Enums/TemplateReferenceType.php +++ b/src/Appwrite/Enums/TemplateReferenceType.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function COMMIT(): TemplateReferenceType { - if (!isset(self::$COMMIT)) { - self::$COMMIT = new TemplateReferenceType('commit'); - } + self::$COMMIT ??= new TemplateReferenceType('commit'); + return self::$COMMIT; } public static function BRANCH(): TemplateReferenceType { - if (!isset(self::$BRANCH)) { - self::$BRANCH = new TemplateReferenceType('branch'); - } + self::$BRANCH ??= new TemplateReferenceType('branch'); + return self::$BRANCH; } public static function TAG(): TemplateReferenceType { - if (!isset(self::$TAG)) { - self::$TAG = new TemplateReferenceType('tag'); - } + self::$TAG ??= new TemplateReferenceType('tag'); + return self::$TAG; } diff --git a/src/Appwrite/Enums/Timezone.php b/src/Appwrite/Enums/Timezone.php index 532f443..d634684 100644 --- a/src/Appwrite/Enums/Timezone.php +++ b/src/Appwrite/Enums/Timezone.php @@ -445,2935 +445,2516 @@ public function jsonSerialize(): string public static function AFRICAABIDJAN(): Timezone { - if (!isset(self::$AFRICAABIDJAN)) { - self::$AFRICAABIDJAN = new Timezone('africa/abidjan'); - } + self::$AFRICAABIDJAN ??= new Timezone('africa/abidjan'); + return self::$AFRICAABIDJAN; } public static function AFRICAACCRA(): Timezone { - if (!isset(self::$AFRICAACCRA)) { - self::$AFRICAACCRA = new Timezone('africa/accra'); - } + self::$AFRICAACCRA ??= new Timezone('africa/accra'); + return self::$AFRICAACCRA; } public static function AFRICAADDISABABA(): Timezone { - if (!isset(self::$AFRICAADDISABABA)) { - self::$AFRICAADDISABABA = new Timezone('africa/addis_ababa'); - } + self::$AFRICAADDISABABA ??= new Timezone('africa/addis_ababa'); + return self::$AFRICAADDISABABA; } public static function AFRICAALGIERS(): Timezone { - if (!isset(self::$AFRICAALGIERS)) { - self::$AFRICAALGIERS = new Timezone('africa/algiers'); - } + self::$AFRICAALGIERS ??= new Timezone('africa/algiers'); + return self::$AFRICAALGIERS; } public static function AFRICAASMARA(): Timezone { - if (!isset(self::$AFRICAASMARA)) { - self::$AFRICAASMARA = new Timezone('africa/asmara'); - } + self::$AFRICAASMARA ??= new Timezone('africa/asmara'); + return self::$AFRICAASMARA; } public static function AFRICABAMAKO(): Timezone { - if (!isset(self::$AFRICABAMAKO)) { - self::$AFRICABAMAKO = new Timezone('africa/bamako'); - } + self::$AFRICABAMAKO ??= new Timezone('africa/bamako'); + return self::$AFRICABAMAKO; } public static function AFRICABANGUI(): Timezone { - if (!isset(self::$AFRICABANGUI)) { - self::$AFRICABANGUI = new Timezone('africa/bangui'); - } + self::$AFRICABANGUI ??= new Timezone('africa/bangui'); + return self::$AFRICABANGUI; } public static function AFRICABANJUL(): Timezone { - if (!isset(self::$AFRICABANJUL)) { - self::$AFRICABANJUL = new Timezone('africa/banjul'); - } + self::$AFRICABANJUL ??= new Timezone('africa/banjul'); + return self::$AFRICABANJUL; } public static function AFRICABISSAU(): Timezone { - if (!isset(self::$AFRICABISSAU)) { - self::$AFRICABISSAU = new Timezone('africa/bissau'); - } + self::$AFRICABISSAU ??= new Timezone('africa/bissau'); + return self::$AFRICABISSAU; } public static function AFRICABLANTYRE(): Timezone { - if (!isset(self::$AFRICABLANTYRE)) { - self::$AFRICABLANTYRE = new Timezone('africa/blantyre'); - } + self::$AFRICABLANTYRE ??= new Timezone('africa/blantyre'); + return self::$AFRICABLANTYRE; } public static function AFRICABRAZZAVILLE(): Timezone { - if (!isset(self::$AFRICABRAZZAVILLE)) { - self::$AFRICABRAZZAVILLE = new Timezone('africa/brazzaville'); - } + self::$AFRICABRAZZAVILLE ??= new Timezone('africa/brazzaville'); + return self::$AFRICABRAZZAVILLE; } public static function AFRICABUJUMBURA(): Timezone { - if (!isset(self::$AFRICABUJUMBURA)) { - self::$AFRICABUJUMBURA = new Timezone('africa/bujumbura'); - } + self::$AFRICABUJUMBURA ??= new Timezone('africa/bujumbura'); + return self::$AFRICABUJUMBURA; } public static function AFRICACAIRO(): Timezone { - if (!isset(self::$AFRICACAIRO)) { - self::$AFRICACAIRO = new Timezone('africa/cairo'); - } + self::$AFRICACAIRO ??= new Timezone('africa/cairo'); + return self::$AFRICACAIRO; } public static function AFRICACASABLANCA(): Timezone { - if (!isset(self::$AFRICACASABLANCA)) { - self::$AFRICACASABLANCA = new Timezone('africa/casablanca'); - } + self::$AFRICACASABLANCA ??= new Timezone('africa/casablanca'); + return self::$AFRICACASABLANCA; } public static function AFRICACEUTA(): Timezone { - if (!isset(self::$AFRICACEUTA)) { - self::$AFRICACEUTA = new Timezone('africa/ceuta'); - } + self::$AFRICACEUTA ??= new Timezone('africa/ceuta'); + return self::$AFRICACEUTA; } public static function AFRICACONAKRY(): Timezone { - if (!isset(self::$AFRICACONAKRY)) { - self::$AFRICACONAKRY = new Timezone('africa/conakry'); - } + self::$AFRICACONAKRY ??= new Timezone('africa/conakry'); + return self::$AFRICACONAKRY; } public static function AFRICADAKAR(): Timezone { - if (!isset(self::$AFRICADAKAR)) { - self::$AFRICADAKAR = new Timezone('africa/dakar'); - } + self::$AFRICADAKAR ??= new Timezone('africa/dakar'); + return self::$AFRICADAKAR; } public static function AFRICADARESSALAAM(): Timezone { - if (!isset(self::$AFRICADARESSALAAM)) { - self::$AFRICADARESSALAAM = new Timezone('africa/dar_es_salaam'); - } + self::$AFRICADARESSALAAM ??= new Timezone('africa/dar_es_salaam'); + return self::$AFRICADARESSALAAM; } public static function AFRICADJIBOUTI(): Timezone { - if (!isset(self::$AFRICADJIBOUTI)) { - self::$AFRICADJIBOUTI = new Timezone('africa/djibouti'); - } + self::$AFRICADJIBOUTI ??= new Timezone('africa/djibouti'); + return self::$AFRICADJIBOUTI; } public static function AFRICADOUALA(): Timezone { - if (!isset(self::$AFRICADOUALA)) { - self::$AFRICADOUALA = new Timezone('africa/douala'); - } + self::$AFRICADOUALA ??= new Timezone('africa/douala'); + return self::$AFRICADOUALA; } public static function AFRICAELAAIUN(): Timezone { - if (!isset(self::$AFRICAELAAIUN)) { - self::$AFRICAELAAIUN = new Timezone('africa/el_aaiun'); - } + self::$AFRICAELAAIUN ??= new Timezone('africa/el_aaiun'); + return self::$AFRICAELAAIUN; } public static function AFRICAFREETOWN(): Timezone { - if (!isset(self::$AFRICAFREETOWN)) { - self::$AFRICAFREETOWN = new Timezone('africa/freetown'); - } + self::$AFRICAFREETOWN ??= new Timezone('africa/freetown'); + return self::$AFRICAFREETOWN; } public static function AFRICAGABORONE(): Timezone { - if (!isset(self::$AFRICAGABORONE)) { - self::$AFRICAGABORONE = new Timezone('africa/gaborone'); - } + self::$AFRICAGABORONE ??= new Timezone('africa/gaborone'); + return self::$AFRICAGABORONE; } public static function AFRICAHARARE(): Timezone { - if (!isset(self::$AFRICAHARARE)) { - self::$AFRICAHARARE = new Timezone('africa/harare'); - } + self::$AFRICAHARARE ??= new Timezone('africa/harare'); + return self::$AFRICAHARARE; } public static function AFRICAJOHANNESBURG(): Timezone { - if (!isset(self::$AFRICAJOHANNESBURG)) { - self::$AFRICAJOHANNESBURG = new Timezone('africa/johannesburg'); - } + self::$AFRICAJOHANNESBURG ??= new Timezone('africa/johannesburg'); + return self::$AFRICAJOHANNESBURG; } public static function AFRICAJUBA(): Timezone { - if (!isset(self::$AFRICAJUBA)) { - self::$AFRICAJUBA = new Timezone('africa/juba'); - } + self::$AFRICAJUBA ??= new Timezone('africa/juba'); + return self::$AFRICAJUBA; } public static function AFRICAKAMPALA(): Timezone { - if (!isset(self::$AFRICAKAMPALA)) { - self::$AFRICAKAMPALA = new Timezone('africa/kampala'); - } + self::$AFRICAKAMPALA ??= new Timezone('africa/kampala'); + return self::$AFRICAKAMPALA; } public static function AFRICAKHARTOUM(): Timezone { - if (!isset(self::$AFRICAKHARTOUM)) { - self::$AFRICAKHARTOUM = new Timezone('africa/khartoum'); - } + self::$AFRICAKHARTOUM ??= new Timezone('africa/khartoum'); + return self::$AFRICAKHARTOUM; } public static function AFRICAKIGALI(): Timezone { - if (!isset(self::$AFRICAKIGALI)) { - self::$AFRICAKIGALI = new Timezone('africa/kigali'); - } + self::$AFRICAKIGALI ??= new Timezone('africa/kigali'); + return self::$AFRICAKIGALI; } public static function AFRICAKINSHASA(): Timezone { - if (!isset(self::$AFRICAKINSHASA)) { - self::$AFRICAKINSHASA = new Timezone('africa/kinshasa'); - } + self::$AFRICAKINSHASA ??= new Timezone('africa/kinshasa'); + return self::$AFRICAKINSHASA; } public static function AFRICALAGOS(): Timezone { - if (!isset(self::$AFRICALAGOS)) { - self::$AFRICALAGOS = new Timezone('africa/lagos'); - } + self::$AFRICALAGOS ??= new Timezone('africa/lagos'); + return self::$AFRICALAGOS; } public static function AFRICALIBREVILLE(): Timezone { - if (!isset(self::$AFRICALIBREVILLE)) { - self::$AFRICALIBREVILLE = new Timezone('africa/libreville'); - } + self::$AFRICALIBREVILLE ??= new Timezone('africa/libreville'); + return self::$AFRICALIBREVILLE; } public static function AFRICALOME(): Timezone { - if (!isset(self::$AFRICALOME)) { - self::$AFRICALOME = new Timezone('africa/lome'); - } + self::$AFRICALOME ??= new Timezone('africa/lome'); + return self::$AFRICALOME; } public static function AFRICALUANDA(): Timezone { - if (!isset(self::$AFRICALUANDA)) { - self::$AFRICALUANDA = new Timezone('africa/luanda'); - } + self::$AFRICALUANDA ??= new Timezone('africa/luanda'); + return self::$AFRICALUANDA; } public static function AFRICALUBUMBASHI(): Timezone { - if (!isset(self::$AFRICALUBUMBASHI)) { - self::$AFRICALUBUMBASHI = new Timezone('africa/lubumbashi'); - } + self::$AFRICALUBUMBASHI ??= new Timezone('africa/lubumbashi'); + return self::$AFRICALUBUMBASHI; } public static function AFRICALUSAKA(): Timezone { - if (!isset(self::$AFRICALUSAKA)) { - self::$AFRICALUSAKA = new Timezone('africa/lusaka'); - } + self::$AFRICALUSAKA ??= new Timezone('africa/lusaka'); + return self::$AFRICALUSAKA; } public static function AFRICAMALABO(): Timezone { - if (!isset(self::$AFRICAMALABO)) { - self::$AFRICAMALABO = new Timezone('africa/malabo'); - } + self::$AFRICAMALABO ??= new Timezone('africa/malabo'); + return self::$AFRICAMALABO; } public static function AFRICAMAPUTO(): Timezone { - if (!isset(self::$AFRICAMAPUTO)) { - self::$AFRICAMAPUTO = new Timezone('africa/maputo'); - } + self::$AFRICAMAPUTO ??= new Timezone('africa/maputo'); + return self::$AFRICAMAPUTO; } public static function AFRICAMASERU(): Timezone { - if (!isset(self::$AFRICAMASERU)) { - self::$AFRICAMASERU = new Timezone('africa/maseru'); - } + self::$AFRICAMASERU ??= new Timezone('africa/maseru'); + return self::$AFRICAMASERU; } public static function AFRICAMBABANE(): Timezone { - if (!isset(self::$AFRICAMBABANE)) { - self::$AFRICAMBABANE = new Timezone('africa/mbabane'); - } + self::$AFRICAMBABANE ??= new Timezone('africa/mbabane'); + return self::$AFRICAMBABANE; } public static function AFRICAMOGADISHU(): Timezone { - if (!isset(self::$AFRICAMOGADISHU)) { - self::$AFRICAMOGADISHU = new Timezone('africa/mogadishu'); - } + self::$AFRICAMOGADISHU ??= new Timezone('africa/mogadishu'); + return self::$AFRICAMOGADISHU; } public static function AFRICAMONROVIA(): Timezone { - if (!isset(self::$AFRICAMONROVIA)) { - self::$AFRICAMONROVIA = new Timezone('africa/monrovia'); - } + self::$AFRICAMONROVIA ??= new Timezone('africa/monrovia'); + return self::$AFRICAMONROVIA; } public static function AFRICANAIROBI(): Timezone { - if (!isset(self::$AFRICANAIROBI)) { - self::$AFRICANAIROBI = new Timezone('africa/nairobi'); - } + self::$AFRICANAIROBI ??= new Timezone('africa/nairobi'); + return self::$AFRICANAIROBI; } public static function AFRICANDJAMENA(): Timezone { - if (!isset(self::$AFRICANDJAMENA)) { - self::$AFRICANDJAMENA = new Timezone('africa/ndjamena'); - } + self::$AFRICANDJAMENA ??= new Timezone('africa/ndjamena'); + return self::$AFRICANDJAMENA; } public static function AFRICANIAMEY(): Timezone { - if (!isset(self::$AFRICANIAMEY)) { - self::$AFRICANIAMEY = new Timezone('africa/niamey'); - } + self::$AFRICANIAMEY ??= new Timezone('africa/niamey'); + return self::$AFRICANIAMEY; } public static function AFRICANOUAKCHOTT(): Timezone { - if (!isset(self::$AFRICANOUAKCHOTT)) { - self::$AFRICANOUAKCHOTT = new Timezone('africa/nouakchott'); - } + self::$AFRICANOUAKCHOTT ??= new Timezone('africa/nouakchott'); + return self::$AFRICANOUAKCHOTT; } public static function AFRICAOUAGADOUGOU(): Timezone { - if (!isset(self::$AFRICAOUAGADOUGOU)) { - self::$AFRICAOUAGADOUGOU = new Timezone('africa/ouagadougou'); - } + self::$AFRICAOUAGADOUGOU ??= new Timezone('africa/ouagadougou'); + return self::$AFRICAOUAGADOUGOU; } public static function AFRICAPORTONOVO(): Timezone { - if (!isset(self::$AFRICAPORTONOVO)) { - self::$AFRICAPORTONOVO = new Timezone('africa/porto-novo'); - } + self::$AFRICAPORTONOVO ??= new Timezone('africa/porto-novo'); + return self::$AFRICAPORTONOVO; } public static function AFRICASAOTOME(): Timezone { - if (!isset(self::$AFRICASAOTOME)) { - self::$AFRICASAOTOME = new Timezone('africa/sao_tome'); - } + self::$AFRICASAOTOME ??= new Timezone('africa/sao_tome'); + return self::$AFRICASAOTOME; } public static function AFRICATRIPOLI(): Timezone { - if (!isset(self::$AFRICATRIPOLI)) { - self::$AFRICATRIPOLI = new Timezone('africa/tripoli'); - } + self::$AFRICATRIPOLI ??= new Timezone('africa/tripoli'); + return self::$AFRICATRIPOLI; } public static function AFRICATUNIS(): Timezone { - if (!isset(self::$AFRICATUNIS)) { - self::$AFRICATUNIS = new Timezone('africa/tunis'); - } + self::$AFRICATUNIS ??= new Timezone('africa/tunis'); + return self::$AFRICATUNIS; } public static function AFRICAWINDHOEK(): Timezone { - if (!isset(self::$AFRICAWINDHOEK)) { - self::$AFRICAWINDHOEK = new Timezone('africa/windhoek'); - } + self::$AFRICAWINDHOEK ??= new Timezone('africa/windhoek'); + return self::$AFRICAWINDHOEK; } public static function AMERICAADAK(): Timezone { - if (!isset(self::$AMERICAADAK)) { - self::$AMERICAADAK = new Timezone('america/adak'); - } + self::$AMERICAADAK ??= new Timezone('america/adak'); + return self::$AMERICAADAK; } public static function AMERICAANCHORAGE(): Timezone { - if (!isset(self::$AMERICAANCHORAGE)) { - self::$AMERICAANCHORAGE = new Timezone('america/anchorage'); - } + self::$AMERICAANCHORAGE ??= new Timezone('america/anchorage'); + return self::$AMERICAANCHORAGE; } public static function AMERICAANGUILLA(): Timezone { - if (!isset(self::$AMERICAANGUILLA)) { - self::$AMERICAANGUILLA = new Timezone('america/anguilla'); - } + self::$AMERICAANGUILLA ??= new Timezone('america/anguilla'); + return self::$AMERICAANGUILLA; } public static function AMERICAANTIGUA(): Timezone { - if (!isset(self::$AMERICAANTIGUA)) { - self::$AMERICAANTIGUA = new Timezone('america/antigua'); - } + self::$AMERICAANTIGUA ??= new Timezone('america/antigua'); + return self::$AMERICAANTIGUA; } public static function AMERICAARAGUAINA(): Timezone { - if (!isset(self::$AMERICAARAGUAINA)) { - self::$AMERICAARAGUAINA = new Timezone('america/araguaina'); - } + self::$AMERICAARAGUAINA ??= new Timezone('america/araguaina'); + return self::$AMERICAARAGUAINA; } public static function AMERICAARGENTINABUENOSAIRES(): Timezone { - if (!isset(self::$AMERICAARGENTINABUENOSAIRES)) { - self::$AMERICAARGENTINABUENOSAIRES = new Timezone('america/argentina/buenos_aires'); - } + self::$AMERICAARGENTINABUENOSAIRES ??= new Timezone('america/argentina/buenos_aires'); + return self::$AMERICAARGENTINABUENOSAIRES; } public static function AMERICAARGENTINACATAMARCA(): Timezone { - if (!isset(self::$AMERICAARGENTINACATAMARCA)) { - self::$AMERICAARGENTINACATAMARCA = new Timezone('america/argentina/catamarca'); - } + self::$AMERICAARGENTINACATAMARCA ??= new Timezone('america/argentina/catamarca'); + return self::$AMERICAARGENTINACATAMARCA; } public static function AMERICAARGENTINACORDOBA(): Timezone { - if (!isset(self::$AMERICAARGENTINACORDOBA)) { - self::$AMERICAARGENTINACORDOBA = new Timezone('america/argentina/cordoba'); - } + self::$AMERICAARGENTINACORDOBA ??= new Timezone('america/argentina/cordoba'); + return self::$AMERICAARGENTINACORDOBA; } public static function AMERICAARGENTINAJUJUY(): Timezone { - if (!isset(self::$AMERICAARGENTINAJUJUY)) { - self::$AMERICAARGENTINAJUJUY = new Timezone('america/argentina/jujuy'); - } + self::$AMERICAARGENTINAJUJUY ??= new Timezone('america/argentina/jujuy'); + return self::$AMERICAARGENTINAJUJUY; } public static function AMERICAARGENTINALARIOJA(): Timezone { - if (!isset(self::$AMERICAARGENTINALARIOJA)) { - self::$AMERICAARGENTINALARIOJA = new Timezone('america/argentina/la_rioja'); - } + self::$AMERICAARGENTINALARIOJA ??= new Timezone('america/argentina/la_rioja'); + return self::$AMERICAARGENTINALARIOJA; } public static function AMERICAARGENTINAMENDOZA(): Timezone { - if (!isset(self::$AMERICAARGENTINAMENDOZA)) { - self::$AMERICAARGENTINAMENDOZA = new Timezone('america/argentina/mendoza'); - } + self::$AMERICAARGENTINAMENDOZA ??= new Timezone('america/argentina/mendoza'); + return self::$AMERICAARGENTINAMENDOZA; } public static function AMERICAARGENTINARIOGALLEGOS(): Timezone { - if (!isset(self::$AMERICAARGENTINARIOGALLEGOS)) { - self::$AMERICAARGENTINARIOGALLEGOS = new Timezone('america/argentina/rio_gallegos'); - } + self::$AMERICAARGENTINARIOGALLEGOS ??= new Timezone('america/argentina/rio_gallegos'); + return self::$AMERICAARGENTINARIOGALLEGOS; } public static function AMERICAARGENTINASALTA(): Timezone { - if (!isset(self::$AMERICAARGENTINASALTA)) { - self::$AMERICAARGENTINASALTA = new Timezone('america/argentina/salta'); - } + self::$AMERICAARGENTINASALTA ??= new Timezone('america/argentina/salta'); + return self::$AMERICAARGENTINASALTA; } public static function AMERICAARGENTINASANJUAN(): Timezone { - if (!isset(self::$AMERICAARGENTINASANJUAN)) { - self::$AMERICAARGENTINASANJUAN = new Timezone('america/argentina/san_juan'); - } + self::$AMERICAARGENTINASANJUAN ??= new Timezone('america/argentina/san_juan'); + return self::$AMERICAARGENTINASANJUAN; } public static function AMERICAARGENTINASANLUIS(): Timezone { - if (!isset(self::$AMERICAARGENTINASANLUIS)) { - self::$AMERICAARGENTINASANLUIS = new Timezone('america/argentina/san_luis'); - } + self::$AMERICAARGENTINASANLUIS ??= new Timezone('america/argentina/san_luis'); + return self::$AMERICAARGENTINASANLUIS; } public static function AMERICAARGENTINATUCUMAN(): Timezone { - if (!isset(self::$AMERICAARGENTINATUCUMAN)) { - self::$AMERICAARGENTINATUCUMAN = new Timezone('america/argentina/tucuman'); - } + self::$AMERICAARGENTINATUCUMAN ??= new Timezone('america/argentina/tucuman'); + return self::$AMERICAARGENTINATUCUMAN; } public static function AMERICAARGENTINAUSHUAIA(): Timezone { - if (!isset(self::$AMERICAARGENTINAUSHUAIA)) { - self::$AMERICAARGENTINAUSHUAIA = new Timezone('america/argentina/ushuaia'); - } + self::$AMERICAARGENTINAUSHUAIA ??= new Timezone('america/argentina/ushuaia'); + return self::$AMERICAARGENTINAUSHUAIA; } public static function AMERICAARUBA(): Timezone { - if (!isset(self::$AMERICAARUBA)) { - self::$AMERICAARUBA = new Timezone('america/aruba'); - } + self::$AMERICAARUBA ??= new Timezone('america/aruba'); + return self::$AMERICAARUBA; } public static function AMERICAASUNCION(): Timezone { - if (!isset(self::$AMERICAASUNCION)) { - self::$AMERICAASUNCION = new Timezone('america/asuncion'); - } + self::$AMERICAASUNCION ??= new Timezone('america/asuncion'); + return self::$AMERICAASUNCION; } public static function AMERICAATIKOKAN(): Timezone { - if (!isset(self::$AMERICAATIKOKAN)) { - self::$AMERICAATIKOKAN = new Timezone('america/atikokan'); - } + self::$AMERICAATIKOKAN ??= new Timezone('america/atikokan'); + return self::$AMERICAATIKOKAN; } public static function AMERICABAHIA(): Timezone { - if (!isset(self::$AMERICABAHIA)) { - self::$AMERICABAHIA = new Timezone('america/bahia'); - } + self::$AMERICABAHIA ??= new Timezone('america/bahia'); + return self::$AMERICABAHIA; } public static function AMERICABAHIABANDERAS(): Timezone { - if (!isset(self::$AMERICABAHIABANDERAS)) { - self::$AMERICABAHIABANDERAS = new Timezone('america/bahia_banderas'); - } + self::$AMERICABAHIABANDERAS ??= new Timezone('america/bahia_banderas'); + return self::$AMERICABAHIABANDERAS; } public static function AMERICABARBADOS(): Timezone { - if (!isset(self::$AMERICABARBADOS)) { - self::$AMERICABARBADOS = new Timezone('america/barbados'); - } + self::$AMERICABARBADOS ??= new Timezone('america/barbados'); + return self::$AMERICABARBADOS; } public static function AMERICABELEM(): Timezone { - if (!isset(self::$AMERICABELEM)) { - self::$AMERICABELEM = new Timezone('america/belem'); - } + self::$AMERICABELEM ??= new Timezone('america/belem'); + return self::$AMERICABELEM; } public static function AMERICABELIZE(): Timezone { - if (!isset(self::$AMERICABELIZE)) { - self::$AMERICABELIZE = new Timezone('america/belize'); - } + self::$AMERICABELIZE ??= new Timezone('america/belize'); + return self::$AMERICABELIZE; } public static function AMERICABLANCSABLON(): Timezone { - if (!isset(self::$AMERICABLANCSABLON)) { - self::$AMERICABLANCSABLON = new Timezone('america/blanc-sablon'); - } + self::$AMERICABLANCSABLON ??= new Timezone('america/blanc-sablon'); + return self::$AMERICABLANCSABLON; } public static function AMERICABOAVISTA(): Timezone { - if (!isset(self::$AMERICABOAVISTA)) { - self::$AMERICABOAVISTA = new Timezone('america/boa_vista'); - } + self::$AMERICABOAVISTA ??= new Timezone('america/boa_vista'); + return self::$AMERICABOAVISTA; } public static function AMERICABOGOTA(): Timezone { - if (!isset(self::$AMERICABOGOTA)) { - self::$AMERICABOGOTA = new Timezone('america/bogota'); - } + self::$AMERICABOGOTA ??= new Timezone('america/bogota'); + return self::$AMERICABOGOTA; } public static function AMERICABOISE(): Timezone { - if (!isset(self::$AMERICABOISE)) { - self::$AMERICABOISE = new Timezone('america/boise'); - } + self::$AMERICABOISE ??= new Timezone('america/boise'); + return self::$AMERICABOISE; } public static function AMERICACAMBRIDGEBAY(): Timezone { - if (!isset(self::$AMERICACAMBRIDGEBAY)) { - self::$AMERICACAMBRIDGEBAY = new Timezone('america/cambridge_bay'); - } + self::$AMERICACAMBRIDGEBAY ??= new Timezone('america/cambridge_bay'); + return self::$AMERICACAMBRIDGEBAY; } public static function AMERICACAMPOGRANDE(): Timezone { - if (!isset(self::$AMERICACAMPOGRANDE)) { - self::$AMERICACAMPOGRANDE = new Timezone('america/campo_grande'); - } + self::$AMERICACAMPOGRANDE ??= new Timezone('america/campo_grande'); + return self::$AMERICACAMPOGRANDE; } public static function AMERICACANCUN(): Timezone { - if (!isset(self::$AMERICACANCUN)) { - self::$AMERICACANCUN = new Timezone('america/cancun'); - } + self::$AMERICACANCUN ??= new Timezone('america/cancun'); + return self::$AMERICACANCUN; } public static function AMERICACARACAS(): Timezone { - if (!isset(self::$AMERICACARACAS)) { - self::$AMERICACARACAS = new Timezone('america/caracas'); - } + self::$AMERICACARACAS ??= new Timezone('america/caracas'); + return self::$AMERICACARACAS; } public static function AMERICACAYENNE(): Timezone { - if (!isset(self::$AMERICACAYENNE)) { - self::$AMERICACAYENNE = new Timezone('america/cayenne'); - } + self::$AMERICACAYENNE ??= new Timezone('america/cayenne'); + return self::$AMERICACAYENNE; } public static function AMERICACAYMAN(): Timezone { - if (!isset(self::$AMERICACAYMAN)) { - self::$AMERICACAYMAN = new Timezone('america/cayman'); - } + self::$AMERICACAYMAN ??= new Timezone('america/cayman'); + return self::$AMERICACAYMAN; } public static function AMERICACHICAGO(): Timezone { - if (!isset(self::$AMERICACHICAGO)) { - self::$AMERICACHICAGO = new Timezone('america/chicago'); - } + self::$AMERICACHICAGO ??= new Timezone('america/chicago'); + return self::$AMERICACHICAGO; } public static function AMERICACHIHUAHUA(): Timezone { - if (!isset(self::$AMERICACHIHUAHUA)) { - self::$AMERICACHIHUAHUA = new Timezone('america/chihuahua'); - } + self::$AMERICACHIHUAHUA ??= new Timezone('america/chihuahua'); + return self::$AMERICACHIHUAHUA; } public static function AMERICACIUDADJUAREZ(): Timezone { - if (!isset(self::$AMERICACIUDADJUAREZ)) { - self::$AMERICACIUDADJUAREZ = new Timezone('america/ciudad_juarez'); - } + self::$AMERICACIUDADJUAREZ ??= new Timezone('america/ciudad_juarez'); + return self::$AMERICACIUDADJUAREZ; } public static function AMERICACOSTARICA(): Timezone { - if (!isset(self::$AMERICACOSTARICA)) { - self::$AMERICACOSTARICA = new Timezone('america/costa_rica'); - } + self::$AMERICACOSTARICA ??= new Timezone('america/costa_rica'); + return self::$AMERICACOSTARICA; } public static function AMERICACOYHAIQUE(): Timezone { - if (!isset(self::$AMERICACOYHAIQUE)) { - self::$AMERICACOYHAIQUE = new Timezone('america/coyhaique'); - } + self::$AMERICACOYHAIQUE ??= new Timezone('america/coyhaique'); + return self::$AMERICACOYHAIQUE; } public static function AMERICACRESTON(): Timezone { - if (!isset(self::$AMERICACRESTON)) { - self::$AMERICACRESTON = new Timezone('america/creston'); - } + self::$AMERICACRESTON ??= new Timezone('america/creston'); + return self::$AMERICACRESTON; } public static function AMERICACUIABA(): Timezone { - if (!isset(self::$AMERICACUIABA)) { - self::$AMERICACUIABA = new Timezone('america/cuiaba'); - } + self::$AMERICACUIABA ??= new Timezone('america/cuiaba'); + return self::$AMERICACUIABA; } public static function AMERICACURACAO(): Timezone { - if (!isset(self::$AMERICACURACAO)) { - self::$AMERICACURACAO = new Timezone('america/curacao'); - } + self::$AMERICACURACAO ??= new Timezone('america/curacao'); + return self::$AMERICACURACAO; } public static function AMERICADANMARKSHAVN(): Timezone { - if (!isset(self::$AMERICADANMARKSHAVN)) { - self::$AMERICADANMARKSHAVN = new Timezone('america/danmarkshavn'); - } + self::$AMERICADANMARKSHAVN ??= new Timezone('america/danmarkshavn'); + return self::$AMERICADANMARKSHAVN; } public static function AMERICADAWSON(): Timezone { - if (!isset(self::$AMERICADAWSON)) { - self::$AMERICADAWSON = new Timezone('america/dawson'); - } + self::$AMERICADAWSON ??= new Timezone('america/dawson'); + return self::$AMERICADAWSON; } public static function AMERICADAWSONCREEK(): Timezone { - if (!isset(self::$AMERICADAWSONCREEK)) { - self::$AMERICADAWSONCREEK = new Timezone('america/dawson_creek'); - } + self::$AMERICADAWSONCREEK ??= new Timezone('america/dawson_creek'); + return self::$AMERICADAWSONCREEK; } public static function AMERICADENVER(): Timezone { - if (!isset(self::$AMERICADENVER)) { - self::$AMERICADENVER = new Timezone('america/denver'); - } + self::$AMERICADENVER ??= new Timezone('america/denver'); + return self::$AMERICADENVER; } public static function AMERICADETROIT(): Timezone { - if (!isset(self::$AMERICADETROIT)) { - self::$AMERICADETROIT = new Timezone('america/detroit'); - } + self::$AMERICADETROIT ??= new Timezone('america/detroit'); + return self::$AMERICADETROIT; } public static function AMERICADOMINICA(): Timezone { - if (!isset(self::$AMERICADOMINICA)) { - self::$AMERICADOMINICA = new Timezone('america/dominica'); - } + self::$AMERICADOMINICA ??= new Timezone('america/dominica'); + return self::$AMERICADOMINICA; } public static function AMERICAEDMONTON(): Timezone { - if (!isset(self::$AMERICAEDMONTON)) { - self::$AMERICAEDMONTON = new Timezone('america/edmonton'); - } + self::$AMERICAEDMONTON ??= new Timezone('america/edmonton'); + return self::$AMERICAEDMONTON; } public static function AMERICAEIRUNEPE(): Timezone { - if (!isset(self::$AMERICAEIRUNEPE)) { - self::$AMERICAEIRUNEPE = new Timezone('america/eirunepe'); - } + self::$AMERICAEIRUNEPE ??= new Timezone('america/eirunepe'); + return self::$AMERICAEIRUNEPE; } public static function AMERICAELSALVADOR(): Timezone { - if (!isset(self::$AMERICAELSALVADOR)) { - self::$AMERICAELSALVADOR = new Timezone('america/el_salvador'); - } + self::$AMERICAELSALVADOR ??= new Timezone('america/el_salvador'); + return self::$AMERICAELSALVADOR; } public static function AMERICAFORTNELSON(): Timezone { - if (!isset(self::$AMERICAFORTNELSON)) { - self::$AMERICAFORTNELSON = new Timezone('america/fort_nelson'); - } + self::$AMERICAFORTNELSON ??= new Timezone('america/fort_nelson'); + return self::$AMERICAFORTNELSON; } public static function AMERICAFORTALEZA(): Timezone { - if (!isset(self::$AMERICAFORTALEZA)) { - self::$AMERICAFORTALEZA = new Timezone('america/fortaleza'); - } + self::$AMERICAFORTALEZA ??= new Timezone('america/fortaleza'); + return self::$AMERICAFORTALEZA; } public static function AMERICAGLACEBAY(): Timezone { - if (!isset(self::$AMERICAGLACEBAY)) { - self::$AMERICAGLACEBAY = new Timezone('america/glace_bay'); - } + self::$AMERICAGLACEBAY ??= new Timezone('america/glace_bay'); + return self::$AMERICAGLACEBAY; } public static function AMERICAGOOSEBAY(): Timezone { - if (!isset(self::$AMERICAGOOSEBAY)) { - self::$AMERICAGOOSEBAY = new Timezone('america/goose_bay'); - } + self::$AMERICAGOOSEBAY ??= new Timezone('america/goose_bay'); + return self::$AMERICAGOOSEBAY; } public static function AMERICAGRANDTURK(): Timezone { - if (!isset(self::$AMERICAGRANDTURK)) { - self::$AMERICAGRANDTURK = new Timezone('america/grand_turk'); - } + self::$AMERICAGRANDTURK ??= new Timezone('america/grand_turk'); + return self::$AMERICAGRANDTURK; } public static function AMERICAGRENADA(): Timezone { - if (!isset(self::$AMERICAGRENADA)) { - self::$AMERICAGRENADA = new Timezone('america/grenada'); - } + self::$AMERICAGRENADA ??= new Timezone('america/grenada'); + return self::$AMERICAGRENADA; } public static function AMERICAGUADELOUPE(): Timezone { - if (!isset(self::$AMERICAGUADELOUPE)) { - self::$AMERICAGUADELOUPE = new Timezone('america/guadeloupe'); - } + self::$AMERICAGUADELOUPE ??= new Timezone('america/guadeloupe'); + return self::$AMERICAGUADELOUPE; } public static function AMERICAGUATEMALA(): Timezone { - if (!isset(self::$AMERICAGUATEMALA)) { - self::$AMERICAGUATEMALA = new Timezone('america/guatemala'); - } + self::$AMERICAGUATEMALA ??= new Timezone('america/guatemala'); + return self::$AMERICAGUATEMALA; } public static function AMERICAGUAYAQUIL(): Timezone { - if (!isset(self::$AMERICAGUAYAQUIL)) { - self::$AMERICAGUAYAQUIL = new Timezone('america/guayaquil'); - } + self::$AMERICAGUAYAQUIL ??= new Timezone('america/guayaquil'); + return self::$AMERICAGUAYAQUIL; } public static function AMERICAGUYANA(): Timezone { - if (!isset(self::$AMERICAGUYANA)) { - self::$AMERICAGUYANA = new Timezone('america/guyana'); - } + self::$AMERICAGUYANA ??= new Timezone('america/guyana'); + return self::$AMERICAGUYANA; } public static function AMERICAHALIFAX(): Timezone { - if (!isset(self::$AMERICAHALIFAX)) { - self::$AMERICAHALIFAX = new Timezone('america/halifax'); - } + self::$AMERICAHALIFAX ??= new Timezone('america/halifax'); + return self::$AMERICAHALIFAX; } public static function AMERICAHAVANA(): Timezone { - if (!isset(self::$AMERICAHAVANA)) { - self::$AMERICAHAVANA = new Timezone('america/havana'); - } + self::$AMERICAHAVANA ??= new Timezone('america/havana'); + return self::$AMERICAHAVANA; } public static function AMERICAHERMOSILLO(): Timezone { - if (!isset(self::$AMERICAHERMOSILLO)) { - self::$AMERICAHERMOSILLO = new Timezone('america/hermosillo'); - } + self::$AMERICAHERMOSILLO ??= new Timezone('america/hermosillo'); + return self::$AMERICAHERMOSILLO; } public static function AMERICAINDIANAINDIANAPOLIS(): Timezone { - if (!isset(self::$AMERICAINDIANAINDIANAPOLIS)) { - self::$AMERICAINDIANAINDIANAPOLIS = new Timezone('america/indiana/indianapolis'); - } + self::$AMERICAINDIANAINDIANAPOLIS ??= new Timezone('america/indiana/indianapolis'); + return self::$AMERICAINDIANAINDIANAPOLIS; } public static function AMERICAINDIANAKNOX(): Timezone { - if (!isset(self::$AMERICAINDIANAKNOX)) { - self::$AMERICAINDIANAKNOX = new Timezone('america/indiana/knox'); - } + self::$AMERICAINDIANAKNOX ??= new Timezone('america/indiana/knox'); + return self::$AMERICAINDIANAKNOX; } public static function AMERICAINDIANAMARENGO(): Timezone { - if (!isset(self::$AMERICAINDIANAMARENGO)) { - self::$AMERICAINDIANAMARENGO = new Timezone('america/indiana/marengo'); - } + self::$AMERICAINDIANAMARENGO ??= new Timezone('america/indiana/marengo'); + return self::$AMERICAINDIANAMARENGO; } public static function AMERICAINDIANAPETERSBURG(): Timezone { - if (!isset(self::$AMERICAINDIANAPETERSBURG)) { - self::$AMERICAINDIANAPETERSBURG = new Timezone('america/indiana/petersburg'); - } + self::$AMERICAINDIANAPETERSBURG ??= new Timezone('america/indiana/petersburg'); + return self::$AMERICAINDIANAPETERSBURG; } public static function AMERICAINDIANATELLCITY(): Timezone { - if (!isset(self::$AMERICAINDIANATELLCITY)) { - self::$AMERICAINDIANATELLCITY = new Timezone('america/indiana/tell_city'); - } + self::$AMERICAINDIANATELLCITY ??= new Timezone('america/indiana/tell_city'); + return self::$AMERICAINDIANATELLCITY; } public static function AMERICAINDIANAVEVAY(): Timezone { - if (!isset(self::$AMERICAINDIANAVEVAY)) { - self::$AMERICAINDIANAVEVAY = new Timezone('america/indiana/vevay'); - } + self::$AMERICAINDIANAVEVAY ??= new Timezone('america/indiana/vevay'); + return self::$AMERICAINDIANAVEVAY; } public static function AMERICAINDIANAVINCENNES(): Timezone { - if (!isset(self::$AMERICAINDIANAVINCENNES)) { - self::$AMERICAINDIANAVINCENNES = new Timezone('america/indiana/vincennes'); - } + self::$AMERICAINDIANAVINCENNES ??= new Timezone('america/indiana/vincennes'); + return self::$AMERICAINDIANAVINCENNES; } public static function AMERICAINDIANAWINAMAC(): Timezone { - if (!isset(self::$AMERICAINDIANAWINAMAC)) { - self::$AMERICAINDIANAWINAMAC = new Timezone('america/indiana/winamac'); - } + self::$AMERICAINDIANAWINAMAC ??= new Timezone('america/indiana/winamac'); + return self::$AMERICAINDIANAWINAMAC; } public static function AMERICAINUVIK(): Timezone { - if (!isset(self::$AMERICAINUVIK)) { - self::$AMERICAINUVIK = new Timezone('america/inuvik'); - } + self::$AMERICAINUVIK ??= new Timezone('america/inuvik'); + return self::$AMERICAINUVIK; } public static function AMERICAIQALUIT(): Timezone { - if (!isset(self::$AMERICAIQALUIT)) { - self::$AMERICAIQALUIT = new Timezone('america/iqaluit'); - } + self::$AMERICAIQALUIT ??= new Timezone('america/iqaluit'); + return self::$AMERICAIQALUIT; } public static function AMERICAJAMAICA(): Timezone { - if (!isset(self::$AMERICAJAMAICA)) { - self::$AMERICAJAMAICA = new Timezone('america/jamaica'); - } + self::$AMERICAJAMAICA ??= new Timezone('america/jamaica'); + return self::$AMERICAJAMAICA; } public static function AMERICAJUNEAU(): Timezone { - if (!isset(self::$AMERICAJUNEAU)) { - self::$AMERICAJUNEAU = new Timezone('america/juneau'); - } + self::$AMERICAJUNEAU ??= new Timezone('america/juneau'); + return self::$AMERICAJUNEAU; } public static function AMERICAKENTUCKYLOUISVILLE(): Timezone { - if (!isset(self::$AMERICAKENTUCKYLOUISVILLE)) { - self::$AMERICAKENTUCKYLOUISVILLE = new Timezone('america/kentucky/louisville'); - } + self::$AMERICAKENTUCKYLOUISVILLE ??= new Timezone('america/kentucky/louisville'); + return self::$AMERICAKENTUCKYLOUISVILLE; } public static function AMERICAKENTUCKYMONTICELLO(): Timezone { - if (!isset(self::$AMERICAKENTUCKYMONTICELLO)) { - self::$AMERICAKENTUCKYMONTICELLO = new Timezone('america/kentucky/monticello'); - } + self::$AMERICAKENTUCKYMONTICELLO ??= new Timezone('america/kentucky/monticello'); + return self::$AMERICAKENTUCKYMONTICELLO; } public static function AMERICAKRALENDIJK(): Timezone { - if (!isset(self::$AMERICAKRALENDIJK)) { - self::$AMERICAKRALENDIJK = new Timezone('america/kralendijk'); - } + self::$AMERICAKRALENDIJK ??= new Timezone('america/kralendijk'); + return self::$AMERICAKRALENDIJK; } public static function AMERICALAPAZ(): Timezone { - if (!isset(self::$AMERICALAPAZ)) { - self::$AMERICALAPAZ = new Timezone('america/la_paz'); - } + self::$AMERICALAPAZ ??= new Timezone('america/la_paz'); + return self::$AMERICALAPAZ; } public static function AMERICALIMA(): Timezone { - if (!isset(self::$AMERICALIMA)) { - self::$AMERICALIMA = new Timezone('america/lima'); - } + self::$AMERICALIMA ??= new Timezone('america/lima'); + return self::$AMERICALIMA; } public static function AMERICALOSANGELES(): Timezone { - if (!isset(self::$AMERICALOSANGELES)) { - self::$AMERICALOSANGELES = new Timezone('america/los_angeles'); - } + self::$AMERICALOSANGELES ??= new Timezone('america/los_angeles'); + return self::$AMERICALOSANGELES; } public static function AMERICALOWERPRINCES(): Timezone { - if (!isset(self::$AMERICALOWERPRINCES)) { - self::$AMERICALOWERPRINCES = new Timezone('america/lower_princes'); - } + self::$AMERICALOWERPRINCES ??= new Timezone('america/lower_princes'); + return self::$AMERICALOWERPRINCES; } public static function AMERICAMACEIO(): Timezone { - if (!isset(self::$AMERICAMACEIO)) { - self::$AMERICAMACEIO = new Timezone('america/maceio'); - } + self::$AMERICAMACEIO ??= new Timezone('america/maceio'); + return self::$AMERICAMACEIO; } public static function AMERICAMANAGUA(): Timezone { - if (!isset(self::$AMERICAMANAGUA)) { - self::$AMERICAMANAGUA = new Timezone('america/managua'); - } + self::$AMERICAMANAGUA ??= new Timezone('america/managua'); + return self::$AMERICAMANAGUA; } public static function AMERICAMANAUS(): Timezone { - if (!isset(self::$AMERICAMANAUS)) { - self::$AMERICAMANAUS = new Timezone('america/manaus'); - } + self::$AMERICAMANAUS ??= new Timezone('america/manaus'); + return self::$AMERICAMANAUS; } public static function AMERICAMARIGOT(): Timezone { - if (!isset(self::$AMERICAMARIGOT)) { - self::$AMERICAMARIGOT = new Timezone('america/marigot'); - } + self::$AMERICAMARIGOT ??= new Timezone('america/marigot'); + return self::$AMERICAMARIGOT; } public static function AMERICAMARTINIQUE(): Timezone { - if (!isset(self::$AMERICAMARTINIQUE)) { - self::$AMERICAMARTINIQUE = new Timezone('america/martinique'); - } + self::$AMERICAMARTINIQUE ??= new Timezone('america/martinique'); + return self::$AMERICAMARTINIQUE; } public static function AMERICAMATAMOROS(): Timezone { - if (!isset(self::$AMERICAMATAMOROS)) { - self::$AMERICAMATAMOROS = new Timezone('america/matamoros'); - } + self::$AMERICAMATAMOROS ??= new Timezone('america/matamoros'); + return self::$AMERICAMATAMOROS; } public static function AMERICAMAZATLAN(): Timezone { - if (!isset(self::$AMERICAMAZATLAN)) { - self::$AMERICAMAZATLAN = new Timezone('america/mazatlan'); - } + self::$AMERICAMAZATLAN ??= new Timezone('america/mazatlan'); + return self::$AMERICAMAZATLAN; } public static function AMERICAMENOMINEE(): Timezone { - if (!isset(self::$AMERICAMENOMINEE)) { - self::$AMERICAMENOMINEE = new Timezone('america/menominee'); - } + self::$AMERICAMENOMINEE ??= new Timezone('america/menominee'); + return self::$AMERICAMENOMINEE; } public static function AMERICAMERIDA(): Timezone { - if (!isset(self::$AMERICAMERIDA)) { - self::$AMERICAMERIDA = new Timezone('america/merida'); - } + self::$AMERICAMERIDA ??= new Timezone('america/merida'); + return self::$AMERICAMERIDA; } public static function AMERICAMETLAKATLA(): Timezone { - if (!isset(self::$AMERICAMETLAKATLA)) { - self::$AMERICAMETLAKATLA = new Timezone('america/metlakatla'); - } + self::$AMERICAMETLAKATLA ??= new Timezone('america/metlakatla'); + return self::$AMERICAMETLAKATLA; } public static function AMERICAMEXICOCITY(): Timezone { - if (!isset(self::$AMERICAMEXICOCITY)) { - self::$AMERICAMEXICOCITY = new Timezone('america/mexico_city'); - } + self::$AMERICAMEXICOCITY ??= new Timezone('america/mexico_city'); + return self::$AMERICAMEXICOCITY; } public static function AMERICAMIQUELON(): Timezone { - if (!isset(self::$AMERICAMIQUELON)) { - self::$AMERICAMIQUELON = new Timezone('america/miquelon'); - } + self::$AMERICAMIQUELON ??= new Timezone('america/miquelon'); + return self::$AMERICAMIQUELON; } public static function AMERICAMONCTON(): Timezone { - if (!isset(self::$AMERICAMONCTON)) { - self::$AMERICAMONCTON = new Timezone('america/moncton'); - } + self::$AMERICAMONCTON ??= new Timezone('america/moncton'); + return self::$AMERICAMONCTON; } public static function AMERICAMONTERREY(): Timezone { - if (!isset(self::$AMERICAMONTERREY)) { - self::$AMERICAMONTERREY = new Timezone('america/monterrey'); - } + self::$AMERICAMONTERREY ??= new Timezone('america/monterrey'); + return self::$AMERICAMONTERREY; } public static function AMERICAMONTEVIDEO(): Timezone { - if (!isset(self::$AMERICAMONTEVIDEO)) { - self::$AMERICAMONTEVIDEO = new Timezone('america/montevideo'); - } + self::$AMERICAMONTEVIDEO ??= new Timezone('america/montevideo'); + return self::$AMERICAMONTEVIDEO; } public static function AMERICAMONTSERRAT(): Timezone { - if (!isset(self::$AMERICAMONTSERRAT)) { - self::$AMERICAMONTSERRAT = new Timezone('america/montserrat'); - } + self::$AMERICAMONTSERRAT ??= new Timezone('america/montserrat'); + return self::$AMERICAMONTSERRAT; } public static function AMERICANASSAU(): Timezone { - if (!isset(self::$AMERICANASSAU)) { - self::$AMERICANASSAU = new Timezone('america/nassau'); - } + self::$AMERICANASSAU ??= new Timezone('america/nassau'); + return self::$AMERICANASSAU; } public static function AMERICANEWYORK(): Timezone { - if (!isset(self::$AMERICANEWYORK)) { - self::$AMERICANEWYORK = new Timezone('america/new_york'); - } + self::$AMERICANEWYORK ??= new Timezone('america/new_york'); + return self::$AMERICANEWYORK; } public static function AMERICANOME(): Timezone { - if (!isset(self::$AMERICANOME)) { - self::$AMERICANOME = new Timezone('america/nome'); - } + self::$AMERICANOME ??= new Timezone('america/nome'); + return self::$AMERICANOME; } public static function AMERICANORONHA(): Timezone { - if (!isset(self::$AMERICANORONHA)) { - self::$AMERICANORONHA = new Timezone('america/noronha'); - } + self::$AMERICANORONHA ??= new Timezone('america/noronha'); + return self::$AMERICANORONHA; } public static function AMERICANORTHDAKOTABEULAH(): Timezone { - if (!isset(self::$AMERICANORTHDAKOTABEULAH)) { - self::$AMERICANORTHDAKOTABEULAH = new Timezone('america/north_dakota/beulah'); - } + self::$AMERICANORTHDAKOTABEULAH ??= new Timezone('america/north_dakota/beulah'); + return self::$AMERICANORTHDAKOTABEULAH; } public static function AMERICANORTHDAKOTACENTER(): Timezone { - if (!isset(self::$AMERICANORTHDAKOTACENTER)) { - self::$AMERICANORTHDAKOTACENTER = new Timezone('america/north_dakota/center'); - } + self::$AMERICANORTHDAKOTACENTER ??= new Timezone('america/north_dakota/center'); + return self::$AMERICANORTHDAKOTACENTER; } public static function AMERICANORTHDAKOTANEWSALEM(): Timezone { - if (!isset(self::$AMERICANORTHDAKOTANEWSALEM)) { - self::$AMERICANORTHDAKOTANEWSALEM = new Timezone('america/north_dakota/new_salem'); - } + self::$AMERICANORTHDAKOTANEWSALEM ??= new Timezone('america/north_dakota/new_salem'); + return self::$AMERICANORTHDAKOTANEWSALEM; } public static function AMERICANUUK(): Timezone { - if (!isset(self::$AMERICANUUK)) { - self::$AMERICANUUK = new Timezone('america/nuuk'); - } + self::$AMERICANUUK ??= new Timezone('america/nuuk'); + return self::$AMERICANUUK; } public static function AMERICAOJINAGA(): Timezone { - if (!isset(self::$AMERICAOJINAGA)) { - self::$AMERICAOJINAGA = new Timezone('america/ojinaga'); - } + self::$AMERICAOJINAGA ??= new Timezone('america/ojinaga'); + return self::$AMERICAOJINAGA; } public static function AMERICAPANAMA(): Timezone { - if (!isset(self::$AMERICAPANAMA)) { - self::$AMERICAPANAMA = new Timezone('america/panama'); - } + self::$AMERICAPANAMA ??= new Timezone('america/panama'); + return self::$AMERICAPANAMA; } public static function AMERICAPARAMARIBO(): Timezone { - if (!isset(self::$AMERICAPARAMARIBO)) { - self::$AMERICAPARAMARIBO = new Timezone('america/paramaribo'); - } + self::$AMERICAPARAMARIBO ??= new Timezone('america/paramaribo'); + return self::$AMERICAPARAMARIBO; } public static function AMERICAPHOENIX(): Timezone { - if (!isset(self::$AMERICAPHOENIX)) { - self::$AMERICAPHOENIX = new Timezone('america/phoenix'); - } + self::$AMERICAPHOENIX ??= new Timezone('america/phoenix'); + return self::$AMERICAPHOENIX; } public static function AMERICAPORTAUPRINCE(): Timezone { - if (!isset(self::$AMERICAPORTAUPRINCE)) { - self::$AMERICAPORTAUPRINCE = new Timezone('america/port-au-prince'); - } + self::$AMERICAPORTAUPRINCE ??= new Timezone('america/port-au-prince'); + return self::$AMERICAPORTAUPRINCE; } public static function AMERICAPORTOFSPAIN(): Timezone { - if (!isset(self::$AMERICAPORTOFSPAIN)) { - self::$AMERICAPORTOFSPAIN = new Timezone('america/port_of_spain'); - } + self::$AMERICAPORTOFSPAIN ??= new Timezone('america/port_of_spain'); + return self::$AMERICAPORTOFSPAIN; } public static function AMERICAPORTOVELHO(): Timezone { - if (!isset(self::$AMERICAPORTOVELHO)) { - self::$AMERICAPORTOVELHO = new Timezone('america/porto_velho'); - } + self::$AMERICAPORTOVELHO ??= new Timezone('america/porto_velho'); + return self::$AMERICAPORTOVELHO; } public static function AMERICAPUERTORICO(): Timezone { - if (!isset(self::$AMERICAPUERTORICO)) { - self::$AMERICAPUERTORICO = new Timezone('america/puerto_rico'); - } + self::$AMERICAPUERTORICO ??= new Timezone('america/puerto_rico'); + return self::$AMERICAPUERTORICO; } public static function AMERICAPUNTAARENAS(): Timezone { - if (!isset(self::$AMERICAPUNTAARENAS)) { - self::$AMERICAPUNTAARENAS = new Timezone('america/punta_arenas'); - } + self::$AMERICAPUNTAARENAS ??= new Timezone('america/punta_arenas'); + return self::$AMERICAPUNTAARENAS; } public static function AMERICARANKININLET(): Timezone { - if (!isset(self::$AMERICARANKININLET)) { - self::$AMERICARANKININLET = new Timezone('america/rankin_inlet'); - } + self::$AMERICARANKININLET ??= new Timezone('america/rankin_inlet'); + return self::$AMERICARANKININLET; } public static function AMERICARECIFE(): Timezone { - if (!isset(self::$AMERICARECIFE)) { - self::$AMERICARECIFE = new Timezone('america/recife'); - } + self::$AMERICARECIFE ??= new Timezone('america/recife'); + return self::$AMERICARECIFE; } public static function AMERICAREGINA(): Timezone { - if (!isset(self::$AMERICAREGINA)) { - self::$AMERICAREGINA = new Timezone('america/regina'); - } + self::$AMERICAREGINA ??= new Timezone('america/regina'); + return self::$AMERICAREGINA; } public static function AMERICARESOLUTE(): Timezone { - if (!isset(self::$AMERICARESOLUTE)) { - self::$AMERICARESOLUTE = new Timezone('america/resolute'); - } + self::$AMERICARESOLUTE ??= new Timezone('america/resolute'); + return self::$AMERICARESOLUTE; } public static function AMERICARIOBRANCO(): Timezone { - if (!isset(self::$AMERICARIOBRANCO)) { - self::$AMERICARIOBRANCO = new Timezone('america/rio_branco'); - } + self::$AMERICARIOBRANCO ??= new Timezone('america/rio_branco'); + return self::$AMERICARIOBRANCO; } public static function AMERICASANTAREM(): Timezone { - if (!isset(self::$AMERICASANTAREM)) { - self::$AMERICASANTAREM = new Timezone('america/santarem'); - } + self::$AMERICASANTAREM ??= new Timezone('america/santarem'); + return self::$AMERICASANTAREM; } public static function AMERICASANTIAGO(): Timezone { - if (!isset(self::$AMERICASANTIAGO)) { - self::$AMERICASANTIAGO = new Timezone('america/santiago'); - } + self::$AMERICASANTIAGO ??= new Timezone('america/santiago'); + return self::$AMERICASANTIAGO; } public static function AMERICASANTODOMINGO(): Timezone { - if (!isset(self::$AMERICASANTODOMINGO)) { - self::$AMERICASANTODOMINGO = new Timezone('america/santo_domingo'); - } + self::$AMERICASANTODOMINGO ??= new Timezone('america/santo_domingo'); + return self::$AMERICASANTODOMINGO; } public static function AMERICASAOPAULO(): Timezone { - if (!isset(self::$AMERICASAOPAULO)) { - self::$AMERICASAOPAULO = new Timezone('america/sao_paulo'); - } + self::$AMERICASAOPAULO ??= new Timezone('america/sao_paulo'); + return self::$AMERICASAOPAULO; } public static function AMERICASCORESBYSUND(): Timezone { - if (!isset(self::$AMERICASCORESBYSUND)) { - self::$AMERICASCORESBYSUND = new Timezone('america/scoresbysund'); - } + self::$AMERICASCORESBYSUND ??= new Timezone('america/scoresbysund'); + return self::$AMERICASCORESBYSUND; } public static function AMERICASITKA(): Timezone { - if (!isset(self::$AMERICASITKA)) { - self::$AMERICASITKA = new Timezone('america/sitka'); - } + self::$AMERICASITKA ??= new Timezone('america/sitka'); + return self::$AMERICASITKA; } public static function AMERICASTBARTHELEMY(): Timezone { - if (!isset(self::$AMERICASTBARTHELEMY)) { - self::$AMERICASTBARTHELEMY = new Timezone('america/st_barthelemy'); - } + self::$AMERICASTBARTHELEMY ??= new Timezone('america/st_barthelemy'); + return self::$AMERICASTBARTHELEMY; } public static function AMERICASTJOHNS(): Timezone { - if (!isset(self::$AMERICASTJOHNS)) { - self::$AMERICASTJOHNS = new Timezone('america/st_johns'); - } + self::$AMERICASTJOHNS ??= new Timezone('america/st_johns'); + return self::$AMERICASTJOHNS; } public static function AMERICASTKITTS(): Timezone { - if (!isset(self::$AMERICASTKITTS)) { - self::$AMERICASTKITTS = new Timezone('america/st_kitts'); - } + self::$AMERICASTKITTS ??= new Timezone('america/st_kitts'); + return self::$AMERICASTKITTS; } public static function AMERICASTLUCIA(): Timezone { - if (!isset(self::$AMERICASTLUCIA)) { - self::$AMERICASTLUCIA = new Timezone('america/st_lucia'); - } + self::$AMERICASTLUCIA ??= new Timezone('america/st_lucia'); + return self::$AMERICASTLUCIA; } public static function AMERICASTTHOMAS(): Timezone { - if (!isset(self::$AMERICASTTHOMAS)) { - self::$AMERICASTTHOMAS = new Timezone('america/st_thomas'); - } + self::$AMERICASTTHOMAS ??= new Timezone('america/st_thomas'); + return self::$AMERICASTTHOMAS; } public static function AMERICASTVINCENT(): Timezone { - if (!isset(self::$AMERICASTVINCENT)) { - self::$AMERICASTVINCENT = new Timezone('america/st_vincent'); - } + self::$AMERICASTVINCENT ??= new Timezone('america/st_vincent'); + return self::$AMERICASTVINCENT; } public static function AMERICASWIFTCURRENT(): Timezone { - if (!isset(self::$AMERICASWIFTCURRENT)) { - self::$AMERICASWIFTCURRENT = new Timezone('america/swift_current'); - } + self::$AMERICASWIFTCURRENT ??= new Timezone('america/swift_current'); + return self::$AMERICASWIFTCURRENT; } public static function AMERICATEGUCIGALPA(): Timezone { - if (!isset(self::$AMERICATEGUCIGALPA)) { - self::$AMERICATEGUCIGALPA = new Timezone('america/tegucigalpa'); - } + self::$AMERICATEGUCIGALPA ??= new Timezone('america/tegucigalpa'); + return self::$AMERICATEGUCIGALPA; } public static function AMERICATHULE(): Timezone { - if (!isset(self::$AMERICATHULE)) { - self::$AMERICATHULE = new Timezone('america/thule'); - } + self::$AMERICATHULE ??= new Timezone('america/thule'); + return self::$AMERICATHULE; } public static function AMERICATIJUANA(): Timezone { - if (!isset(self::$AMERICATIJUANA)) { - self::$AMERICATIJUANA = new Timezone('america/tijuana'); - } + self::$AMERICATIJUANA ??= new Timezone('america/tijuana'); + return self::$AMERICATIJUANA; } public static function AMERICATORONTO(): Timezone { - if (!isset(self::$AMERICATORONTO)) { - self::$AMERICATORONTO = new Timezone('america/toronto'); - } + self::$AMERICATORONTO ??= new Timezone('america/toronto'); + return self::$AMERICATORONTO; } public static function AMERICATORTOLA(): Timezone { - if (!isset(self::$AMERICATORTOLA)) { - self::$AMERICATORTOLA = new Timezone('america/tortola'); - } + self::$AMERICATORTOLA ??= new Timezone('america/tortola'); + return self::$AMERICATORTOLA; } public static function AMERICAVANCOUVER(): Timezone { - if (!isset(self::$AMERICAVANCOUVER)) { - self::$AMERICAVANCOUVER = new Timezone('america/vancouver'); - } + self::$AMERICAVANCOUVER ??= new Timezone('america/vancouver'); + return self::$AMERICAVANCOUVER; } public static function AMERICAWHITEHORSE(): Timezone { - if (!isset(self::$AMERICAWHITEHORSE)) { - self::$AMERICAWHITEHORSE = new Timezone('america/whitehorse'); - } + self::$AMERICAWHITEHORSE ??= new Timezone('america/whitehorse'); + return self::$AMERICAWHITEHORSE; } public static function AMERICAWINNIPEG(): Timezone { - if (!isset(self::$AMERICAWINNIPEG)) { - self::$AMERICAWINNIPEG = new Timezone('america/winnipeg'); - } + self::$AMERICAWINNIPEG ??= new Timezone('america/winnipeg'); + return self::$AMERICAWINNIPEG; } public static function AMERICAYAKUTAT(): Timezone { - if (!isset(self::$AMERICAYAKUTAT)) { - self::$AMERICAYAKUTAT = new Timezone('america/yakutat'); - } + self::$AMERICAYAKUTAT ??= new Timezone('america/yakutat'); + return self::$AMERICAYAKUTAT; } public static function ANTARCTICACASEY(): Timezone { - if (!isset(self::$ANTARCTICACASEY)) { - self::$ANTARCTICACASEY = new Timezone('antarctica/casey'); - } + self::$ANTARCTICACASEY ??= new Timezone('antarctica/casey'); + return self::$ANTARCTICACASEY; } public static function ANTARCTICADAVIS(): Timezone { - if (!isset(self::$ANTARCTICADAVIS)) { - self::$ANTARCTICADAVIS = new Timezone('antarctica/davis'); - } + self::$ANTARCTICADAVIS ??= new Timezone('antarctica/davis'); + return self::$ANTARCTICADAVIS; } public static function ANTARCTICADUMONTDURVILLE(): Timezone { - if (!isset(self::$ANTARCTICADUMONTDURVILLE)) { - self::$ANTARCTICADUMONTDURVILLE = new Timezone('antarctica/dumontdurville'); - } + self::$ANTARCTICADUMONTDURVILLE ??= new Timezone('antarctica/dumontdurville'); + return self::$ANTARCTICADUMONTDURVILLE; } public static function ANTARCTICAMACQUARIE(): Timezone { - if (!isset(self::$ANTARCTICAMACQUARIE)) { - self::$ANTARCTICAMACQUARIE = new Timezone('antarctica/macquarie'); - } + self::$ANTARCTICAMACQUARIE ??= new Timezone('antarctica/macquarie'); + return self::$ANTARCTICAMACQUARIE; } public static function ANTARCTICAMAWSON(): Timezone { - if (!isset(self::$ANTARCTICAMAWSON)) { - self::$ANTARCTICAMAWSON = new Timezone('antarctica/mawson'); - } + self::$ANTARCTICAMAWSON ??= new Timezone('antarctica/mawson'); + return self::$ANTARCTICAMAWSON; } public static function ANTARCTICAMCMURDO(): Timezone { - if (!isset(self::$ANTARCTICAMCMURDO)) { - self::$ANTARCTICAMCMURDO = new Timezone('antarctica/mcmurdo'); - } + self::$ANTARCTICAMCMURDO ??= new Timezone('antarctica/mcmurdo'); + return self::$ANTARCTICAMCMURDO; } public static function ANTARCTICAPALMER(): Timezone { - if (!isset(self::$ANTARCTICAPALMER)) { - self::$ANTARCTICAPALMER = new Timezone('antarctica/palmer'); - } + self::$ANTARCTICAPALMER ??= new Timezone('antarctica/palmer'); + return self::$ANTARCTICAPALMER; } public static function ANTARCTICAROTHERA(): Timezone { - if (!isset(self::$ANTARCTICAROTHERA)) { - self::$ANTARCTICAROTHERA = new Timezone('antarctica/rothera'); - } + self::$ANTARCTICAROTHERA ??= new Timezone('antarctica/rothera'); + return self::$ANTARCTICAROTHERA; } public static function ANTARCTICASYOWA(): Timezone { - if (!isset(self::$ANTARCTICASYOWA)) { - self::$ANTARCTICASYOWA = new Timezone('antarctica/syowa'); - } + self::$ANTARCTICASYOWA ??= new Timezone('antarctica/syowa'); + return self::$ANTARCTICASYOWA; } public static function ANTARCTICATROLL(): Timezone { - if (!isset(self::$ANTARCTICATROLL)) { - self::$ANTARCTICATROLL = new Timezone('antarctica/troll'); - } + self::$ANTARCTICATROLL ??= new Timezone('antarctica/troll'); + return self::$ANTARCTICATROLL; } public static function ANTARCTICAVOSTOK(): Timezone { - if (!isset(self::$ANTARCTICAVOSTOK)) { - self::$ANTARCTICAVOSTOK = new Timezone('antarctica/vostok'); - } + self::$ANTARCTICAVOSTOK ??= new Timezone('antarctica/vostok'); + return self::$ANTARCTICAVOSTOK; } public static function ARCTICLONGYEARBYEN(): Timezone { - if (!isset(self::$ARCTICLONGYEARBYEN)) { - self::$ARCTICLONGYEARBYEN = new Timezone('arctic/longyearbyen'); - } + self::$ARCTICLONGYEARBYEN ??= new Timezone('arctic/longyearbyen'); + return self::$ARCTICLONGYEARBYEN; } public static function ASIAADEN(): Timezone { - if (!isset(self::$ASIAADEN)) { - self::$ASIAADEN = new Timezone('asia/aden'); - } + self::$ASIAADEN ??= new Timezone('asia/aden'); + return self::$ASIAADEN; } public static function ASIAALMATY(): Timezone { - if (!isset(self::$ASIAALMATY)) { - self::$ASIAALMATY = new Timezone('asia/almaty'); - } + self::$ASIAALMATY ??= new Timezone('asia/almaty'); + return self::$ASIAALMATY; } public static function ASIAAMMAN(): Timezone { - if (!isset(self::$ASIAAMMAN)) { - self::$ASIAAMMAN = new Timezone('asia/amman'); - } + self::$ASIAAMMAN ??= new Timezone('asia/amman'); + return self::$ASIAAMMAN; } public static function ASIAANADYR(): Timezone { - if (!isset(self::$ASIAANADYR)) { - self::$ASIAANADYR = new Timezone('asia/anadyr'); - } + self::$ASIAANADYR ??= new Timezone('asia/anadyr'); + return self::$ASIAANADYR; } public static function ASIAAQTAU(): Timezone { - if (!isset(self::$ASIAAQTAU)) { - self::$ASIAAQTAU = new Timezone('asia/aqtau'); - } + self::$ASIAAQTAU ??= new Timezone('asia/aqtau'); + return self::$ASIAAQTAU; } public static function ASIAAQTOBE(): Timezone { - if (!isset(self::$ASIAAQTOBE)) { - self::$ASIAAQTOBE = new Timezone('asia/aqtobe'); - } + self::$ASIAAQTOBE ??= new Timezone('asia/aqtobe'); + return self::$ASIAAQTOBE; } public static function ASIAASHGABAT(): Timezone { - if (!isset(self::$ASIAASHGABAT)) { - self::$ASIAASHGABAT = new Timezone('asia/ashgabat'); - } + self::$ASIAASHGABAT ??= new Timezone('asia/ashgabat'); + return self::$ASIAASHGABAT; } public static function ASIAATYRAU(): Timezone { - if (!isset(self::$ASIAATYRAU)) { - self::$ASIAATYRAU = new Timezone('asia/atyrau'); - } + self::$ASIAATYRAU ??= new Timezone('asia/atyrau'); + return self::$ASIAATYRAU; } public static function ASIABAGHDAD(): Timezone { - if (!isset(self::$ASIABAGHDAD)) { - self::$ASIABAGHDAD = new Timezone('asia/baghdad'); - } + self::$ASIABAGHDAD ??= new Timezone('asia/baghdad'); + return self::$ASIABAGHDAD; } public static function ASIABAHRAIN(): Timezone { - if (!isset(self::$ASIABAHRAIN)) { - self::$ASIABAHRAIN = new Timezone('asia/bahrain'); - } + self::$ASIABAHRAIN ??= new Timezone('asia/bahrain'); + return self::$ASIABAHRAIN; } public static function ASIABAKU(): Timezone { - if (!isset(self::$ASIABAKU)) { - self::$ASIABAKU = new Timezone('asia/baku'); - } + self::$ASIABAKU ??= new Timezone('asia/baku'); + return self::$ASIABAKU; } public static function ASIABANGKOK(): Timezone { - if (!isset(self::$ASIABANGKOK)) { - self::$ASIABANGKOK = new Timezone('asia/bangkok'); - } + self::$ASIABANGKOK ??= new Timezone('asia/bangkok'); + return self::$ASIABANGKOK; } public static function ASIABARNAUL(): Timezone { - if (!isset(self::$ASIABARNAUL)) { - self::$ASIABARNAUL = new Timezone('asia/barnaul'); - } + self::$ASIABARNAUL ??= new Timezone('asia/barnaul'); + return self::$ASIABARNAUL; } public static function ASIABEIRUT(): Timezone { - if (!isset(self::$ASIABEIRUT)) { - self::$ASIABEIRUT = new Timezone('asia/beirut'); - } + self::$ASIABEIRUT ??= new Timezone('asia/beirut'); + return self::$ASIABEIRUT; } public static function ASIABISHKEK(): Timezone { - if (!isset(self::$ASIABISHKEK)) { - self::$ASIABISHKEK = new Timezone('asia/bishkek'); - } + self::$ASIABISHKEK ??= new Timezone('asia/bishkek'); + return self::$ASIABISHKEK; } public static function ASIABRUNEI(): Timezone { - if (!isset(self::$ASIABRUNEI)) { - self::$ASIABRUNEI = new Timezone('asia/brunei'); - } + self::$ASIABRUNEI ??= new Timezone('asia/brunei'); + return self::$ASIABRUNEI; } public static function ASIACHITA(): Timezone { - if (!isset(self::$ASIACHITA)) { - self::$ASIACHITA = new Timezone('asia/chita'); - } + self::$ASIACHITA ??= new Timezone('asia/chita'); + return self::$ASIACHITA; } public static function ASIACOLOMBO(): Timezone { - if (!isset(self::$ASIACOLOMBO)) { - self::$ASIACOLOMBO = new Timezone('asia/colombo'); - } + self::$ASIACOLOMBO ??= new Timezone('asia/colombo'); + return self::$ASIACOLOMBO; } public static function ASIADAMASCUS(): Timezone { - if (!isset(self::$ASIADAMASCUS)) { - self::$ASIADAMASCUS = new Timezone('asia/damascus'); - } + self::$ASIADAMASCUS ??= new Timezone('asia/damascus'); + return self::$ASIADAMASCUS; } public static function ASIADHAKA(): Timezone { - if (!isset(self::$ASIADHAKA)) { - self::$ASIADHAKA = new Timezone('asia/dhaka'); - } + self::$ASIADHAKA ??= new Timezone('asia/dhaka'); + return self::$ASIADHAKA; } public static function ASIADILI(): Timezone { - if (!isset(self::$ASIADILI)) { - self::$ASIADILI = new Timezone('asia/dili'); - } + self::$ASIADILI ??= new Timezone('asia/dili'); + return self::$ASIADILI; } public static function ASIADUBAI(): Timezone { - if (!isset(self::$ASIADUBAI)) { - self::$ASIADUBAI = new Timezone('asia/dubai'); - } + self::$ASIADUBAI ??= new Timezone('asia/dubai'); + return self::$ASIADUBAI; } public static function ASIADUSHANBE(): Timezone { - if (!isset(self::$ASIADUSHANBE)) { - self::$ASIADUSHANBE = new Timezone('asia/dushanbe'); - } + self::$ASIADUSHANBE ??= new Timezone('asia/dushanbe'); + return self::$ASIADUSHANBE; } public static function ASIAFAMAGUSTA(): Timezone { - if (!isset(self::$ASIAFAMAGUSTA)) { - self::$ASIAFAMAGUSTA = new Timezone('asia/famagusta'); - } + self::$ASIAFAMAGUSTA ??= new Timezone('asia/famagusta'); + return self::$ASIAFAMAGUSTA; } public static function ASIAGAZA(): Timezone { - if (!isset(self::$ASIAGAZA)) { - self::$ASIAGAZA = new Timezone('asia/gaza'); - } + self::$ASIAGAZA ??= new Timezone('asia/gaza'); + return self::$ASIAGAZA; } public static function ASIAHEBRON(): Timezone { - if (!isset(self::$ASIAHEBRON)) { - self::$ASIAHEBRON = new Timezone('asia/hebron'); - } + self::$ASIAHEBRON ??= new Timezone('asia/hebron'); + return self::$ASIAHEBRON; } public static function ASIAHOCHIMINH(): Timezone { - if (!isset(self::$ASIAHOCHIMINH)) { - self::$ASIAHOCHIMINH = new Timezone('asia/ho_chi_minh'); - } + self::$ASIAHOCHIMINH ??= new Timezone('asia/ho_chi_minh'); + return self::$ASIAHOCHIMINH; } public static function ASIAHONGKONG(): Timezone { - if (!isset(self::$ASIAHONGKONG)) { - self::$ASIAHONGKONG = new Timezone('asia/hong_kong'); - } + self::$ASIAHONGKONG ??= new Timezone('asia/hong_kong'); + return self::$ASIAHONGKONG; } public static function ASIAHOVD(): Timezone { - if (!isset(self::$ASIAHOVD)) { - self::$ASIAHOVD = new Timezone('asia/hovd'); - } + self::$ASIAHOVD ??= new Timezone('asia/hovd'); + return self::$ASIAHOVD; } public static function ASIAIRKUTSK(): Timezone { - if (!isset(self::$ASIAIRKUTSK)) { - self::$ASIAIRKUTSK = new Timezone('asia/irkutsk'); - } + self::$ASIAIRKUTSK ??= new Timezone('asia/irkutsk'); + return self::$ASIAIRKUTSK; } public static function ASIAJAKARTA(): Timezone { - if (!isset(self::$ASIAJAKARTA)) { - self::$ASIAJAKARTA = new Timezone('asia/jakarta'); - } + self::$ASIAJAKARTA ??= new Timezone('asia/jakarta'); + return self::$ASIAJAKARTA; } public static function ASIAJAYAPURA(): Timezone { - if (!isset(self::$ASIAJAYAPURA)) { - self::$ASIAJAYAPURA = new Timezone('asia/jayapura'); - } + self::$ASIAJAYAPURA ??= new Timezone('asia/jayapura'); + return self::$ASIAJAYAPURA; } public static function ASIAJERUSALEM(): Timezone { - if (!isset(self::$ASIAJERUSALEM)) { - self::$ASIAJERUSALEM = new Timezone('asia/jerusalem'); - } + self::$ASIAJERUSALEM ??= new Timezone('asia/jerusalem'); + return self::$ASIAJERUSALEM; } public static function ASIAKABUL(): Timezone { - if (!isset(self::$ASIAKABUL)) { - self::$ASIAKABUL = new Timezone('asia/kabul'); - } + self::$ASIAKABUL ??= new Timezone('asia/kabul'); + return self::$ASIAKABUL; } public static function ASIAKAMCHATKA(): Timezone { - if (!isset(self::$ASIAKAMCHATKA)) { - self::$ASIAKAMCHATKA = new Timezone('asia/kamchatka'); - } + self::$ASIAKAMCHATKA ??= new Timezone('asia/kamchatka'); + return self::$ASIAKAMCHATKA; } public static function ASIAKARACHI(): Timezone { - if (!isset(self::$ASIAKARACHI)) { - self::$ASIAKARACHI = new Timezone('asia/karachi'); - } + self::$ASIAKARACHI ??= new Timezone('asia/karachi'); + return self::$ASIAKARACHI; } public static function ASIAKATHMANDU(): Timezone { - if (!isset(self::$ASIAKATHMANDU)) { - self::$ASIAKATHMANDU = new Timezone('asia/kathmandu'); - } + self::$ASIAKATHMANDU ??= new Timezone('asia/kathmandu'); + return self::$ASIAKATHMANDU; } public static function ASIAKHANDYGA(): Timezone { - if (!isset(self::$ASIAKHANDYGA)) { - self::$ASIAKHANDYGA = new Timezone('asia/khandyga'); - } + self::$ASIAKHANDYGA ??= new Timezone('asia/khandyga'); + return self::$ASIAKHANDYGA; } public static function ASIAKOLKATA(): Timezone { - if (!isset(self::$ASIAKOLKATA)) { - self::$ASIAKOLKATA = new Timezone('asia/kolkata'); - } + self::$ASIAKOLKATA ??= new Timezone('asia/kolkata'); + return self::$ASIAKOLKATA; } public static function ASIAKRASNOYARSK(): Timezone { - if (!isset(self::$ASIAKRASNOYARSK)) { - self::$ASIAKRASNOYARSK = new Timezone('asia/krasnoyarsk'); - } + self::$ASIAKRASNOYARSK ??= new Timezone('asia/krasnoyarsk'); + return self::$ASIAKRASNOYARSK; } public static function ASIAKUALALUMPUR(): Timezone { - if (!isset(self::$ASIAKUALALUMPUR)) { - self::$ASIAKUALALUMPUR = new Timezone('asia/kuala_lumpur'); - } + self::$ASIAKUALALUMPUR ??= new Timezone('asia/kuala_lumpur'); + return self::$ASIAKUALALUMPUR; } public static function ASIAKUCHING(): Timezone { - if (!isset(self::$ASIAKUCHING)) { - self::$ASIAKUCHING = new Timezone('asia/kuching'); - } + self::$ASIAKUCHING ??= new Timezone('asia/kuching'); + return self::$ASIAKUCHING; } public static function ASIAKUWAIT(): Timezone { - if (!isset(self::$ASIAKUWAIT)) { - self::$ASIAKUWAIT = new Timezone('asia/kuwait'); - } + self::$ASIAKUWAIT ??= new Timezone('asia/kuwait'); + return self::$ASIAKUWAIT; } public static function ASIAMACAU(): Timezone { - if (!isset(self::$ASIAMACAU)) { - self::$ASIAMACAU = new Timezone('asia/macau'); - } + self::$ASIAMACAU ??= new Timezone('asia/macau'); + return self::$ASIAMACAU; } public static function ASIAMAGADAN(): Timezone { - if (!isset(self::$ASIAMAGADAN)) { - self::$ASIAMAGADAN = new Timezone('asia/magadan'); - } + self::$ASIAMAGADAN ??= new Timezone('asia/magadan'); + return self::$ASIAMAGADAN; } public static function ASIAMAKASSAR(): Timezone { - if (!isset(self::$ASIAMAKASSAR)) { - self::$ASIAMAKASSAR = new Timezone('asia/makassar'); - } + self::$ASIAMAKASSAR ??= new Timezone('asia/makassar'); + return self::$ASIAMAKASSAR; } public static function ASIAMANILA(): Timezone { - if (!isset(self::$ASIAMANILA)) { - self::$ASIAMANILA = new Timezone('asia/manila'); - } + self::$ASIAMANILA ??= new Timezone('asia/manila'); + return self::$ASIAMANILA; } public static function ASIAMUSCAT(): Timezone { - if (!isset(self::$ASIAMUSCAT)) { - self::$ASIAMUSCAT = new Timezone('asia/muscat'); - } + self::$ASIAMUSCAT ??= new Timezone('asia/muscat'); + return self::$ASIAMUSCAT; } public static function ASIANICOSIA(): Timezone { - if (!isset(self::$ASIANICOSIA)) { - self::$ASIANICOSIA = new Timezone('asia/nicosia'); - } + self::$ASIANICOSIA ??= new Timezone('asia/nicosia'); + return self::$ASIANICOSIA; } public static function ASIANOVOKUZNETSK(): Timezone { - if (!isset(self::$ASIANOVOKUZNETSK)) { - self::$ASIANOVOKUZNETSK = new Timezone('asia/novokuznetsk'); - } + self::$ASIANOVOKUZNETSK ??= new Timezone('asia/novokuznetsk'); + return self::$ASIANOVOKUZNETSK; } public static function ASIANOVOSIBIRSK(): Timezone { - if (!isset(self::$ASIANOVOSIBIRSK)) { - self::$ASIANOVOSIBIRSK = new Timezone('asia/novosibirsk'); - } + self::$ASIANOVOSIBIRSK ??= new Timezone('asia/novosibirsk'); + return self::$ASIANOVOSIBIRSK; } public static function ASIAOMSK(): Timezone { - if (!isset(self::$ASIAOMSK)) { - self::$ASIAOMSK = new Timezone('asia/omsk'); - } + self::$ASIAOMSK ??= new Timezone('asia/omsk'); + return self::$ASIAOMSK; } public static function ASIAORAL(): Timezone { - if (!isset(self::$ASIAORAL)) { - self::$ASIAORAL = new Timezone('asia/oral'); - } + self::$ASIAORAL ??= new Timezone('asia/oral'); + return self::$ASIAORAL; } public static function ASIAPHNOMPENH(): Timezone { - if (!isset(self::$ASIAPHNOMPENH)) { - self::$ASIAPHNOMPENH = new Timezone('asia/phnom_penh'); - } + self::$ASIAPHNOMPENH ??= new Timezone('asia/phnom_penh'); + return self::$ASIAPHNOMPENH; } public static function ASIAPONTIANAK(): Timezone { - if (!isset(self::$ASIAPONTIANAK)) { - self::$ASIAPONTIANAK = new Timezone('asia/pontianak'); - } + self::$ASIAPONTIANAK ??= new Timezone('asia/pontianak'); + return self::$ASIAPONTIANAK; } public static function ASIAPYONGYANG(): Timezone { - if (!isset(self::$ASIAPYONGYANG)) { - self::$ASIAPYONGYANG = new Timezone('asia/pyongyang'); - } + self::$ASIAPYONGYANG ??= new Timezone('asia/pyongyang'); + return self::$ASIAPYONGYANG; } public static function ASIAQATAR(): Timezone { - if (!isset(self::$ASIAQATAR)) { - self::$ASIAQATAR = new Timezone('asia/qatar'); - } + self::$ASIAQATAR ??= new Timezone('asia/qatar'); + return self::$ASIAQATAR; } public static function ASIAQOSTANAY(): Timezone { - if (!isset(self::$ASIAQOSTANAY)) { - self::$ASIAQOSTANAY = new Timezone('asia/qostanay'); - } + self::$ASIAQOSTANAY ??= new Timezone('asia/qostanay'); + return self::$ASIAQOSTANAY; } public static function ASIAQYZYLORDA(): Timezone { - if (!isset(self::$ASIAQYZYLORDA)) { - self::$ASIAQYZYLORDA = new Timezone('asia/qyzylorda'); - } + self::$ASIAQYZYLORDA ??= new Timezone('asia/qyzylorda'); + return self::$ASIAQYZYLORDA; } public static function ASIARIYADH(): Timezone { - if (!isset(self::$ASIARIYADH)) { - self::$ASIARIYADH = new Timezone('asia/riyadh'); - } + self::$ASIARIYADH ??= new Timezone('asia/riyadh'); + return self::$ASIARIYADH; } public static function ASIASAKHALIN(): Timezone { - if (!isset(self::$ASIASAKHALIN)) { - self::$ASIASAKHALIN = new Timezone('asia/sakhalin'); - } + self::$ASIASAKHALIN ??= new Timezone('asia/sakhalin'); + return self::$ASIASAKHALIN; } public static function ASIASAMARKAND(): Timezone { - if (!isset(self::$ASIASAMARKAND)) { - self::$ASIASAMARKAND = new Timezone('asia/samarkand'); - } + self::$ASIASAMARKAND ??= new Timezone('asia/samarkand'); + return self::$ASIASAMARKAND; } public static function ASIASEOUL(): Timezone { - if (!isset(self::$ASIASEOUL)) { - self::$ASIASEOUL = new Timezone('asia/seoul'); - } + self::$ASIASEOUL ??= new Timezone('asia/seoul'); + return self::$ASIASEOUL; } public static function ASIASHANGHAI(): Timezone { - if (!isset(self::$ASIASHANGHAI)) { - self::$ASIASHANGHAI = new Timezone('asia/shanghai'); - } + self::$ASIASHANGHAI ??= new Timezone('asia/shanghai'); + return self::$ASIASHANGHAI; } public static function ASIASINGAPORE(): Timezone { - if (!isset(self::$ASIASINGAPORE)) { - self::$ASIASINGAPORE = new Timezone('asia/singapore'); - } + self::$ASIASINGAPORE ??= new Timezone('asia/singapore'); + return self::$ASIASINGAPORE; } public static function ASIASREDNEKOLYMSK(): Timezone { - if (!isset(self::$ASIASREDNEKOLYMSK)) { - self::$ASIASREDNEKOLYMSK = new Timezone('asia/srednekolymsk'); - } + self::$ASIASREDNEKOLYMSK ??= new Timezone('asia/srednekolymsk'); + return self::$ASIASREDNEKOLYMSK; } public static function ASIATAIPEI(): Timezone { - if (!isset(self::$ASIATAIPEI)) { - self::$ASIATAIPEI = new Timezone('asia/taipei'); - } + self::$ASIATAIPEI ??= new Timezone('asia/taipei'); + return self::$ASIATAIPEI; } public static function ASIATASHKENT(): Timezone { - if (!isset(self::$ASIATASHKENT)) { - self::$ASIATASHKENT = new Timezone('asia/tashkent'); - } + self::$ASIATASHKENT ??= new Timezone('asia/tashkent'); + return self::$ASIATASHKENT; } public static function ASIATBILISI(): Timezone { - if (!isset(self::$ASIATBILISI)) { - self::$ASIATBILISI = new Timezone('asia/tbilisi'); - } + self::$ASIATBILISI ??= new Timezone('asia/tbilisi'); + return self::$ASIATBILISI; } public static function ASIATEHRAN(): Timezone { - if (!isset(self::$ASIATEHRAN)) { - self::$ASIATEHRAN = new Timezone('asia/tehran'); - } + self::$ASIATEHRAN ??= new Timezone('asia/tehran'); + return self::$ASIATEHRAN; } public static function ASIATHIMPHU(): Timezone { - if (!isset(self::$ASIATHIMPHU)) { - self::$ASIATHIMPHU = new Timezone('asia/thimphu'); - } + self::$ASIATHIMPHU ??= new Timezone('asia/thimphu'); + return self::$ASIATHIMPHU; } public static function ASIATOKYO(): Timezone { - if (!isset(self::$ASIATOKYO)) { - self::$ASIATOKYO = new Timezone('asia/tokyo'); - } + self::$ASIATOKYO ??= new Timezone('asia/tokyo'); + return self::$ASIATOKYO; } public static function ASIATOMSK(): Timezone { - if (!isset(self::$ASIATOMSK)) { - self::$ASIATOMSK = new Timezone('asia/tomsk'); - } + self::$ASIATOMSK ??= new Timezone('asia/tomsk'); + return self::$ASIATOMSK; } public static function ASIAULAANBAATAR(): Timezone { - if (!isset(self::$ASIAULAANBAATAR)) { - self::$ASIAULAANBAATAR = new Timezone('asia/ulaanbaatar'); - } + self::$ASIAULAANBAATAR ??= new Timezone('asia/ulaanbaatar'); + return self::$ASIAULAANBAATAR; } public static function ASIAURUMQI(): Timezone { - if (!isset(self::$ASIAURUMQI)) { - self::$ASIAURUMQI = new Timezone('asia/urumqi'); - } + self::$ASIAURUMQI ??= new Timezone('asia/urumqi'); + return self::$ASIAURUMQI; } public static function ASIAUSTNERA(): Timezone { - if (!isset(self::$ASIAUSTNERA)) { - self::$ASIAUSTNERA = new Timezone('asia/ust-nera'); - } + self::$ASIAUSTNERA ??= new Timezone('asia/ust-nera'); + return self::$ASIAUSTNERA; } public static function ASIAVIENTIANE(): Timezone { - if (!isset(self::$ASIAVIENTIANE)) { - self::$ASIAVIENTIANE = new Timezone('asia/vientiane'); - } + self::$ASIAVIENTIANE ??= new Timezone('asia/vientiane'); + return self::$ASIAVIENTIANE; } public static function ASIAVLADIVOSTOK(): Timezone { - if (!isset(self::$ASIAVLADIVOSTOK)) { - self::$ASIAVLADIVOSTOK = new Timezone('asia/vladivostok'); - } + self::$ASIAVLADIVOSTOK ??= new Timezone('asia/vladivostok'); + return self::$ASIAVLADIVOSTOK; } public static function ASIAYAKUTSK(): Timezone { - if (!isset(self::$ASIAYAKUTSK)) { - self::$ASIAYAKUTSK = new Timezone('asia/yakutsk'); - } + self::$ASIAYAKUTSK ??= new Timezone('asia/yakutsk'); + return self::$ASIAYAKUTSK; } public static function ASIAYANGON(): Timezone { - if (!isset(self::$ASIAYANGON)) { - self::$ASIAYANGON = new Timezone('asia/yangon'); - } + self::$ASIAYANGON ??= new Timezone('asia/yangon'); + return self::$ASIAYANGON; } public static function ASIAYEKATERINBURG(): Timezone { - if (!isset(self::$ASIAYEKATERINBURG)) { - self::$ASIAYEKATERINBURG = new Timezone('asia/yekaterinburg'); - } + self::$ASIAYEKATERINBURG ??= new Timezone('asia/yekaterinburg'); + return self::$ASIAYEKATERINBURG; } public static function ASIAYEREVAN(): Timezone { - if (!isset(self::$ASIAYEREVAN)) { - self::$ASIAYEREVAN = new Timezone('asia/yerevan'); - } + self::$ASIAYEREVAN ??= new Timezone('asia/yerevan'); + return self::$ASIAYEREVAN; } public static function ATLANTICAZORES(): Timezone { - if (!isset(self::$ATLANTICAZORES)) { - self::$ATLANTICAZORES = new Timezone('atlantic/azores'); - } + self::$ATLANTICAZORES ??= new Timezone('atlantic/azores'); + return self::$ATLANTICAZORES; } public static function ATLANTICBERMUDA(): Timezone { - if (!isset(self::$ATLANTICBERMUDA)) { - self::$ATLANTICBERMUDA = new Timezone('atlantic/bermuda'); - } + self::$ATLANTICBERMUDA ??= new Timezone('atlantic/bermuda'); + return self::$ATLANTICBERMUDA; } public static function ATLANTICCANARY(): Timezone { - if (!isset(self::$ATLANTICCANARY)) { - self::$ATLANTICCANARY = new Timezone('atlantic/canary'); - } + self::$ATLANTICCANARY ??= new Timezone('atlantic/canary'); + return self::$ATLANTICCANARY; } public static function ATLANTICCAPEVERDE(): Timezone { - if (!isset(self::$ATLANTICCAPEVERDE)) { - self::$ATLANTICCAPEVERDE = new Timezone('atlantic/cape_verde'); - } + self::$ATLANTICCAPEVERDE ??= new Timezone('atlantic/cape_verde'); + return self::$ATLANTICCAPEVERDE; } public static function ATLANTICFAROE(): Timezone { - if (!isset(self::$ATLANTICFAROE)) { - self::$ATLANTICFAROE = new Timezone('atlantic/faroe'); - } + self::$ATLANTICFAROE ??= new Timezone('atlantic/faroe'); + return self::$ATLANTICFAROE; } public static function ATLANTICMADEIRA(): Timezone { - if (!isset(self::$ATLANTICMADEIRA)) { - self::$ATLANTICMADEIRA = new Timezone('atlantic/madeira'); - } + self::$ATLANTICMADEIRA ??= new Timezone('atlantic/madeira'); + return self::$ATLANTICMADEIRA; } public static function ATLANTICREYKJAVIK(): Timezone { - if (!isset(self::$ATLANTICREYKJAVIK)) { - self::$ATLANTICREYKJAVIK = new Timezone('atlantic/reykjavik'); - } + self::$ATLANTICREYKJAVIK ??= new Timezone('atlantic/reykjavik'); + return self::$ATLANTICREYKJAVIK; } public static function ATLANTICSOUTHGEORGIA(): Timezone { - if (!isset(self::$ATLANTICSOUTHGEORGIA)) { - self::$ATLANTICSOUTHGEORGIA = new Timezone('atlantic/south_georgia'); - } + self::$ATLANTICSOUTHGEORGIA ??= new Timezone('atlantic/south_georgia'); + return self::$ATLANTICSOUTHGEORGIA; } public static function ATLANTICSTHELENA(): Timezone { - if (!isset(self::$ATLANTICSTHELENA)) { - self::$ATLANTICSTHELENA = new Timezone('atlantic/st_helena'); - } + self::$ATLANTICSTHELENA ??= new Timezone('atlantic/st_helena'); + return self::$ATLANTICSTHELENA; } public static function ATLANTICSTANLEY(): Timezone { - if (!isset(self::$ATLANTICSTANLEY)) { - self::$ATLANTICSTANLEY = new Timezone('atlantic/stanley'); - } + self::$ATLANTICSTANLEY ??= new Timezone('atlantic/stanley'); + return self::$ATLANTICSTANLEY; } public static function AUSTRALIAADELAIDE(): Timezone { - if (!isset(self::$AUSTRALIAADELAIDE)) { - self::$AUSTRALIAADELAIDE = new Timezone('australia/adelaide'); - } + self::$AUSTRALIAADELAIDE ??= new Timezone('australia/adelaide'); + return self::$AUSTRALIAADELAIDE; } public static function AUSTRALIABRISBANE(): Timezone { - if (!isset(self::$AUSTRALIABRISBANE)) { - self::$AUSTRALIABRISBANE = new Timezone('australia/brisbane'); - } + self::$AUSTRALIABRISBANE ??= new Timezone('australia/brisbane'); + return self::$AUSTRALIABRISBANE; } public static function AUSTRALIABROKENHILL(): Timezone { - if (!isset(self::$AUSTRALIABROKENHILL)) { - self::$AUSTRALIABROKENHILL = new Timezone('australia/broken_hill'); - } + self::$AUSTRALIABROKENHILL ??= new Timezone('australia/broken_hill'); + return self::$AUSTRALIABROKENHILL; } public static function AUSTRALIADARWIN(): Timezone { - if (!isset(self::$AUSTRALIADARWIN)) { - self::$AUSTRALIADARWIN = new Timezone('australia/darwin'); - } + self::$AUSTRALIADARWIN ??= new Timezone('australia/darwin'); + return self::$AUSTRALIADARWIN; } public static function AUSTRALIAEUCLA(): Timezone { - if (!isset(self::$AUSTRALIAEUCLA)) { - self::$AUSTRALIAEUCLA = new Timezone('australia/eucla'); - } + self::$AUSTRALIAEUCLA ??= new Timezone('australia/eucla'); + return self::$AUSTRALIAEUCLA; } public static function AUSTRALIAHOBART(): Timezone { - if (!isset(self::$AUSTRALIAHOBART)) { - self::$AUSTRALIAHOBART = new Timezone('australia/hobart'); - } + self::$AUSTRALIAHOBART ??= new Timezone('australia/hobart'); + return self::$AUSTRALIAHOBART; } public static function AUSTRALIALINDEMAN(): Timezone { - if (!isset(self::$AUSTRALIALINDEMAN)) { - self::$AUSTRALIALINDEMAN = new Timezone('australia/lindeman'); - } + self::$AUSTRALIALINDEMAN ??= new Timezone('australia/lindeman'); + return self::$AUSTRALIALINDEMAN; } public static function AUSTRALIALORDHOWE(): Timezone { - if (!isset(self::$AUSTRALIALORDHOWE)) { - self::$AUSTRALIALORDHOWE = new Timezone('australia/lord_howe'); - } + self::$AUSTRALIALORDHOWE ??= new Timezone('australia/lord_howe'); + return self::$AUSTRALIALORDHOWE; } public static function AUSTRALIAMELBOURNE(): Timezone { - if (!isset(self::$AUSTRALIAMELBOURNE)) { - self::$AUSTRALIAMELBOURNE = new Timezone('australia/melbourne'); - } + self::$AUSTRALIAMELBOURNE ??= new Timezone('australia/melbourne'); + return self::$AUSTRALIAMELBOURNE; } public static function AUSTRALIAPERTH(): Timezone { - if (!isset(self::$AUSTRALIAPERTH)) { - self::$AUSTRALIAPERTH = new Timezone('australia/perth'); - } + self::$AUSTRALIAPERTH ??= new Timezone('australia/perth'); + return self::$AUSTRALIAPERTH; } public static function AUSTRALIASYDNEY(): Timezone { - if (!isset(self::$AUSTRALIASYDNEY)) { - self::$AUSTRALIASYDNEY = new Timezone('australia/sydney'); - } + self::$AUSTRALIASYDNEY ??= new Timezone('australia/sydney'); + return self::$AUSTRALIASYDNEY; } public static function EUROPEAMSTERDAM(): Timezone { - if (!isset(self::$EUROPEAMSTERDAM)) { - self::$EUROPEAMSTERDAM = new Timezone('europe/amsterdam'); - } + self::$EUROPEAMSTERDAM ??= new Timezone('europe/amsterdam'); + return self::$EUROPEAMSTERDAM; } public static function EUROPEANDORRA(): Timezone { - if (!isset(self::$EUROPEANDORRA)) { - self::$EUROPEANDORRA = new Timezone('europe/andorra'); - } + self::$EUROPEANDORRA ??= new Timezone('europe/andorra'); + return self::$EUROPEANDORRA; } public static function EUROPEASTRAKHAN(): Timezone { - if (!isset(self::$EUROPEASTRAKHAN)) { - self::$EUROPEASTRAKHAN = new Timezone('europe/astrakhan'); - } + self::$EUROPEASTRAKHAN ??= new Timezone('europe/astrakhan'); + return self::$EUROPEASTRAKHAN; } public static function EUROPEATHENS(): Timezone { - if (!isset(self::$EUROPEATHENS)) { - self::$EUROPEATHENS = new Timezone('europe/athens'); - } + self::$EUROPEATHENS ??= new Timezone('europe/athens'); + return self::$EUROPEATHENS; } public static function EUROPEBELGRADE(): Timezone { - if (!isset(self::$EUROPEBELGRADE)) { - self::$EUROPEBELGRADE = new Timezone('europe/belgrade'); - } + self::$EUROPEBELGRADE ??= new Timezone('europe/belgrade'); + return self::$EUROPEBELGRADE; } public static function EUROPEBERLIN(): Timezone { - if (!isset(self::$EUROPEBERLIN)) { - self::$EUROPEBERLIN = new Timezone('europe/berlin'); - } + self::$EUROPEBERLIN ??= new Timezone('europe/berlin'); + return self::$EUROPEBERLIN; } public static function EUROPEBRATISLAVA(): Timezone { - if (!isset(self::$EUROPEBRATISLAVA)) { - self::$EUROPEBRATISLAVA = new Timezone('europe/bratislava'); - } + self::$EUROPEBRATISLAVA ??= new Timezone('europe/bratislava'); + return self::$EUROPEBRATISLAVA; } public static function EUROPEBRUSSELS(): Timezone { - if (!isset(self::$EUROPEBRUSSELS)) { - self::$EUROPEBRUSSELS = new Timezone('europe/brussels'); - } + self::$EUROPEBRUSSELS ??= new Timezone('europe/brussels'); + return self::$EUROPEBRUSSELS; } public static function EUROPEBUCHAREST(): Timezone { - if (!isset(self::$EUROPEBUCHAREST)) { - self::$EUROPEBUCHAREST = new Timezone('europe/bucharest'); - } + self::$EUROPEBUCHAREST ??= new Timezone('europe/bucharest'); + return self::$EUROPEBUCHAREST; } public static function EUROPEBUDAPEST(): Timezone { - if (!isset(self::$EUROPEBUDAPEST)) { - self::$EUROPEBUDAPEST = new Timezone('europe/budapest'); - } + self::$EUROPEBUDAPEST ??= new Timezone('europe/budapest'); + return self::$EUROPEBUDAPEST; } public static function EUROPEBUSINGEN(): Timezone { - if (!isset(self::$EUROPEBUSINGEN)) { - self::$EUROPEBUSINGEN = new Timezone('europe/busingen'); - } + self::$EUROPEBUSINGEN ??= new Timezone('europe/busingen'); + return self::$EUROPEBUSINGEN; } public static function EUROPECHISINAU(): Timezone { - if (!isset(self::$EUROPECHISINAU)) { - self::$EUROPECHISINAU = new Timezone('europe/chisinau'); - } + self::$EUROPECHISINAU ??= new Timezone('europe/chisinau'); + return self::$EUROPECHISINAU; } public static function EUROPECOPENHAGEN(): Timezone { - if (!isset(self::$EUROPECOPENHAGEN)) { - self::$EUROPECOPENHAGEN = new Timezone('europe/copenhagen'); - } + self::$EUROPECOPENHAGEN ??= new Timezone('europe/copenhagen'); + return self::$EUROPECOPENHAGEN; } public static function EUROPEDUBLIN(): Timezone { - if (!isset(self::$EUROPEDUBLIN)) { - self::$EUROPEDUBLIN = new Timezone('europe/dublin'); - } + self::$EUROPEDUBLIN ??= new Timezone('europe/dublin'); + return self::$EUROPEDUBLIN; } public static function EUROPEGIBRALTAR(): Timezone { - if (!isset(self::$EUROPEGIBRALTAR)) { - self::$EUROPEGIBRALTAR = new Timezone('europe/gibraltar'); - } + self::$EUROPEGIBRALTAR ??= new Timezone('europe/gibraltar'); + return self::$EUROPEGIBRALTAR; } public static function EUROPEGUERNSEY(): Timezone { - if (!isset(self::$EUROPEGUERNSEY)) { - self::$EUROPEGUERNSEY = new Timezone('europe/guernsey'); - } + self::$EUROPEGUERNSEY ??= new Timezone('europe/guernsey'); + return self::$EUROPEGUERNSEY; } public static function EUROPEHELSINKI(): Timezone { - if (!isset(self::$EUROPEHELSINKI)) { - self::$EUROPEHELSINKI = new Timezone('europe/helsinki'); - } + self::$EUROPEHELSINKI ??= new Timezone('europe/helsinki'); + return self::$EUROPEHELSINKI; } public static function EUROPEISLEOFMAN(): Timezone { - if (!isset(self::$EUROPEISLEOFMAN)) { - self::$EUROPEISLEOFMAN = new Timezone('europe/isle_of_man'); - } + self::$EUROPEISLEOFMAN ??= new Timezone('europe/isle_of_man'); + return self::$EUROPEISLEOFMAN; } public static function EUROPEISTANBUL(): Timezone { - if (!isset(self::$EUROPEISTANBUL)) { - self::$EUROPEISTANBUL = new Timezone('europe/istanbul'); - } + self::$EUROPEISTANBUL ??= new Timezone('europe/istanbul'); + return self::$EUROPEISTANBUL; } public static function EUROPEJERSEY(): Timezone { - if (!isset(self::$EUROPEJERSEY)) { - self::$EUROPEJERSEY = new Timezone('europe/jersey'); - } + self::$EUROPEJERSEY ??= new Timezone('europe/jersey'); + return self::$EUROPEJERSEY; } public static function EUROPEKALININGRAD(): Timezone { - if (!isset(self::$EUROPEKALININGRAD)) { - self::$EUROPEKALININGRAD = new Timezone('europe/kaliningrad'); - } + self::$EUROPEKALININGRAD ??= new Timezone('europe/kaliningrad'); + return self::$EUROPEKALININGRAD; } public static function EUROPEKIROV(): Timezone { - if (!isset(self::$EUROPEKIROV)) { - self::$EUROPEKIROV = new Timezone('europe/kirov'); - } + self::$EUROPEKIROV ??= new Timezone('europe/kirov'); + return self::$EUROPEKIROV; } public static function EUROPEKYIV(): Timezone { - if (!isset(self::$EUROPEKYIV)) { - self::$EUROPEKYIV = new Timezone('europe/kyiv'); - } + self::$EUROPEKYIV ??= new Timezone('europe/kyiv'); + return self::$EUROPEKYIV; } public static function EUROPELISBON(): Timezone { - if (!isset(self::$EUROPELISBON)) { - self::$EUROPELISBON = new Timezone('europe/lisbon'); - } + self::$EUROPELISBON ??= new Timezone('europe/lisbon'); + return self::$EUROPELISBON; } public static function EUROPELJUBLJANA(): Timezone { - if (!isset(self::$EUROPELJUBLJANA)) { - self::$EUROPELJUBLJANA = new Timezone('europe/ljubljana'); - } + self::$EUROPELJUBLJANA ??= new Timezone('europe/ljubljana'); + return self::$EUROPELJUBLJANA; } public static function EUROPELONDON(): Timezone { - if (!isset(self::$EUROPELONDON)) { - self::$EUROPELONDON = new Timezone('europe/london'); - } + self::$EUROPELONDON ??= new Timezone('europe/london'); + return self::$EUROPELONDON; } public static function EUROPELUXEMBOURG(): Timezone { - if (!isset(self::$EUROPELUXEMBOURG)) { - self::$EUROPELUXEMBOURG = new Timezone('europe/luxembourg'); - } + self::$EUROPELUXEMBOURG ??= new Timezone('europe/luxembourg'); + return self::$EUROPELUXEMBOURG; } public static function EUROPEMADRID(): Timezone { - if (!isset(self::$EUROPEMADRID)) { - self::$EUROPEMADRID = new Timezone('europe/madrid'); - } + self::$EUROPEMADRID ??= new Timezone('europe/madrid'); + return self::$EUROPEMADRID; } public static function EUROPEMALTA(): Timezone { - if (!isset(self::$EUROPEMALTA)) { - self::$EUROPEMALTA = new Timezone('europe/malta'); - } + self::$EUROPEMALTA ??= new Timezone('europe/malta'); + return self::$EUROPEMALTA; } public static function EUROPEMARIEHAMN(): Timezone { - if (!isset(self::$EUROPEMARIEHAMN)) { - self::$EUROPEMARIEHAMN = new Timezone('europe/mariehamn'); - } + self::$EUROPEMARIEHAMN ??= new Timezone('europe/mariehamn'); + return self::$EUROPEMARIEHAMN; } public static function EUROPEMINSK(): Timezone { - if (!isset(self::$EUROPEMINSK)) { - self::$EUROPEMINSK = new Timezone('europe/minsk'); - } + self::$EUROPEMINSK ??= new Timezone('europe/minsk'); + return self::$EUROPEMINSK; } public static function EUROPEMONACO(): Timezone { - if (!isset(self::$EUROPEMONACO)) { - self::$EUROPEMONACO = new Timezone('europe/monaco'); - } + self::$EUROPEMONACO ??= new Timezone('europe/monaco'); + return self::$EUROPEMONACO; } public static function EUROPEMOSCOW(): Timezone { - if (!isset(self::$EUROPEMOSCOW)) { - self::$EUROPEMOSCOW = new Timezone('europe/moscow'); - } + self::$EUROPEMOSCOW ??= new Timezone('europe/moscow'); + return self::$EUROPEMOSCOW; } public static function EUROPEOSLO(): Timezone { - if (!isset(self::$EUROPEOSLO)) { - self::$EUROPEOSLO = new Timezone('europe/oslo'); - } + self::$EUROPEOSLO ??= new Timezone('europe/oslo'); + return self::$EUROPEOSLO; } public static function EUROPEPARIS(): Timezone { - if (!isset(self::$EUROPEPARIS)) { - self::$EUROPEPARIS = new Timezone('europe/paris'); - } + self::$EUROPEPARIS ??= new Timezone('europe/paris'); + return self::$EUROPEPARIS; } public static function EUROPEPODGORICA(): Timezone { - if (!isset(self::$EUROPEPODGORICA)) { - self::$EUROPEPODGORICA = new Timezone('europe/podgorica'); - } + self::$EUROPEPODGORICA ??= new Timezone('europe/podgorica'); + return self::$EUROPEPODGORICA; } public static function EUROPEPRAGUE(): Timezone { - if (!isset(self::$EUROPEPRAGUE)) { - self::$EUROPEPRAGUE = new Timezone('europe/prague'); - } + self::$EUROPEPRAGUE ??= new Timezone('europe/prague'); + return self::$EUROPEPRAGUE; } public static function EUROPERIGA(): Timezone { - if (!isset(self::$EUROPERIGA)) { - self::$EUROPERIGA = new Timezone('europe/riga'); - } + self::$EUROPERIGA ??= new Timezone('europe/riga'); + return self::$EUROPERIGA; } public static function EUROPEROME(): Timezone { - if (!isset(self::$EUROPEROME)) { - self::$EUROPEROME = new Timezone('europe/rome'); - } + self::$EUROPEROME ??= new Timezone('europe/rome'); + return self::$EUROPEROME; } public static function EUROPESAMARA(): Timezone { - if (!isset(self::$EUROPESAMARA)) { - self::$EUROPESAMARA = new Timezone('europe/samara'); - } + self::$EUROPESAMARA ??= new Timezone('europe/samara'); + return self::$EUROPESAMARA; } public static function EUROPESANMARINO(): Timezone { - if (!isset(self::$EUROPESANMARINO)) { - self::$EUROPESANMARINO = new Timezone('europe/san_marino'); - } + self::$EUROPESANMARINO ??= new Timezone('europe/san_marino'); + return self::$EUROPESANMARINO; } public static function EUROPESARAJEVO(): Timezone { - if (!isset(self::$EUROPESARAJEVO)) { - self::$EUROPESARAJEVO = new Timezone('europe/sarajevo'); - } + self::$EUROPESARAJEVO ??= new Timezone('europe/sarajevo'); + return self::$EUROPESARAJEVO; } public static function EUROPESARATOV(): Timezone { - if (!isset(self::$EUROPESARATOV)) { - self::$EUROPESARATOV = new Timezone('europe/saratov'); - } + self::$EUROPESARATOV ??= new Timezone('europe/saratov'); + return self::$EUROPESARATOV; } public static function EUROPESIMFEROPOL(): Timezone { - if (!isset(self::$EUROPESIMFEROPOL)) { - self::$EUROPESIMFEROPOL = new Timezone('europe/simferopol'); - } + self::$EUROPESIMFEROPOL ??= new Timezone('europe/simferopol'); + return self::$EUROPESIMFEROPOL; } public static function EUROPESKOPJE(): Timezone { - if (!isset(self::$EUROPESKOPJE)) { - self::$EUROPESKOPJE = new Timezone('europe/skopje'); - } + self::$EUROPESKOPJE ??= new Timezone('europe/skopje'); + return self::$EUROPESKOPJE; } public static function EUROPESOFIA(): Timezone { - if (!isset(self::$EUROPESOFIA)) { - self::$EUROPESOFIA = new Timezone('europe/sofia'); - } + self::$EUROPESOFIA ??= new Timezone('europe/sofia'); + return self::$EUROPESOFIA; } public static function EUROPESTOCKHOLM(): Timezone { - if (!isset(self::$EUROPESTOCKHOLM)) { - self::$EUROPESTOCKHOLM = new Timezone('europe/stockholm'); - } + self::$EUROPESTOCKHOLM ??= new Timezone('europe/stockholm'); + return self::$EUROPESTOCKHOLM; } public static function EUROPETALLINN(): Timezone { - if (!isset(self::$EUROPETALLINN)) { - self::$EUROPETALLINN = new Timezone('europe/tallinn'); - } + self::$EUROPETALLINN ??= new Timezone('europe/tallinn'); + return self::$EUROPETALLINN; } public static function EUROPETIRANE(): Timezone { - if (!isset(self::$EUROPETIRANE)) { - self::$EUROPETIRANE = new Timezone('europe/tirane'); - } + self::$EUROPETIRANE ??= new Timezone('europe/tirane'); + return self::$EUROPETIRANE; } public static function EUROPEULYANOVSK(): Timezone { - if (!isset(self::$EUROPEULYANOVSK)) { - self::$EUROPEULYANOVSK = new Timezone('europe/ulyanovsk'); - } + self::$EUROPEULYANOVSK ??= new Timezone('europe/ulyanovsk'); + return self::$EUROPEULYANOVSK; } public static function EUROPEVADUZ(): Timezone { - if (!isset(self::$EUROPEVADUZ)) { - self::$EUROPEVADUZ = new Timezone('europe/vaduz'); - } + self::$EUROPEVADUZ ??= new Timezone('europe/vaduz'); + return self::$EUROPEVADUZ; } public static function EUROPEVATICAN(): Timezone { - if (!isset(self::$EUROPEVATICAN)) { - self::$EUROPEVATICAN = new Timezone('europe/vatican'); - } + self::$EUROPEVATICAN ??= new Timezone('europe/vatican'); + return self::$EUROPEVATICAN; } public static function EUROPEVIENNA(): Timezone { - if (!isset(self::$EUROPEVIENNA)) { - self::$EUROPEVIENNA = new Timezone('europe/vienna'); - } + self::$EUROPEVIENNA ??= new Timezone('europe/vienna'); + return self::$EUROPEVIENNA; } public static function EUROPEVILNIUS(): Timezone { - if (!isset(self::$EUROPEVILNIUS)) { - self::$EUROPEVILNIUS = new Timezone('europe/vilnius'); - } + self::$EUROPEVILNIUS ??= new Timezone('europe/vilnius'); + return self::$EUROPEVILNIUS; } public static function EUROPEVOLGOGRAD(): Timezone { - if (!isset(self::$EUROPEVOLGOGRAD)) { - self::$EUROPEVOLGOGRAD = new Timezone('europe/volgograd'); - } + self::$EUROPEVOLGOGRAD ??= new Timezone('europe/volgograd'); + return self::$EUROPEVOLGOGRAD; } public static function EUROPEWARSAW(): Timezone { - if (!isset(self::$EUROPEWARSAW)) { - self::$EUROPEWARSAW = new Timezone('europe/warsaw'); - } + self::$EUROPEWARSAW ??= new Timezone('europe/warsaw'); + return self::$EUROPEWARSAW; } public static function EUROPEZAGREB(): Timezone { - if (!isset(self::$EUROPEZAGREB)) { - self::$EUROPEZAGREB = new Timezone('europe/zagreb'); - } + self::$EUROPEZAGREB ??= new Timezone('europe/zagreb'); + return self::$EUROPEZAGREB; } public static function EUROPEZURICH(): Timezone { - if (!isset(self::$EUROPEZURICH)) { - self::$EUROPEZURICH = new Timezone('europe/zurich'); - } + self::$EUROPEZURICH ??= new Timezone('europe/zurich'); + return self::$EUROPEZURICH; } public static function INDIANANTANANARIVO(): Timezone { - if (!isset(self::$INDIANANTANANARIVO)) { - self::$INDIANANTANANARIVO = new Timezone('indian/antananarivo'); - } + self::$INDIANANTANANARIVO ??= new Timezone('indian/antananarivo'); + return self::$INDIANANTANANARIVO; } public static function INDIANCHAGOS(): Timezone { - if (!isset(self::$INDIANCHAGOS)) { - self::$INDIANCHAGOS = new Timezone('indian/chagos'); - } + self::$INDIANCHAGOS ??= new Timezone('indian/chagos'); + return self::$INDIANCHAGOS; } public static function INDIANCHRISTMAS(): Timezone { - if (!isset(self::$INDIANCHRISTMAS)) { - self::$INDIANCHRISTMAS = new Timezone('indian/christmas'); - } + self::$INDIANCHRISTMAS ??= new Timezone('indian/christmas'); + return self::$INDIANCHRISTMAS; } public static function INDIANCOCOS(): Timezone { - if (!isset(self::$INDIANCOCOS)) { - self::$INDIANCOCOS = new Timezone('indian/cocos'); - } + self::$INDIANCOCOS ??= new Timezone('indian/cocos'); + return self::$INDIANCOCOS; } public static function INDIANCOMORO(): Timezone { - if (!isset(self::$INDIANCOMORO)) { - self::$INDIANCOMORO = new Timezone('indian/comoro'); - } + self::$INDIANCOMORO ??= new Timezone('indian/comoro'); + return self::$INDIANCOMORO; } public static function INDIANKERGUELEN(): Timezone { - if (!isset(self::$INDIANKERGUELEN)) { - self::$INDIANKERGUELEN = new Timezone('indian/kerguelen'); - } + self::$INDIANKERGUELEN ??= new Timezone('indian/kerguelen'); + return self::$INDIANKERGUELEN; } public static function INDIANMAHE(): Timezone { - if (!isset(self::$INDIANMAHE)) { - self::$INDIANMAHE = new Timezone('indian/mahe'); - } + self::$INDIANMAHE ??= new Timezone('indian/mahe'); + return self::$INDIANMAHE; } public static function INDIANMALDIVES(): Timezone { - if (!isset(self::$INDIANMALDIVES)) { - self::$INDIANMALDIVES = new Timezone('indian/maldives'); - } + self::$INDIANMALDIVES ??= new Timezone('indian/maldives'); + return self::$INDIANMALDIVES; } public static function INDIANMAURITIUS(): Timezone { - if (!isset(self::$INDIANMAURITIUS)) { - self::$INDIANMAURITIUS = new Timezone('indian/mauritius'); - } + self::$INDIANMAURITIUS ??= new Timezone('indian/mauritius'); + return self::$INDIANMAURITIUS; } public static function INDIANMAYOTTE(): Timezone { - if (!isset(self::$INDIANMAYOTTE)) { - self::$INDIANMAYOTTE = new Timezone('indian/mayotte'); - } + self::$INDIANMAYOTTE ??= new Timezone('indian/mayotte'); + return self::$INDIANMAYOTTE; } public static function INDIANREUNION(): Timezone { - if (!isset(self::$INDIANREUNION)) { - self::$INDIANREUNION = new Timezone('indian/reunion'); - } + self::$INDIANREUNION ??= new Timezone('indian/reunion'); + return self::$INDIANREUNION; } public static function PACIFICAPIA(): Timezone { - if (!isset(self::$PACIFICAPIA)) { - self::$PACIFICAPIA = new Timezone('pacific/apia'); - } + self::$PACIFICAPIA ??= new Timezone('pacific/apia'); + return self::$PACIFICAPIA; } public static function PACIFICAUCKLAND(): Timezone { - if (!isset(self::$PACIFICAUCKLAND)) { - self::$PACIFICAUCKLAND = new Timezone('pacific/auckland'); - } + self::$PACIFICAUCKLAND ??= new Timezone('pacific/auckland'); + return self::$PACIFICAUCKLAND; } public static function PACIFICBOUGAINVILLE(): Timezone { - if (!isset(self::$PACIFICBOUGAINVILLE)) { - self::$PACIFICBOUGAINVILLE = new Timezone('pacific/bougainville'); - } + self::$PACIFICBOUGAINVILLE ??= new Timezone('pacific/bougainville'); + return self::$PACIFICBOUGAINVILLE; } public static function PACIFICCHATHAM(): Timezone { - if (!isset(self::$PACIFICCHATHAM)) { - self::$PACIFICCHATHAM = new Timezone('pacific/chatham'); - } + self::$PACIFICCHATHAM ??= new Timezone('pacific/chatham'); + return self::$PACIFICCHATHAM; } public static function PACIFICCHUUK(): Timezone { - if (!isset(self::$PACIFICCHUUK)) { - self::$PACIFICCHUUK = new Timezone('pacific/chuuk'); - } + self::$PACIFICCHUUK ??= new Timezone('pacific/chuuk'); + return self::$PACIFICCHUUK; } public static function PACIFICEASTER(): Timezone { - if (!isset(self::$PACIFICEASTER)) { - self::$PACIFICEASTER = new Timezone('pacific/easter'); - } + self::$PACIFICEASTER ??= new Timezone('pacific/easter'); + return self::$PACIFICEASTER; } public static function PACIFICEFATE(): Timezone { - if (!isset(self::$PACIFICEFATE)) { - self::$PACIFICEFATE = new Timezone('pacific/efate'); - } + self::$PACIFICEFATE ??= new Timezone('pacific/efate'); + return self::$PACIFICEFATE; } public static function PACIFICFAKAOFO(): Timezone { - if (!isset(self::$PACIFICFAKAOFO)) { - self::$PACIFICFAKAOFO = new Timezone('pacific/fakaofo'); - } + self::$PACIFICFAKAOFO ??= new Timezone('pacific/fakaofo'); + return self::$PACIFICFAKAOFO; } public static function PACIFICFIJI(): Timezone { - if (!isset(self::$PACIFICFIJI)) { - self::$PACIFICFIJI = new Timezone('pacific/fiji'); - } + self::$PACIFICFIJI ??= new Timezone('pacific/fiji'); + return self::$PACIFICFIJI; } public static function PACIFICFUNAFUTI(): Timezone { - if (!isset(self::$PACIFICFUNAFUTI)) { - self::$PACIFICFUNAFUTI = new Timezone('pacific/funafuti'); - } + self::$PACIFICFUNAFUTI ??= new Timezone('pacific/funafuti'); + return self::$PACIFICFUNAFUTI; } public static function PACIFICGALAPAGOS(): Timezone { - if (!isset(self::$PACIFICGALAPAGOS)) { - self::$PACIFICGALAPAGOS = new Timezone('pacific/galapagos'); - } + self::$PACIFICGALAPAGOS ??= new Timezone('pacific/galapagos'); + return self::$PACIFICGALAPAGOS; } public static function PACIFICGAMBIER(): Timezone { - if (!isset(self::$PACIFICGAMBIER)) { - self::$PACIFICGAMBIER = new Timezone('pacific/gambier'); - } + self::$PACIFICGAMBIER ??= new Timezone('pacific/gambier'); + return self::$PACIFICGAMBIER; } public static function PACIFICGUADALCANAL(): Timezone { - if (!isset(self::$PACIFICGUADALCANAL)) { - self::$PACIFICGUADALCANAL = new Timezone('pacific/guadalcanal'); - } + self::$PACIFICGUADALCANAL ??= new Timezone('pacific/guadalcanal'); + return self::$PACIFICGUADALCANAL; } public static function PACIFICGUAM(): Timezone { - if (!isset(self::$PACIFICGUAM)) { - self::$PACIFICGUAM = new Timezone('pacific/guam'); - } + self::$PACIFICGUAM ??= new Timezone('pacific/guam'); + return self::$PACIFICGUAM; } public static function PACIFICHONOLULU(): Timezone { - if (!isset(self::$PACIFICHONOLULU)) { - self::$PACIFICHONOLULU = new Timezone('pacific/honolulu'); - } + self::$PACIFICHONOLULU ??= new Timezone('pacific/honolulu'); + return self::$PACIFICHONOLULU; } public static function PACIFICKANTON(): Timezone { - if (!isset(self::$PACIFICKANTON)) { - self::$PACIFICKANTON = new Timezone('pacific/kanton'); - } + self::$PACIFICKANTON ??= new Timezone('pacific/kanton'); + return self::$PACIFICKANTON; } public static function PACIFICKIRITIMATI(): Timezone { - if (!isset(self::$PACIFICKIRITIMATI)) { - self::$PACIFICKIRITIMATI = new Timezone('pacific/kiritimati'); - } + self::$PACIFICKIRITIMATI ??= new Timezone('pacific/kiritimati'); + return self::$PACIFICKIRITIMATI; } public static function PACIFICKOSRAE(): Timezone { - if (!isset(self::$PACIFICKOSRAE)) { - self::$PACIFICKOSRAE = new Timezone('pacific/kosrae'); - } + self::$PACIFICKOSRAE ??= new Timezone('pacific/kosrae'); + return self::$PACIFICKOSRAE; } public static function PACIFICKWAJALEIN(): Timezone { - if (!isset(self::$PACIFICKWAJALEIN)) { - self::$PACIFICKWAJALEIN = new Timezone('pacific/kwajalein'); - } + self::$PACIFICKWAJALEIN ??= new Timezone('pacific/kwajalein'); + return self::$PACIFICKWAJALEIN; } public static function PACIFICMAJURO(): Timezone { - if (!isset(self::$PACIFICMAJURO)) { - self::$PACIFICMAJURO = new Timezone('pacific/majuro'); - } + self::$PACIFICMAJURO ??= new Timezone('pacific/majuro'); + return self::$PACIFICMAJURO; } public static function PACIFICMARQUESAS(): Timezone { - if (!isset(self::$PACIFICMARQUESAS)) { - self::$PACIFICMARQUESAS = new Timezone('pacific/marquesas'); - } + self::$PACIFICMARQUESAS ??= new Timezone('pacific/marquesas'); + return self::$PACIFICMARQUESAS; } public static function PACIFICMIDWAY(): Timezone { - if (!isset(self::$PACIFICMIDWAY)) { - self::$PACIFICMIDWAY = new Timezone('pacific/midway'); - } + self::$PACIFICMIDWAY ??= new Timezone('pacific/midway'); + return self::$PACIFICMIDWAY; } public static function PACIFICNAURU(): Timezone { - if (!isset(self::$PACIFICNAURU)) { - self::$PACIFICNAURU = new Timezone('pacific/nauru'); - } + self::$PACIFICNAURU ??= new Timezone('pacific/nauru'); + return self::$PACIFICNAURU; } public static function PACIFICNIUE(): Timezone { - if (!isset(self::$PACIFICNIUE)) { - self::$PACIFICNIUE = new Timezone('pacific/niue'); - } + self::$PACIFICNIUE ??= new Timezone('pacific/niue'); + return self::$PACIFICNIUE; } public static function PACIFICNORFOLK(): Timezone { - if (!isset(self::$PACIFICNORFOLK)) { - self::$PACIFICNORFOLK = new Timezone('pacific/norfolk'); - } + self::$PACIFICNORFOLK ??= new Timezone('pacific/norfolk'); + return self::$PACIFICNORFOLK; } public static function PACIFICNOUMEA(): Timezone { - if (!isset(self::$PACIFICNOUMEA)) { - self::$PACIFICNOUMEA = new Timezone('pacific/noumea'); - } + self::$PACIFICNOUMEA ??= new Timezone('pacific/noumea'); + return self::$PACIFICNOUMEA; } public static function PACIFICPAGOPAGO(): Timezone { - if (!isset(self::$PACIFICPAGOPAGO)) { - self::$PACIFICPAGOPAGO = new Timezone('pacific/pago_pago'); - } + self::$PACIFICPAGOPAGO ??= new Timezone('pacific/pago_pago'); + return self::$PACIFICPAGOPAGO; } public static function PACIFICPALAU(): Timezone { - if (!isset(self::$PACIFICPALAU)) { - self::$PACIFICPALAU = new Timezone('pacific/palau'); - } + self::$PACIFICPALAU ??= new Timezone('pacific/palau'); + return self::$PACIFICPALAU; } public static function PACIFICPITCAIRN(): Timezone { - if (!isset(self::$PACIFICPITCAIRN)) { - self::$PACIFICPITCAIRN = new Timezone('pacific/pitcairn'); - } + self::$PACIFICPITCAIRN ??= new Timezone('pacific/pitcairn'); + return self::$PACIFICPITCAIRN; } public static function PACIFICPOHNPEI(): Timezone { - if (!isset(self::$PACIFICPOHNPEI)) { - self::$PACIFICPOHNPEI = new Timezone('pacific/pohnpei'); - } + self::$PACIFICPOHNPEI ??= new Timezone('pacific/pohnpei'); + return self::$PACIFICPOHNPEI; } public static function PACIFICPORTMORESBY(): Timezone { - if (!isset(self::$PACIFICPORTMORESBY)) { - self::$PACIFICPORTMORESBY = new Timezone('pacific/port_moresby'); - } + self::$PACIFICPORTMORESBY ??= new Timezone('pacific/port_moresby'); + return self::$PACIFICPORTMORESBY; } public static function PACIFICRAROTONGA(): Timezone { - if (!isset(self::$PACIFICRAROTONGA)) { - self::$PACIFICRAROTONGA = new Timezone('pacific/rarotonga'); - } + self::$PACIFICRAROTONGA ??= new Timezone('pacific/rarotonga'); + return self::$PACIFICRAROTONGA; } public static function PACIFICSAIPAN(): Timezone { - if (!isset(self::$PACIFICSAIPAN)) { - self::$PACIFICSAIPAN = new Timezone('pacific/saipan'); - } + self::$PACIFICSAIPAN ??= new Timezone('pacific/saipan'); + return self::$PACIFICSAIPAN; } public static function PACIFICTAHITI(): Timezone { - if (!isset(self::$PACIFICTAHITI)) { - self::$PACIFICTAHITI = new Timezone('pacific/tahiti'); - } + self::$PACIFICTAHITI ??= new Timezone('pacific/tahiti'); + return self::$PACIFICTAHITI; } public static function PACIFICTARAWA(): Timezone { - if (!isset(self::$PACIFICTARAWA)) { - self::$PACIFICTARAWA = new Timezone('pacific/tarawa'); - } + self::$PACIFICTARAWA ??= new Timezone('pacific/tarawa'); + return self::$PACIFICTARAWA; } public static function PACIFICTONGATAPU(): Timezone { - if (!isset(self::$PACIFICTONGATAPU)) { - self::$PACIFICTONGATAPU = new Timezone('pacific/tongatapu'); - } + self::$PACIFICTONGATAPU ??= new Timezone('pacific/tongatapu'); + return self::$PACIFICTONGATAPU; } public static function PACIFICWAKE(): Timezone { - if (!isset(self::$PACIFICWAKE)) { - self::$PACIFICWAKE = new Timezone('pacific/wake'); - } + self::$PACIFICWAKE ??= new Timezone('pacific/wake'); + return self::$PACIFICWAKE; } public static function PACIFICWALLIS(): Timezone { - if (!isset(self::$PACIFICWALLIS)) { - self::$PACIFICWALLIS = new Timezone('pacific/wallis'); - } + self::$PACIFICWALLIS ??= new Timezone('pacific/wallis'); + return self::$PACIFICWALLIS; } public static function UTC(): Timezone { - if (!isset(self::$UTC)) { - self::$UTC = new Timezone('utc'); - } + self::$UTC ??= new Timezone('utc'); + return self::$UTC; } diff --git a/src/Appwrite/Enums/VCSReferenceType.php b/src/Appwrite/Enums/VCSReferenceType.php index 582c743..08c725f 100644 --- a/src/Appwrite/Enums/VCSReferenceType.php +++ b/src/Appwrite/Enums/VCSReferenceType.php @@ -29,23 +29,20 @@ public function jsonSerialize(): string public static function BRANCH(): VCSReferenceType { - if (!isset(self::$BRANCH)) { - self::$BRANCH = new VCSReferenceType('branch'); - } + self::$BRANCH ??= new VCSReferenceType('branch'); + return self::$BRANCH; } public static function COMMIT(): VCSReferenceType { - if (!isset(self::$COMMIT)) { - self::$COMMIT = new VCSReferenceType('commit'); - } + self::$COMMIT ??= new VCSReferenceType('commit'); + return self::$COMMIT; } public static function TAG(): VCSReferenceType { - if (!isset(self::$TAG)) { - self::$TAG = new VCSReferenceType('tag'); - } + self::$TAG ??= new VCSReferenceType('tag'); + return self::$TAG; } diff --git a/src/Appwrite/Enums/VectorsDBIndexType.php b/src/Appwrite/Enums/VectorsDBIndexType.php new file mode 100644 index 0000000..79d1014 --- /dev/null +++ b/src/Appwrite/Enums/VectorsDBIndexType.php @@ -0,0 +1,82 @@ +value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function HNSWEUCLIDEAN(): VectorsDBIndexType + { + self::$HNSWEUCLIDEAN ??= new VectorsDBIndexType('hnsw_euclidean'); + + return self::$HNSWEUCLIDEAN; + } + public static function HNSWDOT(): VectorsDBIndexType + { + self::$HNSWDOT ??= new VectorsDBIndexType('hnsw_dot'); + + return self::$HNSWDOT; + } + public static function HNSWCOSINE(): VectorsDBIndexType + { + self::$HNSWCOSINE ??= new VectorsDBIndexType('hnsw_cosine'); + + return self::$HNSWCOSINE; + } + public static function OBJECT(): VectorsDBIndexType + { + self::$OBJECT ??= new VectorsDBIndexType('object'); + + return self::$OBJECT; + } + public static function KEY(): VectorsDBIndexType + { + self::$KEY ??= new VectorsDBIndexType('key'); + + return self::$KEY; + } + public static function UNIQUE(): VectorsDBIndexType + { + self::$UNIQUE ??= new VectorsDBIndexType('unique'); + + return self::$UNIQUE; + } + + public static function from(string $value): self + { + return match ($value) { + 'hnsw_euclidean' => self::HNSWEUCLIDEAN(), + 'hnsw_dot' => self::HNSWDOT(), + 'hnsw_cosine' => self::HNSWCOSINE(), + 'object' => self::OBJECT(), + 'key' => self::KEY(), + 'unique' => self::UNIQUE(), + default => throw new \InvalidArgumentException('Unknown VectorsDBIndexType value: ' . $value), + }; + } +} diff --git a/src/Appwrite/Models/AttributeObject.php b/src/Appwrite/Models/AttributeObject.php new file mode 100644 index 0000000..9675c7d --- /dev/null +++ b/src/Appwrite/Models/AttributeObject.php @@ -0,0 +1,97 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('key', $data)) { + throw new \InvalidArgumentException('Missing required field "key" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('error', $data)) { + throw new \InvalidArgumentException('Missing required field "error" for ' . static::class . '.'); + } + if (!array_key_exists('required', $data)) { + throw new \InvalidArgumentException('Missing required field "required" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('$updatedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$updatedAt" for ' . static::class . '.'); + } + + return new static( + key: $data['key'], + type: $data['type'], + status: static::hydrateTypedValue(AttributeStatus::class, $data['status']), + error: $data['error'], + required: $data['required'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + array: $data['array'] ?? null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'key' => static::serializeValue($this->key), + 'type' => static::serializeValue($this->type), + 'status' => static::serializeValue($this->status), + 'error' => static::serializeValue($this->error), + 'required' => static::serializeValue($this->required), + 'array' => static::serializeValue($this->array), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt) + ]; + } +} diff --git a/src/Appwrite/Models/AttributeVector.php b/src/Appwrite/Models/AttributeVector.php new file mode 100644 index 0000000..782068a --- /dev/null +++ b/src/Appwrite/Models/AttributeVector.php @@ -0,0 +1,104 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('key', $data)) { + throw new \InvalidArgumentException('Missing required field "key" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('error', $data)) { + throw new \InvalidArgumentException('Missing required field "error" for ' . static::class . '.'); + } + if (!array_key_exists('required', $data)) { + throw new \InvalidArgumentException('Missing required field "required" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('$updatedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$updatedAt" for ' . static::class . '.'); + } + if (!array_key_exists('size', $data)) { + throw new \InvalidArgumentException('Missing required field "size" for ' . static::class . '.'); + } + + return new static( + key: $data['key'], + type: $data['type'], + status: static::hydrateTypedValue(AttributeStatus::class, $data['status']), + error: $data['error'], + required: $data['required'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + size: $data['size'], + array: $data['array'] ?? null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'key' => static::serializeValue($this->key), + 'type' => static::serializeValue($this->type), + 'status' => static::serializeValue($this->status), + 'error' => static::serializeValue($this->error), + 'required' => static::serializeValue($this->required), + 'array' => static::serializeValue($this->array), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + 'size' => static::serializeValue($this->size) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseBackup.php b/src/Appwrite/Models/DedicatedDatabaseBackup.php new file mode 100644 index 0000000..81e70d2 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseBackup.php @@ -0,0 +1,146 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('databaseId', $data)) { + throw new \InvalidArgumentException('Missing required field "databaseId" for ' . static::class . '.'); + } + if (!array_key_exists('projectId', $data)) { + throw new \InvalidArgumentException('Missing required field "projectId" for ' . static::class . '.'); + } + if (!array_key_exists('policyId', $data)) { + throw new \InvalidArgumentException('Missing required field "policyId" for ' . static::class . '.'); + } + if (!array_key_exists('trigger', $data)) { + throw new \InvalidArgumentException('Missing required field "trigger" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('requestedType', $data)) { + throw new \InvalidArgumentException('Missing required field "requestedType" for ' . static::class . '.'); + } + if (!array_key_exists('fallbackReason', $data)) { + throw new \InvalidArgumentException('Missing required field "fallbackReason" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('sizeBytes', $data)) { + throw new \InvalidArgumentException('Missing required field "sizeBytes" for ' . static::class . '.'); + } + if (!array_key_exists('error', $data)) { + throw new \InvalidArgumentException('Missing required field "error" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + databaseId: $data['databaseId'], + projectId: $data['projectId'], + policyId: $data['policyId'], + trigger: $data['trigger'], + type: $data['type'], + requestedType: $data['requestedType'], + fallbackReason: $data['fallbackReason'], + status: $data['status'], + sizeBytes: $data['sizeBytes'], + error: $data['error'], + startedAt: $data['startedAt'] ?? null, + completedAt: $data['completedAt'] ?? null, + verifiedAt: $data['verifiedAt'] ?? null, + expiresAt: $data['expiresAt'] ?? null, + logPosition: $data['logPosition'] ?? null + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + 'databaseId' => static::serializeValue($this->databaseId), + 'projectId' => static::serializeValue($this->projectId), + 'policyId' => static::serializeValue($this->policyId), + 'trigger' => static::serializeValue($this->trigger), + 'type' => static::serializeValue($this->type), + 'requestedType' => static::serializeValue($this->requestedType), + 'fallbackReason' => static::serializeValue($this->fallbackReason), + 'status' => static::serializeValue($this->status), + 'sizeBytes' => static::serializeValue($this->sizeBytes), + 'startedAt' => static::serializeValue($this->startedAt), + 'completedAt' => static::serializeValue($this->completedAt), + 'verifiedAt' => static::serializeValue($this->verifiedAt), + 'expiresAt' => static::serializeValue($this->expiresAt), + 'logPosition' => static::serializeValue($this->logPosition), + 'error' => static::serializeValue($this->error) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseBackupList.php b/src/Appwrite/Models/DedicatedDatabaseBackupList.php new file mode 100644 index 0000000..079ee9b --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseBackupList.php @@ -0,0 +1,61 @@ + $backups list of backups. + */ + public function __construct( + public int $total, + public array $backups + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('backups', $data)) { + throw new \InvalidArgumentException('Missing required field "backups" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + backups: is_array($data['backups']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DedicatedDatabaseBackup::class, $item), + $data['backups'] + ) + : $data['backups'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'backups' => static::serializeValue($this->backups) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseBackupStorage.php b/src/Appwrite/Models/DedicatedDatabaseBackupStorage.php new file mode 100644 index 0000000..6b5e881 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseBackupStorage.php @@ -0,0 +1,77 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('provider', $data)) { + throw new \InvalidArgumentException('Missing required field "provider" for ' . static::class . '.'); + } + if (!array_key_exists('bucket', $data)) { + throw new \InvalidArgumentException('Missing required field "bucket" for ' . static::class . '.'); + } + if (!array_key_exists('region', $data)) { + throw new \InvalidArgumentException('Missing required field "region" for ' . static::class . '.'); + } + if (!array_key_exists('prefix', $data)) { + throw new \InvalidArgumentException('Missing required field "prefix" for ' . static::class . '.'); + } + if (!array_key_exists('endpoint', $data)) { + throw new \InvalidArgumentException('Missing required field "endpoint" for ' . static::class . '.'); + } + + return new static( + provider: $data['provider'], + bucket: $data['bucket'], + region: $data['region'], + prefix: $data['prefix'], + endpoint: $data['endpoint'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'provider' => static::serializeValue($this->provider), + 'bucket' => static::serializeValue($this->bucket), + 'region' => static::serializeValue($this->region), + 'prefix' => static::serializeValue($this->prefix), + 'endpoint' => static::serializeValue($this->endpoint) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseBranch.php b/src/Appwrite/Models/DedicatedDatabaseBranch.php new file mode 100644 index 0000000..2e20e40 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseBranch.php @@ -0,0 +1,126 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('branchId', $data)) { + throw new \InvalidArgumentException('Missing required field "branchId" for ' . static::class . '.'); + } + if (!array_key_exists('branchName', $data)) { + throw new \InvalidArgumentException('Missing required field "branchName" for ' . static::class . '.'); + } + if (!array_key_exists('namespace', $data)) { + throw new \InvalidArgumentException('Missing required field "namespace" for ' . static::class . '.'); + } + if (!array_key_exists('expiresAt', $data)) { + throw new \InvalidArgumentException('Missing required field "expiresAt" for ' . static::class . '.'); + } + if (!array_key_exists('host', $data)) { + throw new \InvalidArgumentException('Missing required field "host" for ' . static::class . '.'); + } + if (!array_key_exists('port', $data)) { + throw new \InvalidArgumentException('Missing required field "port" for ' . static::class . '.'); + } + if (!array_key_exists('database', $data)) { + throw new \InvalidArgumentException('Missing required field "database" for ' . static::class . '.'); + } + if (!array_key_exists('username', $data)) { + throw new \InvalidArgumentException('Missing required field "username" for ' . static::class . '.'); + } + if (!array_key_exists('password', $data)) { + throw new \InvalidArgumentException('Missing required field "password" for ' . static::class . '.'); + } + if (!array_key_exists('ssl', $data)) { + throw new \InvalidArgumentException('Missing required field "ssl" for ' . static::class . '.'); + } + if (!array_key_exists('engine', $data)) { + throw new \InvalidArgumentException('Missing required field "engine" for ' . static::class . '.'); + } + if (!array_key_exists('connectionString', $data)) { + throw new \InvalidArgumentException('Missing required field "connectionString" for ' . static::class . '.'); + } + + return new static( + branchId: $data['branchId'], + branchName: $data['branchName'], + namespace: $data['namespace'], + expiresAt: $data['expiresAt'], + host: $data['host'], + port: $data['port'], + database: $data['database'], + username: $data['username'], + password: $data['password'], + ssl: $data['ssl'], + engine: $data['engine'], + connectionString: $data['connectionString'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'branchId' => static::serializeValue($this->branchId), + 'branchName' => static::serializeValue($this->branchName), + 'namespace' => static::serializeValue($this->namespace), + 'expiresAt' => static::serializeValue($this->expiresAt), + 'host' => static::serializeValue($this->host), + 'port' => static::serializeValue($this->port), + 'database' => static::serializeValue($this->database), + 'username' => static::serializeValue($this->username), + 'password' => static::serializeValue($this->password), + 'ssl' => static::serializeValue($this->ssl), + 'engine' => static::serializeValue($this->engine), + 'connectionString' => static::serializeValue($this->connectionString) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseBranchList.php b/src/Appwrite/Models/DedicatedDatabaseBranchList.php new file mode 100644 index 0000000..ad45dbb --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseBranchList.php @@ -0,0 +1,61 @@ + $branches list of branches. + */ + public function __construct( + public int $total, + public array $branches + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('branches', $data)) { + throw new \InvalidArgumentException('Missing required field "branches" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + branches: is_array($data['branches']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DedicatedDatabaseBranch::class, $item), + $data['branches'] + ) + : $data['branches'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'branches' => static::serializeValue($this->branches) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseExecution.php b/src/Appwrite/Models/DedicatedDatabaseExecution.php new file mode 100644 index 0000000..ac2add7 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseExecution.php @@ -0,0 +1,89 @@ + value maps. empty for non-returning statements. + * @param int $rowCount number of rows returned (for select) or affected (for insert/update/delete). + * @param list $columns column metadata in result-set order. + * @param int $durationMs server-side execution time in milliseconds. + * @param bool $truncated true when the configured row or byte cap was hit and the result was truncated. + * @param int $bytes serialised payload size in bytes. + */ + public function __construct( + public array $rows, + public int $rowCount, + public array $columns, + public int $durationMs, + public bool $truncated, + public int $bytes + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('rows', $data)) { + throw new \InvalidArgumentException('Missing required field "rows" for ' . static::class . '.'); + } + if (!array_key_exists('rowCount', $data)) { + throw new \InvalidArgumentException('Missing required field "rowCount" for ' . static::class . '.'); + } + if (!array_key_exists('columns', $data)) { + throw new \InvalidArgumentException('Missing required field "columns" for ' . static::class . '.'); + } + if (!array_key_exists('durationMs', $data)) { + throw new \InvalidArgumentException('Missing required field "durationMs" for ' . static::class . '.'); + } + if (!array_key_exists('truncated', $data)) { + throw new \InvalidArgumentException('Missing required field "truncated" for ' . static::class . '.'); + } + if (!array_key_exists('bytes', $data)) { + throw new \InvalidArgumentException('Missing required field "bytes" for ' . static::class . '.'); + } + + return new static( + rows: $data['rows'], + rowCount: $data['rowCount'], + columns: is_array($data['columns']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DedicatedDatabaseExecutionColumn::class, $item), + $data['columns'] + ) + : $data['columns'], + durationMs: $data['durationMs'], + truncated: $data['truncated'], + bytes: $data['bytes'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'rows' => static::serializeValue($this->rows), + 'rowCount' => static::serializeValue($this->rowCount), + 'columns' => static::serializeValue($this->columns), + 'durationMs' => static::serializeValue($this->durationMs), + 'truncated' => static::serializeValue($this->truncated), + 'bytes' => static::serializeValue($this->bytes) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseExecutionColumn.php b/src/Appwrite/Models/DedicatedDatabaseExecutionColumn.php new file mode 100644 index 0000000..5ad74e1 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseExecutionColumn.php @@ -0,0 +1,56 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('name', $data)) { + throw new \InvalidArgumentException('Missing required field "name" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + + return new static( + name: $data['name'], + type: $data['type'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'name' => static::serializeValue($this->name), + 'type' => static::serializeValue($this->type) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseExtensions.php b/src/Appwrite/Models/DedicatedDatabaseExtensions.php new file mode 100644 index 0000000..6647bf5 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseExtensions.php @@ -0,0 +1,68 @@ + $metadata curated metadata (display name, description, category) for each available extension. + */ + public function __construct( + public array $installed, + public array $available, + public array $metadata + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('installed', $data)) { + throw new \InvalidArgumentException('Missing required field "installed" for ' . static::class . '.'); + } + if (!array_key_exists('available', $data)) { + throw new \InvalidArgumentException('Missing required field "available" for ' . static::class . '.'); + } + if (!array_key_exists('metadata', $data)) { + throw new \InvalidArgumentException('Missing required field "metadata" for ' . static::class . '.'); + } + + return new static( + installed: $data['installed'], + available: $data['available'], + metadata: is_array($data['metadata']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(PostgresExtension::class, $item), + $data['metadata'] + ) + : $data['metadata'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'installed' => static::serializeValue($this->installed), + 'available' => static::serializeValue($this->available), + 'metadata' => static::serializeValue($this->metadata) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseList.php b/src/Appwrite/Models/DedicatedDatabaseList.php new file mode 100644 index 0000000..8c3c246 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseList.php @@ -0,0 +1,61 @@ + $databases list of databases. + */ + public function __construct( + public int $total, + public array $databases + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('databases', $data)) { + throw new \InvalidArgumentException('Missing required field "databases" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + databases: is_array($data['databases']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DedicatedDatabase::class, $item), + $data['databases'] + ) + : $data['databases'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'databases' => static::serializeValue($this->databases) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseOperation.php b/src/Appwrite/Models/DedicatedDatabaseOperation.php index bee49ab..d52ebcf 100644 --- a/src/Appwrite/Models/DedicatedDatabaseOperation.php +++ b/src/Appwrite/Models/DedicatedDatabaseOperation.php @@ -20,7 +20,7 @@ * @param string $createdAt operation creation time in iso 8601 format. * @param string $databaseId database id the operation ran against. * @param string $type operation type, such as provision, update, restore, pausing, resuming, failover, backup-create or cross-region-enable. - * @param string $status operation status. possible values: running (in progress), completed (finished successfully), failed (ended in an error). + * @param string $status operation status. possible values: queued (accepted and waiting to resume), running (in progress), completed (finished successfully), failed (ended in an error). * @param int $attempts number of times this operation has been attempted. * @param string $errorCode machine-readable failure code. `interrupted` marks an attempt that ended before its outcome could be confirmed. * @param string $errorMessage failure message if the operation failed. diff --git a/src/Appwrite/Models/DedicatedDatabasePITRWindows.php b/src/Appwrite/Models/DedicatedDatabasePITRWindows.php new file mode 100644 index 0000000..adb5bfc --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabasePITRWindows.php @@ -0,0 +1,56 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('earliest', $data)) { + throw new \InvalidArgumentException('Missing required field "earliest" for ' . static::class . '.'); + } + if (!array_key_exists('latest', $data)) { + throw new \InvalidArgumentException('Missing required field "latest" for ' . static::class . '.'); + } + + return new static( + earliest: $data['earliest'], + latest: $data['latest'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'earliest' => static::serializeValue($this->earliest), + 'latest' => static::serializeValue($this->latest) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabasePooler.php b/src/Appwrite/Models/DedicatedDatabasePooler.php new file mode 100644 index 0000000..0bcc77d --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabasePooler.php @@ -0,0 +1,112 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('enabled', $data)) { + throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); + } + if (!array_key_exists('mode', $data)) { + throw new \InvalidArgumentException('Missing required field "mode" for ' . static::class . '.'); + } + if (!array_key_exists('maxConnections', $data)) { + throw new \InvalidArgumentException('Missing required field "maxConnections" for ' . static::class . '.'); + } + if (!array_key_exists('defaultPoolSize', $data)) { + throw new \InvalidArgumentException('Missing required field "defaultPoolSize" for ' . static::class . '.'); + } + if (!array_key_exists('port', $data)) { + throw new \InvalidArgumentException('Missing required field "port" for ' . static::class . '.'); + } + if (!array_key_exists('readWriteSplitting', $data)) { + throw new \InvalidArgumentException('Missing required field "readWriteSplitting" for ' . static::class . '.'); + } + if (!array_key_exists('poolerCpuRequest', $data)) { + throw new \InvalidArgumentException('Missing required field "poolerCpuRequest" for ' . static::class . '.'); + } + if (!array_key_exists('poolerCpuLimit', $data)) { + throw new \InvalidArgumentException('Missing required field "poolerCpuLimit" for ' . static::class . '.'); + } + if (!array_key_exists('poolerMemoryRequest', $data)) { + throw new \InvalidArgumentException('Missing required field "poolerMemoryRequest" for ' . static::class . '.'); + } + if (!array_key_exists('poolerMemoryLimit', $data)) { + throw new \InvalidArgumentException('Missing required field "poolerMemoryLimit" for ' . static::class . '.'); + } + + return new static( + enabled: $data['enabled'], + mode: $data['mode'], + maxConnections: $data['maxConnections'], + defaultPoolSize: $data['defaultPoolSize'], + port: $data['port'], + readWriteSplitting: $data['readWriteSplitting'], + poolerCpuRequest: $data['poolerCpuRequest'], + poolerCpuLimit: $data['poolerCpuLimit'], + poolerMemoryRequest: $data['poolerMemoryRequest'], + poolerMemoryLimit: $data['poolerMemoryLimit'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'enabled' => static::serializeValue($this->enabled), + 'mode' => static::serializeValue($this->mode), + 'maxConnections' => static::serializeValue($this->maxConnections), + 'defaultPoolSize' => static::serializeValue($this->defaultPoolSize), + 'port' => static::serializeValue($this->port), + 'readWriteSplitting' => static::serializeValue($this->readWriteSplitting), + 'poolerCpuRequest' => static::serializeValue($this->poolerCpuRequest), + 'poolerCpuLimit' => static::serializeValue($this->poolerCpuLimit), + 'poolerMemoryRequest' => static::serializeValue($this->poolerMemoryRequest), + 'poolerMemoryLimit' => static::serializeValue($this->poolerMemoryLimit) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseRestoration.php b/src/Appwrite/Models/DedicatedDatabaseRestoration.php new file mode 100644 index 0000000..9866762 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseRestoration.php @@ -0,0 +1,126 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('databaseId', $data)) { + throw new \InvalidArgumentException('Missing required field "databaseId" for ' . static::class . '.'); + } + if (!array_key_exists('sourceDatabaseId', $data)) { + throw new \InvalidArgumentException('Missing required field "sourceDatabaseId" for ' . static::class . '.'); + } + if (!array_key_exists('projectId', $data)) { + throw new \InvalidArgumentException('Missing required field "projectId" for ' . static::class . '.'); + } + if (!array_key_exists('backupId', $data)) { + throw new \InvalidArgumentException('Missing required field "backupId" for ' . static::class . '.'); + } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } + if (!array_key_exists('status', $data)) { + throw new \InvalidArgumentException('Missing required field "status" for ' . static::class . '.'); + } + if (!array_key_exists('targetTime', $data)) { + throw new \InvalidArgumentException('Missing required field "targetTime" for ' . static::class . '.'); + } + if (!array_key_exists('startedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "startedAt" for ' . static::class . '.'); + } + if (!array_key_exists('completedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "completedAt" for ' . static::class . '.'); + } + if (!array_key_exists('error', $data)) { + throw new \InvalidArgumentException('Missing required field "error" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + databaseId: $data['databaseId'], + sourceDatabaseId: $data['sourceDatabaseId'], + projectId: $data['projectId'], + backupId: $data['backupId'], + type: $data['type'], + status: $data['status'], + targetTime: $data['targetTime'], + startedAt: $data['startedAt'], + completedAt: $data['completedAt'], + error: $data['error'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + 'databaseId' => static::serializeValue($this->databaseId), + 'sourceDatabaseId' => static::serializeValue($this->sourceDatabaseId), + 'projectId' => static::serializeValue($this->projectId), + 'backupId' => static::serializeValue($this->backupId), + 'type' => static::serializeValue($this->type), + 'status' => static::serializeValue($this->status), + 'targetTime' => static::serializeValue($this->targetTime), + 'startedAt' => static::serializeValue($this->startedAt), + 'completedAt' => static::serializeValue($this->completedAt), + 'error' => static::serializeValue($this->error) + ]; + } +} diff --git a/src/Appwrite/Models/DedicatedDatabaseRestorationList.php b/src/Appwrite/Models/DedicatedDatabaseRestorationList.php new file mode 100644 index 0000000..daf3405 --- /dev/null +++ b/src/Appwrite/Models/DedicatedDatabaseRestorationList.php @@ -0,0 +1,61 @@ + $restorations list of restorations. + */ + public function __construct( + public int $total, + public array $restorations + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('restorations', $data)) { + throw new \InvalidArgumentException('Missing required field "restorations" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + restorations: is_array($data['restorations']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(DedicatedDatabaseRestoration::class, $item), + $data['restorations'] + ) + : $data['restorations'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'restorations' => static::serializeValue($this->restorations) + ]; + } +} diff --git a/src/Appwrite/Models/PostgresExtension.php b/src/Appwrite/Models/PostgresExtension.php new file mode 100644 index 0000000..84c15d2 --- /dev/null +++ b/src/Appwrite/Models/PostgresExtension.php @@ -0,0 +1,70 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('key', $data)) { + throw new \InvalidArgumentException('Missing required field "key" for ' . static::class . '.'); + } + if (!array_key_exists('name', $data)) { + throw new \InvalidArgumentException('Missing required field "name" for ' . static::class . '.'); + } + if (!array_key_exists('description', $data)) { + throw new \InvalidArgumentException('Missing required field "description" for ' . static::class . '.'); + } + if (!array_key_exists('category', $data)) { + throw new \InvalidArgumentException('Missing required field "category" for ' . static::class . '.'); + } + + return new static( + key: $data['key'], + name: $data['name'], + description: $data['description'], + category: $data['category'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'key' => static::serializeValue($this->key), + 'name' => static::serializeValue($this->name), + 'description' => static::serializeValue($this->description), + 'category' => static::serializeValue($this->category) + ]; + } +} diff --git a/src/Appwrite/Models/VectorsdbCollection.php b/src/Appwrite/Models/VectorsdbCollection.php new file mode 100644 index 0000000..512dc08 --- /dev/null +++ b/src/Appwrite/Models/VectorsdbCollection.php @@ -0,0 +1,138 @@ + $indexes collection indexes. + * @param int $bytesMax maximum document size in bytes. returns 0 when no limit applies. + * @param int $bytesUsed currently used document size in bytes based on defined attributes. + * @param int $dimension embedding dimension. + */ + public function __construct( + public string $id, + public string $createdAt, + public string $updatedAt, + public array $permissions, + public string $databaseId, + public string $name, + public bool $enabled, + public bool $documentSecurity, + public array $attributes, + public array $indexes, + public int $bytesMax, + public int $bytesUsed, + public int $dimension + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('$createdAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$createdAt" for ' . static::class . '.'); + } + if (!array_key_exists('$updatedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "$updatedAt" for ' . static::class . '.'); + } + if (!array_key_exists('$permissions', $data)) { + throw new \InvalidArgumentException('Missing required field "$permissions" for ' . static::class . '.'); + } + if (!array_key_exists('databaseId', $data)) { + throw new \InvalidArgumentException('Missing required field "databaseId" for ' . static::class . '.'); + } + if (!array_key_exists('name', $data)) { + throw new \InvalidArgumentException('Missing required field "name" for ' . static::class . '.'); + } + if (!array_key_exists('enabled', $data)) { + throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); + } + if (!array_key_exists('documentSecurity', $data)) { + throw new \InvalidArgumentException('Missing required field "documentSecurity" for ' . static::class . '.'); + } + if (!array_key_exists('attributes', $data)) { + throw new \InvalidArgumentException('Missing required field "attributes" for ' . static::class . '.'); + } + if (!array_key_exists('indexes', $data)) { + throw new \InvalidArgumentException('Missing required field "indexes" for ' . static::class . '.'); + } + if (!array_key_exists('bytesMax', $data)) { + throw new \InvalidArgumentException('Missing required field "bytesMax" for ' . static::class . '.'); + } + if (!array_key_exists('bytesUsed', $data)) { + throw new \InvalidArgumentException('Missing required field "bytesUsed" for ' . static::class . '.'); + } + if (!array_key_exists('dimension', $data)) { + throw new \InvalidArgumentException('Missing required field "dimension" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + createdAt: $data['$createdAt'], + updatedAt: $data['$updatedAt'], + permissions: $data['$permissions'], + databaseId: $data['databaseId'], + name: $data['name'], + enabled: $data['enabled'], + documentSecurity: $data['documentSecurity'], + attributes: $data['attributes'], + indexes: is_array($data['indexes']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(Index::class, $item), + $data['indexes'] + ) + : $data['indexes'], + bytesMax: $data['bytesMax'], + bytesUsed: $data['bytesUsed'], + dimension: $data['dimension'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + '$id' => static::serializeValue($this->id), + '$createdAt' => static::serializeValue($this->createdAt), + '$updatedAt' => static::serializeValue($this->updatedAt), + '$permissions' => static::serializeValue($this->permissions), + 'databaseId' => static::serializeValue($this->databaseId), + 'name' => static::serializeValue($this->name), + 'enabled' => static::serializeValue($this->enabled), + 'documentSecurity' => static::serializeValue($this->documentSecurity), + 'attributes' => static::serializeValue($this->attributes), + 'indexes' => static::serializeValue($this->indexes), + 'bytesMax' => static::serializeValue($this->bytesMax), + 'bytesUsed' => static::serializeValue($this->bytesUsed), + 'dimension' => static::serializeValue($this->dimension) + ]; + } +} diff --git a/src/Appwrite/Models/VectorsdbCollectionList.php b/src/Appwrite/Models/VectorsdbCollectionList.php new file mode 100644 index 0000000..a7f870f --- /dev/null +++ b/src/Appwrite/Models/VectorsdbCollectionList.php @@ -0,0 +1,61 @@ + $collections list of collections. + */ + public function __construct( + public int $total, + public array $collections + ) { + } + + /** + * @param array $data + */ + public static function from(array $data): static + { + if (!array_key_exists('total', $data)) { + throw new \InvalidArgumentException('Missing required field "total" for ' . static::class . '.'); + } + if (!array_key_exists('collections', $data)) { + throw new \InvalidArgumentException('Missing required field "collections" for ' . static::class . '.'); + } + + return new static( + total: $data['total'], + collections: is_array($data['collections']) + ? array_map( + static fn (mixed $item): mixed => static::hydrateTypedValue(VectorsdbCollection::class, $item), + $data['collections'] + ) + : $data['collections'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + return [ + 'total' => static::serializeValue($this->total), + 'collections' => static::serializeValue($this->collections) + ]; + } +} diff --git a/src/Appwrite/Services/DocumentsDB.php b/src/Appwrite/Services/DocumentsDB.php new file mode 100644 index 0000000..3919a7d --- /dev/null +++ b/src/Appwrite/Services/DocumentsDB.php @@ -0,0 +1,1567 @@ +client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DatabaseList::from($response); + } + + /** + * Create a new Database. + * + * @throws AppwriteException + */ + public function create(string $databaseId, string $name, ?bool $enabled = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null): \Appwrite\Models\Database + { + $apiPath = str_replace( + [], + [], + '/documentsdb' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($specification)) { + $apiParams['specification'] = $specification; + } + + if (!is_null($replicas)) { + $apiParams['replicas'] = $replicas; + } + $apiParams['syncMode'] = $syncMode; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Database::from($response); + } + + /** + * List the dedicated database specifications available on the current plan. + * Each specification reports its resource limits, pricing, and whether it is + * enabled for the organization. + * + * @throws AppwriteException + */ + public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecificationList + { + $apiPath = str_replace( + [], + [], + '/documentsdb/specifications' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseSpecificationList::from($response); + } + + /** + * List transactions across all databases. + * + * @throws AppwriteException + */ + public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList + { + $apiPath = str_replace( + [], + [], + '/documentsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\TransactionList::from($response); + } + + /** + * Create a new transaction. + * + * @throws AppwriteException + */ + public function createTransaction(?int $ttl = null): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + [], + [], + '/documentsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Get a transaction by its unique ID. + * + * @throws AppwriteException + */ + public function getTransaction(string $transactionId): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Update a transaction, to either commit or roll back its operations. + * + * @throws AppwriteException + */ + public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($commit)) { + $apiParams['commit'] = $commit; + } + + if (!is_null($rollback)) { + $apiParams['rollback'] = $rollback; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Delete a transaction by its unique ID. + * + * @throws AppwriteException + */ + public function deleteTransaction(string $transactionId): string + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create multiple operations in a single transaction. + * + * @throws AppwriteException + */ + public function createOperations(string $transactionId, ?array $operations = null): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/documentsdb/transactions/{transactionId}/operations' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($operations)) { + $apiParams['operations'] = $operations; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Get a database by its unique ID. This endpoint response returns a JSON + * object with the database metadata. + * + * @throws AppwriteException + */ + public function get(string $databaseId): \Appwrite\Models\Database + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Database::from($response); + } + + /** + * Update a database by its unique ID. + * + * @throws AppwriteException + */ + public function update(string $databaseId, string $name, ?bool $enabled = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null): \Appwrite\Models\Database + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + $apiParams['specification'] = $specification; + $apiParams['replicas'] = $replicas; + $apiParams['syncMode'] = $syncMode; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Database::from($response); + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write + * scope can delete a database. + * + * @throws AppwriteException + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all collections that belong to the provided databaseId. You + * can use the search parameter to filter your results. + * + * @throws AppwriteException + */ + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\CollectionList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\CollectionList::from($response); + } + + /** + * Create a new Collection. Before using this route, you should create a new + * database resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function createCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null, ?array $attributes = null, ?array $indexes = null): \Appwrite\Models\Collection + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + $apiParams['permissions'] = $permissions; + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($attributes)) { + $apiParams['attributes'] = $attributes; + } + + if (!is_null($indexes)) { + $apiParams['indexes'] = $indexes; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Collection::from($response); + } + + /** + * Get a collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @throws AppwriteException + */ + public function getCollection(string $databaseId, string $collectionId): \Appwrite\Models\Collection + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Collection::from($response); + } + + /** + * Update a collection by its unique ID. + * + * @throws AppwriteException + */ + public function updateCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null, ?bool $purge = null): \Appwrite\Models\Collection + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($purge)) { + $apiParams['purge'] = $purge; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Collection::from($response); + } + + /** + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @throws AppwriteException + */ + public function deleteCollection(string $databaseId, string $collectionId): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all the user's documents in a given collection. You can use + * the query params to filter your results. + * + * @throws AppwriteException + */ + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['data'] = $data; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Create new Documents. Before using this route, you should create a new + * collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function createDocuments(string $databaseId, string $collectionId, array $documents): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Create or update Documents. Before using this route, you should create a + * new collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * 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. + * + * @throws AppwriteException + */ + public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Bulk delete documents using queries, if no queries are passed then all + * documents are deleted. + * + * @throws AppwriteException + */ + public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Get a document by its unique ID. This endpoint response returns a JSON + * object with the document data. + * + * @throws AppwriteException + */ + public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Create or update a Document. Before using this route, you should create a + * new collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Update a document by its unique ID. Using the patch method you can pass + * only specific fields that will get updated. + * + * @throws AppwriteException + */ + public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Delete a document by its unique ID. + * + * @throws AppwriteException + */ + public function deleteDocument(string $databaseId, string $collectionId, string $documentId, ?string $transactionId = null): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $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. + * + * @throws AppwriteException + */ + public function decrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $min = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], + [$databaseId, $collectionId, $documentId, $attribute], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['attribute'] = $attribute; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + if (!is_null($min)) { + $apiParams['min'] = $min; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Increment a specific column of a row by a given value. + * + * @throws AppwriteException + */ + public function incrementDocumentAttribute(string $databaseId, string $collectionId, string $documentId, string $attribute, ?float $value = null, ?float $max = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}', '{attribute}'], + [$databaseId, $collectionId, $documentId, $attribute], + '/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['attribute'] = $attribute; + + if (!is_null($value)) { + $apiParams['value'] = $value; + } + + if (!is_null($max)) { + $apiParams['max'] = $max; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * List indexes in the collection. + * + * @throws AppwriteException + */ + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\IndexList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\IndexList::from($response); + } + + /** + * Creates an index on the attributes listed. Your index should include all + * the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @throws AppwriteException + */ + public function createIndex(string $databaseId, string $collectionId, string $key, DocumentsDBIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): \Appwrite\Models\Index + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['type'] = $type; + $apiParams['attributes'] = $attributes; + + if (!is_null($orders)) { + $apiParams['orders'] = $orders; + } + + if (!is_null($lengths)) { + $apiParams['lengths'] = $lengths; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Index::from($response); + } + + /** + * Get index by ID. + * + * @throws AppwriteException + */ + public function getIndex(string $databaseId, string $collectionId, string $key): \Appwrite\Models\Index + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Index::from($response); + } + + /** + * Delete an index. + * + * @throws AppwriteException + */ + public function deleteIndex(string $databaseId, string $collectionId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/documentsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Trigger a manual failover for a dedicated database with high availability + * enabled. Promotes a replica to primary. The failover runs asynchronously; + * poll the database document for status updates. A database left + * mid-operation also accepts this call as a repair once nothing is driving + * the operation it is stuck in. Repairing a failover that did not finish, a + * `failed` database, a stranded upgrade or migrate, or a stranded compute + * resize additionally requires `targetReplicaId` to name the member to + * promote, because the default target may be the member that operation + * already promoted. + * + * @throws AppwriteException + */ + public function createFailover(string $databaseId, ?string $targetReplicaId = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/failovers' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetReplicaId'] = $targetReplicaId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest + * first. Every provision, update, restore, backup and replication action is + * recorded here with its outcome, including an attempt that was abandoned + * because another worker took over the database. + * + * @throws AppwriteException + */ + public function listOperations(string $databaseId, ?string $status = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseOperationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/operations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseOperationList::from($response); + } + + /** + * Get high availability status for a dedicated database. Returns replica + * statuses, replication lag, and sync mode. + * + * @throws AppwriteException + */ + public function getReplicas(string $databaseId): \Appwrite\Models\DedicatedDatabaseReplicas + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/replicas' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseReplicas::from($response); + } + + /** + * Get real-time health and status information for a dedicated database. + * Returns health status, readiness, uptime, connection info, replica status, + * and volume information. + * + * @throws AppwriteException + */ + public function getStatus(string $databaseId): \Appwrite\Models\DatabaseStatus + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/documentsdb/{databaseId}/status' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DatabaseStatus::from($response); + } +} diff --git a/src/Appwrite/Services/Mongo.php b/src/Appwrite/Services/Mongo.php new file mode 100644 index 0000000..71c6eda --- /dev/null +++ b/src/Appwrite/Services/Mongo.php @@ -0,0 +1,1283 @@ +client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseList::from($response); + } + + /** + * Create a new dedicated database with the chosen engine and configuration. + * Status will be 'provisioning' until the database is ready. + * + * @throws AppwriteException + */ + public function create(string $databaseId, string $name, ?string $version = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null, ?int $networkIdleTimeoutSeconds = null, ?array $networkIPAllowlist = null, ?int $idleTimeoutMinutes = null, ?bool $pitr = null, ?int $pitrRetentionDays = null, ?bool $storageAutoscaling = null, ?int $storageAutoscalingThresholdPercent = null, ?int $storageAutoscalingMaxGb = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + [], + [], + '/mongo' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + $apiParams['version'] = $version; + + if (!is_null($specification)) { + $apiParams['specification'] = $specification; + } + + if (!is_null($replicas)) { + $apiParams['replicas'] = $replicas; + } + $apiParams['syncMode'] = $syncMode; + + if (!is_null($networkIdleTimeoutSeconds)) { + $apiParams['networkIdleTimeoutSeconds'] = $networkIdleTimeoutSeconds; + } + $apiParams['networkIPAllowlist'] = $networkIPAllowlist; + + if (!is_null($idleTimeoutMinutes)) { + $apiParams['idleTimeoutMinutes'] = $idleTimeoutMinutes; + } + + if (!is_null($pitr)) { + $apiParams['pitr'] = $pitr; + } + + if (!is_null($pitrRetentionDays)) { + $apiParams['pitrRetentionDays'] = $pitrRetentionDays; + } + + if (!is_null($storageAutoscaling)) { + $apiParams['storageAutoscaling'] = $storageAutoscaling; + } + + if (!is_null($storageAutoscalingThresholdPercent)) { + $apiParams['storageAutoscalingThresholdPercent'] = $storageAutoscalingThresholdPercent; + } + + if (!is_null($storageAutoscalingMaxGb)) { + $apiParams['storageAutoscalingMaxGb'] = $storageAutoscalingMaxGb; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the dedicated database specifications available on the current plan. + * Each specification reports its resource limits, pricing, and whether it is + * enabled for the organization. + * + * @throws AppwriteException + */ + public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecificationList + { + $apiPath = str_replace( + [], + [], + '/mongo/specifications' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseSpecificationList::from($response); + } + + /** + * Get a dedicated database by its unique ID. Returns the database + * configuration and current status. + * + * @throws AppwriteException + */ + public function get(string $databaseId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Update a dedicated database configuration. All changes are applied with + * zero downtime. Specification changes (cpu, memory, storage) are handled via + * rolling cutover. Storage expansion is done online. All other settings are + * applied in-place. + * + * @throws AppwriteException + */ + public function update(string $databaseId, ?string $name = null, ?string $status = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null, ?int $networkIdleTimeoutSeconds = null, ?array $networkIPAllowlist = null, ?int $idleTimeoutMinutes = null, ?bool $pitr = null, ?int $pitrRetentionDays = null, ?bool $storageAutoscaling = null, ?int $storageAutoscalingThresholdPercent = null, ?int $storageAutoscalingMaxGb = null, ?float $metricsTraceSampleRate = null, ?int $metricsSlowQueryLogThresholdMs = null, ?bool $sqlApiEnabled = null, ?array $sqlApiAllowedStatements = null, ?int $sqlApiMaxRows = null, ?int $sqlApiMaxBytes = null, ?int $sqlApiTimeoutSeconds = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + $apiParams['status'] = $status; + $apiParams['specification'] = $specification; + $apiParams['replicas'] = $replicas; + $apiParams['syncMode'] = $syncMode; + $apiParams['networkIdleTimeoutSeconds'] = $networkIdleTimeoutSeconds; + $apiParams['networkIPAllowlist'] = $networkIPAllowlist; + $apiParams['idleTimeoutMinutes'] = $idleTimeoutMinutes; + $apiParams['pitr'] = $pitr; + $apiParams['pitrRetentionDays'] = $pitrRetentionDays; + $apiParams['storageAutoscaling'] = $storageAutoscaling; + $apiParams['storageAutoscalingThresholdPercent'] = $storageAutoscalingThresholdPercent; + $apiParams['storageAutoscalingMaxGb'] = $storageAutoscalingMaxGb; + $apiParams['metricsTraceSampleRate'] = $metricsTraceSampleRate; + $apiParams['metricsSlowQueryLogThresholdMs'] = $metricsSlowQueryLogThresholdMs; + $apiParams['sqlApiEnabled'] = $sqlApiEnabled; + $apiParams['sqlApiAllowedStatements'] = $sqlApiAllowedStatements; + $apiParams['sqlApiMaxRows'] = $sqlApiMaxRows; + $apiParams['sqlApiMaxBytes'] = $sqlApiMaxBytes; + $apiParams['sqlApiTimeoutSeconds'] = $sqlApiTimeoutSeconds; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Delete a dedicated database. This action is irreversible. The database + * status will be set to 'deleting' and all resources will be cleaned up. + * Deletion is allowed from any state, and repeating the call re-dispatches + * the cleanup. + * + * @throws AppwriteException + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all backups for a dedicated database. Results can be filtered by + * status and type. + * + * @throws AppwriteException + */ + public function listBackups(string $databaseId, ?array $queries = null): \Appwrite\Models\DedicatedDatabaseBackupList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/backups' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackupList::from($response); + } + + /** + * Create a manual backup of a dedicated database. The backup will be created + * asynchronously and its status can be checked via the get backup endpoint. + * + * @throws AppwriteException + */ + public function createBackup(string $databaseId, ?string $type = null): \Appwrite\Models\DedicatedDatabaseBackup + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/backups' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackup::from($response); + } + + /** + * List scheduled backup policies for a dedicated database. + * + * @throws AppwriteException + */ + public function listBackupPolicies(string $databaseId, ?array $queries = null): \Appwrite\Models\BackupPolicyList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/backups/policies' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicyList::from($response); + } + + /** + * Create a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function createBackupPolicy(string $databaseId, string $policyId, string $name, string $schedule, int $retention, ?string $type = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/backups/policies' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + $apiParams['schedule'] = $schedule; + $apiParams['retention'] = $retention; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Get a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function getBackupPolicy(string $databaseId, string $policyId): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/mongo/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Update a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function updateBackupPolicy(string $databaseId, string $policyId, ?string $name = null, ?string $schedule = null, ?int $retention = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/mongo/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + + if (!is_null($schedule)) { + $apiParams['schedule'] = $schedule; + } + $apiParams['retention'] = $retention; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Delete a scheduled backup policy for a dedicated database. Backups already + * taken by the policy are kept until their retention expires. + * + * @throws AppwriteException + */ + public function deleteBackupPolicy(string $databaseId, string $policyId): string + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/mongo/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, + * GCS, and Azure Blob Storage destinations. Backups will be stored to the + * configured destination in addition to on-cluster storage. + * + * @throws AppwriteException + */ + public function updateBackupStorage(string $databaseId, string $provider, string $bucket, string $accessKey, string $secretKey, ?string $region = null, ?string $prefix = null, ?string $endpoint = null): \Appwrite\Models\DedicatedDatabaseBackupStorage + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/backups/storage' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['provider'] = $provider; + $apiParams['bucket'] = $bucket; + $apiParams['accessKey'] = $accessKey; + $apiParams['secretKey'] = $secretKey; + + if (!is_null($region)) { + $apiParams['region'] = $region; + } + + if (!is_null($prefix)) { + $apiParams['prefix'] = $prefix; + } + + if (!is_null($endpoint)) { + $apiParams['endpoint'] = $endpoint; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackupStorage::from($response); + } + + /** + * Get details of a specific database backup including its status, size, and + * timestamps. + * + * @throws AppwriteException + */ + public function getBackup(string $databaseId, string $backupId): \Appwrite\Models\DedicatedDatabaseBackup + { + $apiPath = str_replace( + ['{databaseId}', '{backupId}'], + [$databaseId, $backupId], + '/mongo/{databaseId}/backups/{backupId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['backupId'] = $backupId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackup::from($response); + } + + /** + * Delete a database backup. This will permanently remove the backup from + * storage and cannot be undone. + * + * @throws AppwriteException + */ + public function deleteBackup(string $databaseId, string $backupId): string + { + $apiPath = str_replace( + ['{databaseId}', '{backupId}'], + [$databaseId, $backupId], + '/mongo/{databaseId}/backups/{backupId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['backupId'] = $backupId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all ephemeral branches for a dedicated database. Returns branch + * metadata including ID, name, namespace, and expiration time. + * + * @throws AppwriteException + */ + public function listBranches(string $databaseId): \Appwrite\Models\DedicatedDatabaseBranchList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/branches' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBranchList::from($response); + } + + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The + * branch is a full copy of the database at the current point in time, useful + * for testing schema migrations or running experiments without affecting + * production data. Branches expire after the configured TTL (default 24 + * hours). The branch is created asynchronously. + * + * @throws AppwriteException + */ + public function createBranch(string $databaseId, ?string $branchId = null, ?int $ttl = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/branches' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($branchId)) { + $apiParams['branchId'] = $branchId; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Delete an ephemeral database branch. This removes the branch namespace, its + * PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + * and is irreversible. + * + * @throws AppwriteException + */ + public function deleteBranch(string $databaseId, string $branchId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}', '{branchId}'], + [$databaseId, $branchId], + '/mongo/{databaseId}/branches/{branchId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['branchId'] = $branchId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Rotate the primary connection credentials for a dedicated database. + * Generates a new password and updates the database atomically. Previous + * credentials stop working immediately. Returns the database with a refreshed + * connection string carrying the new password. + * + * @throws AppwriteException + */ + public function updateCredentials(string $databaseId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/credentials' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Trigger a manual failover for a dedicated database with high availability + * enabled. Promotes a replica to primary. The failover runs asynchronously; + * poll the database document for status updates. A database left + * mid-operation also accepts this call as a repair once nothing is driving + * the operation it is stuck in. Repairing a failover that did not finish, a + * `failed` database, a stranded upgrade or migrate, or a stranded compute + * resize additionally requires `targetReplicaId` to name the member to + * promote, because the default target may be the member that operation + * already promoted. + * + * @throws AppwriteException + */ + public function createFailover(string $databaseId, ?string $targetReplicaId = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/failovers' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetReplicaId'] = $targetReplicaId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Update the maintenance window for a dedicated database. Maintenance + * operations like minor version upgrades will be performed during this + * window. + * + * @throws AppwriteException + */ + public function updateMaintenance(string $databaseId, string $day, int $hourUtc): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/maintenance' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['day'] = $day; + $apiParams['hourUtc'] = $hourUtc; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Migrate a database between shared and dedicated types. Shared to dedicated + * provisions an always-on dedicated instance; dedicated to shared converts to + * a serverless instance that scales to zero when idle. Data is copied to the + * target with a brief read-only window during cutover. + * + * @throws AppwriteException + */ + public function createMigration(string $databaseId, string $targetType, ?string $specification = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/migrations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetType'] = $targetType; + $apiParams['specification'] = $specification; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest + * first. Every provision, update, restore, backup and replication action is + * recorded here with its outcome, including an attempt that was abandoned + * because another worker took over the database. + * + * @throws AppwriteException + */ + public function listOperations(string $databaseId, ?string $status = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseOperationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/operations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseOperationList::from($response); + } + + /** + * Get available point-in-time recovery windows for a dedicated database. + * Returns the earliest and latest recovery points. + * + * @throws AppwriteException + */ + public function getPitr(string $databaseId): \Appwrite\Models\DedicatedDatabasePITRWindows + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/pitr' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabasePITRWindows::from($response); + } + + /** + * Get high availability status for a dedicated database. Returns replica + * statuses, replication lag, and sync mode. + * + * @throws AppwriteException + */ + public function getReplicas(string $databaseId): \Appwrite\Models\DedicatedDatabaseReplicas + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/replicas' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseReplicas::from($response); + } + + /** + * List all restorations for a dedicated database. Results can be filtered by + * status and type. + * + * @throws AppwriteException + */ + public function listRestorations(string $databaseId, ?string $status = null, ?string $type = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseRestorationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/restorations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestorationList::from($response); + } + + /** + * Restore a database from a backup or to a specific point in time (PITR). For + * backup restoration, provide a backupId. For PITR, provide a targetTime as + * an ISO 8601 datetime. PITR requires the database to have PITR enabled and + * is only available for enterprise databases. + * + * @throws AppwriteException + */ + public function createRestoration(string $databaseId, ?string $type = null, ?string $backupId = null, ?string $targetDatabaseId = null, ?string $targetTime = null): \Appwrite\Models\DedicatedDatabaseRestoration + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/restorations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + $apiParams['backupId'] = $backupId; + $apiParams['targetDatabaseId'] = $targetDatabaseId; + $apiParams['targetTime'] = $targetTime; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestoration::from($response); + } + + /** + * Get details of a specific database restoration including its status, type, + * and timestamps. + * + * @throws AppwriteException + */ + public function getRestoration(string $databaseId, string $restorationId): \Appwrite\Models\DedicatedDatabaseRestoration + { + $apiPath = str_replace( + ['{databaseId}', '{restorationId}'], + [$databaseId, $restorationId], + '/mongo/{databaseId}/restorations/{restorationId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['restorationId'] = $restorationId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestoration::from($response); + } + + /** + * Get real-time health and status information for a dedicated database. + * Returns health status, readiness, uptime, connection info, replica status, + * and volume information. + * + * @throws AppwriteException + */ + public function getStatus(string $databaseId): \Appwrite\Models\DatabaseStatus + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/status' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DatabaseStatus::from($response); + } + + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green + * deployment for zero-downtime cutover. + * + * @throws AppwriteException + */ + public function createUpgrade(string $databaseId, string $targetVersion): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mongo/{databaseId}/upgrades' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetVersion'] = $targetVersion; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } +} diff --git a/src/Appwrite/Services/Mysql.php b/src/Appwrite/Services/Mysql.php new file mode 100644 index 0000000..36cb6f8 --- /dev/null +++ b/src/Appwrite/Services/Mysql.php @@ -0,0 +1,1408 @@ +client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseList::from($response); + } + + /** + * Create a new dedicated database with the chosen engine and configuration. + * Status will be 'provisioning' until the database is ready. + * + * @throws AppwriteException + */ + public function create(string $databaseId, string $name, ?string $version = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null, ?int $networkIdleTimeoutSeconds = null, ?array $networkIPAllowlist = null, ?int $idleTimeoutMinutes = null, ?bool $pitr = null, ?int $pitrRetentionDays = null, ?bool $storageAutoscaling = null, ?int $storageAutoscalingThresholdPercent = null, ?int $storageAutoscalingMaxGb = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + [], + [], + '/mysql' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + $apiParams['version'] = $version; + + if (!is_null($specification)) { + $apiParams['specification'] = $specification; + } + + if (!is_null($replicas)) { + $apiParams['replicas'] = $replicas; + } + $apiParams['syncMode'] = $syncMode; + + if (!is_null($networkIdleTimeoutSeconds)) { + $apiParams['networkIdleTimeoutSeconds'] = $networkIdleTimeoutSeconds; + } + $apiParams['networkIPAllowlist'] = $networkIPAllowlist; + + if (!is_null($idleTimeoutMinutes)) { + $apiParams['idleTimeoutMinutes'] = $idleTimeoutMinutes; + } + + if (!is_null($pitr)) { + $apiParams['pitr'] = $pitr; + } + + if (!is_null($pitrRetentionDays)) { + $apiParams['pitrRetentionDays'] = $pitrRetentionDays; + } + + if (!is_null($storageAutoscaling)) { + $apiParams['storageAutoscaling'] = $storageAutoscaling; + } + + if (!is_null($storageAutoscalingThresholdPercent)) { + $apiParams['storageAutoscalingThresholdPercent'] = $storageAutoscalingThresholdPercent; + } + + if (!is_null($storageAutoscalingMaxGb)) { + $apiParams['storageAutoscalingMaxGb'] = $storageAutoscalingMaxGb; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the dedicated database specifications available on the current plan. + * Each specification reports its resource limits, pricing, and whether it is + * enabled for the organization. + * + * @throws AppwriteException + */ + public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecificationList + { + $apiPath = str_replace( + [], + [], + '/mysql/specifications' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseSpecificationList::from($response); + } + + /** + * Get a dedicated database by its unique ID. Returns the database + * configuration and current status. + * + * @throws AppwriteException + */ + public function get(string $databaseId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Update a dedicated database configuration. All changes are applied with + * zero downtime. Specification changes (cpu, memory, storage) are handled via + * rolling cutover. Storage expansion is done online. All other settings are + * applied in-place. + * + * @throws AppwriteException + */ + public function update(string $databaseId, ?string $name = null, ?string $status = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null, ?int $networkIdleTimeoutSeconds = null, ?array $networkIPAllowlist = null, ?int $idleTimeoutMinutes = null, ?bool $pitr = null, ?int $pitrRetentionDays = null, ?bool $storageAutoscaling = null, ?int $storageAutoscalingThresholdPercent = null, ?int $storageAutoscalingMaxGb = null, ?float $metricsTraceSampleRate = null, ?int $metricsSlowQueryLogThresholdMs = null, ?bool $sqlApiEnabled = null, ?array $sqlApiAllowedStatements = null, ?int $sqlApiMaxRows = null, ?int $sqlApiMaxBytes = null, ?int $sqlApiTimeoutSeconds = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + $apiParams['status'] = $status; + $apiParams['specification'] = $specification; + $apiParams['replicas'] = $replicas; + $apiParams['syncMode'] = $syncMode; + $apiParams['networkIdleTimeoutSeconds'] = $networkIdleTimeoutSeconds; + $apiParams['networkIPAllowlist'] = $networkIPAllowlist; + $apiParams['idleTimeoutMinutes'] = $idleTimeoutMinutes; + $apiParams['pitr'] = $pitr; + $apiParams['pitrRetentionDays'] = $pitrRetentionDays; + $apiParams['storageAutoscaling'] = $storageAutoscaling; + $apiParams['storageAutoscalingThresholdPercent'] = $storageAutoscalingThresholdPercent; + $apiParams['storageAutoscalingMaxGb'] = $storageAutoscalingMaxGb; + $apiParams['metricsTraceSampleRate'] = $metricsTraceSampleRate; + $apiParams['metricsSlowQueryLogThresholdMs'] = $metricsSlowQueryLogThresholdMs; + $apiParams['sqlApiEnabled'] = $sqlApiEnabled; + $apiParams['sqlApiAllowedStatements'] = $sqlApiAllowedStatements; + $apiParams['sqlApiMaxRows'] = $sqlApiMaxRows; + $apiParams['sqlApiMaxBytes'] = $sqlApiMaxBytes; + $apiParams['sqlApiTimeoutSeconds'] = $sqlApiTimeoutSeconds; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Delete a dedicated database. This action is irreversible. The database + * status will be set to 'deleting' and all resources will be cleaned up. + * Deletion is allowed from any state, and repeating the call re-dispatches + * the cleanup. + * + * @throws AppwriteException + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all backups for a dedicated database. Results can be filtered by + * status and type. + * + * @throws AppwriteException + */ + public function listBackups(string $databaseId, ?array $queries = null): \Appwrite\Models\DedicatedDatabaseBackupList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/backups' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackupList::from($response); + } + + /** + * Create a manual backup of a dedicated database. The backup will be created + * asynchronously and its status can be checked via the get backup endpoint. + * + * @throws AppwriteException + */ + public function createBackup(string $databaseId, ?string $type = null): \Appwrite\Models\DedicatedDatabaseBackup + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/backups' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackup::from($response); + } + + /** + * List scheduled backup policies for a dedicated database. + * + * @throws AppwriteException + */ + public function listBackupPolicies(string $databaseId, ?array $queries = null): \Appwrite\Models\BackupPolicyList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/backups/policies' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicyList::from($response); + } + + /** + * Create a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function createBackupPolicy(string $databaseId, string $policyId, string $name, string $schedule, int $retention, ?string $type = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/backups/policies' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + $apiParams['schedule'] = $schedule; + $apiParams['retention'] = $retention; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Get a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function getBackupPolicy(string $databaseId, string $policyId): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/mysql/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Update a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function updateBackupPolicy(string $databaseId, string $policyId, ?string $name = null, ?string $schedule = null, ?int $retention = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/mysql/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + + if (!is_null($schedule)) { + $apiParams['schedule'] = $schedule; + } + $apiParams['retention'] = $retention; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Delete a scheduled backup policy for a dedicated database. Backups already + * taken by the policy are kept until their retention expires. + * + * @throws AppwriteException + */ + public function deleteBackupPolicy(string $databaseId, string $policyId): string + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/mysql/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, + * GCS, and Azure Blob Storage destinations. Backups will be stored to the + * configured destination in addition to on-cluster storage. + * + * @throws AppwriteException + */ + public function updateBackupStorage(string $databaseId, string $provider, string $bucket, string $accessKey, string $secretKey, ?string $region = null, ?string $prefix = null, ?string $endpoint = null): \Appwrite\Models\DedicatedDatabaseBackupStorage + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/backups/storage' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['provider'] = $provider; + $apiParams['bucket'] = $bucket; + $apiParams['accessKey'] = $accessKey; + $apiParams['secretKey'] = $secretKey; + + if (!is_null($region)) { + $apiParams['region'] = $region; + } + + if (!is_null($prefix)) { + $apiParams['prefix'] = $prefix; + } + + if (!is_null($endpoint)) { + $apiParams['endpoint'] = $endpoint; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackupStorage::from($response); + } + + /** + * Get details of a specific database backup including its status, size, and + * timestamps. + * + * @throws AppwriteException + */ + public function getBackup(string $databaseId, string $backupId): \Appwrite\Models\DedicatedDatabaseBackup + { + $apiPath = str_replace( + ['{databaseId}', '{backupId}'], + [$databaseId, $backupId], + '/mysql/{databaseId}/backups/{backupId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['backupId'] = $backupId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackup::from($response); + } + + /** + * Delete a database backup. This will permanently remove the backup from + * storage and cannot be undone. + * + * @throws AppwriteException + */ + public function deleteBackup(string $databaseId, string $backupId): string + { + $apiPath = str_replace( + ['{databaseId}', '{backupId}'], + [$databaseId, $backupId], + '/mysql/{databaseId}/backups/{backupId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['backupId'] = $backupId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all ephemeral branches for a dedicated database. Returns branch + * metadata including ID, name, namespace, and expiration time. + * + * @throws AppwriteException + */ + public function listBranches(string $databaseId): \Appwrite\Models\DedicatedDatabaseBranchList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/branches' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBranchList::from($response); + } + + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The + * branch is a full copy of the database at the current point in time, useful + * for testing schema migrations or running experiments without affecting + * production data. Branches expire after the configured TTL (default 24 + * hours). The branch is created asynchronously. + * + * @throws AppwriteException + */ + public function createBranch(string $databaseId, ?string $branchId = null, ?int $ttl = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/branches' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($branchId)) { + $apiParams['branchId'] = $branchId; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Delete an ephemeral database branch. This removes the branch namespace, its + * PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + * and is irreversible. + * + * @throws AppwriteException + */ + public function deleteBranch(string $databaseId, string $branchId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}', '{branchId}'], + [$databaseId, $branchId], + '/mysql/{databaseId}/branches/{branchId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['branchId'] = $branchId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Rotate the primary connection credentials for a dedicated database. + * Generates a new password and updates the database atomically. Previous + * credentials stop working immediately. Returns the database with a refreshed + * connection string carrying the new password. + * + * @throws AppwriteException + */ + public function updateCredentials(string $databaseId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/credentials' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies + * through the edge platform to the per-database SQL API sidecar. Application + * traffic should bypass cloud entirely and POST directly to the per-database + * hostname: + * `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with + * an `X-Appwrite-Key` header — that path scales to the whole DB fleet + * without a per-query cloud round-trip. The statement type must be on the + * database's configured allow-list. Use bound parameters for any + * user-supplied values — the API does not interpolate raw strings. + * + * @throws AppwriteException + */ + public function createExecution(string $databaseId, string $sql, ?array $bindings = null, ?int $timeoutSeconds = null): \Appwrite\Models\DedicatedDatabaseExecution + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/executions' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['sql'] = $sql; + $apiParams['bindings'] = $bindings; + $apiParams['timeoutSeconds'] = $timeoutSeconds; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseExecution::from($response); + } + + /** + * Trigger a manual failover for a dedicated database with high availability + * enabled. Promotes a replica to primary. The failover runs asynchronously; + * poll the database document for status updates. A database left + * mid-operation also accepts this call as a repair once nothing is driving + * the operation it is stuck in. Repairing a failover that did not finish, a + * `failed` database, a stranded upgrade or migrate, or a stranded compute + * resize additionally requires `targetReplicaId` to name the member to + * promote, because the default target may be the member that operation + * already promoted. + * + * @throws AppwriteException + */ + public function createFailover(string $databaseId, ?string $targetReplicaId = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/failovers' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetReplicaId'] = $targetReplicaId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Update the maintenance window for a dedicated database. Maintenance + * operations like minor version upgrades will be performed during this + * window. + * + * @throws AppwriteException + */ + public function updateMaintenance(string $databaseId, string $day, int $hourUtc): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/maintenance' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['day'] = $day; + $apiParams['hourUtc'] = $hourUtc; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Migrate a database between shared and dedicated types. Shared to dedicated + * provisions an always-on dedicated instance; dedicated to shared converts to + * a serverless instance that scales to zero when idle. Data is copied to the + * target with a brief read-only window during cutover. + * + * @throws AppwriteException + */ + public function createMigration(string $databaseId, string $targetType, ?string $specification = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/migrations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetType'] = $targetType; + $apiParams['specification'] = $specification; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest + * first. Every provision, update, restore, backup and replication action is + * recorded here with its outcome, including an attempt that was abandoned + * because another worker took over the database. + * + * @throws AppwriteException + */ + public function listOperations(string $databaseId, ?string $status = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseOperationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/operations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseOperationList::from($response); + } + + /** + * Get available point-in-time recovery windows for a dedicated database. + * Returns the earliest and latest recovery points. + * + * @throws AppwriteException + */ + public function getPitr(string $databaseId): \Appwrite\Models\DedicatedDatabasePITRWindows + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/pitr' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabasePITRWindows::from($response); + } + + /** + * Get the connection pooler configuration for a dedicated database. Returns + * pooler mode, max connections, and pool size settings. + * + * @throws AppwriteException + */ + public function getPooler(string $databaseId): \Appwrite\Models\DedicatedDatabasePooler + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/pooler' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabasePooler::from($response); + } + + /** + * Update the connection pooler configuration for a dedicated database. + * Configure pool mode, max connections, and pool sizes. + * + * @throws AppwriteException + */ + public function updatePooler(string $databaseId, ?string $mode = null, ?int $maxConnections = null, ?int $defaultPoolSize = null, ?bool $readWriteSplitting = null, ?string $poolerCpuRequest = null, ?string $poolerCpuLimit = null, ?string $poolerMemoryRequest = null, ?string $poolerMemoryLimit = null): \Appwrite\Models\DedicatedDatabasePooler + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/pooler' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['mode'] = $mode; + $apiParams['maxConnections'] = $maxConnections; + $apiParams['defaultPoolSize'] = $defaultPoolSize; + $apiParams['readWriteSplitting'] = $readWriteSplitting; + $apiParams['poolerCpuRequest'] = $poolerCpuRequest; + $apiParams['poolerCpuLimit'] = $poolerCpuLimit; + $apiParams['poolerMemoryRequest'] = $poolerMemoryRequest; + $apiParams['poolerMemoryLimit'] = $poolerMemoryLimit; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabasePooler::from($response); + } + + /** + * Get high availability status for a dedicated database. Returns replica + * statuses, replication lag, and sync mode. + * + * @throws AppwriteException + */ + public function getReplicas(string $databaseId): \Appwrite\Models\DedicatedDatabaseReplicas + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/replicas' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseReplicas::from($response); + } + + /** + * List all restorations for a dedicated database. Results can be filtered by + * status and type. + * + * @throws AppwriteException + */ + public function listRestorations(string $databaseId, ?string $status = null, ?string $type = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseRestorationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/restorations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestorationList::from($response); + } + + /** + * Restore a database from a backup or to a specific point in time (PITR). For + * backup restoration, provide a backupId. For PITR, provide a targetTime as + * an ISO 8601 datetime. PITR requires the database to have PITR enabled and + * is only available for enterprise databases. + * + * @throws AppwriteException + */ + public function createRestoration(string $databaseId, ?string $type = null, ?string $backupId = null, ?string $targetDatabaseId = null, ?string $targetTime = null): \Appwrite\Models\DedicatedDatabaseRestoration + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/restorations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + $apiParams['backupId'] = $backupId; + $apiParams['targetDatabaseId'] = $targetDatabaseId; + $apiParams['targetTime'] = $targetTime; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestoration::from($response); + } + + /** + * Get details of a specific database restoration including its status, type, + * and timestamps. + * + * @throws AppwriteException + */ + public function getRestoration(string $databaseId, string $restorationId): \Appwrite\Models\DedicatedDatabaseRestoration + { + $apiPath = str_replace( + ['{databaseId}', '{restorationId}'], + [$databaseId, $restorationId], + '/mysql/{databaseId}/restorations/{restorationId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['restorationId'] = $restorationId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestoration::from($response); + } + + /** + * Get real-time health and status information for a dedicated database. + * Returns health status, readiness, uptime, connection info, replica status, + * and volume information. + * + * @throws AppwriteException + */ + public function getStatus(string $databaseId): \Appwrite\Models\DatabaseStatus + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/status' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DatabaseStatus::from($response); + } + + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green + * deployment for zero-downtime cutover. + * + * @throws AppwriteException + */ + public function createUpgrade(string $databaseId, string $targetVersion): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/mysql/{databaseId}/upgrades' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetVersion'] = $targetVersion; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } +} diff --git a/src/Appwrite/Services/Postgresql.php b/src/Appwrite/Services/Postgresql.php new file mode 100644 index 0000000..5ed1127 --- /dev/null +++ b/src/Appwrite/Services/Postgresql.php @@ -0,0 +1,1516 @@ +client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseList::from($response); + } + + /** + * Create a new dedicated database with the chosen engine and configuration. + * Status will be 'provisioning' until the database is ready. + * + * @throws AppwriteException + */ + public function create(string $databaseId, string $name, ?string $version = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null, ?int $networkIdleTimeoutSeconds = null, ?array $networkIPAllowlist = null, ?int $idleTimeoutMinutes = null, ?bool $pitr = null, ?int $pitrRetentionDays = null, ?bool $storageAutoscaling = null, ?int $storageAutoscalingThresholdPercent = null, ?int $storageAutoscalingMaxGb = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + [], + [], + '/postgresql' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + $apiParams['version'] = $version; + + if (!is_null($specification)) { + $apiParams['specification'] = $specification; + } + + if (!is_null($replicas)) { + $apiParams['replicas'] = $replicas; + } + $apiParams['syncMode'] = $syncMode; + + if (!is_null($networkIdleTimeoutSeconds)) { + $apiParams['networkIdleTimeoutSeconds'] = $networkIdleTimeoutSeconds; + } + $apiParams['networkIPAllowlist'] = $networkIPAllowlist; + + if (!is_null($idleTimeoutMinutes)) { + $apiParams['idleTimeoutMinutes'] = $idleTimeoutMinutes; + } + + if (!is_null($pitr)) { + $apiParams['pitr'] = $pitr; + } + + if (!is_null($pitrRetentionDays)) { + $apiParams['pitrRetentionDays'] = $pitrRetentionDays; + } + + if (!is_null($storageAutoscaling)) { + $apiParams['storageAutoscaling'] = $storageAutoscaling; + } + + if (!is_null($storageAutoscalingThresholdPercent)) { + $apiParams['storageAutoscalingThresholdPercent'] = $storageAutoscalingThresholdPercent; + } + + if (!is_null($storageAutoscalingMaxGb)) { + $apiParams['storageAutoscalingMaxGb'] = $storageAutoscalingMaxGb; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the dedicated database specifications available on the current plan. + * Each specification reports its resource limits, pricing, and whether it is + * enabled for the organization. + * + * @throws AppwriteException + */ + public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecificationList + { + $apiPath = str_replace( + [], + [], + '/postgresql/specifications' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseSpecificationList::from($response); + } + + /** + * Get a dedicated database by its unique ID. Returns the database + * configuration and current status. + * + * @throws AppwriteException + */ + public function get(string $databaseId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Update a dedicated database configuration. All changes are applied with + * zero downtime. Specification changes (cpu, memory, storage) are handled via + * rolling cutover. Storage expansion is done online. All other settings are + * applied in-place. + * + * @throws AppwriteException + */ + public function update(string $databaseId, ?string $name = null, ?string $status = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null, ?int $networkIdleTimeoutSeconds = null, ?array $networkIPAllowlist = null, ?int $idleTimeoutMinutes = null, ?bool $pitr = null, ?int $pitrRetentionDays = null, ?bool $storageAutoscaling = null, ?int $storageAutoscalingThresholdPercent = null, ?int $storageAutoscalingMaxGb = null, ?float $metricsTraceSampleRate = null, ?int $metricsSlowQueryLogThresholdMs = null, ?bool $sqlApiEnabled = null, ?array $sqlApiAllowedStatements = null, ?int $sqlApiMaxRows = null, ?int $sqlApiMaxBytes = null, ?int $sqlApiTimeoutSeconds = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + $apiParams['status'] = $status; + $apiParams['specification'] = $specification; + $apiParams['replicas'] = $replicas; + $apiParams['syncMode'] = $syncMode; + $apiParams['networkIdleTimeoutSeconds'] = $networkIdleTimeoutSeconds; + $apiParams['networkIPAllowlist'] = $networkIPAllowlist; + $apiParams['idleTimeoutMinutes'] = $idleTimeoutMinutes; + $apiParams['pitr'] = $pitr; + $apiParams['pitrRetentionDays'] = $pitrRetentionDays; + $apiParams['storageAutoscaling'] = $storageAutoscaling; + $apiParams['storageAutoscalingThresholdPercent'] = $storageAutoscalingThresholdPercent; + $apiParams['storageAutoscalingMaxGb'] = $storageAutoscalingMaxGb; + $apiParams['metricsTraceSampleRate'] = $metricsTraceSampleRate; + $apiParams['metricsSlowQueryLogThresholdMs'] = $metricsSlowQueryLogThresholdMs; + $apiParams['sqlApiEnabled'] = $sqlApiEnabled; + $apiParams['sqlApiAllowedStatements'] = $sqlApiAllowedStatements; + $apiParams['sqlApiMaxRows'] = $sqlApiMaxRows; + $apiParams['sqlApiMaxBytes'] = $sqlApiMaxBytes; + $apiParams['sqlApiTimeoutSeconds'] = $sqlApiTimeoutSeconds; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Delete a dedicated database. This action is irreversible. The database + * status will be set to 'deleting' and all resources will be cleaned up. + * Deletion is allowed from any state, and repeating the call re-dispatches + * the cleanup. + * + * @throws AppwriteException + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all backups for a dedicated database. Results can be filtered by + * status and type. + * + * @throws AppwriteException + */ + public function listBackups(string $databaseId, ?array $queries = null): \Appwrite\Models\DedicatedDatabaseBackupList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/backups' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackupList::from($response); + } + + /** + * Create a manual backup of a dedicated database. The backup will be created + * asynchronously and its status can be checked via the get backup endpoint. + * + * @throws AppwriteException + */ + public function createBackup(string $databaseId, ?string $type = null): \Appwrite\Models\DedicatedDatabaseBackup + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/backups' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackup::from($response); + } + + /** + * List scheduled backup policies for a dedicated database. + * + * @throws AppwriteException + */ + public function listBackupPolicies(string $databaseId, ?array $queries = null): \Appwrite\Models\BackupPolicyList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/backups/policies' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicyList::from($response); + } + + /** + * Create a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function createBackupPolicy(string $databaseId, string $policyId, string $name, string $schedule, int $retention, ?string $type = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/backups/policies' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + $apiParams['schedule'] = $schedule; + $apiParams['retention'] = $retention; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Get a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function getBackupPolicy(string $databaseId, string $policyId): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/postgresql/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Update a scheduled backup policy for a dedicated database. + * + * @throws AppwriteException + */ + public function updateBackupPolicy(string $databaseId, string $policyId, ?string $name = null, ?string $schedule = null, ?int $retention = null, ?bool $enabled = null): \Appwrite\Models\BackupPolicy + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/postgresql/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + + if (!is_null($schedule)) { + $apiParams['schedule'] = $schedule; + } + $apiParams['retention'] = $retention; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\BackupPolicy::from($response); + } + + /** + * Delete a scheduled backup policy for a dedicated database. Backups already + * taken by the policy are kept until their retention expires. + * + * @throws AppwriteException + */ + public function deleteBackupPolicy(string $databaseId, string $policyId): string + { + $apiPath = str_replace( + ['{databaseId}', '{policyId}'], + [$databaseId, $policyId], + '/postgresql/{databaseId}/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Configure off-cluster backup storage for a dedicated database. Supports S3, + * GCS, and Azure Blob Storage destinations. Backups will be stored to the + * configured destination in addition to on-cluster storage. + * + * @throws AppwriteException + */ + public function updateBackupStorage(string $databaseId, string $provider, string $bucket, string $accessKey, string $secretKey, ?string $region = null, ?string $prefix = null, ?string $endpoint = null): \Appwrite\Models\DedicatedDatabaseBackupStorage + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/backups/storage' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['provider'] = $provider; + $apiParams['bucket'] = $bucket; + $apiParams['accessKey'] = $accessKey; + $apiParams['secretKey'] = $secretKey; + + if (!is_null($region)) { + $apiParams['region'] = $region; + } + + if (!is_null($prefix)) { + $apiParams['prefix'] = $prefix; + } + + if (!is_null($endpoint)) { + $apiParams['endpoint'] = $endpoint; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackupStorage::from($response); + } + + /** + * Get details of a specific database backup including its status, size, and + * timestamps. + * + * @throws AppwriteException + */ + public function getBackup(string $databaseId, string $backupId): \Appwrite\Models\DedicatedDatabaseBackup + { + $apiPath = str_replace( + ['{databaseId}', '{backupId}'], + [$databaseId, $backupId], + '/postgresql/{databaseId}/backups/{backupId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['backupId'] = $backupId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBackup::from($response); + } + + /** + * Delete a database backup. This will permanently remove the backup from + * storage and cannot be undone. + * + * @throws AppwriteException + */ + public function deleteBackup(string $databaseId, string $backupId): string + { + $apiPath = str_replace( + ['{databaseId}', '{backupId}'], + [$databaseId, $backupId], + '/postgresql/{databaseId}/backups/{backupId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['backupId'] = $backupId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all ephemeral branches for a dedicated database. Returns branch + * metadata including ID, name, namespace, and expiration time. + * + * @throws AppwriteException + */ + public function listBranches(string $databaseId): \Appwrite\Models\DedicatedDatabaseBranchList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/branches' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseBranchList::from($response); + } + + /** + * Create an ephemeral database branch from the primary via PVC snapshot. The + * branch is a full copy of the database at the current point in time, useful + * for testing schema migrations or running experiments without affecting + * production data. Branches expire after the configured TTL (default 24 + * hours). The branch is created asynchronously. + * + * @throws AppwriteException + */ + public function createBranch(string $databaseId, ?string $branchId = null, ?int $ttl = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/branches' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($branchId)) { + $apiParams['branchId'] = $branchId; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Delete an ephemeral database branch. This removes the branch namespace, its + * PVC, and the associated VolumeSnapshot. The deletion runs asynchronously + * and is irreversible. + * + * @throws AppwriteException + */ + public function deleteBranch(string $databaseId, string $branchId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}', '{branchId}'], + [$databaseId, $branchId], + '/postgresql/{databaseId}/branches/{branchId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['branchId'] = $branchId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Rotate the primary connection credentials for a dedicated database. + * Generates a new password and updates the database atomically. Previous + * credentials stop working immediately. Returns the database with a refreshed + * connection string carrying the new password. + * + * @throws AppwriteException + */ + public function updateCredentials(string $databaseId): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/credentials' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Execute SQL through the console-facing Cloud endpoint. Cloud proxies + * through the edge platform to the per-database SQL API sidecar. Application + * traffic should bypass cloud entirely and POST directly to the per-database + * hostname: + * `https://db-{project}-{db}.{region}.appwrite.center/v1/sql/executions` with + * an `X-Appwrite-Key` header — that path scales to the whole DB fleet + * without a per-query cloud round-trip. The statement type must be on the + * database's configured allow-list. Use bound parameters for any + * user-supplied values — the API does not interpolate raw strings. + * + * @throws AppwriteException + */ + public function createExecution(string $databaseId, string $sql, ?array $bindings = null, ?int $timeoutSeconds = null): \Appwrite\Models\DedicatedDatabaseExecution + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/executions' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['sql'] = $sql; + $apiParams['bindings'] = $bindings; + $apiParams['timeoutSeconds'] = $timeoutSeconds; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseExecution::from($response); + } + + /** + * List installed and available extensions for a PostgreSQL database. + * + * @throws AppwriteException + */ + public function listExtensions(string $databaseId): \Appwrite\Models\DedicatedDatabaseExtensions + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/extensions' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseExtensions::from($response); + } + + /** + * Install a database extension. Only available for PostgreSQL databases. The + * install runs asynchronously; poll the extensions list endpoint for status. + * + * @throws AppwriteException + */ + public function createExtension(string $databaseId, string $name): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/extensions' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Uninstall a database extension from a PostgreSQL database. The uninstall + * runs asynchronously; poll the extensions list endpoint for status. + * + * @throws AppwriteException + */ + public function deleteExtension(string $databaseId, string $extensionName): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}', '{extensionName}'], + [$databaseId, $extensionName], + '/postgresql/{databaseId}/extensions/{extensionName}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['extensionName'] = $extensionName; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Trigger a manual failover for a dedicated database with high availability + * enabled. Promotes a replica to primary. The failover runs asynchronously; + * poll the database document for status updates. A database left + * mid-operation also accepts this call as a repair once nothing is driving + * the operation it is stuck in. Repairing a failover that did not finish, a + * `failed` database, a stranded upgrade or migrate, or a stranded compute + * resize additionally requires `targetReplicaId` to name the member to + * promote, because the default target may be the member that operation + * already promoted. + * + * @throws AppwriteException + */ + public function createFailover(string $databaseId, ?string $targetReplicaId = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/failovers' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetReplicaId'] = $targetReplicaId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Update the maintenance window for a dedicated database. Maintenance + * operations like minor version upgrades will be performed during this + * window. + * + * @throws AppwriteException + */ + public function updateMaintenance(string $databaseId, string $day, int $hourUtc): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/maintenance' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['day'] = $day; + $apiParams['hourUtc'] = $hourUtc; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * Migrate a database between shared and dedicated types. Shared to dedicated + * provisions an always-on dedicated instance; dedicated to shared converts to + * a serverless instance that scales to zero when idle. Data is copied to the + * target with a brief read-only window during cutover. + * + * @throws AppwriteException + */ + public function createMigration(string $databaseId, string $targetType, ?string $specification = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/migrations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetType'] = $targetType; + $apiParams['specification'] = $specification; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest + * first. Every provision, update, restore, backup and replication action is + * recorded here with its outcome, including an attempt that was abandoned + * because another worker took over the database. + * + * @throws AppwriteException + */ + public function listOperations(string $databaseId, ?string $status = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseOperationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/operations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseOperationList::from($response); + } + + /** + * Get available point-in-time recovery windows for a dedicated database. + * Returns the earliest and latest recovery points. + * + * @throws AppwriteException + */ + public function getPitr(string $databaseId): \Appwrite\Models\DedicatedDatabasePITRWindows + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/pitr' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabasePITRWindows::from($response); + } + + /** + * Get the connection pooler configuration for a dedicated database. Returns + * pooler mode, max connections, and pool size settings. + * + * @throws AppwriteException + */ + public function getPooler(string $databaseId): \Appwrite\Models\DedicatedDatabasePooler + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/pooler' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabasePooler::from($response); + } + + /** + * Update the connection pooler configuration for a dedicated database. + * Configure pool mode, max connections, and pool sizes. + * + * @throws AppwriteException + */ + public function updatePooler(string $databaseId, ?string $mode = null, ?int $maxConnections = null, ?int $defaultPoolSize = null, ?bool $readWriteSplitting = null, ?string $poolerCpuRequest = null, ?string $poolerCpuLimit = null, ?string $poolerMemoryRequest = null, ?string $poolerMemoryLimit = null): \Appwrite\Models\DedicatedDatabasePooler + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/pooler' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['mode'] = $mode; + $apiParams['maxConnections'] = $maxConnections; + $apiParams['defaultPoolSize'] = $defaultPoolSize; + $apiParams['readWriteSplitting'] = $readWriteSplitting; + $apiParams['poolerCpuRequest'] = $poolerCpuRequest; + $apiParams['poolerCpuLimit'] = $poolerCpuLimit; + $apiParams['poolerMemoryRequest'] = $poolerMemoryRequest; + $apiParams['poolerMemoryLimit'] = $poolerMemoryLimit; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabasePooler::from($response); + } + + /** + * Get high availability status for a dedicated database. Returns replica + * statuses, replication lag, and sync mode. + * + * @throws AppwriteException + */ + public function getReplicas(string $databaseId): \Appwrite\Models\DedicatedDatabaseReplicas + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/replicas' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseReplicas::from($response); + } + + /** + * List all restorations for a dedicated database. Results can be filtered by + * status and type. + * + * @throws AppwriteException + */ + public function listRestorations(string $databaseId, ?string $status = null, ?string $type = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseRestorationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/restorations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestorationList::from($response); + } + + /** + * Restore a database from a backup or to a specific point in time (PITR). For + * backup restoration, provide a backupId. For PITR, provide a targetTime as + * an ISO 8601 datetime. PITR requires the database to have PITR enabled and + * is only available for enterprise databases. + * + * @throws AppwriteException + */ + public function createRestoration(string $databaseId, ?string $type = null, ?string $backupId = null, ?string $targetDatabaseId = null, ?string $targetTime = null): \Appwrite\Models\DedicatedDatabaseRestoration + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/restorations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($type)) { + $apiParams['type'] = $type; + } + $apiParams['backupId'] = $backupId; + $apiParams['targetDatabaseId'] = $targetDatabaseId; + $apiParams['targetTime'] = $targetTime; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestoration::from($response); + } + + /** + * Get details of a specific database restoration including its status, type, + * and timestamps. + * + * @throws AppwriteException + */ + public function getRestoration(string $databaseId, string $restorationId): \Appwrite\Models\DedicatedDatabaseRestoration + { + $apiPath = str_replace( + ['{databaseId}', '{restorationId}'], + [$databaseId, $restorationId], + '/postgresql/{databaseId}/restorations/{restorationId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['restorationId'] = $restorationId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseRestoration::from($response); + } + + /** + * Get real-time health and status information for a dedicated database. + * Returns health status, readiness, uptime, connection info, replica status, + * and volume information. + * + * @throws AppwriteException + */ + public function getStatus(string $databaseId): \Appwrite\Models\DatabaseStatus + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/status' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DatabaseStatus::from($response); + } + + /** + * Upgrade a dedicated database to a new engine version. Uses blue-green + * deployment for zero-downtime cutover. + * + * @throws AppwriteException + */ + public function createUpgrade(string $databaseId, string $targetVersion): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/postgresql/{databaseId}/upgrades' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetVersion'] = $targetVersion; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } +} diff --git a/src/Appwrite/Services/VectorsDB.php b/src/Appwrite/Services/VectorsDB.php new file mode 100644 index 0000000..b22626c --- /dev/null +++ b/src/Appwrite/Services/VectorsDB.php @@ -0,0 +1,1518 @@ +client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DatabaseList::from($response); + } + + /** + * Create a new Database. + * + * @throws AppwriteException + */ + public function create(string $databaseId, string $name, ?bool $enabled = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null): \Appwrite\Models\Database + { + $apiPath = str_replace( + [], + [], + '/vectorsdb' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + if (!is_null($specification)) { + $apiParams['specification'] = $specification; + } + + if (!is_null($replicas)) { + $apiParams['replicas'] = $replicas; + } + $apiParams['syncMode'] = $syncMode; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Database::from($response); + } + + /** + * List the dedicated database specifications available on the current plan. + * Each specification reports its resource limits, pricing, and whether it is + * enabled for the organization. + * + * @throws AppwriteException + */ + public function listSpecifications(): \Appwrite\Models\DedicatedDatabaseSpecificationList + { + $apiPath = str_replace( + [], + [], + '/vectorsdb/specifications' + ); + + $apiParams = []; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseSpecificationList::from($response); + } + + /** + * List transactions across all databases. + * + * @throws AppwriteException + */ + public function listTransactions(?array $queries = null): \Appwrite\Models\TransactionList + { + $apiPath = str_replace( + [], + [], + '/vectorsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\TransactionList::from($response); + } + + /** + * Create a new transaction. + * + * @throws AppwriteException + */ + public function createTransaction(?int $ttl = null): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + [], + [], + '/vectorsdb/transactions' + ); + + $apiParams = []; + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Get a transaction by its unique ID. + * + * @throws AppwriteException + */ + public function getTransaction(string $transactionId): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Update a transaction, to either commit or roll back its operations. + * + * @throws AppwriteException + */ + public function updateTransaction(string $transactionId, ?bool $commit = null, ?bool $rollback = null): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($commit)) { + $apiParams['commit'] = $commit; + } + + if (!is_null($rollback)) { + $apiParams['rollback'] = $rollback; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Delete a transaction by its unique ID. + * + * @throws AppwriteException + */ + public function deleteTransaction(string $transactionId): string + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create multiple operations in a single transaction. + * + * @throws AppwriteException + */ + public function createOperations(string $transactionId, ?array $operations = null): \Appwrite\Models\Transaction + { + $apiPath = str_replace( + ['{transactionId}'], + [$transactionId], + '/vectorsdb/transactions/{transactionId}/operations' + ); + + $apiParams = []; + $apiParams['transactionId'] = $transactionId; + + if (!is_null($operations)) { + $apiParams['operations'] = $operations; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Transaction::from($response); + } + + /** + * Get a database by its unique ID. This endpoint response returns a JSON + * object with the database metadata. + * + * @throws AppwriteException + */ + public function get(string $databaseId): \Appwrite\Models\Database + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Database::from($response); + } + + /** + * Update a database by its unique ID. + * + * @throws AppwriteException + */ + public function update(string $databaseId, string $name, ?bool $enabled = null, ?string $specification = null, ?int $replicas = null, ?string $syncMode = null): \Appwrite\Models\Database + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['name'] = $name; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + $apiParams['specification'] = $specification; + $apiParams['replicas'] = $replicas; + $apiParams['syncMode'] = $syncMode; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Database::from($response); + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write + * scope can delete a database. + * + * @throws AppwriteException + */ + public function delete(string $databaseId): string + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all collections that belong to the provided databaseId. You + * can use the search parameter to filter your results. + * + * @throws AppwriteException + */ + public function listCollections(string $databaseId, ?array $queries = null, ?string $search = null, ?bool $total = null): \Appwrite\Models\VectorsdbCollectionList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($search)) { + $apiParams['search'] = $search; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\VectorsdbCollectionList::from($response); + } + + /** + * Create a new Collection. Before using this route, you should create a new + * database resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function createCollection(string $databaseId, string $collectionId, string $name, int $dimension, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): \Appwrite\Models\VectorsdbCollection + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/collections' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + $apiParams['dimension'] = $dimension; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\VectorsdbCollection::from($response); + } + + /** + * Get a collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @throws AppwriteException + */ + public function getCollection(string $databaseId, string $collectionId): \Appwrite\Models\VectorsdbCollection + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\VectorsdbCollection::from($response); + } + + /** + * Update a collection by its unique ID. + * + * @throws AppwriteException + */ + public function updateCollection(string $databaseId, string $collectionId, string $name, ?int $dimension = null, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): \Appwrite\Models\VectorsdbCollection + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['name'] = $name; + + if (!is_null($dimension)) { + $apiParams['dimension'] = $dimension; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($documentSecurity)) { + $apiParams['documentSecurity'] = $documentSecurity; + } + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\VectorsdbCollection::from($response); + } + + /** + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @throws AppwriteException + */ + public function deleteCollection(string $databaseId, string $collectionId): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all the user's documents in a given collection. You can use + * the query params to filter your results. + * + * @throws AppwriteException + */ + public function listDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function createDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + $apiParams['data'] = $data; + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Create new Documents. Before using this route, you should create a new + * collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function createDocuments(string $databaseId, string $collectionId, array $documents): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Create or update Documents. Before using this route, you should create a + * new collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function upsertDocuments(string $databaseId, string $collectionId, array $documents, ?string $transactionId = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documents'] = $documents; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * 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. + * + * @throws AppwriteException + */ + public function updateDocuments(string $databaseId, string $collectionId, ?array $data = null, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Bulk delete documents using queries, if no queries are passed then all + * documents are deleted. + * + * @throws AppwriteException + */ + public function deleteDocuments(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Get a list of all the user's documents in a given collection using a POST + * request. This behaves identically to the list documents endpoint but + * accepts the queries in the request body, allowing much larger `queries` + * arrays than can fit in a URL query string. + * + * @throws AppwriteException + */ + public function createQuery(string $databaseId, string $collectionId, ?array $queries = null, ?string $transactionId = null, ?bool $total = null, ?int $ttl = null): \Appwrite\Models\DocumentList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/query' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + if (!is_null($ttl)) { + $apiParams['ttl'] = $ttl; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DocumentList::from($response); + } + + /** + * Get a document by its unique ID. This endpoint response returns a JSON + * object with the document data. + * + * @throws AppwriteException + */ + public function getDocument(string $databaseId, string $collectionId, string $documentId, ?array $queries = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Create or update a Document. Before using this route, you should create a + * new collection resource using either a [server + * integration](https://appwrite.io/docs/server/databases#documentsDBCreateCollection) + * API or directly from your database console. + * + * @throws AppwriteException + */ + public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Update a document by its unique ID. Using the patch method you can pass + * only specific fields that will get updated. + * + * @throws AppwriteException + */ + public function updateDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): \Appwrite\Models\Document + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } + + if (!is_null($permissions)) { + $apiParams['permissions'] = $permissions; + } + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Document::from($response); + } + + /** + * Delete a document by its unique ID. + * + * @throws AppwriteException + */ + public function deleteDocument(string $databaseId, string $collectionId, string $documentId, ?string $transactionId = null): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{documentId}'], + [$databaseId, $collectionId, $documentId], + '/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['documentId'] = $documentId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List indexes in the collection. + * + * @throws AppwriteException + */ + public function listIndexes(string $databaseId, string $collectionId, ?array $queries = null, ?bool $total = null): \Appwrite\Models\IndexList + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\IndexList::from($response); + } + + /** + * Creates an index on the attributes listed. Your index should include all + * the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @throws AppwriteException + */ + public function createIndex(string $databaseId, string $collectionId, string $key, VectorsDBIndexType $type, array $attributes, ?array $orders = null, ?array $lengths = null): \Appwrite\Models\Index + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['type'] = $type; + $apiParams['attributes'] = $attributes; + + if (!is_null($orders)) { + $apiParams['orders'] = $orders; + } + + if (!is_null($lengths)) { + $apiParams['lengths'] = $lengths; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Index::from($response); + } + + /** + * Get index by ID. + * + * @throws AppwriteException + */ + public function getIndex(string $databaseId, string $collectionId, string $key): \Appwrite\Models\Index + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Index::from($response); + } + + /** + * Delete an index. + * + * @throws AppwriteException + */ + public function deleteIndex(string $databaseId, string $collectionId, string $key): string + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/vectorsdb/{databaseId}/collections/{collectionId}/indexes/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Trigger a manual failover for a dedicated database with high availability + * enabled. Promotes a replica to primary. The failover runs asynchronously; + * poll the database document for status updates. A database left + * mid-operation also accepts this call as a repair once nothing is driving + * the operation it is stuck in. Repairing a failover that did not finish, a + * `failed` database, a stranded upgrade or migrate, or a stranded compute + * resize additionally requires `targetReplicaId` to name the member to + * promote, because the default target may be the member that operation + * already promoted. + * + * @throws AppwriteException + */ + public function createFailover(string $databaseId, ?string $targetReplicaId = null): \Appwrite\Models\DedicatedDatabase + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/failovers' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['targetReplicaId'] = $targetReplicaId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabase::from($response); + } + + /** + * List the lifecycle operations recorded for a dedicated database, newest + * first. Every provision, update, restore, backup and replication action is + * recorded here with its outcome, including an attempt that was abandoned + * because another worker took over the database. + * + * @throws AppwriteException + */ + public function listOperations(string $databaseId, ?string $status = null, ?int $limit = null, ?int $offset = null): \Appwrite\Models\DedicatedDatabaseOperationList + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/operations' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + if (!is_null($status)) { + $apiParams['status'] = $status; + } + + if (!is_null($limit)) { + $apiParams['limit'] = $limit; + } + + if (!is_null($offset)) { + $apiParams['offset'] = $offset; + } + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseOperationList::from($response); + } + + /** + * Get high availability status for a dedicated database. Returns replica + * statuses, replication lag, and sync mode. + * + * @throws AppwriteException + */ + public function getReplicas(string $databaseId): \Appwrite\Models\DedicatedDatabaseReplicas + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/replicas' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DedicatedDatabaseReplicas::from($response); + } + + /** + * Get real-time health and status information for a dedicated database. + * Returns health status, readiness, uptime, connection info, replica status, + * and volume information. + * + * @throws AppwriteException + */ + public function getStatus(string $databaseId): \Appwrite\Models\DatabaseStatus + { + $apiPath = str_replace( + ['{databaseId}'], + [$databaseId], + '/vectorsdb/{databaseId}/status' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\DatabaseStatus::from($response); + } +} diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index 4c61a66..b8aeaf1 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -515,7 +515,7 @@ public function testMethodCreateBigIntAttribute(): void $response = $this->databases->createBigIntAttribute( "", "", - "", + "", true ); @@ -543,7 +543,7 @@ public function testMethodUpdateBigIntAttribute(): void $response = $this->databases->updateBigIntAttribute( "", "", - "", + "", true, 1 ); @@ -572,7 +572,7 @@ public function testMethodCreateBooleanAttribute(): void $response = $this->databases->createBooleanAttribute( "", "", - "", + "", true ); @@ -600,7 +600,7 @@ public function testMethodUpdateBooleanAttribute(): void $response = $this->databases->updateBooleanAttribute( "", "", - "", + "", true, true ); @@ -630,7 +630,7 @@ public function testMethodCreateDatetimeAttribute(): void $response = $this->databases->createDatetimeAttribute( "", "", - "", + "", true ); @@ -659,7 +659,7 @@ public function testMethodUpdateDatetimeAttribute(): void $response = $this->databases->updateDatetimeAttribute( "", "", - "", + "", true, "2020-10-15T06:38:00.000+00:00" ); @@ -689,7 +689,7 @@ public function testMethodCreateEmailAttribute(): void $response = $this->databases->createEmailAttribute( "", "", - "", + "", true ); @@ -718,7 +718,7 @@ public function testMethodUpdateEmailAttribute(): void $response = $this->databases->updateEmailAttribute( "", "", - "", + "", true, "email@example.com" ); @@ -749,7 +749,7 @@ public function testMethodCreateEnumAttribute(): void $response = $this->databases->createEnumAttribute( "", "", - "", + "", [], true ); @@ -780,10 +780,10 @@ public function testMethodUpdateEnumAttribute(): void $response = $this->databases->updateEnumAttribute( "", "", - "", + "", [], true, - "" + "active" ); $this->assertInstanceOf(\Appwrite\Models\AttributeEnum::class, $response); @@ -810,7 +810,7 @@ public function testMethodCreateFloatAttribute(): void $response = $this->databases->createFloatAttribute( "", "", - "", + "", true ); @@ -838,7 +838,7 @@ public function testMethodUpdateFloatAttribute(): void $response = $this->databases->updateFloatAttribute( "", "", - "", + "", true, 1.0 ); @@ -867,7 +867,7 @@ public function testMethodCreateIntegerAttribute(): void $response = $this->databases->createIntegerAttribute( "", "", - "", + "", true ); @@ -895,7 +895,7 @@ public function testMethodUpdateIntegerAttribute(): void $response = $this->databases->updateIntegerAttribute( "", "", - "", + "", true, 1 ); @@ -925,7 +925,7 @@ public function testMethodCreateIpAttribute(): void $response = $this->databases->createIpAttribute( "", "", - "", + "", true ); @@ -954,9 +954,9 @@ public function testMethodUpdateIpAttribute(): void $response = $this->databases->updateIpAttribute( "", "", - "", + "", true, - "" + "192.0.2.0" ); $this->assertInstanceOf(\Appwrite\Models\AttributeIp::class, $response); @@ -983,7 +983,7 @@ public function testMethodCreateLineAttribute(): void $response = $this->databases->createLineAttribute( "", "", - "", + "", true ); @@ -1011,7 +1011,7 @@ public function testMethodUpdateLineAttribute(): void $response = $this->databases->updateLineAttribute( "", "", - "", + "", true ); @@ -1039,7 +1039,7 @@ public function testMethodCreateLongtextAttribute(): void $response = $this->databases->createLongtextAttribute( "", "", - "", + "", true ); @@ -1067,9 +1067,9 @@ public function testMethodUpdateLongtextAttribute(): void $response = $this->databases->updateLongtextAttribute( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\AttributeLongtext::class, $response); @@ -1096,7 +1096,7 @@ public function testMethodCreateMediumtextAttribute(): void $response = $this->databases->createMediumtextAttribute( "", "", - "", + "", true ); @@ -1124,9 +1124,9 @@ public function testMethodUpdateMediumtextAttribute(): void $response = $this->databases->updateMediumtextAttribute( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\AttributeMediumtext::class, $response); @@ -1153,7 +1153,7 @@ public function testMethodCreatePointAttribute(): void $response = $this->databases->createPointAttribute( "", "", - "", + "", true ); @@ -1181,7 +1181,7 @@ public function testMethodUpdatePointAttribute(): void $response = $this->databases->updatePointAttribute( "", "", - "", + "", true ); @@ -1209,7 +1209,7 @@ public function testMethodCreatePolygonAttribute(): void $response = $this->databases->createPolygonAttribute( "", "", - "", + "", true ); @@ -1237,7 +1237,7 @@ public function testMethodUpdatePolygonAttribute(): void $response = $this->databases->updatePolygonAttribute( "", "", - "", + "", true ); @@ -1305,7 +1305,7 @@ public function testMethodUpdateRelationshipAttribute(): void $response = $this->databases->updateRelationshipAttribute( "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\AttributeRelationship::class, $response); @@ -1333,7 +1333,7 @@ public function testMethodCreateStringAttribute(): void $response = $this->databases->createStringAttribute( "", "", - "", + "", 1, true ); @@ -1363,9 +1363,9 @@ public function testMethodUpdateStringAttribute(): void $response = $this->databases->updateStringAttribute( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); @@ -1392,7 +1392,7 @@ public function testMethodCreateTextAttribute(): void $response = $this->databases->createTextAttribute( "", "", - "", + "", true ); @@ -1420,9 +1420,9 @@ public function testMethodUpdateTextAttribute(): void $response = $this->databases->updateTextAttribute( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\AttributeText::class, $response); @@ -1450,7 +1450,7 @@ public function testMethodCreateUrlAttribute(): void $response = $this->databases->createUrlAttribute( "", "", - "", + "", true ); @@ -1479,7 +1479,7 @@ public function testMethodUpdateUrlAttribute(): void $response = $this->databases->updateUrlAttribute( "", "", - "", + "", true, "https://example.com" ); @@ -1509,7 +1509,7 @@ public function testMethodCreateVarcharAttribute(): void $response = $this->databases->createVarcharAttribute( "", "", - "", + "", 1, true ); @@ -1539,9 +1539,9 @@ public function testMethodUpdateVarcharAttribute(): void $response = $this->databases->updateVarcharAttribute( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\AttributeVarchar::class, $response); @@ -1574,7 +1574,7 @@ public function testMethodGetAttribute(): void $response = $this->databases->getAttribute( "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\AttributeString::class, $response); @@ -1593,7 +1593,7 @@ public function testMethodDeleteAttribute(): void $response = $this->databases->deleteAttribute( "", "", - "" + "" ); $this->assertSame($data, $response); @@ -1906,7 +1906,7 @@ public function testMethodDecrementDocumentAttribute(): void "", "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); @@ -1934,7 +1934,7 @@ public function testMethodIncrementDocumentAttribute(): void "", "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); @@ -1996,7 +1996,7 @@ public function testMethodCreateIndex(): void $response = $this->databases->createIndex( "", "", - "", + "", DatabasesIndexType::KEY(), [] ); @@ -2027,7 +2027,7 @@ public function testMethodGetIndex(): void $response = $this->databases->getIndex( "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); @@ -2046,7 +2046,7 @@ public function testMethodDeleteIndex(): void $response = $this->databases->deleteIndex( "", "", - "" + "" ); $this->assertSame($data, $response); diff --git a/tests/Appwrite/Services/DocumentsDBTest.php b/tests/Appwrite/Services/DocumentsDBTest.php new file mode 100644 index 0000000..3a9ffdd --- /dev/null +++ b/tests/Appwrite/Services/DocumentsDBTest.php @@ -0,0 +1,1136 @@ +client = Mockery::mock(Client::class); + $this->documentsDB = new DocumentsDB($this->client); + } + + public function testMethodList(): void + { + $data = [ + "total" => 5, + "databases" => [ + [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->list(); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); + } + public function testMethodCreate(): void + { + $data = [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->create( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + public function testMethodListSpecifications(): void + { + $data = [ + "specifications" => [ + [ + "slug" => "s-2vcpu-2gb", + "name" => "Standard", + "price" => 20, + "cpu" => 2000, + "memory" => 2048, + "maxConnections" => 200, + "includedStorage" => 25, + "includedBandwidth" => 200, + "enabled" => true + ] + ], + "total" => 9, + "pricing" => [ + "storageOverageRate" => 0.125, + "bandwidthOverageRate" => 0.08, + "replicaRate" => 1, + "pitrRate" => 0.2 + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->listSpecifications(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseSpecificationList::class, $response); + } + public function testMethodListTransactions(): void + { + $data = [ + "total" => 5, + "transactions" => [ + [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->listTransactions(); + + $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); + } + public function testMethodCreateTransaction(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->createTransaction(); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodGetTransaction(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->getTransaction( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodUpdateTransaction(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->updateTransaction( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodDeleteTransaction(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->deleteTransaction( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateOperations(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->createOperations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodGet(): void + { + $data = [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->get( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + public function testMethodUpdate(): void + { + $data = [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->update( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->delete( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListCollections(): void + { + $data = [ + "total" => 5, + "collections" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500 + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->listCollections( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\CollectionList::class, $response); + } + public function testMethodCreateCollection(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->createCollection( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } + public function testMethodGetCollection(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->getCollection( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } + public function testMethodUpdateCollection(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->updateCollection( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Collection::class, $response); + } + public function testMethodDeleteCollection(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->deleteCollection( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->listDocuments( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodCreateDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->createDocument( + "", + "", + "", + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodCreateDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->createDocuments( + "", + "", + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodUpsertDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->upsertDocuments( + "", + "", + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodUpdateDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->updateDocuments( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodDeleteDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->deleteDocuments( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodGetDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->getDocument( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodUpsertDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->upsertDocument( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodUpdateDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->updateDocument( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodDeleteDocument(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->deleteDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodDecrementDocumentAttribute(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->decrementDocumentAttribute( + "", + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodIncrementDocumentAttribute(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->incrementDocumentAttribute( + "", + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodListIndexes(): void + { + $data = [ + "total" => 5, + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->listIndexes( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\IndexList::class, $response); + } + public function testMethodCreateIndex(): void + { + $data = [ + "\$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" => [], + "lengths" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->createIndex( + "", + "", + "", + DocumentsDBIndexType::KEY(), + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } + public function testMethodGetIndex(): void + { + $data = [ + "\$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" => [], + "lengths" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->getIndex( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } + public function testMethodDeleteIndex(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->deleteIndex( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateFailover(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->createFailover( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListOperations(): void + { + $data = [ + "total" => 5, + "operations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "type" => "update", + "status" => "completed", + "attempts" => 1, + "errorCode" => "Interrupted", + "errorMessage" => "[ERRORMESSAGE]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->listOperations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseOperationList::class, $response); + } + public function testMethodGetReplicas(): void + { + $data = [ + "replicas" => 2, + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "members" => [ + [ + "\$id" => "1", + "role" => "replica", + "status" => "active" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->getReplicas( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseReplicas::class, $response); + } + public function testMethodGetStatus(): void + { + $data = [ + "health" => "healthy", + "ready" => true, + "engine" => "postgresql", + "version" => "17", + "uptime" => 86400, + "connections" => [ + "current" => 12, + "max" => 100 + ], + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "replicas" => [ + [ + "index" => 0, + "role" => "primary", + "healthy" => true + ] + ], + "volumes" => [ + [ + "path" => "/var/lib/postgresql/data", + "usedPercent" => "45%", + "available" => "55GB", + "mounted" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->documentsDB->getStatus( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseStatus::class, $response); + } +} diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index edb4266..0e950d3 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -991,7 +991,7 @@ public function testMethodCreateVariable(): void $response = $this->functions->createVariable( "", "", - "", + "", "" ); diff --git a/tests/Appwrite/Services/MongoTest.php b/tests/Appwrite/Services/MongoTest.php new file mode 100644 index 0000000..e8b0a46 --- /dev/null +++ b/tests/Appwrite/Services/MongoTest.php @@ -0,0 +1,1329 @@ +client = Mockery::mock(Client::class); + $this->mongo = new Mongo($this->client); + } + + public function testMethodList(): void + { + $data = [ + "total" => 5, + "databases" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->list(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseList::class, $response); + } + public function testMethodCreate(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->create( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListSpecifications(): void + { + $data = [ + "specifications" => [ + [ + "slug" => "s-2vcpu-2gb", + "name" => "Standard", + "price" => 20, + "cpu" => 2000, + "memory" => 2048, + "maxConnections" => 200, + "includedStorage" => 25, + "includedBandwidth" => 200, + "enabled" => true + ] + ], + "total" => 9, + "pricing" => [ + "storageOverageRate" => 0.125, + "bandwidthOverageRate" => 0.08, + "replicaRate" => 1, + "pitrRate" => 0.2 + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->listSpecifications(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseSpecificationList::class, $response); + } + public function testMethodGet(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->get( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdate(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->update( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->delete( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListBackups(): void + { + $data = [ + "total" => 5, + "backups" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->listBackups( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackupList::class, $response); + } + public function testMethodCreateBackup(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->createBackup( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackup::class, $response); + } + public function testMethodListBackupPolicies(): void + { + $data = [ + "total" => 5, + "policies" => [ + [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->listBackupPolicies( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicyList::class, $response); + } + public function testMethodCreateBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->createBackupPolicy( + "", + "", + "", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodGetBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->getBackupPolicy( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodUpdateBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->updateBackupPolicy( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodDeleteBackupPolicy(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->deleteBackupPolicy( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateBackupStorage(): void + { + $data = [ + "provider" => "s3", + "bucket" => "my-backup-bucket", + "region" => "us-east-1", + "prefix" => "backups/", + "endpoint" => "https://minio.example.com" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->updateBackupStorage( + "", + "s3", + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackupStorage::class, $response); + } + public function testMethodGetBackup(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->getBackup( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackup::class, $response); + } + public function testMethodDeleteBackup(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->deleteBackup( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListBranches(): void + { + $data = [ + "total" => 2, + "branches" => [ + [ + "branchId" => "a1b2c3d4", + "branchName" => "branch-a1b2c3d4", + "namespace" => "db-myproject-mydb-branch-a1b2c3d4", + "expiresAt" => 1711411200, + "host" => "db-myproject-mydb-a1b2c3d4.fra.appwrite.center", + "port" => 5432, + "database" => "db-myproject-mydb-a1b2c3d4", + "username" => "appwrite", + "password" => "********", + "ssl" => true, + "engine" => "postgresql", + "connectionString" => "postgresql://appwrite:****@db-myproject-mydb-a1b2c3d4.fra.appwrite.center:5432/db-myproject-mydb-a1b2c3d4?sslmode=disable" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->listBranches( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBranchList::class, $response); + } + public function testMethodCreateBranch(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->createBranch( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodDeleteBranch(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->deleteBranch( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdateCredentials(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->updateCredentials( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodCreateFailover(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->createFailover( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdateMaintenance(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->updateMaintenance( + "", + "sun", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodCreateMigration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->createMigration( + "", + "shared" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListOperations(): void + { + $data = [ + "total" => 5, + "operations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "type" => "update", + "status" => "completed", + "attempts" => 1, + "errorCode" => "Interrupted", + "errorMessage" => "[ERRORMESSAGE]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->listOperations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseOperationList::class, $response); + } + public function testMethodGetPitr(): void + { + $data = [ + "earliest" => "2020-10-15T06:38:00.000+00:00", + "latest" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->getPitr( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabasePITRWindows::class, $response); + } + public function testMethodGetReplicas(): void + { + $data = [ + "replicas" => 2, + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "members" => [ + [ + "\$id" => "1", + "role" => "replica", + "status" => "active" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->getReplicas( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseReplicas::class, $response); + } + public function testMethodListRestorations(): void + { + $data = [ + "total" => 5, + "restorations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->listRestorations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestorationList::class, $response); + } + public function testMethodCreateRestoration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->createRestoration( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestoration::class, $response); + } + public function testMethodGetRestoration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->getRestoration( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestoration::class, $response); + } + public function testMethodGetStatus(): void + { + $data = [ + "health" => "healthy", + "ready" => true, + "engine" => "postgresql", + "version" => "17", + "uptime" => 86400, + "connections" => [ + "current" => 12, + "max" => 100 + ], + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "replicas" => [ + [ + "index" => 0, + "role" => "primary", + "healthy" => true + ] + ], + "volumes" => [ + [ + "path" => "/var/lib/postgresql/data", + "usedPercent" => "45%", + "available" => "55GB", + "mounted" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->getStatus( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseStatus::class, $response); + } + public function testMethodCreateUpgrade(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mongo->createUpgrade( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } +} diff --git a/tests/Appwrite/Services/MysqlTest.php b/tests/Appwrite/Services/MysqlTest.php new file mode 100644 index 0000000..04478bf --- /dev/null +++ b/tests/Appwrite/Services/MysqlTest.php @@ -0,0 +1,1415 @@ +client = Mockery::mock(Client::class); + $this->mysql = new Mysql($this->client); + } + + public function testMethodList(): void + { + $data = [ + "total" => 5, + "databases" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->list(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseList::class, $response); + } + public function testMethodCreate(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->create( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListSpecifications(): void + { + $data = [ + "specifications" => [ + [ + "slug" => "s-2vcpu-2gb", + "name" => "Standard", + "price" => 20, + "cpu" => 2000, + "memory" => 2048, + "maxConnections" => 200, + "includedStorage" => 25, + "includedBandwidth" => 200, + "enabled" => true + ] + ], + "total" => 9, + "pricing" => [ + "storageOverageRate" => 0.125, + "bandwidthOverageRate" => 0.08, + "replicaRate" => 1, + "pitrRate" => 0.2 + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->listSpecifications(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseSpecificationList::class, $response); + } + public function testMethodGet(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->get( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdate(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->update( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->delete( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListBackups(): void + { + $data = [ + "total" => 5, + "backups" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->listBackups( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackupList::class, $response); + } + public function testMethodCreateBackup(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createBackup( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackup::class, $response); + } + public function testMethodListBackupPolicies(): void + { + $data = [ + "total" => 5, + "policies" => [ + [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->listBackupPolicies( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicyList::class, $response); + } + public function testMethodCreateBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createBackupPolicy( + "", + "", + "", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodGetBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->getBackupPolicy( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodUpdateBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->updateBackupPolicy( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodDeleteBackupPolicy(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->deleteBackupPolicy( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateBackupStorage(): void + { + $data = [ + "provider" => "s3", + "bucket" => "my-backup-bucket", + "region" => "us-east-1", + "prefix" => "backups/", + "endpoint" => "https://minio.example.com" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->updateBackupStorage( + "", + "s3", + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackupStorage::class, $response); + } + public function testMethodGetBackup(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->getBackup( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackup::class, $response); + } + public function testMethodDeleteBackup(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->deleteBackup( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListBranches(): void + { + $data = [ + "total" => 2, + "branches" => [ + [ + "branchId" => "a1b2c3d4", + "branchName" => "branch-a1b2c3d4", + "namespace" => "db-myproject-mydb-branch-a1b2c3d4", + "expiresAt" => 1711411200, + "host" => "db-myproject-mydb-a1b2c3d4.fra.appwrite.center", + "port" => 5432, + "database" => "db-myproject-mydb-a1b2c3d4", + "username" => "appwrite", + "password" => "********", + "ssl" => true, + "engine" => "postgresql", + "connectionString" => "postgresql://appwrite:****@db-myproject-mydb-a1b2c3d4.fra.appwrite.center:5432/db-myproject-mydb-a1b2c3d4?sslmode=disable" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->listBranches( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBranchList::class, $response); + } + public function testMethodCreateBranch(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createBranch( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodDeleteBranch(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->deleteBranch( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdateCredentials(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->updateCredentials( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodCreateExecution(): void + { + $data = [ + "rows" => [], + "rowCount" => 1, + "columns" => [ + [ + "name" => "id", + "type" => "int4" + ] + ], + "durationMs" => 12, + "truncated" => true, + "bytes" => 1024 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createExecution( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseExecution::class, $response); + } + public function testMethodCreateFailover(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createFailover( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdateMaintenance(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->updateMaintenance( + "", + "sun", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodCreateMigration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createMigration( + "", + "shared" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListOperations(): void + { + $data = [ + "total" => 5, + "operations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "type" => "update", + "status" => "completed", + "attempts" => 1, + "errorCode" => "Interrupted", + "errorMessage" => "[ERRORMESSAGE]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->listOperations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseOperationList::class, $response); + } + public function testMethodGetPitr(): void + { + $data = [ + "earliest" => "2020-10-15T06:38:00.000+00:00", + "latest" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->getPitr( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabasePITRWindows::class, $response); + } + public function testMethodGetPooler(): void + { + $data = [ + "enabled" => true, + "mode" => "transaction", + "maxConnections" => 200, + "defaultPoolSize" => 25, + "port" => 6432, + "readWriteSplitting" => true, + "poolerCpuRequest" => "100m", + "poolerCpuLimit" => "200m", + "poolerMemoryRequest" => "64Mi", + "poolerMemoryLimit" => "128Mi" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->getPooler( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabasePooler::class, $response); + } + public function testMethodUpdatePooler(): void + { + $data = [ + "enabled" => true, + "mode" => "transaction", + "maxConnections" => 200, + "defaultPoolSize" => 25, + "port" => 6432, + "readWriteSplitting" => true, + "poolerCpuRequest" => "100m", + "poolerCpuLimit" => "200m", + "poolerMemoryRequest" => "64Mi", + "poolerMemoryLimit" => "128Mi" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->updatePooler( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabasePooler::class, $response); + } + public function testMethodGetReplicas(): void + { + $data = [ + "replicas" => 2, + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "members" => [ + [ + "\$id" => "1", + "role" => "replica", + "status" => "active" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->getReplicas( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseReplicas::class, $response); + } + public function testMethodListRestorations(): void + { + $data = [ + "total" => 5, + "restorations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->listRestorations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestorationList::class, $response); + } + public function testMethodCreateRestoration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createRestoration( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestoration::class, $response); + } + public function testMethodGetRestoration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->getRestoration( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestoration::class, $response); + } + public function testMethodGetStatus(): void + { + $data = [ + "health" => "healthy", + "ready" => true, + "engine" => "postgresql", + "version" => "17", + "uptime" => 86400, + "connections" => [ + "current" => 12, + "max" => 100 + ], + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "replicas" => [ + [ + "index" => 0, + "role" => "primary", + "healthy" => true + ] + ], + "volumes" => [ + [ + "path" => "/var/lib/postgresql/data", + "usedPercent" => "45%", + "available" => "55GB", + "mounted" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->getStatus( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseStatus::class, $response); + } + public function testMethodCreateUpgrade(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->mysql->createUpgrade( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } +} diff --git a/tests/Appwrite/Services/OrganizationTest.php b/tests/Appwrite/Services/OrganizationTest.php index b60dcc8..7d97f8f 100644 --- a/tests/Appwrite/Services/OrganizationTest.php +++ b/tests/Appwrite/Services/OrganizationTest.php @@ -957,7 +957,7 @@ public function testMethodCreateProject(): void ->andReturn(''); $response = $this->organization->createProject( - "", + "", "" ); diff --git a/tests/Appwrite/Services/PostgresqlTest.php b/tests/Appwrite/Services/PostgresqlTest.php new file mode 100644 index 0000000..4c90a6e --- /dev/null +++ b/tests/Appwrite/Services/PostgresqlTest.php @@ -0,0 +1,1573 @@ +client = Mockery::mock(Client::class); + $this->postgresql = new Postgresql($this->client); + } + + public function testMethodList(): void + { + $data = [ + "total" => 5, + "databases" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->list(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseList::class, $response); + } + public function testMethodCreate(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->create( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListSpecifications(): void + { + $data = [ + "specifications" => [ + [ + "slug" => "s-2vcpu-2gb", + "name" => "Standard", + "price" => 20, + "cpu" => 2000, + "memory" => 2048, + "maxConnections" => 200, + "includedStorage" => 25, + "includedBandwidth" => 200, + "enabled" => true + ] + ], + "total" => 9, + "pricing" => [ + "storageOverageRate" => 0.125, + "bandwidthOverageRate" => 0.08, + "replicaRate" => 1, + "pitrRate" => 0.2 + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->listSpecifications(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseSpecificationList::class, $response); + } + public function testMethodGet(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->get( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdate(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->update( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->delete( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListBackups(): void + { + $data = [ + "total" => 5, + "backups" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->listBackups( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackupList::class, $response); + } + public function testMethodCreateBackup(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createBackup( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackup::class, $response); + } + public function testMethodListBackupPolicies(): void + { + $data = [ + "total" => 5, + "policies" => [ + [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->listBackupPolicies( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicyList::class, $response); + } + public function testMethodCreateBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createBackupPolicy( + "", + "", + "", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodGetBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->getBackupPolicy( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodUpdateBackupPolicy(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => [], + "resources" => [], + "retention" => 7, + "schedule" => "0 * * * *", + "type" => "full", + "enabled" => true + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->updateBackupPolicy( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\BackupPolicy::class, $response); + } + public function testMethodDeleteBackupPolicy(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->deleteBackupPolicy( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodUpdateBackupStorage(): void + { + $data = [ + "provider" => "s3", + "bucket" => "my-backup-bucket", + "region" => "us-east-1", + "prefix" => "backups/", + "endpoint" => "https://minio.example.com" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->updateBackupStorage( + "", + "s3", + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackupStorage::class, $response); + } + public function testMethodGetBackup(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "policyId" => "5e5ea5c16897e", + "trigger" => "schedule", + "type" => "full", + "requestedType" => "incremental", + "fallbackReason" => "PostgreSQL incremental backups are not offered because they cannot be restored: archived WAL is physical and cannot replay onto a logically-restored base. A full backup was taken instead; use a point-in-time restore (targetTime) to recover to a moment between fulls.", + "status" => "completed", + "sizeBytes" => 1073741824, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->getBackup( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBackup::class, $response); + } + public function testMethodDeleteBackup(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->deleteBackup( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListBranches(): void + { + $data = [ + "total" => 2, + "branches" => [ + [ + "branchId" => "a1b2c3d4", + "branchName" => "branch-a1b2c3d4", + "namespace" => "db-myproject-mydb-branch-a1b2c3d4", + "expiresAt" => 1711411200, + "host" => "db-myproject-mydb-a1b2c3d4.fra.appwrite.center", + "port" => 5432, + "database" => "db-myproject-mydb-a1b2c3d4", + "username" => "appwrite", + "password" => "********", + "ssl" => true, + "engine" => "postgresql", + "connectionString" => "postgresql://appwrite:****@db-myproject-mydb-a1b2c3d4.fra.appwrite.center:5432/db-myproject-mydb-a1b2c3d4?sslmode=disable" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->listBranches( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseBranchList::class, $response); + } + public function testMethodCreateBranch(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createBranch( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodDeleteBranch(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->deleteBranch( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdateCredentials(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->updateCredentials( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodCreateExecution(): void + { + $data = [ + "rows" => [], + "rowCount" => 1, + "columns" => [ + [ + "name" => "id", + "type" => "int4" + ] + ], + "durationMs" => 12, + "truncated" => true, + "bytes" => 1024 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createExecution( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseExecution::class, $response); + } + public function testMethodListExtensions(): void + { + $data = [ + "installed" => [], + "available" => [], + "metadata" => [ + [ + "key" => "vector", + "name" => "pgvector", + "description" => "Vector data type and similarity search for embeddings.", + "category" => "search" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->listExtensions( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseExtensions::class, $response); + } + public function testMethodCreateExtension(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createExtension( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodDeleteExtension(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->deleteExtension( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodCreateFailover(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createFailover( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodUpdateMaintenance(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->updateMaintenance( + "", + "sun", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodCreateMigration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createMigration( + "", + "shared" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListOperations(): void + { + $data = [ + "total" => 5, + "operations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "type" => "update", + "status" => "completed", + "attempts" => 1, + "errorCode" => "Interrupted", + "errorMessage" => "[ERRORMESSAGE]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->listOperations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseOperationList::class, $response); + } + public function testMethodGetPitr(): void + { + $data = [ + "earliest" => "2020-10-15T06:38:00.000+00:00", + "latest" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->getPitr( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabasePITRWindows::class, $response); + } + public function testMethodGetPooler(): void + { + $data = [ + "enabled" => true, + "mode" => "transaction", + "maxConnections" => 200, + "defaultPoolSize" => 25, + "port" => 6432, + "readWriteSplitting" => true, + "poolerCpuRequest" => "100m", + "poolerCpuLimit" => "200m", + "poolerMemoryRequest" => "64Mi", + "poolerMemoryLimit" => "128Mi" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->getPooler( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabasePooler::class, $response); + } + public function testMethodUpdatePooler(): void + { + $data = [ + "enabled" => true, + "mode" => "transaction", + "maxConnections" => 200, + "defaultPoolSize" => 25, + "port" => 6432, + "readWriteSplitting" => true, + "poolerCpuRequest" => "100m", + "poolerCpuLimit" => "200m", + "poolerMemoryRequest" => "64Mi", + "poolerMemoryLimit" => "128Mi" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->updatePooler( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabasePooler::class, $response); + } + public function testMethodGetReplicas(): void + { + $data = [ + "replicas" => 2, + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "members" => [ + [ + "\$id" => "1", + "role" => "replica", + "status" => "active" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->getReplicas( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseReplicas::class, $response); + } + public function testMethodListRestorations(): void + { + $data = [ + "total" => 5, + "restorations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->listRestorations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestorationList::class, $response); + } + public function testMethodCreateRestoration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createRestoration( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestoration::class, $response); + } + public function testMethodGetRestoration(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "sourceDatabaseId" => "5e5ea5c16897e", + "projectId" => "5e5ea5c16897e", + "backupId" => "5e5ea5c16897e", + "type" => "backup", + "status" => "completed", + "targetTime" => "2020-10-15T06:38:00.000+00:00", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "completedAt" => "2020-10-15T06:38:00.000+00:00", + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->getRestoration( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseRestoration::class, $response); + } + public function testMethodGetStatus(): void + { + $data = [ + "health" => "healthy", + "ready" => true, + "engine" => "postgresql", + "version" => "17", + "uptime" => 86400, + "connections" => [ + "current" => 12, + "max" => 100 + ], + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "replicas" => [ + [ + "index" => 0, + "role" => "primary", + "healthy" => true + ] + ], + "volumes" => [ + [ + "path" => "/var/lib/postgresql/data", + "usedPercent" => "45%", + "available" => "55GB", + "mounted" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->getStatus( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseStatus::class, $response); + } + public function testMethodCreateUpgrade(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->postgresql->createUpgrade( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } +} diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php index 362e48c..edd1009 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -3503,7 +3503,7 @@ public function testMethodCreateVariable(): void $response = $this->project->createVariable( "", - "", + "", "" ); diff --git a/tests/Appwrite/Services/ProxyTest.php b/tests/Appwrite/Services/ProxyTest.php index 89affa1..df5e021 100644 --- a/tests/Appwrite/Services/ProxyTest.php +++ b/tests/Appwrite/Services/ProxyTest.php @@ -40,7 +40,7 @@ public function testMethodCreateInvalidation(): void ->andReturn(''); $response = $this->proxy->createInvalidation( - "", + "example.com", InvalidationType::TAG() ); @@ -108,7 +108,7 @@ public function testMethodCreateAPIRule(): void ->andReturn(''); $response = $this->proxy->createAPIRule( - "" + "example.com" ); $this->assertInstanceOf(\Appwrite\Models\ProxyRule::class, $response); @@ -140,7 +140,7 @@ public function testMethodCreateFunctionRule(): void ->andReturn(''); $response = $this->proxy->createFunctionRule( - "", + "example.com", "" ); @@ -173,7 +173,7 @@ public function testMethodCreateRedirectRule(): void ->andReturn(''); $response = $this->proxy->createRedirectRule( - "", + "example.com", "https://example.com", StatusCode::MOVEDPERMANENTLY(), "", @@ -209,7 +209,7 @@ public function testMethodCreateSiteRule(): void ->andReturn(''); $response = $this->proxy->createSiteRule( - "", + "example.com", "" ); diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index b2c9299..b80a554 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -967,7 +967,7 @@ public function testMethodCreateVariable(): void $response = $this->sites->createVariable( "", "", - "", + "", "" ); diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index 6a705d1..010f38c 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -888,7 +888,7 @@ public function testMethodCreateBigIntColumn(): void $response = $this->tablesDB->createBigIntColumn( "", "", - "", + "", true ); @@ -916,7 +916,7 @@ public function testMethodUpdateBigIntColumn(): void $response = $this->tablesDB->updateBigIntColumn( "", "", - "", + "", true, 1 ); @@ -945,7 +945,7 @@ public function testMethodCreateBooleanColumn(): void $response = $this->tablesDB->createBooleanColumn( "", "", - "", + "", true ); @@ -973,7 +973,7 @@ public function testMethodUpdateBooleanColumn(): void $response = $this->tablesDB->updateBooleanColumn( "", "", - "", + "", true, true ); @@ -1003,7 +1003,7 @@ public function testMethodCreateDatetimeColumn(): void $response = $this->tablesDB->createDatetimeColumn( "", "", - "", + "", true ); @@ -1032,7 +1032,7 @@ public function testMethodUpdateDatetimeColumn(): void $response = $this->tablesDB->updateDatetimeColumn( "", "", - "", + "", true, "2020-10-15T06:38:00.000+00:00" ); @@ -1062,7 +1062,7 @@ public function testMethodCreateEmailColumn(): void $response = $this->tablesDB->createEmailColumn( "", "", - "", + "", true ); @@ -1091,7 +1091,7 @@ public function testMethodUpdateEmailColumn(): void $response = $this->tablesDB->updateEmailColumn( "", "", - "", + "", true, "email@example.com" ); @@ -1122,7 +1122,7 @@ public function testMethodCreateEnumColumn(): void $response = $this->tablesDB->createEnumColumn( "", "", - "", + "", [], true ); @@ -1153,10 +1153,10 @@ public function testMethodUpdateEnumColumn(): void $response = $this->tablesDB->updateEnumColumn( "", "", - "", + "", [], true, - "" + "active" ); $this->assertInstanceOf(\Appwrite\Models\ColumnEnum::class, $response); @@ -1183,7 +1183,7 @@ public function testMethodCreateFloatColumn(): void $response = $this->tablesDB->createFloatColumn( "", "", - "", + "", true ); @@ -1211,7 +1211,7 @@ public function testMethodUpdateFloatColumn(): void $response = $this->tablesDB->updateFloatColumn( "", "", - "", + "", true, 1.0 ); @@ -1240,7 +1240,7 @@ public function testMethodCreateIntegerColumn(): void $response = $this->tablesDB->createIntegerColumn( "", "", - "", + "", true ); @@ -1268,7 +1268,7 @@ public function testMethodUpdateIntegerColumn(): void $response = $this->tablesDB->updateIntegerColumn( "", "", - "", + "", true, 1 ); @@ -1298,7 +1298,7 @@ public function testMethodCreateIpColumn(): void $response = $this->tablesDB->createIpColumn( "", "", - "", + "", true ); @@ -1327,9 +1327,9 @@ public function testMethodUpdateIpColumn(): void $response = $this->tablesDB->updateIpColumn( "", "", - "", + "", true, - "" + "192.0.2.0" ); $this->assertInstanceOf(\Appwrite\Models\ColumnIp::class, $response); @@ -1356,7 +1356,7 @@ public function testMethodCreateLineColumn(): void $response = $this->tablesDB->createLineColumn( "", "", - "", + "", true ); @@ -1384,7 +1384,7 @@ public function testMethodUpdateLineColumn(): void $response = $this->tablesDB->updateLineColumn( "", "", - "", + "", true ); @@ -1412,7 +1412,7 @@ public function testMethodCreateLongtextColumn(): void $response = $this->tablesDB->createLongtextColumn( "", "", - "", + "", true ); @@ -1440,9 +1440,9 @@ public function testMethodUpdateLongtextColumn(): void $response = $this->tablesDB->updateLongtextColumn( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\ColumnLongtext::class, $response); @@ -1469,7 +1469,7 @@ public function testMethodCreateMediumtextColumn(): void $response = $this->tablesDB->createMediumtextColumn( "", "", - "", + "", true ); @@ -1497,9 +1497,9 @@ public function testMethodUpdateMediumtextColumn(): void $response = $this->tablesDB->updateMediumtextColumn( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\ColumnMediumtext::class, $response); @@ -1526,7 +1526,7 @@ public function testMethodCreatePointColumn(): void $response = $this->tablesDB->createPointColumn( "", "", - "", + "", true ); @@ -1554,7 +1554,7 @@ public function testMethodUpdatePointColumn(): void $response = $this->tablesDB->updatePointColumn( "", "", - "", + "", true ); @@ -1582,7 +1582,7 @@ public function testMethodCreatePolygonColumn(): void $response = $this->tablesDB->createPolygonColumn( "", "", - "", + "", true ); @@ -1610,7 +1610,7 @@ public function testMethodUpdatePolygonColumn(): void $response = $this->tablesDB->updatePolygonColumn( "", "", - "", + "", true ); @@ -1673,7 +1673,7 @@ public function testMethodCreateStringColumn(): void $response = $this->tablesDB->createStringColumn( "", "", - "", + "", 1, true ); @@ -1703,9 +1703,9 @@ public function testMethodUpdateStringColumn(): void $response = $this->tablesDB->updateStringColumn( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); @@ -1732,7 +1732,7 @@ public function testMethodCreateTextColumn(): void $response = $this->tablesDB->createTextColumn( "", "", - "", + "", true ); @@ -1760,9 +1760,9 @@ public function testMethodUpdateTextColumn(): void $response = $this->tablesDB->updateTextColumn( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\ColumnText::class, $response); @@ -1790,7 +1790,7 @@ public function testMethodCreateUrlColumn(): void $response = $this->tablesDB->createUrlColumn( "", "", - "", + "", true ); @@ -1819,7 +1819,7 @@ public function testMethodUpdateUrlColumn(): void $response = $this->tablesDB->updateUrlColumn( "", "", - "", + "", true, "https://example.com" ); @@ -1849,7 +1849,7 @@ public function testMethodCreateVarcharColumn(): void $response = $this->tablesDB->createVarcharColumn( "", "", - "", + "", 1, true ); @@ -1879,9 +1879,9 @@ public function testMethodUpdateVarcharColumn(): void $response = $this->tablesDB->updateVarcharColumn( "", "", - "", + "", true, - "" + "Hello World" ); $this->assertInstanceOf(\Appwrite\Models\ColumnVarchar::class, $response); @@ -1914,7 +1914,7 @@ public function testMethodGetColumn(): void $response = $this->tablesDB->getColumn( "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\ColumnString::class, $response); @@ -1933,7 +1933,7 @@ public function testMethodDeleteColumn(): void $response = $this->tablesDB->deleteColumn( "", "", - "" + "" ); $this->assertSame($data, $response); @@ -1966,7 +1966,7 @@ public function testMethodUpdateRelationshipColumn(): void $response = $this->tablesDB->updateRelationshipColumn( "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\ColumnRelationship::class, $response); @@ -2028,7 +2028,7 @@ public function testMethodCreateIndex(): void $response = $this->tablesDB->createIndex( "", "", - "", + "", TablesDBIndexType::KEY(), [] ); @@ -2059,7 +2059,7 @@ public function testMethodGetIndex(): void $response = $this->tablesDB->getIndex( "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\ColumnIndex::class, $response); @@ -2078,7 +2078,7 @@ public function testMethodDeleteIndex(): void $response = $this->tablesDB->deleteIndex( "", "", - "" + "" ); $this->assertSame($data, $response); @@ -2391,7 +2391,7 @@ public function testMethodDecrementRowColumn(): void "", "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); @@ -2419,7 +2419,7 @@ public function testMethodIncrementRowColumn(): void "", "", "", - "" + "" ); $this->assertInstanceOf(\Appwrite\Models\Row::class, $response); diff --git a/tests/Appwrite/Services/VectorsDBTest.php b/tests/Appwrite/Services/VectorsDBTest.php new file mode 100644 index 0000000..5e07adb --- /dev/null +++ b/tests/Appwrite/Services/VectorsDBTest.php @@ -0,0 +1,1116 @@ +client = Mockery::mock(Client::class); + $this->vectorsDB = new VectorsDB($this->client); + } + + public function testMethodList(): void + { + $data = [ + "total" => 5, + "databases" => [ + [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->list(); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseList::class, $response); + } + public function testMethodCreate(): void + { + $data = [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->create( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + public function testMethodListSpecifications(): void + { + $data = [ + "specifications" => [ + [ + "slug" => "s-2vcpu-2gb", + "name" => "Standard", + "price" => 20, + "cpu" => 2000, + "memory" => 2048, + "maxConnections" => 200, + "includedStorage" => 25, + "includedBandwidth" => 200, + "enabled" => true + ] + ], + "total" => 9, + "pricing" => [ + "storageOverageRate" => 0.125, + "bandwidthOverageRate" => 0.08, + "replicaRate" => 1, + "pitrRate" => 0.2 + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->listSpecifications(); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseSpecificationList::class, $response); + } + public function testMethodListTransactions(): void + { + $data = [ + "total" => 5, + "transactions" => [ + [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->listTransactions(); + + $this->assertInstanceOf(\Appwrite\Models\TransactionList::class, $response); + } + public function testMethodCreateTransaction(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createTransaction(); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodGetTransaction(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->getTransaction( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodUpdateTransaction(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->updateTransaction( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodDeleteTransaction(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->deleteTransaction( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateOperations(): void + { + $data = [ + "\$id" => "259125845563242502", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "status" => "pending", + "operations" => 5, + "expiresAt" => "2020-10-15T06:38:00.000+00:00" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createOperations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Transaction::class, $response); + } + public function testMethodGet(): void + { + $data = [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->get( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + public function testMethodUpdate(): void + { + $data = [ + "\$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); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->update( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Database::class, $response); + } + public function testMethodDelete(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->delete( + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListCollections(): void + { + $data = [ + "total" => 5, + "collections" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500, + "dimension" => 1536 + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->listCollections( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\VectorsdbCollectionList::class, $response); + } + public function testMethodCreateCollection(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500, + "dimension" => 1536 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createCollection( + "", + "", + "", + 1 + ); + + $this->assertInstanceOf(\Appwrite\Models\VectorsdbCollection::class, $response); + } + public function testMethodGetCollection(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500, + "dimension" => 1536 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->getCollection( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\VectorsdbCollection::class, $response); + } + public function testMethodUpdateCollection(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [], + "databaseId" => "5e5ea5c16897e", + "name" => "My Collection", + "enabled" => true, + "documentSecurity" => true, + "attributes" => [], + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ], + "bytesMax" => 65535, + "bytesUsed" => 1500, + "dimension" => 1536 + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->updateCollection( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\VectorsdbCollection::class, $response); + } + public function testMethodDeleteCollection(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->deleteCollection( + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->listDocuments( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodCreateDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createDocument( + "", + "", + "", + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodCreateDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createDocuments( + "", + "", + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodUpsertDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->upsertDocuments( + "", + "", + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodUpdateDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->updateDocuments( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodDeleteDocuments(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->deleteDocuments( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodCreateQuery(): void + { + $data = [ + "total" => 5, + "documents" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createQuery( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DocumentList::class, $response); + } + public function testMethodGetDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->getDocument( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodUpsertDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->upsertDocument( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodUpdateDocument(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$sequence" => "1", + "\$collectionId" => "5e5ea5c15117e", + "\$databaseId" => "5e5ea5c15117e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "\$permissions" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->updateDocument( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Document::class, $response); + } + public function testMethodDeleteDocument(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->deleteDocument( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodListIndexes(): void + { + $data = [ + "total" => 5, + "indexes" => [ + [ + "\$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" => [], + "lengths" => [] + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->listIndexes( + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\IndexList::class, $response); + } + public function testMethodCreateIndex(): void + { + $data = [ + "\$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" => [], + "lengths" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createIndex( + "", + "", + "", + VectorsDBIndexType::HNSWEUCLIDEAN(), + [] + ); + + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } + public function testMethodGetIndex(): void + { + $data = [ + "\$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" => [], + "lengths" => [] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->getIndex( + "", + "", + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\Index::class, $response); + } + public function testMethodDeleteIndex(): void + { + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->deleteIndex( + "", + "", + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateFailover(): void + { + $data = [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "projectId" => "5e5ea5c16897e", + "name" => "My Production Database", + "api" => "postgresql", + "engine" => "postgresql", + "version" => "16", + "specification" => "s-2vcpu-2gb", + "backend" => "edge", + "hostname" => "db-myproject-mydb.fra.appwrite.center", + "connectionPort" => 5432, + "connectionUser" => "appwrite_user", + "connectionPassword" => "••••••••", + "connectionString" => "postgresql://user:pass@db-myproject-mydb.fra.appwrite.center:5432/postgres?sslmode=require", + "ssl" => true, + "status" => "ready", + "containerStatus" => "active", + "lifecycleState" => "active", + "idleTimeoutMinutes" => 15, + "cpu" => 2000, + "memory" => 4096, + "storage" => 100, + "storageClass" => "ssd", + "storageMaxGb" => 100, + "nodePool" => "db-pool-4vcpu-8gb", + "replicas" => 2, + "syncMode" => "async", + "networkMaxConnections" => 500, + "networkIdleTimeoutSeconds" => 900, + "networkIPAllowlist" => [], + "backupEnabled" => true, + "pitr" => true, + "pitrRetentionDays" => 14, + "storageAutoscaling" => true, + "storageAutoscalingThresholdPercent" => 85, + "storageAutoscalingMaxGb" => 500, + "maintenanceWindowDay" => "sun", + "maintenanceWindowHourUtc" => 3, + "metricsEnabled" => true, + "sqlApiEnabled" => true, + "sqlApiAllowedStatements" => [], + "sqlApiMaxRows" => 10000, + "sqlApiMaxBytes" => 10485760, + "sqlApiTimeoutSeconds" => 30, + "error" => "[ERROR]" + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->createFailover( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabase::class, $response); + } + public function testMethodListOperations(): void + { + $data = [ + "total" => 5, + "operations" => [ + [ + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "databaseId" => "5e5ea5c16897e", + "type" => "update", + "status" => "completed", + "attempts" => 1, + "errorCode" => "Interrupted", + "errorMessage" => "[ERRORMESSAGE]" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->listOperations( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseOperationList::class, $response); + } + public function testMethodGetReplicas(): void + { + $data = [ + "replicas" => 2, + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "members" => [ + [ + "\$id" => "1", + "role" => "replica", + "status" => "active" + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->getReplicas( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DedicatedDatabaseReplicas::class, $response); + } + public function testMethodGetStatus(): void + { + $data = [ + "health" => "healthy", + "ready" => true, + "engine" => "postgresql", + "version" => "17", + "uptime" => 86400, + "connections" => [ + "current" => 12, + "max" => 100 + ], + "syncMode" => "async", + "syncDegraded" => true, + "syncAcknowledgements" => 1, + "syncStandbyCount" => 2, + "replicas" => [ + [ + "index" => 0, + "role" => "primary", + "healthy" => true + ] + ], + "volumes" => [ + [ + "path" => "/var/lib/postgresql/data", + "usedPercent" => "45%", + "available" => "55GB", + "mounted" => true + ] + ] + ]; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->vectorsDB->getStatus( + "" + ); + + $this->assertInstanceOf(\Appwrite\Models\DatabaseStatus::class, $response); + } +} diff --git a/tests/Appwrite/Services/WebhooksTest.php b/tests/Appwrite/Services/WebhooksTest.php index 677b145..6753dc0 100644 --- a/tests/Appwrite/Services/WebhooksTest.php +++ b/tests/Appwrite/Services/WebhooksTest.php @@ -81,7 +81,7 @@ public function testMethodCreate(): void $response = $this->webhooks->create( "", - "", + "https://example.com/webhook", "", [] ); @@ -147,7 +147,7 @@ public function testMethodUpdate(): void $response = $this->webhooks->update( "", "", - "", + "https://example.com/webhook", [] );