diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index b94ebcc..14a26e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,5 @@ # Change Log -## 19.1.0 - -* Added ability to create columns and indexes synchronously while creating a table - -## 19.0.0 - -* Rename `VCSDeploymentType` enum to `VCSReferenceType` -* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters -* Add `Theme`, `Timezone` and `Output` enums - ## 18.0.1 * Fix `TablesDB` service to use correct file name diff --git a/LICENSE b/LICENSE index c1602fc..6f8702b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 3fc6168..6f4db85 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # Appwrite PHP SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1) -![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square&v=1) +![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square&v=1) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-php/releases).** -Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) +Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the PHP SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) diff --git a/composer.json b/composer.json index 83f2bc0..6d9446d 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "appwrite/appwrite", - "description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API", + "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", "type": "library", "license": "BSD-3-Clause", "support": { @@ -16,13 +16,13 @@ } }, "require": { - "php": ">=7.1.0", + "php": ">=8.0.0", "ext-curl": "*", "ext-json": "*" }, "require-dev": { "phpunit/phpunit": "^10", - "mockery/mockery": "^1.6.12" + "mockery/mockery": "1.6.12" }, "minimum-stability": "dev" } \ No newline at end of file diff --git a/docs/account.md b/docs/account.md index f7c0724..1aef77c 100644 --- a/docs/account.md +++ b/docs/account.md @@ -73,6 +73,82 @@ POST https://cloud.appwrite.io/v1/account/jwts ** Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. ** +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| duration | integer | Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. | 900 | + + +```http request +GET https://cloud.appwrite.io/v1/account/keys +``` + +** Get a list of all API keys from the current account. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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/account/keys +``` + +** Create a new account API key. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Key name. Max length: 128 chars. | | +| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | +| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | + + +```http request +GET https://cloud.appwrite.io/v1/account/keys/{keyId} +``` + +** Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key unique ID. | | + + +```http request +PUT https://cloud.appwrite.io/v1/account/keys/{keyId} +``` + +** Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key unique ID. | | +| name | string | Key name. Max length: 128 chars. | | +| scopes | array | Key scopes list. Maximum of 100 scopes are allowed. | | +| expire | string | Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/account/keys/{keyId} +``` + +** Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| keyId | string | **Required** Key unique ID. | | + ```http request GET https://cloud.appwrite.io/v1/account/logs @@ -559,7 +635,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. | | +| provider | string | **Required** OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom, githubImagine, googleImagine. | | | success | string | URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | failure | string | URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | | scopes | array | A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. | [] | diff --git a/docs/backups.md b/docs/backups.md new file mode 100644 index 0000000..36a4ee9 --- /dev/null +++ b/docs/backups.md @@ -0,0 +1,172 @@ +# Backups Service + + +```http request +GET https://cloud.appwrite.io/v1/backups/archives +``` + +** List all archives for a project. ** + +### 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. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/backups/archives +``` + +** Create a new archive asynchronously for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| services | array | Array of services to backup | | +| resourceId | string | Resource ID. When set, only this single resource will be backed up. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/archives/{archiveId} +``` + +** Get a backup archive using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| archiveId | string | **Required** Archive ID. Choose a custom ID`. 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. | | + + +```http request +DELETE https://cloud.appwrite.io/v1/backups/archives/{archiveId} +``` + +** Delete an existing archive for a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| archiveId | string | **Required** 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. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/policies +``` + +** List all policies for a project. ** + +### 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. | [] | + + +```http request +POST https://cloud.appwrite.io/v1/backups/policies +``` + +** Create a new backup policy. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| 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. | | +| services | array | Array of services to backup | | +| resourceId | string | Resource ID. When set, only this single resource will be backed up. | | +| enabled | boolean | Is policy enabled? When set to 'disabled', no backups will be taken | 1 | +| retention | integer | Days to keep backups before deletion | | +| schedule | string | Schedule CRON syntax. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/policies/{policyId} +``` + +** Get a backup policy using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | **Required** Policy ID. Choose a custom ID`. 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. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/backups/policies/{policyId} +``` + +** Update an existing policy using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | **Required** Policy ID. Choose a custom ID`. 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. | | +| retention | integer | Days to keep backups before deletion | | +| schedule | string | Cron expression | | +| enabled | boolean | Is Backup enabled? When set to 'disabled', No backup will be taken | | + + +```http request +DELETE https://cloud.appwrite.io/v1/backups/policies/{policyId} +``` + +** Delete a policy using it's ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| policyId | string | **Required** 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. | | + + +```http request +POST https://cloud.appwrite.io/v1/backups/restoration +``` + +** Create and trigger a new restoration for a backup on a project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| archiveId | string | Backup archive ID to restore | | +| services | array | Array of services to restore | | +| newResourceId | 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. | | +| newResourceName | string | Database name. Max length: 128 chars. | | + + +```http request +GET https://cloud.appwrite.io/v1/backups/restorations +``` + +** List all backup restorations for a project. ** + +### 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. | [] | + + +```http request +GET https://cloud.appwrite.io/v1/backups/restorations/{restorationId} +``` + +** Get the current status of a backup restoration. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| restorationId | string | **Required** Restoration ID. Choose a custom ID`. 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. | | + diff --git a/docs/databases.md b/docs/databases.md index 25ccef6..b719a18 100644 --- a/docs/databases.md +++ b/docs/databases.md @@ -560,6 +560,82 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | newKey | string | New attribute key. | | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/longtext +``` + +** Create a longtext attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key} +``` + +** Update a longtext attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New Attribute Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext +``` + +** Create a mediumtext attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key} +``` + +** Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New Attribute Key. | | + + ```http request POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/point ``` @@ -692,6 +768,44 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | newKey | string | New Attribute Key. | | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/text +``` + +** Create a text attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/text/{key} +``` + +** Update a text attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| newKey | string | New Attribute Key. | | + + ```http request POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/url ``` @@ -730,6 +844,46 @@ PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectio | newKey | string | New Attribute Key. | | +```http request +POST https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/varchar +``` + +** Create a varchar attribute. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | Attribute Key. | | +| size | integer | Attribute size for varchar attributes, in number of characters. Maximum size is 16381. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| array | boolean | Is attribute an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key} +``` + +** Update a varchar attribute. Changing the `default` value will not update already existing documents. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| collectionId | string | **Required** Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). | | +| key | string | **Required** Attribute Key. | | +| required | boolean | Is attribute required? | | +| default | string | Default value for attribute when not provided. Cannot be set when attribute is required. | | +| size | integer | Maximum size of the varchar attribute. | | +| newKey | string | New Attribute Key. | | + + ```http request GET https://cloud.appwrite.io/v1/databases/{databaseId}/collections/{collectionId}/attributes/{key} ``` diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 9959a3f..90283cf 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,3 +1,4 @@ +```php createAnonymousSession(); +``` diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 3ffa5a5..2a80ab6 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,3 +1,4 @@ +```php createEmailPasswordSession( email: 'email@example.com', password: 'password' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index f1405da..9c20e74 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,3 +1,4 @@ +```php createEmailToken( userId: '', email: 'email@example.com', phrase: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md index 691d6fa..650f577 100644 --- a/docs/examples/account/create-email-verification.md +++ b/docs/examples/account/create-email-verification.md @@ -1,3 +1,4 @@ +```php createEmailVerification( url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 458405e..3314407 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -1,3 +1,4 @@ +```php createJWT(); +$result = $account->createJWT( + duration: 0 // optional +);``` diff --git a/docs/examples/account/create-key.md b/docs/examples/account/create-key.md new file mode 100644 index 0000000..cc00f17 --- /dev/null +++ b/docs/examples/account/create-key.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 + +$account = new Account($client); + +$result = $account->createKey( + name: '', + scopes: [Scopes::ACCOUNT()], + expire: '' // optional +);``` diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index 6e738e6..a4dde3d 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -1,3 +1,4 @@ +```php createMagicURLToken( email: 'email@example.com', url: 'https://example.com', // optional phrase: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 2eb50c3..fbbc193 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php createMFAAuthenticator( type: AuthenticatorType::TOTP() -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 6f0ecf8..08bf57d 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -1,3 +1,4 @@ +```php createMFAChallenge( factor: AuthenticationFactor::EMAIL() -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 031bc4d..655663f 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php createMFARecoveryCodes(); +``` diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index 721ed36..170192d 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -1,3 +1,4 @@ +```php createOAuth2Token( success: 'https://example.com', // optional failure: 'https://example.com', // optional scopes: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index a2b45f7..f48754f 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,3 +1,4 @@ +```php createPhoneToken( userId: '', phone: '+12065550100' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index a152667..4cedfba 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,3 +1,4 @@ +```php createPhoneVerification(); +``` diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index c15e41d..c6eaada 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,3 +1,4 @@ +```php createRecovery( email: 'email@example.com', url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 02525f7..6e339b0 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,3 +1,4 @@ +```php createSession( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 4628175..2266a0f 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,3 +1,4 @@ +```php createVerification( url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 9168434..8975698 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,3 +1,4 @@ +```php create( email: 'email@example.com', password: '', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index fd66d3a..56db56f 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,3 +1,4 @@ +```php deleteIdentity( identityId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-key.md b/docs/examples/account/delete-key.md new file mode 100644 index 0000000..f272ae1 --- /dev/null +++ b/docs/examples/account/delete-key.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteKey( + keyId: '' +);``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 524b9b3..c171381 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php deleteMFAAuthenticator( type: AuthenticatorType::TOTP() -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 9233ae1..b200785 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,3 +1,4 @@ +```php deleteSession( sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 557fd6d..7886fab 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,3 +1,4 @@ +```php deleteSessions(); +``` diff --git a/docs/examples/account/get-key.md b/docs/examples/account/get-key.md new file mode 100644 index 0000000..576a976 --- /dev/null +++ b/docs/examples/account/get-key.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getKey( + keyId: '' +);``` diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index fc5aef2..9a99dac 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php getMFARecoveryCodes(); +``` diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index c7077af..e125917 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,3 +1,4 @@ +```php getPrefs(); +``` diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index be26713..7e79a07 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,3 +1,4 @@ +```php getSession( sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 30cb7b2..d1fb255 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,3 +1,4 @@ +```php get(); +``` diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index b75a64c..1bd2ef0 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,3 +1,4 @@ +```php listIdentities( queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/list-keys.md b/docs/examples/account/list-keys.md new file mode 100644 index 0000000..7b405d1 --- /dev/null +++ b/docs/examples/account/list-keys.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listKeys( + total: false // optional +);``` diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index deddc9e..763b772 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,3 +1,4 @@ +```php listLogs( queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index f7b6e26..96b6021 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -1,3 +1,4 @@ +```php listMFAFactors(); +``` diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 7f9749f..9c42f8c 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,3 +1,4 @@ +```php listSessions(); +``` diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md index 95cd1b5..2fa17a5 100644 --- a/docs/examples/account/update-email-verification.md +++ b/docs/examples/account/update-email-verification.md @@ -1,3 +1,4 @@ +```php updateEmailVerification( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index c7c0d48..8cdfc5f 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,3 +1,4 @@ +```php updateEmail( email: 'email@example.com', password: 'password' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-key.md b/docs/examples/account/update-key.md new file mode 100644 index 0000000..12736f6 --- /dev/null +++ b/docs/examples/account/update-key.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 + +$account = new Account($client); + +$result = $account->updateKey( + keyId: '', + name: '', + scopes: [Scopes::ACCOUNT()], + expire: '' // optional +);``` diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index ef6b8cc..055f066 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -1,3 +1,4 @@ +```php updateMagicURLSession( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index 8486e88..c2f9dd6 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php updateMFAAuthenticator( type: AuthenticatorType::TOTP(), otp: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index e5821e5..effbb17 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -1,3 +1,4 @@ +```php updateMFAChallenge( challengeId: '', otp: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index f57e490..ee16a9c 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php updateMFARecoveryCodes(); +``` diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md index a1978e6..3d2f9b6 100644 --- a/docs/examples/account/update-mfa.md +++ b/docs/examples/account/update-mfa.md @@ -1,3 +1,4 @@ +```php updateMFA( mfa: false -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 2603b6e..4a34bc3 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,3 +1,4 @@ +```php updateName( name: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index c510138..ea1996a 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,3 +1,4 @@ +```php updatePassword( password: '', oldPassword: 'password' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 42f7fb9..67b5816 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -1,3 +1,4 @@ +```php updatePhoneSession( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index df59922..877a034 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,3 +1,4 @@ +```php updatePhoneVerification( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 853cb62..6b5e9ca 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,3 +1,4 @@ +```php updatePhone( phone: '+12065550100', password: 'password' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index f6a1003..4709edd 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,3 +1,4 @@ +```php updatePrefs( 'timezone' => 'UTC', 'darkTheme' => true ] -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 63518b0..7b5c1d0 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,3 +1,4 @@ +```php updateRecovery( userId: '', secret: '', password: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 11cb4c7..aecf2fe 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,3 +1,4 @@ +```php updateSession( sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index 7c8075e..7f0088a 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,3 +1,4 @@ +```php updateStatus(); +``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 60ec0b3..24bb3ff 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,3 +1,4 @@ +```php updateVerification( userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 2449c26..ec2a759 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,3 +1,4 @@ +```php getBrowser( width: 0, // optional height: 0, // optional quality: -1 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 123b345..05ddc24 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,3 +1,4 @@ +```php getCreditCard( width: 0, // optional height: 0, // optional quality: -1 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 1e67186..424cea8 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,3 +1,4 @@ +```php getFavicon( url: 'https://example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 5b7d8ba..1a4ef37 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,3 +1,4 @@ +```php getFlag( width: 0, // optional height: 0, // optional quality: -1 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index e155545..4ceb8d3 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,3 +1,4 @@ +```php getImage( url: 'https://example.com', width: 0, // optional height: 0 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index d84e23a..2bd523b 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,3 +1,4 @@ +```php getInitials( width: 0, // optional height: 0, // optional background: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md index 0d5936a..ad49bf9 100644 --- a/docs/examples/avatars/get-qr.md +++ b/docs/examples/avatars/get-qr.md @@ -1,3 +1,4 @@ +```php getQR( size: 1, // optional margin: 0, // optional download: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 9f91a3f..9db8b3c 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -1,10 +1,12 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -22,19 +24,19 @@ $result = $avatars->getScreenshot( viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: Theme::LIGHT(), // optional + theme: Theme::DARK(), // optional userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional fullpage: true, // optional locale: 'en-US', // optional - timezone: Timezone::AFRICAABIDJAN(), // optional + timezone: Timezone::AMERICANEWYORK(), // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional touch: true, // optional - permissions: ["geolocation","notifications"], // optional + permissions: [BrowserPermission::GEOLOCATION(), BrowserPermission::NOTIFICATIONS()], // optional sleep: 3, // optional width: 800, // optional height: 600, // optional quality: 85, // optional - output: Output::JPG() // optional -); \ No newline at end of file + output: ImageFormat::JPEG() // optional +);``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 0000000..d73db2e --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,18 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->createArchive( + services: [BackupServices::DATABASES()], + resourceId: '' // optional +);``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md new file mode 100644 index 0000000..ea87f28 --- /dev/null +++ b/docs/examples/backups/create-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 + +$backups = new Backups($client); + +$result = $backups->createPolicy( + policyId: '', + services: [BackupServices::DATABASES()], + retention: 1, + schedule: '', + name: '', // optional + resourceId: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md new file mode 100644 index 0000000..61d9e0b --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->createRestoration( + archiveId: '', + services: [BackupServices::DATABASES()], + newResourceId: '', // optional + newResourceName: '' // optional +);``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md new file mode 100644 index 0000000..a6c3d33 --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->deleteArchive( + archiveId: '' +);``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md new file mode 100644 index 0000000..3c6df8f --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->deletePolicy( + policyId: '' +);``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md new file mode 100644 index 0000000..6fa9ea9 --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->getArchive( + archiveId: '' +);``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md new file mode 100644 index 0000000..e8ce5c8 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->getPolicy( + policyId: '' +);``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md new file mode 100644 index 0000000..ed3e94a --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->getRestoration( + restorationId: '' +);``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md new file mode 100644 index 0000000..4060e3c --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->listArchives( + queries: [] // optional +);``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md new file mode 100644 index 0000000..a8b0331 --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->listPolicies( + queries: [] // optional +);``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md new file mode 100644 index 0000000..2c7132b --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->listRestorations( + queries: [] // optional +);``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md new file mode 100644 index 0000000..fe53fa2 --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,20 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$backups = new Backups($client); + +$result = $backups->updatePolicy( + policyId: '', + name: '', // optional + retention: 1, // optional + schedule: '', // optional + enabled: false // optional +);``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 805d022..746db6b 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -1,3 +1,4 @@ +```php createBooleanAttribute( required: false, default: false, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index aabfa03..a90e579 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -1,3 +1,4 @@ +```php createCollection( enabled: false, // optional attributes: [], // optional indexes: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index dd2fcec..f7c3862 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -1,3 +1,4 @@ +```php createDatetimeAttribute( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 39fb26f..f8e7e94 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,3 +1,4 @@ +```php createDocument( ], permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index ced7a5a..f4f153a 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -1,3 +1,4 @@ +```php createDocuments( collectionId: '', documents: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 1274a4b..4f53b8a 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -1,3 +1,4 @@ +```php createEmailAttribute( required: false, default: 'email@example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 9abf2df..49eb90a 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -1,3 +1,4 @@ +```php createEnumAttribute( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index e6eecb5..60486bb 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -1,3 +1,4 @@ +```php createFloatAttribute( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 9e8a221..39b3722 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -17,6 +19,6 @@ $result = $databases->createIndex( key: '', type: IndexType::KEY(), attributes: [], - orders: [], // optional + orders: [OrderBy::ASC()], // optional lengths: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 1dbeefa..e1c771f 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -1,3 +1,4 @@ +```php createIntegerAttribute( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index f42717c..b15fc38 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -1,3 +1,4 @@ +```php createIpAttribute( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 56d007c..dd59e00 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -1,3 +1,4 @@ +```php createLineAttribute( key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md new file mode 100644 index 0000000..9c3b4a6 --- /dev/null +++ b/docs/examples/databases/create-longtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md new file mode 100644 index 0000000..9c3a78f --- /dev/null +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index 05038cb..10b2e6c 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -1,3 +1,4 @@ +```php createOperations( } } ] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index dee0801..14ced40 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -1,3 +1,4 @@ +```php createPointAttribute( key: '', required: false, default: [1, 2] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index d745589..5886cf2 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -1,3 +1,4 @@ +```php createPolygonAttribute( key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 551fe17..739b27e 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,3 +1,4 @@ +```php createRelationshipAttribute( key: '', // optional twoWayKey: '', // optional onDelete: RelationMutate::CASCADE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 5a4f72b..e6da950 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -1,3 +1,4 @@ +```php createStringAttribute( default: '', // optional array: false, // optional encrypt: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md new file mode 100644 index 0000000..b123b1b --- /dev/null +++ b/docs/examples/databases/create-text-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createTextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md index ea6faf7..9ca8028 100644 --- a/docs/examples/databases/create-transaction.md +++ b/docs/examples/databases/create-transaction.md @@ -1,3 +1,4 @@ +```php createTransaction( ttl: 60 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 6b9bc80..c1b432d 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -1,3 +1,4 @@ +```php createUrlAttribute( required: false, default: 'https://example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md new file mode 100644 index 0000000..31a1028 --- /dev/null +++ b/docs/examples/databases/create-varchar-attribute.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + size: 1, + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 73c6188..867c31c 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -1,3 +1,4 @@ +```php create( databaseId: '', name: '', enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index dfb1873..2c00e78 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -1,3 +1,4 @@ +```php decrementDocumentAttribute( value: null, // optional min: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 71b7162..cc77743 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -1,3 +1,4 @@ +```php deleteAttribute( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 4e98dfd..8419bc4 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -1,3 +1,4 @@ +```php deleteCollection( databaseId: '', collectionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 6e4d7aa..c0c620b 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,3 +1,4 @@ +```php deleteDocument( collectionId: '', documentId: '', transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md index 3b2b0c7..124294d 100644 --- a/docs/examples/databases/delete-documents.md +++ b/docs/examples/databases/delete-documents.md @@ -1,3 +1,4 @@ +```php deleteDocuments( collectionId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 79e476b..d810609 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -1,3 +1,4 @@ +```php deleteIndex( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md index 0559aac..3e2db81 100644 --- a/docs/examples/databases/delete-transaction.md +++ b/docs/examples/databases/delete-transaction.md @@ -1,3 +1,4 @@ +```php deleteTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index c796b7c..9d89cfb 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -1,3 +1,4 @@ +```php delete( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index ba82db4..4f3f7f7 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -1,3 +1,4 @@ +```php getAttribute( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index ecddab0..e3cccdf 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -1,3 +1,4 @@ +```php getCollection( databaseId: '', collectionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 834602d..90f8760 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,3 +1,4 @@ +```php getDocument( documentId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index e9c6307..001fc6e 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -1,3 +1,4 @@ +```php getIndex( databaseId: '', collectionId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md index 16ca28d..82b34ae 100644 --- a/docs/examples/databases/get-transaction.md +++ b/docs/examples/databases/get-transaction.md @@ -1,3 +1,4 @@ +```php getTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 9aa6395..59a83bf 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -1,3 +1,4 @@ +```php get( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index 63162d3..8782cf7 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -1,3 +1,4 @@ +```php incrementDocumentAttribute( value: null, // optional max: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index e770292..dac753d 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -1,3 +1,4 @@ +```php listAttributes( collectionId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index c71866b..7f994e1 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -1,3 +1,4 @@ +```php listCollections( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 8713327..1ff2692 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,3 +1,4 @@ +```php listDocuments( queries: [], // optional transactionId: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index a26ff7c..1ebd269 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -1,3 +1,4 @@ +```php listIndexes( collectionId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index 858e905..8990c74 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -1,3 +1,4 @@ +```php listTransactions( queries: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index f5baccc..d439184 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 2e4bee7..f63e5f3 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -1,3 +1,4 @@ +```php updateBooleanAttribute( required: false, default: false, newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index d37f6e2..79271f6 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -1,3 +1,4 @@ +```php updateCollection( databaseId: '', collectionId: '', - name: '', + name: '', // optional permissions: [Permission::read(Role::any())], // optional documentSecurity: false, // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index b1a03ec..a1fb43f 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -1,3 +1,4 @@ +```php updateDatetimeAttribute( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 2aaada2..7a18545 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,3 +1,4 @@ +```php updateDocument( databaseId: '', collectionId: '', documentId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index 7263246..c29a467 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -1,3 +1,4 @@ +```php updateDocuments( databaseId: '', collectionId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index dc9865f..b4421d5 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -1,3 +1,4 @@ +```php updateEmailAttribute( required: false, default: 'email@example.com', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index f7cd0b7..c2880f2 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -1,3 +1,4 @@ +```php updateEnumAttribute( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 51f6ec9..3ea4818 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -1,3 +1,4 @@ +```php updateFloatAttribute( min: null, // optional max: null, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index bdbd96c..29b7ac6 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -1,3 +1,4 @@ +```php updateIntegerAttribute( min: null, // optional max: null, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 130cd0c..c7490c5 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -1,3 +1,4 @@ +```php updateIpAttribute( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index 86b8f64..7cb7dab 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -1,3 +1,4 @@ +```php updateLineAttribute( required: false, default: [[1, 2], [3, 4], [5, 6]], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md new file mode 100644 index 0000000..d9a217d --- /dev/null +++ b/docs/examples/databases/update-longtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md new file mode 100644 index 0000000..bae0341 --- /dev/null +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index cdff226..1359ec9 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -1,3 +1,4 @@ +```php updatePointAttribute( required: false, default: [1, 2], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index c2736bd..cf79996 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -1,3 +1,4 @@ +```php updatePolygonAttribute( required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index a4d6888..824f1f7 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,3 +1,4 @@ +```php updateRelationshipAttribute( key: '', onDelete: RelationMutate::CASCADE(), // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index e0c8f99..828dda4 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -1,3 +1,4 @@ +```php updateStringAttribute( default: '', size: 1, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md new file mode 100644 index 0000000..8de8c78 --- /dev/null +++ b/docs/examples/databases/update-text-attribute.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateTextAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md index 750eb86..13137b6 100644 --- a/docs/examples/databases/update-transaction.md +++ b/docs/examples/databases/update-transaction.md @@ -1,3 +1,4 @@ +```php updateTransaction( transactionId: '', commit: false, // optional rollback: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index c200463..461abf5 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -1,3 +1,4 @@ +```php updateUrlAttribute( required: false, default: 'https://example.com', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md new file mode 100644 index 0000000..0c5dbbe --- /dev/null +++ b/docs/examples/databases/update-varchar-attribute.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + required: false, + default: '', + size: 1, // optional + newKey: '' // optional +);``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 9b0b078..67af71a 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -1,3 +1,4 @@ +```php update( databaseId: '', - name: '', + name: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 8e9d2c9..9b01b8c 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -1,3 +1,4 @@ +```php upsertDocument( databaseId: '', collectionId: '', documentId: '', - data: [], + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 30, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 06d3a31..5bc04d7 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -1,3 +1,4 @@ +```php upsertDocuments( collectionId: '', documents: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 7e48b89..cdee0ff 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,3 +1,4 @@ +```php createDeployment( activate: false, entrypoint: '', // optional commands: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md index a898762..0cf3a83 100644 --- a/docs/examples/functions/create-duplicate-deployment.md +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -1,3 +1,4 @@ +```php createDuplicateDeployment( functionId: '', deploymentId: '', buildId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 9c12e87..70a8fc0 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,3 +1,4 @@ +```php createExecution( method: ExecutionMethod::GET(), // optional headers: [], // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md index a127252..c6dae9a 100644 --- a/docs/examples/functions/create-template-deployment.md +++ b/docs/examples/functions/create-template-deployment.md @@ -1,3 +1,4 @@ +```php createTemplateDeployment( type: TemplateReferenceType::COMMIT(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index ec470d5..d860cb3 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -1,3 +1,4 @@ +```php createVariable( key: '', value: '', secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md index f044219..5ccab95 100644 --- a/docs/examples/functions/create-vcs-deployment.md +++ b/docs/examples/functions/create-vcs-deployment.md @@ -1,3 +1,4 @@ +```php createVcsDeployment( type: VCSReferenceType::BRANCH(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index f717687..e921e99 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -23,11 +25,11 @@ $result = $functions->create( logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [], // optional + scopes: [Scopes::SESSIONSWRITE()], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // optional specification: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 20285d7..96e78e3 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -1,3 +1,4 @@ +```php deleteDeployment( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md index e55a8b1..e95d2f7 100644 --- a/docs/examples/functions/delete-execution.md +++ b/docs/examples/functions/delete-execution.md @@ -1,3 +1,4 @@ +```php deleteExecution( functionId: '', executionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index e1fb391..9be2e17 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -1,3 +1,4 @@ +```php deleteVariable( functionId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 9f87f5c..d718bfb 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -1,3 +1,4 @@ +```php delete( functionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index a06f97b..73842f5 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -1,3 +1,4 @@ +```php getDeploymentDownload( functionId: '', deploymentId: '', type: DeploymentDownloadType::SOURCE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 945933b..f8d4a26 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -1,3 +1,4 @@ +```php getDeployment( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 7dfeeed..f647a7f 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,3 +1,4 @@ +```php getExecution( functionId: '', executionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 4c8d3d6..8d40864 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -1,3 +1,4 @@ +```php getVariable( functionId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index ca2160f..e5997ee 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -1,3 +1,4 @@ +```php get( functionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index bf90318..bc46662 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -1,3 +1,4 @@ +```php listDeployments( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 4a7c79c..9948e86 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,3 +1,4 @@ +```php listExecutions( functionId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index 6c77c42..320a9dc 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -1,3 +1,4 @@ +```php listRuntimes(); +``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index eec5c33..f5afe80 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -1,3 +1,4 @@ +```php listSpecifications(); +``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index f85e854..8867ad6 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -1,3 +1,4 @@ +```php listVariables( functionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 1646a06..2dc45db 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md index de36d4e..311645e 100644 --- a/docs/examples/functions/update-deployment-status.md +++ b/docs/examples/functions/update-deployment-status.md @@ -1,3 +1,4 @@ +```php updateDeploymentStatus( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md index 38ba026..b1c0edb 100644 --- a/docs/examples/functions/update-function-deployment.md +++ b/docs/examples/functions/update-function-deployment.md @@ -1,3 +1,4 @@ +```php updateFunctionDeployment( functionId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index b15597a..3a28069 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -1,3 +1,4 @@ +```php updateVariable( key: '', value: '', // optional secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index da5ee88..f9bdac1 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -23,11 +25,11 @@ $result = $functions->update( logging: false, // optional entrypoint: '', // optional commands: '', // optional - scopes: [], // optional + scopes: [Scopes::SESSIONSWRITE()], // optional installationId: '', // optional providerRepositoryId: '', // optional providerBranch: '', // optional providerSilentMode: false, // optional providerRootDirectory: '', // optional specification: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index c349bc2..1e25bf7 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,3 +1,4 @@ +```php mutation( query: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index e6e277c..9097994 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,3 +1,4 @@ +```php query( query: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 4721064..7f57d8a 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -1,3 +1,4 @@ +```php getAntivirus(); +``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 2e81dae..8443c64 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -1,3 +1,4 @@ +```php getCache(); +``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index 408581b..d1d1fd1 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -1,3 +1,4 @@ +```php getCertificate( domain: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md index cfec70e..1682bcf 100644 --- a/docs/examples/health/get-db.md +++ b/docs/examples/health/get-db.md @@ -1,3 +1,4 @@ +```php getDB(); +``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 63bc1c8..8586763 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,3 +1,4 @@ +```php getFailedJobs( name: Name::V1DATABASE(), threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index 1c346ca..97dc4b6 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -1,3 +1,4 @@ +```php getPubSub(); +``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 0000000..2bfc32e --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueAudits( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md new file mode 100644 index 0000000..e04fc2e --- /dev/null +++ b/docs/examples/health/get-queue-billing-project-aggregation.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBillingProjectAggregation( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md new file mode 100644 index 0000000..37fa4d2 --- /dev/null +++ b/docs/examples/health/get-queue-billing-team-aggregation.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBillingTeamAggregation( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 8c1f774..607acb2 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -1,3 +1,4 @@ +```php getQueueBuilds( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 92fb79a..d70b657 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -1,3 +1,4 @@ +```php getQueueCertificates( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 745b469..96bfb6f 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -1,3 +1,4 @@ +```php getQueueDatabases( name: '', // optional threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index d395268..2b147f4 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -1,3 +1,4 @@ +```php getQueueDeletes( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 1a5bea2..d5b5844 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -1,3 +1,4 @@ +```php getQueueFunctions( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index cf5e3b9..cb0125c 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -1,3 +1,4 @@ +```php getQueueLogs( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index 132dfa6..56babd6 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -1,3 +1,4 @@ +```php getQueueMails( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index fd5fdb1..4539c5d 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -1,3 +1,4 @@ +```php getQueueMessaging( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 6811018..36b8d4b 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -1,3 +1,4 @@ +```php getQueueMigrations( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md new file mode 100644 index 0000000..b7a97a5 --- /dev/null +++ b/docs/examples/health/get-queue-priority-builds.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueuePriorityBuilds( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md new file mode 100644 index 0000000..11b63f7 --- /dev/null +++ b/docs/examples/health/get-queue-region-manager.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueRegionManager( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md index d0bd6c0..da4cee7 100644 --- a/docs/examples/health/get-queue-stats-resources.md +++ b/docs/examples/health/get-queue-stats-resources.md @@ -1,3 +1,4 @@ +```php getQueueStatsResources( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/health/get-queue-threats.md new file mode 100644 index 0000000..8ccfb0d --- /dev/null +++ b/docs/examples/health/get-queue-threats.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueThreats( + threshold: null // optional +);``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md index 627a85c..dd35802 100644 --- a/docs/examples/health/get-queue-usage.md +++ b/docs/examples/health/get-queue-usage.md @@ -1,3 +1,4 @@ +```php getQueueUsage( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index d6ccd7c..d2877ce 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -1,3 +1,4 @@ +```php getQueueWebhooks( threshold: null // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 041d249..d7524ba 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -1,3 +1,4 @@ +```php getStorageLocal(); +``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md index 377416e..2a109de 100644 --- a/docs/examples/health/get-storage.md +++ b/docs/examples/health/get-storage.md @@ -1,3 +1,4 @@ +```php getStorage(); +``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index aa26993..559b179 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -1,3 +1,4 @@ +```php getTime(); +``` diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index fec3e3f..4b46ac2 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -1,3 +1,4 @@ +```php get(); +``` diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index ef4c043..8b20457 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,3 +1,4 @@ +```php get(); +``` diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 273fad0..5c99bbf 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,3 +1,4 @@ +```php listCodes(); +``` diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index e8c7ca4..1245b2e 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,3 +1,4 @@ +```php listContinents(); +``` diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index c5dd1d2..9744c8e 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -1,3 +1,4 @@ +```php listCountriesEU(); +``` diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 7585c10..df66061 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,3 +1,4 @@ +```php listCountriesPhones(); +``` diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 63a2e0b..f4f9626 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,3 +1,4 @@ +```php listCountries(); +``` diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index d385018..f4f1125 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,3 +1,4 @@ +```php listCurrencies(); +``` diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index f0ca4d4..b25fab6 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,3 +1,4 @@ +```php listLanguages(); +``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 2ce4b7f..768878a 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -1,3 +1,4 @@ +```php createAPNSProvider( bundleId: '', // optional sandbox: false, // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 9de2487..68f46f9 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -1,3 +1,4 @@ +```php createEmail( draft: false, // optional html: false, // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 8037c23..1ab3e98 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -1,3 +1,4 @@ +```php createFCMProvider( name: '', serviceAccountJSON: [], // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 6c62ee8..ca0a3cb 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -1,3 +1,4 @@ +```php createMailgunProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md index 1eb954a..78998cf 100644 --- a/docs/examples/messaging/create-msg-91-provider.md +++ b/docs/examples/messaging/create-msg-91-provider.md @@ -1,3 +1,4 @@ +```php createMsg91Provider( senderId: '', // optional authKey: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 614c758..2673d48 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,3 +1,4 @@ +```php createPush( contentAvailable: false, // optional critical: false, // optional priority: MessagePriority::NORMAL() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md index e66b0b8..e32ad9f 100644 --- a/docs/examples/messaging/create-resend-provider.md +++ b/docs/examples/messaging/create-resend-provider.md @@ -1,3 +1,4 @@ +```php createResendProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 892d856..38f213c 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -1,3 +1,4 @@ +```php createSendgridProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 50623b5..5f946db 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -1,3 +1,4 @@ +```php createSMS( targets: [], // optional draft: false, // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 953bbcf..0538612 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -1,3 +1,4 @@ +```php createSMTPProvider( replyToName: '', // optional replyToEmail: 'email@example.com', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 3516fa3..f0d2783 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,3 +1,4 @@ +```php createSubscriber( topicId: '', subscriberId: '', targetId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index 9006918..005e6d0 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -1,3 +1,4 @@ +```php createTelesignProvider( customerId: '', // optional apiKey: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 5215d52..262a9e2 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -1,3 +1,4 @@ +```php createTextmagicProvider( username: '', // optional apiKey: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index e94141c..460168e 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -1,3 +1,4 @@ +```php createTopic( topicId: '', name: '', subscribe: ["any"] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index c356828..f8ee417 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -1,3 +1,4 @@ +```php createTwilioProvider( accountSid: '', // optional authToken: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index adeacbc..450cf9c 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -1,3 +1,4 @@ +```php createVonageProvider( apiKey: '', // optional apiSecret: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index f37d18b..e0a63c1 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -1,3 +1,4 @@ +```php deleteProvider( providerId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index f7a8425..9720ad0 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,3 +1,4 @@ +```php deleteSubscriber( topicId: '', subscriberId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 2ec899b..9061451 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -1,3 +1,4 @@ +```php deleteTopic( topicId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index 5781838..1548905 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -1,3 +1,4 @@ +```php delete( messageId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index cf92221..a1d2f02 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -1,3 +1,4 @@ +```php getMessage( messageId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index d19f5c6..6353e54 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -1,3 +1,4 @@ +```php getProvider( providerId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index e2a0d7e..d3a20e9 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -1,3 +1,4 @@ +```php getSubscriber( topicId: '', subscriberId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index fc06cbb..95ff3ff 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -1,3 +1,4 @@ +```php getTopic( topicId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 4e0ab3e..8bc5631 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -1,3 +1,4 @@ +```php listMessageLogs( messageId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index d66c64f..fa6d57c 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -1,3 +1,4 @@ +```php listMessages( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 8c8d7f1..afc3df9 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -1,3 +1,4 @@ +```php listProviderLogs( providerId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index da0910e..281a522 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -1,3 +1,4 @@ +```php listProviders( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 9e453a2..7a0e5ad 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -1,3 +1,4 @@ +```php listSubscriberLogs( subscriberId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index f21c788..096a8f2 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -1,3 +1,4 @@ +```php listSubscribers( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 03ffdbb..0615d82 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -1,3 +1,4 @@ +```php listTargets( messageId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index fae8eec..d32d27a 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -1,3 +1,4 @@ +```php listTopicLogs( topicId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index b5d4c54..6386df1 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -1,3 +1,4 @@ +```php listTopics( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 161a148..aa0e78f 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -1,3 +1,4 @@ +```php updateAPNSProvider( teamId: '', // optional bundleId: '', // optional sandbox: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index dd0f645..347f030 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -1,3 +1,4 @@ +```php updateEmail( bcc: [], // optional scheduledAt: '', // optional attachments: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 0df2b93..a9a54d1 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -1,3 +1,4 @@ +```php updateFCMProvider( name: '', // optional enabled: false, // optional serviceAccountJSON: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index c99ebc7..6392e78 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -1,3 +1,4 @@ +```php updateMailgunProvider( fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md index f6f557c..67b689c 100644 --- a/docs/examples/messaging/update-msg-91-provider.md +++ b/docs/examples/messaging/update-msg-91-provider.md @@ -1,3 +1,4 @@ +```php updateMsg91Provider( templateId: '', // optional senderId: '', // optional authKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 0fea9a1..0b3f1bc 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,3 +1,4 @@ +```php updatePush( contentAvailable: false, // optional critical: false, // optional priority: MessagePriority::NORMAL() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md index b3f1d1f..ab60aaf 100644 --- a/docs/examples/messaging/update-resend-provider.md +++ b/docs/examples/messaging/update-resend-provider.md @@ -1,3 +1,4 @@ +```php updateResendProvider( fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index b8473c1..e6e0391 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -1,3 +1,4 @@ +```php updateSendgridProvider( fromEmail: 'email@example.com', // optional replyToName: '', // optional replyToEmail: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 92d3ebb..3dc932a 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -1,3 +1,4 @@ +```php updateSMS( content: '', // optional draft: false, // optional scheduledAt: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 495f332..5701b3c 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -1,3 +1,4 @@ +```php updateSMTPProvider( replyToName: '', // optional replyToEmail: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 29a54bf..33fcbb3 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -1,3 +1,4 @@ +```php updateTelesignProvider( customerId: '', // optional apiKey: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index e6a1ed1..96564c7 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -1,3 +1,4 @@ +```php updateTextmagicProvider( username: '', // optional apiKey: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index b1f9a32..257e754 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -1,3 +1,4 @@ +```php updateTopic( topicId: '', name: '', // optional subscribe: ["any"] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index def821a..c9bcfa9 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -1,3 +1,4 @@ +```php updateTwilioProvider( accountSid: '', // optional authToken: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 0841e28..112745e 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -1,3 +1,4 @@ +```php updateVonageProvider( apiKey: '', // optional apiSecret: '', // optional from: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/organizations/delete.md b/docs/examples/organizations/delete.md new file mode 100644 index 0000000..887b0be --- /dev/null +++ b/docs/examples/organizations/delete.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$organizations = new Organizations($client); + +$result = $organizations->delete( + organizationId: '' +);``` diff --git a/docs/examples/organizations/estimation-delete-organization.md b/docs/examples/organizations/estimation-delete-organization.md new file mode 100644 index 0000000..770e6e7 --- /dev/null +++ b/docs/examples/organizations/estimation-delete-organization.md @@ -0,0 +1,16 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setSession(''); // The user session to authenticate with + +$organizations = new Organizations($client); + +$result = $organizations->estimationDeleteOrganization( + organizationId: '' +);``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index 30770b7..c890f11 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -1,3 +1,4 @@ +```php createDeployment( installCommand: '', // optional buildCommand: '', // optional outputDirectory: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md index 84f65cd..97fb1f5 100644 --- a/docs/examples/sites/create-duplicate-deployment.md +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -1,3 +1,4 @@ +```php createDuplicateDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md index 1661bbb..05f039e 100644 --- a/docs/examples/sites/create-template-deployment.md +++ b/docs/examples/sites/create-template-deployment.md @@ -1,3 +1,4 @@ +```php createTemplateDeployment( type: TemplateReferenceType::BRANCH(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index 3097e19..fee3ae9 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -1,3 +1,4 @@ +```php createVariable( key: '', value: '', secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md index 015bf09..d01747b 100644 --- a/docs/examples/sites/create-vcs-deployment.md +++ b/docs/examples/sites/create-vcs-deployment.md @@ -1,3 +1,4 @@ +```php createVcsDeployment( type: VCSReferenceType::BRANCH(), reference: '', activate: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 6f1fc5a..9191261 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -1,3 +1,4 @@ +```php create( providerSilentMode: false, // optional providerRootDirectory: '', // optional specification: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md index 4e24748..97bb976 100644 --- a/docs/examples/sites/delete-deployment.md +++ b/docs/examples/sites/delete-deployment.md @@ -1,3 +1,4 @@ +```php deleteDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md index b6e3064..ed5b3c5 100644 --- a/docs/examples/sites/delete-log.md +++ b/docs/examples/sites/delete-log.md @@ -1,3 +1,4 @@ +```php deleteLog( siteId: '', logId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md index 6632543..bdb2fbf 100644 --- a/docs/examples/sites/delete-variable.md +++ b/docs/examples/sites/delete-variable.md @@ -1,3 +1,4 @@ +```php deleteVariable( siteId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md index 8e6363a..c2965d4 100644 --- a/docs/examples/sites/delete.md +++ b/docs/examples/sites/delete.md @@ -1,3 +1,4 @@ +```php delete( siteId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index 61fad0b..5582e96 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -1,3 +1,4 @@ +```php getDeploymentDownload( siteId: '', deploymentId: '', type: DeploymentDownloadType::SOURCE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md index 19525d9..91f8367 100644 --- a/docs/examples/sites/get-deployment.md +++ b/docs/examples/sites/get-deployment.md @@ -1,3 +1,4 @@ +```php getDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md index 5ceb2b9..a781d20 100644 --- a/docs/examples/sites/get-log.md +++ b/docs/examples/sites/get-log.md @@ -1,3 +1,4 @@ +```php getLog( siteId: '', logId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md index 0cab412..80b61ec 100644 --- a/docs/examples/sites/get-variable.md +++ b/docs/examples/sites/get-variable.md @@ -1,3 +1,4 @@ +```php getVariable( siteId: '', variableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md index e5ec061..c8f8c8e 100644 --- a/docs/examples/sites/get.md +++ b/docs/examples/sites/get.md @@ -1,3 +1,4 @@ +```php get( siteId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index bb49a5a..82cee29 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -1,3 +1,4 @@ +```php listDeployments( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md index 87df92d..74ea882 100644 --- a/docs/examples/sites/list-frameworks.md +++ b/docs/examples/sites/list-frameworks.md @@ -1,3 +1,4 @@ +```php listFrameworks(); +``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index 3bc4540..5626bbb 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -1,3 +1,4 @@ +```php listLogs( siteId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 42dae1b..1a732b6 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -1,3 +1,4 @@ +```php listSpecifications(); +``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 36aad64..7b7ab11 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -1,3 +1,4 @@ +```php listVariables( siteId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index d056e8d..08c1314 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md index 2714b35..06ffc75 100644 --- a/docs/examples/sites/update-deployment-status.md +++ b/docs/examples/sites/update-deployment-status.md @@ -1,3 +1,4 @@ +```php updateDeploymentStatus( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md index 6e2614c..bdac54d 100644 --- a/docs/examples/sites/update-site-deployment.md +++ b/docs/examples/sites/update-site-deployment.md @@ -1,3 +1,4 @@ +```php updateSiteDeployment( siteId: '', deploymentId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 84bafe2..9651875 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -1,3 +1,4 @@ +```php updateVariable( key: '', value: '', // optional secret: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index d2a6c9d..42d24fb 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -1,3 +1,4 @@ +```php update( providerSilentMode: false, // optional providerRootDirectory: '', // optional specification: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 3184095..f00c2c7 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,3 +1,4 @@ +```php createBucket( encryption: false, // optional antivirus: false, // optional transformations: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 33bef04..62301b1 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,3 +1,4 @@ +```php createFile( fileId: '', file: InputFile::withPath('file.png'), permissions: [Permission::read(Role::any())] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 50adf35..737f4e1 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -1,3 +1,4 @@ +```php deleteBucket( bucketId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index d4c45eb..dd2c3a7 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,3 +1,4 @@ +```php deleteFile( bucketId: '', fileId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index e62c43d..f6449ae 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -1,3 +1,4 @@ +```php getBucket( bucketId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index defefa5..f55376f 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,3 +1,4 @@ +```php getFileDownload( bucketId: '', fileId: '', token: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index aaa15a2..8964011 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,3 +1,4 @@ +```php getFilePreview( background: '', // optional output: ImageFormat::JPG(), // optional token: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index dfc84ca..6a729dc 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,3 +1,4 @@ +```php getFileView( bucketId: '', fileId: '', token: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 6964144..b498b60 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,3 +1,4 @@ +```php getFile( bucketId: '', fileId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 8b84a8b..3b0d79d 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -1,3 +1,4 @@ +```php listBuckets( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 309c87c..77e78cd 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,3 +1,4 @@ +```php listFiles( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 1556257..c14e75c 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,3 +1,4 @@ +```php updateBucket( encryption: false, // optional antivirus: false, // optional transformations: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index fc84f59..1e40a49 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,3 +1,4 @@ +```php updateFile( fileId: '', name: '', // optional permissions: [Permission::read(Role::any())] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 5f0a2de..b6032a3 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -1,3 +1,4 @@ +```php createBooleanColumn( required: false, default: false, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 9ea8e8f..9e9ad84 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -1,3 +1,4 @@ +```php createDatetimeColumn( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index 64f3a08..f24aa05 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -1,3 +1,4 @@ +```php createEmailColumn( required: false, default: 'email@example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index 0506a33..9515742 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -1,3 +1,4 @@ +```php createEnumColumn( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index 65a7f00..c83abba 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -1,3 +1,4 @@ +```php createFloatColumn( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 1a3fd13..c91356f 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -1,8 +1,10 @@ +```php setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint @@ -17,6 +19,6 @@ $result = $tablesDB->createIndex( key: '', type: IndexType::KEY(), columns: [], - orders: [], // optional + orders: [OrderBy::ASC()], // optional lengths: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index 4bf96e8..a42c871 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -1,3 +1,4 @@ +```php createIntegerColumn( max: null, // optional default: null, // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index ab0032e..f40fe61 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -1,3 +1,4 @@ +```php createIpColumn( required: false, default: '', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index 69f2e66..c1d17b8 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -1,3 +1,4 @@ +```php createLineColumn( key: '', required: false, default: [[1, 2], [3, 4], [5, 6]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md new file mode 100644 index 0000000..cb2bd85 --- /dev/null +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createLongtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md new file mode 100644 index 0000000..b17328c --- /dev/null +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index 429a0bb..45ea4c9 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -1,3 +1,4 @@ +```php createOperations( } } ] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 006c9e0..bde57bc 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -1,3 +1,4 @@ +```php createPointColumn( key: '', required: false, default: [1, 2] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index 20fb271..ee340f3 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -1,3 +1,4 @@ +```php createPolygonColumn( key: '', required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 7f9a06c..06dd6c0 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -1,3 +1,4 @@ +```php createRelationshipColumn( key: '', // optional twoWayKey: '', // optional onDelete: RelationMutate::CASCADE() // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 70666d5..fc253f2 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -1,3 +1,4 @@ +```php createRow( ], permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index 44c9c7d..8c08fa5 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -1,3 +1,4 @@ +```php createRows( tableId: '', rows: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 22fc7cc..a4dd4da 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -1,3 +1,4 @@ +```php createStringColumn( default: '', // optional array: false, // optional encrypt: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index aef39e5..fbe4476 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -1,3 +1,4 @@ +```php createTable( enabled: false, // optional columns: [], // optional indexes: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md new file mode 100644 index 0000000..833aa90 --- /dev/null +++ b/docs/examples/tablesdb/create-text-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createTextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md index 3248818..6664c08 100644 --- a/docs/examples/tablesdb/create-transaction.md +++ b/docs/examples/tablesdb/create-transaction.md @@ -1,3 +1,4 @@ +```php createTransaction( ttl: 60 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index fe25988..ceb1dae 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -1,3 +1,4 @@ +```php createUrlColumn( required: false, default: 'https://example.com', // optional array: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md new file mode 100644 index 0000000..25aa354 --- /dev/null +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->createVarcharColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + required: false, + default: '', // optional + array: false // optional +);``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index c3c4faa..2265fc9 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -1,3 +1,4 @@ +```php create( databaseId: '', name: '', enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index ede258e..0d01314 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -1,3 +1,4 @@ +```php decrementRowColumn( value: null, // optional min: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index dd99fab..97cafce 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -1,3 +1,4 @@ +```php deleteColumn( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index 1ef346f..abad824 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -1,3 +1,4 @@ +```php deleteIndex( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index df87c50..05722a0 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -1,3 +1,4 @@ +```php deleteRow( tableId: '', rowId: '', transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index 79ed607..934ea6b 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -1,3 +1,4 @@ +```php deleteRows( tableId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md index 3cbb35d..acc711d 100644 --- a/docs/examples/tablesdb/delete-table.md +++ b/docs/examples/tablesdb/delete-table.md @@ -1,3 +1,4 @@ +```php deleteTable( databaseId: '', tableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md index d165015..2b0c7ff 100644 --- a/docs/examples/tablesdb/delete-transaction.md +++ b/docs/examples/tablesdb/delete-transaction.md @@ -1,3 +1,4 @@ +```php deleteTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md index ea996e9..1b2cc93 100644 --- a/docs/examples/tablesdb/delete.md +++ b/docs/examples/tablesdb/delete.md @@ -1,3 +1,4 @@ +```php delete( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index d1705a4..0be374f 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -1,3 +1,4 @@ +```php getColumn( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 0d67648..5e79e70 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -1,3 +1,4 @@ +```php getIndex( databaseId: '', tableId: '', key: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 4bbea55..f8871ff 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -1,3 +1,4 @@ +```php getRow( rowId: '', queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md index ee8812f..1bc0166 100644 --- a/docs/examples/tablesdb/get-table.md +++ b/docs/examples/tablesdb/get-table.md @@ -1,3 +1,4 @@ +```php getTable( databaseId: '', tableId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md index 146e7d1..fc4030f 100644 --- a/docs/examples/tablesdb/get-transaction.md +++ b/docs/examples/tablesdb/get-transaction.md @@ -1,3 +1,4 @@ +```php getTransaction( transactionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md index 07f7098..5dde28d 100644 --- a/docs/examples/tablesdb/get.md +++ b/docs/examples/tablesdb/get.md @@ -1,3 +1,4 @@ +```php get( databaseId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 66bf2e8..5c6176e 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -1,3 +1,4 @@ +```php incrementRowColumn( value: null, // optional max: null, // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index 49b4eba..2ecf654 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -1,3 +1,4 @@ +```php listColumns( tableId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index ac466c7..17428fe 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -1,3 +1,4 @@ +```php listIndexes( tableId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index cdcc796..710c791 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -1,3 +1,4 @@ +```php listRows( queries: [], // optional transactionId: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index b14e28c..c74d5a1 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -1,3 +1,4 @@ +```php listTables( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index 15095d6..58b31a6 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -1,3 +1,4 @@ +```php listTransactions( queries: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 3d74dde..77da552 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index 0c73516..8a7850f 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -1,3 +1,4 @@ +```php updateBooleanColumn( required: false, default: false, newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 52213c6..4f994a5 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -1,3 +1,4 @@ +```php updateDatetimeColumn( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index d13de56..8cd10d4 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -1,3 +1,4 @@ +```php updateEmailColumn( required: false, default: 'email@example.com', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index d54c0b3..0dcf574 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -1,3 +1,4 @@ +```php updateEnumColumn( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index bb091ab..68a90df 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -1,3 +1,4 @@ +```php updateFloatColumn( min: null, // optional max: null, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 2436bc2..ba7a781 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -1,3 +1,4 @@ +```php updateIntegerColumn( min: null, // optional max: null, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index aa97752..25a7160 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -1,3 +1,4 @@ +```php updateIpColumn( required: false, default: '', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 56a557c..a7126a3 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -1,3 +1,4 @@ +```php updateLineColumn( required: false, default: [[1, 2], [3, 4], [5, 6]], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md new file mode 100644 index 0000000..aaccf92 --- /dev/null +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateLongtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md new file mode 100644 index 0000000..2b06e8d --- /dev/null +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index abe8b73..0d137ce 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -1,3 +1,4 @@ +```php updatePointColumn( required: false, default: [1, 2], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 2ff4011..5341610 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -1,3 +1,4 @@ +```php updatePolygonColumn( required: false, default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index cc2e2cc..4b15385 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -1,3 +1,4 @@ +```php updateRelationshipColumn( key: '', onDelete: RelationMutate::CASCADE(), // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index d92ab78..f0fd37d 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -1,3 +1,4 @@ +```php updateRow( databaseId: '', tableId: '', rowId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 681a9f0..baf98ec 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -1,3 +1,4 @@ +```php updateRows( databaseId: '', tableId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional queries: [], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index eb1acc1..ff01707 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -1,3 +1,4 @@ +```php updateStringColumn( default: '', size: 1, // optional newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 22f1523..4409db2 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -1,3 +1,4 @@ +```php updateTable( databaseId: '', tableId: '', - name: '', + name: '', // optional permissions: [Permission::read(Role::any())], // optional rowSecurity: false, // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md new file mode 100644 index 0000000..81fa0fe --- /dev/null +++ b/docs/examples/tablesdb/update-text-column.md @@ -0,0 +1,21 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateTextColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md index fed3810..512760b 100644 --- a/docs/examples/tablesdb/update-transaction.md +++ b/docs/examples/tablesdb/update-transaction.md @@ -1,3 +1,4 @@ +```php updateTransaction( transactionId: '', commit: false, // optional rollback: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index b64b302..6c05516 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -1,3 +1,4 @@ +```php updateUrlColumn( required: false, default: 'https://example.com', newKey: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md new file mode 100644 index 0000000..ca4ba82 --- /dev/null +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -0,0 +1,22 @@ +```php +setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('') // Your project ID + ->setKey(''); // Your secret API key + +$tablesDB = new TablesDB($client); + +$result = $tablesDB->updateVarcharColumn( + databaseId: '', + tableId: '', + key: '', + required: false, + default: '', + size: 1, // optional + newKey: '' // optional +);``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 106b75e..126b3ca 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -1,3 +1,4 @@ +```php update( databaseId: '', - name: '', + name: '', // optional enabled: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 192463e..5c4645b 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -1,3 +1,4 @@ +```php upsertRow( databaseId: '', tableId: '', rowId: '', - data: [], // optional + data: [ + 'username' => 'walter.obrien', + 'email' => 'walter.obrien@example.com', + 'fullName' => 'Walter O'Brien', + 'age' => 33, + 'isAdmin' => false + ], // optional permissions: [Permission::read(Role::any())], // optional transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index fb93df8..6d9d615 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -1,3 +1,4 @@ +```php upsertRows( tableId: '', rows: [], transactionId: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 285368f..ddbddc3 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,3 +1,4 @@ +```php createMembership( phone: '+12065550100', // optional url: 'https://example.com', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 643fa0e..e0eef90 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,3 +1,4 @@ +```php create( teamId: '', name: '', roles: [] // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 579b790..096d69e 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,3 +1,4 @@ +```php deleteMembership( teamId: '', membershipId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 9db4e7e..e982d57 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,3 +1,4 @@ +```php delete( teamId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index bd6cbe8..c696fd0 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,3 +1,4 @@ +```php getMembership( teamId: '', membershipId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index fbade4f..ea621f3 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,3 +1,4 @@ +```php getPrefs( teamId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 0dafa8a..b0a7124 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,3 +1,4 @@ +```php get( teamId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 5ff4736..0b4fd91 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,3 +1,4 @@ +```php listMemberships( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 144b50d..04fdc4f 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 5dbfd4c..33f891c 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,3 +1,4 @@ +```php updateMembershipStatus( membershipId: '', userId: '', secret: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 10f135b..0a25189 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,3 +1,4 @@ +```php updateMembership( teamId: '', membershipId: '', roles: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index bc13d92..eae3a3b 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,3 +1,4 @@ +```php updateName( teamId: '', name: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index bd8d9de..785f7ba 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,3 +1,4 @@ +```php updatePrefs( teamId: '', prefs: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md index e4f2302..d172c15 100644 --- a/docs/examples/tokens/create-file-token.md +++ b/docs/examples/tokens/create-file-token.md @@ -1,3 +1,4 @@ +```php createFileToken( bucketId: '', fileId: '', expire: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md index 278be90..d298ed3 100644 --- a/docs/examples/tokens/delete.md +++ b/docs/examples/tokens/delete.md @@ -1,3 +1,4 @@ +```php delete( tokenId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md index e7b4e10..db117e6 100644 --- a/docs/examples/tokens/get.md +++ b/docs/examples/tokens/get.md @@ -1,3 +1,4 @@ +```php get( tokenId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index 212a443..3551261 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -1,3 +1,4 @@ +```php list( fileId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md index ea95322..07c37e3 100644 --- a/docs/examples/tokens/update.md +++ b/docs/examples/tokens/update.md @@ -1,3 +1,4 @@ +```php update( tokenId: '', expire: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md index a9166ef..4813cd8 100644 --- a/docs/examples/users/create-argon-2-user.md +++ b/docs/examples/users/create-argon-2-user.md @@ -1,3 +1,4 @@ +```php createArgon2User( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index c9fd81e..17a3c7e 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -1,3 +1,4 @@ +```php createBcryptUser( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md index 1c1c6d4..9a22a60 100644 --- a/docs/examples/users/create-jwt.md +++ b/docs/examples/users/create-jwt.md @@ -1,3 +1,4 @@ +```php createJWT( userId: '', sessionId: '', // optional duration: 0 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md index 696cbbe..85e97f7 100644 --- a/docs/examples/users/create-md-5-user.md +++ b/docs/examples/users/create-md-5-user.md @@ -1,3 +1,4 @@ +```php createMD5User( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index ee96d2e..2329547 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php createMFARecoveryCodes( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md index d56c465..0e9a62f 100644 --- a/docs/examples/users/create-ph-pass-user.md +++ b/docs/examples/users/create-ph-pass-user.md @@ -1,3 +1,4 @@ +```php createPHPassUser( email: 'email@example.com', password: 'password', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index f579efb..22c18b1 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -1,3 +1,4 @@ +```php createScryptModifiedUser( passwordSaltSeparator: '', passwordSignerKey: '', name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index b406b94..8ebc44d 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -1,3 +1,4 @@ +```php createScryptUser( passwordParallel: null, passwordLength: null, name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index 1589315..0279835 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -1,3 +1,4 @@ +```php createSession( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md index 812bcd5..924224b 100644 --- a/docs/examples/users/create-sha-user.md +++ b/docs/examples/users/create-sha-user.md @@ -1,3 +1,4 @@ +```php createSHAUser( password: 'password', passwordVersion: PasswordHash::SHA1(), // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 57946a4..1000574 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -1,3 +1,4 @@ +```php createTarget( identifier: '', providerId: '', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index 1b92f51..4519995 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -1,3 +1,4 @@ +```php createToken( userId: '', length: 4, // optional expire: 60 // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index 595f24f..ec9b683 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -1,3 +1,4 @@ +```php create( phone: '+12065550100', // optional password: '', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 26b71ee..b364358 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -1,3 +1,4 @@ +```php deleteIdentity( identityId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index f2f08ec..15ca8e2 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -1,3 +1,4 @@ +```php deleteMFAAuthenticator( userId: '', type: AuthenticatorType::TOTP() -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index 493cf53..9786bde 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -1,3 +1,4 @@ +```php deleteSession( userId: '', sessionId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index cd6d11e..236aeff 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -1,3 +1,4 @@ +```php deleteSessions( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 0d85d3e..6d915db 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -1,3 +1,4 @@ +```php deleteTarget( userId: '', targetId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 883156e..faea96c 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -1,3 +1,4 @@ +```php delete( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index 7937e6a..90aa08d 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php getMFARecoveryCodes( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 5e99e14..931c5be 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -1,3 +1,4 @@ +```php getPrefs( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 31baf3c..1f3c002 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -1,3 +1,4 @@ +```php getTarget( userId: '', targetId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 0ce39ae..a777b73 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -1,3 +1,4 @@ +```php get( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 9cdc5bc..3707410 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -1,3 +1,4 @@ +```php listIdentities( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 7015526..0d0464e 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -1,3 +1,4 @@ +```php listLogs( userId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 9a37fea..c9b3fb5 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -1,3 +1,4 @@ +```php listMemberships( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 5dae790..c3cd045 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -1,3 +1,4 @@ +```php listMFAFactors( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index e657aa2..e4baa40 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -1,3 +1,4 @@ +```php listSessions( userId: '', total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index 435dbde..3e33f9f 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -1,3 +1,4 @@ +```php listTargets( userId: '', queries: [], // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 6494f07..39d3189 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -1,3 +1,4 @@ +```php list( queries: [], // optional search: '', // optional total: false // optional -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 636f1d2..b7a3a91 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -1,3 +1,4 @@ +```php updateEmailVerification( userId: '', emailVerification: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 21ec88b..2710f49 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -1,3 +1,4 @@ +```php updateEmail( userId: '', email: 'email@example.com' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 7d4ae5d..56be4fb 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -1,3 +1,4 @@ +```php updateLabels( userId: '', labels: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index 8474755..bee4d18 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -1,3 +1,4 @@ +```php updateMFARecoveryCodes( userId: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index c24916a..9cac2ff 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -1,3 +1,4 @@ +```php updateMFA( userId: '', mfa: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 09bb07c..bce3d8c 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -1,3 +1,4 @@ +```php updateName( userId: '', name: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 6d58605..69d9330 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -1,3 +1,4 @@ +```php updatePassword( userId: '', password: '' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 019fb3f..f94b1f8 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -1,3 +1,4 @@ +```php updatePhoneVerification( userId: '', phoneVerification: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index 13bd41b..c975eaf 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -1,3 +1,4 @@ +```php updatePhone( userId: '', number: '+12065550100' -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index 9491239..b276922 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -1,3 +1,4 @@ +```php updatePrefs( userId: '', prefs: [] -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index f29dc95..1a8346c 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -1,3 +1,4 @@ +```php updateStatus( userId: '', status: false -); \ No newline at end of file +);``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 00ad27b..8963569 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -1,3 +1,4 @@ +```php updateTarget( identifier: '', // optional providerId: '', // optional name: '' // optional -); \ No newline at end of file +);``` diff --git a/docs/health.md b/docs/health.md index dc19294..4532a8c 100644 --- a/docs/health.md +++ b/docs/health.md @@ -49,6 +49,45 @@ GET https://cloud.appwrite.io/v1/health/pubsub ** Check the Appwrite pub-sub servers are up and connection is successful. ** +```http request +GET https://cloud.appwrite.io/v1/health/queue/audits +``` + +** Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | + + +```http request +GET https://cloud.appwrite.io/v1/health/queue/billing-project-aggregation +``` + +** Get billing project aggregation queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | + + +```http request +GET https://cloud.appwrite.io/v1/health/queue/billing-team-aggregation +``` + +** Get billing team aggregation queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 10000 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/builds ``` @@ -62,6 +101,19 @@ GET https://cloud.appwrite.io/v1/health/queue/builds | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/builds-priority +``` + +** Get the priority builds queue size. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. | 500 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/certificates ``` @@ -182,6 +234,19 @@ GET https://cloud.appwrite.io/v1/health/queue/migrations | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/region-manager +``` + +** Get region manager queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/stats-resources ``` @@ -208,6 +273,19 @@ GET https://cloud.appwrite.io/v1/health/queue/stats-usage | threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. | 5000 | +```http request +GET https://cloud.appwrite.io/v1/health/queue/threats +``` + +** Get threats queue. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| threshold | integer | Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. | 100 | + + ```http request GET https://cloud.appwrite.io/v1/health/queue/webhooks ``` diff --git a/docs/organizations.md b/docs/organizations.md new file mode 100644 index 0000000..1b7105f --- /dev/null +++ b/docs/organizations.md @@ -0,0 +1,28 @@ +# Organizations Service + + +```http request +DELETE https://cloud.appwrite.io/v1/organizations/{organizationId} +``` + +** Delete an organization. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| organizationId | string | **Required** Team ID. | | + + +```http request +PATCH https://cloud.appwrite.io/v1/organizations/{organizationId}/estimations/delete-organization +``` + +** Get estimation for deleting an organization. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| organizationId | string | **Required** Team ID. | | + diff --git a/docs/storage.md b/docs/storage.md index 8654029..c051c9b 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -31,9 +31,9 @@ POST https://cloud.appwrite.io/v1/storage/buckets | permissions | array | An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | -| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | +| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 5GB. | [] | | allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | -| compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | +| compression | string | Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | | antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | | transformations | boolean | Are image transformations enabled? | 1 | @@ -67,9 +67,9 @@ PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId} | permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | fileSecurity | boolean | Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). | | | enabled | boolean | Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. | 1 | -| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 30MB. | [] | +| maximumFileSize | integer | Maximum file size allowed in bytes. Maximum allowed value is 5GB. | [] | | allowedFileExtensions | array | Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. | [] | -| compression | string | Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | +| compression | string | Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled | none | | encryption | boolean | Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled | 1 | | antivirus | boolean | Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled | 1 | | transformations | boolean | Are image transformations enabled? | 1 | @@ -151,10 +151,10 @@ PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| bucketId | string | **Required** Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). | | -| fileId | string | **Required** File unique ID. | | -| name | string | Name of the file | | -| permissions | array | An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | +| bucketId | string | **Required** Bucket unique ID. | | +| fileId | string | **Required** File ID. | | +| name | string | File name. | | +| permissions | array | An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | | ```http request diff --git a/docs/tablesdb.md b/docs/tablesdb.md index e92f32b..863408d 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -559,6 +559,82 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | newKey | string | New Column Key. | | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/longtext +``` + +** Create a longtext column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key} +``` + +** Update a longtext column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext +``` + +** Create a mediumtext column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key} +``` + +** Update a mediumtext column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + ```http request POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/point ``` @@ -691,6 +767,44 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | newKey | string | New Column Key. | | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/text +``` + +** Create a text column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key} +``` + +** Update a text column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| newKey | string | New Column Key. | | + + ```http request POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/url ``` @@ -729,6 +843,46 @@ PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/column | newKey | string | New Column Key. | | +```http request +POST https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/varchar +``` + +** Create a varchar column. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | Column Key. | | +| size | integer | Column size for varchar columns, in number of characters. Maximum size is 16381. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| array | boolean | Is column an array? | | + + +```http request +PATCH https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key} +``` + +** Update a varchar column. Changing the `default` value will not update already existing rows. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| databaseId | string | **Required** Database ID. | | +| tableId | string | **Required** Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). | | +| key | string | **Required** Column Key. | | +| required | boolean | Is column required? | | +| default | string | Default value for column when not provided. Cannot be set when column is required. | | +| size | integer | Maximum size of the varchar column. | | +| newKey | string | New Column Key. | | + + ```http request GET https://cloud.appwrite.io/v1/tablesdb/{databaseId}/tables/{tableId}/columns/{key} ``` diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 9ade612..8d8d89e 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,13 +37,27 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/19.1.0 ()', + 'user-agent' => 'AppwritePHPSDK/20.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '19.1.0', + 'x-sdk-version'=> '20.0.0', ]; + /** + * Timeout in seconds + * + * @var int|null + */ + protected ?int $timeout = null; + + /** + * Connect timeout in seconds + * + * @var int|null + */ + protected ?int $connectTimeout = null; + /** * Client constructor. */ @@ -173,6 +187,30 @@ public function setEndpoint(string $endpoint): Client return $this; } + /** + * Set Timeout + * + * @param int $timeout Timeout in seconds + * @return Client + */ + public function setTimeout(int $timeout): Client + { + $this->timeout = $timeout; + return $this; + } + + /** + * Set Connect Timeout + * + * @param int $connectTimeout Connect timeout in seconds + * @return Client + */ + public function setConnectTimeout(int $connectTimeout): Client + { + $this->connectTimeout = $connectTimeout; + return $this; + } + /** * @param $key * @param $value @@ -180,7 +218,7 @@ public function setEndpoint(string $endpoint): Client public function addHeader(string $key, string $value): Client { $this->headers[strtolower($key)] = $value; - + return $this; } @@ -210,7 +248,7 @@ public function call( switch ($headers['content-type']) { case 'application/json': - $query = json_encode($params); + $query = json_encode($this->prepareParams($params)); break; case 'multipart/form-data': @@ -255,6 +293,16 @@ public function call( curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } + // Set timeout if configured + if($this->timeout !== null) { + curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); + } + + // Set connect timeout if configured + if($this->connectTimeout !== null) { + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout); + } + $responseBody = curl_exec($ch); $contentType = $responseHeaders['content-type'] ?? ''; $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); @@ -316,4 +364,23 @@ protected function flatten(array $data, string $prefix = ''): array { return $output; } + + /** + * Prepare params for JSON encoding by converting model objects to arrays + * + * @param mixed $data + * @return mixed + */ + protected function prepareParams($data) + { + if (is_array($data)) { + return array_map([$this, 'prepareParams'], $data); + } + + if (is_object($data) && method_exists($data, 'toArray')) { + return $data->toArray(); + } + + return $data; + } } diff --git a/src/Appwrite/Enums/BackupServices.php b/src/Appwrite/Enums/BackupServices.php new file mode 100644 index 0000000..8eb096d --- /dev/null +++ b/src/Appwrite/Enums/BackupServices.php @@ -0,0 +1,51 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function DATABASES(): BackupServices + { + if (!isset(self::$DATABASES)) { + self::$DATABASES = new BackupServices('databases'); + } + return self::$DATABASES; + } + public static function FUNCTIONS(): BackupServices + { + if (!isset(self::$FUNCTIONS)) { + self::$FUNCTIONS = new BackupServices('functions'); + } + return self::$FUNCTIONS; + } + public static function STORAGE(): BackupServices + { + if (!isset(self::$STORAGE)) { + self::$STORAGE = new BackupServices('storage'); + } + return self::$STORAGE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/BrowserPermission.php b/src/Appwrite/Enums/BrowserPermission.php new file mode 100644 index 0000000..30a13a1 --- /dev/null +++ b/src/Appwrite/Enums/BrowserPermission.php @@ -0,0 +1,187 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function GEOLOCATION(): BrowserPermission + { + if (!isset(self::$GEOLOCATION)) { + self::$GEOLOCATION = new BrowserPermission('geolocation'); + } + return self::$GEOLOCATION; + } + public static function CAMERA(): BrowserPermission + { + if (!isset(self::$CAMERA)) { + self::$CAMERA = new BrowserPermission('camera'); + } + return self::$CAMERA; + } + public static function MICROPHONE(): BrowserPermission + { + if (!isset(self::$MICROPHONE)) { + self::$MICROPHONE = new BrowserPermission('microphone'); + } + return self::$MICROPHONE; + } + public static function NOTIFICATIONS(): BrowserPermission + { + if (!isset(self::$NOTIFICATIONS)) { + self::$NOTIFICATIONS = new BrowserPermission('notifications'); + } + return self::$NOTIFICATIONS; + } + public static function MIDI(): BrowserPermission + { + if (!isset(self::$MIDI)) { + self::$MIDI = new BrowserPermission('midi'); + } + return self::$MIDI; + } + public static function PUSH(): BrowserPermission + { + if (!isset(self::$PUSH)) { + self::$PUSH = new BrowserPermission('push'); + } + return self::$PUSH; + } + public static function CLIPBOARDREAD(): BrowserPermission + { + if (!isset(self::$CLIPBOARDREAD)) { + self::$CLIPBOARDREAD = new BrowserPermission('clipboard-read'); + } + return self::$CLIPBOARDREAD; + } + public static function CLIPBOARDWRITE(): BrowserPermission + { + if (!isset(self::$CLIPBOARDWRITE)) { + self::$CLIPBOARDWRITE = new BrowserPermission('clipboard-write'); + } + return self::$CLIPBOARDWRITE; + } + public static function PAYMENTHANDLER(): BrowserPermission + { + if (!isset(self::$PAYMENTHANDLER)) { + self::$PAYMENTHANDLER = new BrowserPermission('payment-handler'); + } + return self::$PAYMENTHANDLER; + } + public static function USB(): BrowserPermission + { + if (!isset(self::$USB)) { + self::$USB = new BrowserPermission('usb'); + } + return self::$USB; + } + public static function BLUETOOTH(): BrowserPermission + { + if (!isset(self::$BLUETOOTH)) { + self::$BLUETOOTH = new BrowserPermission('bluetooth'); + } + return self::$BLUETOOTH; + } + public static function ACCELEROMETER(): BrowserPermission + { + if (!isset(self::$ACCELEROMETER)) { + self::$ACCELEROMETER = new BrowserPermission('accelerometer'); + } + return self::$ACCELEROMETER; + } + public static function GYROSCOPE(): BrowserPermission + { + if (!isset(self::$GYROSCOPE)) { + self::$GYROSCOPE = new BrowserPermission('gyroscope'); + } + return self::$GYROSCOPE; + } + public static function MAGNETOMETER(): BrowserPermission + { + if (!isset(self::$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'); + } + return self::$AMBIENTLIGHTSENSOR; + } + public static function BACKGROUNDSYNC(): BrowserPermission + { + if (!isset(self::$BACKGROUNDSYNC)) { + self::$BACKGROUNDSYNC = new BrowserPermission('background-sync'); + } + return self::$BACKGROUNDSYNC; + } + public static function PERSISTENTSTORAGE(): BrowserPermission + { + if (!isset(self::$PERSISTENTSTORAGE)) { + 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'); + } + return self::$SCREENWAKELOCK; + } + public static function WEBSHARE(): BrowserPermission + { + if (!isset(self::$WEBSHARE)) { + 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'); + } + return self::$XRSPATIALTRACKING; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/BuildRuntime.php b/src/Appwrite/Enums/BuildRuntime.php index 0806513..a7fe12a 100644 --- a/src/Appwrite/Enums/BuildRuntime.php +++ b/src/Appwrite/Enums/BuildRuntime.php @@ -28,9 +28,6 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $PYTHON312; private static BuildRuntime $PYTHONML311; private static BuildRuntime $PYTHONML312; - private static BuildRuntime $DENO121; - private static BuildRuntime $DENO124; - private static BuildRuntime $DENO135; private static BuildRuntime $DENO140; private static BuildRuntime $DENO146; private static BuildRuntime $DENO20; @@ -45,6 +42,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $DART35; private static BuildRuntime $DART38; private static BuildRuntime $DART39; + private static BuildRuntime $DART310; private static BuildRuntime $DOTNET60; private static BuildRuntime $DOTNET70; private static BuildRuntime $DOTNET80; @@ -73,6 +71,7 @@ class BuildRuntime implements JsonSerializable private static BuildRuntime $FLUTTER329; private static BuildRuntime $FLUTTER332; private static BuildRuntime $FLUTTER335; + private static BuildRuntime $FLUTTER338; private string $value; @@ -245,27 +244,6 @@ public static function PYTHONML312(): BuildRuntime } return self::$PYTHONML312; } - public static function DENO121(): BuildRuntime - { - if (!isset(self::$DENO121)) { - self::$DENO121 = new BuildRuntime('deno-1.21'); - } - return self::$DENO121; - } - public static function DENO124(): BuildRuntime - { - if (!isset(self::$DENO124)) { - self::$DENO124 = new BuildRuntime('deno-1.24'); - } - return self::$DENO124; - } - public static function DENO135(): BuildRuntime - { - if (!isset(self::$DENO135)) { - self::$DENO135 = new BuildRuntime('deno-1.35'); - } - return self::$DENO135; - } public static function DENO140(): BuildRuntime { if (!isset(self::$DENO140)) { @@ -364,6 +342,13 @@ public static function DART39(): BuildRuntime } return self::$DART39; } + public static function DART310(): BuildRuntime + { + if (!isset(self::$DART310)) { + self::$DART310 = new BuildRuntime('dart-3.10'); + } + return self::$DART310; + } public static function DOTNET60(): BuildRuntime { if (!isset(self::$DOTNET60)) { @@ -560,4 +545,11 @@ public static function FLUTTER335(): BuildRuntime } return self::$FLUTTER335; } + public static function FLUTTER338(): BuildRuntime + { + if (!isset(self::$FLUTTER338)) { + self::$FLUTTER338 = new BuildRuntime('flutter-3.38'); + } + return self::$FLUTTER338; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/DeploymentStatus.php b/src/Appwrite/Enums/DeploymentStatus.php index 7d53c88..1cc26b6 100644 --- a/src/Appwrite/Enums/DeploymentStatus.php +++ b/src/Appwrite/Enums/DeploymentStatus.php @@ -10,6 +10,7 @@ class DeploymentStatus implements JsonSerializable private static DeploymentStatus $PROCESSING; private static DeploymentStatus $BUILDING; private static DeploymentStatus $READY; + private static DeploymentStatus $CANCELED; private static DeploymentStatus $FAILED; private string $value; @@ -57,6 +58,13 @@ public static function READY(): DeploymentStatus } return self::$READY; } + public static function CANCELED(): DeploymentStatus + { + if (!isset(self::$CANCELED)) { + self::$CANCELED = new DeploymentStatus('canceled'); + } + return self::$CANCELED; + } public static function FAILED(): DeploymentStatus { if (!isset(self::$FAILED)) { diff --git a/src/Appwrite/Enums/Name.php b/src/Appwrite/Enums/Name.php index bcf9dc5..7407769 100644 --- a/src/Appwrite/Enums/Name.php +++ b/src/Appwrite/Enums/Name.php @@ -16,6 +16,7 @@ class Name implements JsonSerializable private static Name $V1WEBHOOKS; private static Name $V1CERTIFICATES; private static Name $V1BUILDS; + private static Name $V1SCREENSHOTS; private static Name $V1MESSAGING; private static Name $V1MIGRATIONS; @@ -106,6 +107,13 @@ public static function V1BUILDS(): Name } return self::$V1BUILDS; } + public static function V1SCREENSHOTS(): Name + { + if (!isset(self::$V1SCREENSHOTS)) { + self::$V1SCREENSHOTS = new Name('v1-screenshots'); + } + return self::$V1SCREENSHOTS; + } public static function V1MESSAGING(): Name { if (!isset(self::$V1MESSAGING)) { diff --git a/src/Appwrite/Enums/OAuthProvider.php b/src/Appwrite/Enums/OAuthProvider.php index 4763c9c..29bcd73 100644 --- a/src/Appwrite/Enums/OAuthProvider.php +++ b/src/Appwrite/Enums/OAuthProvider.php @@ -45,7 +45,8 @@ class OAuthProvider implements JsonSerializable private static OAuthProvider $YANDEX; private static OAuthProvider $ZOHO; private static OAuthProvider $ZOOM; - private static OAuthProvider $MOCK; + private static OAuthProvider $GITHUBIMAGINE; + private static OAuthProvider $GOOGLEIMAGINE; private string $value; @@ -337,11 +338,18 @@ public static function ZOOM(): OAuthProvider } return self::$ZOOM; } - public static function MOCK(): OAuthProvider + public static function GITHUBIMAGINE(): OAuthProvider { - if (!isset(self::$MOCK)) { - self::$MOCK = new OAuthProvider('mock'); + if (!isset(self::$GITHUBIMAGINE)) { + self::$GITHUBIMAGINE = new OAuthProvider('githubImagine'); } - return self::$MOCK; + return self::$GITHUBIMAGINE; + } + public static function GOOGLEIMAGINE(): OAuthProvider + { + if (!isset(self::$GOOGLEIMAGINE)) { + self::$GOOGLEIMAGINE = new OAuthProvider('googleImagine'); + } + return self::$GOOGLEIMAGINE; } } \ No newline at end of file diff --git a/src/Appwrite/Enums/OrderBy.php b/src/Appwrite/Enums/OrderBy.php new file mode 100644 index 0000000..457dd7a --- /dev/null +++ b/src/Appwrite/Enums/OrderBy.php @@ -0,0 +1,43 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function ASC(): OrderBy + { + if (!isset(self::$ASC)) { + self::$ASC = new OrderBy('asc'); + } + return self::$ASC; + } + public static function DESC(): OrderBy + { + if (!isset(self::$DESC)) { + self::$DESC = new OrderBy('desc'); + } + return self::$DESC; + } +} \ No newline at end of file diff --git a/src/Appwrite/Enums/Output.php b/src/Appwrite/Enums/Output.php deleted file mode 100644 index 45c0675..0000000 --- a/src/Appwrite/Enums/Output.php +++ /dev/null @@ -1,83 +0,0 @@ -value = $value; - } - - public function __toString(): string - { - return $this->value; - } - - public function jsonSerialize(): string - { - return $this->value; - } - - public static function JPG(): Output - { - if (!isset(self::$JPG)) { - self::$JPG = new Output('jpg'); - } - return self::$JPG; - } - public static function JPEG(): Output - { - if (!isset(self::$JPEG)) { - self::$JPEG = new Output('jpeg'); - } - return self::$JPEG; - } - public static function PNG(): Output - { - if (!isset(self::$PNG)) { - self::$PNG = new Output('png'); - } - return self::$PNG; - } - public static function WEBP(): Output - { - if (!isset(self::$WEBP)) { - self::$WEBP = new Output('webp'); - } - return self::$WEBP; - } - public static function HEIC(): Output - { - if (!isset(self::$HEIC)) { - self::$HEIC = new Output('heic'); - } - return self::$HEIC; - } - public static function AVIF(): Output - { - if (!isset(self::$AVIF)) { - self::$AVIF = new Output('avif'); - } - return self::$AVIF; - } - public static function GIF(): Output - { - if (!isset(self::$GIF)) { - self::$GIF = new Output('gif'); - } - return self::$GIF; - } -} \ No newline at end of file diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 75e78e5..0c5eeab 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -28,9 +28,6 @@ class Runtime implements JsonSerializable private static Runtime $PYTHON312; private static Runtime $PYTHONML311; private static Runtime $PYTHONML312; - private static Runtime $DENO121; - private static Runtime $DENO124; - private static Runtime $DENO135; private static Runtime $DENO140; private static Runtime $DENO146; private static Runtime $DENO20; @@ -45,6 +42,7 @@ class Runtime implements JsonSerializable private static Runtime $DART35; private static Runtime $DART38; private static Runtime $DART39; + private static Runtime $DART310; private static Runtime $DOTNET60; private static Runtime $DOTNET70; private static Runtime $DOTNET80; @@ -73,6 +71,7 @@ class Runtime implements JsonSerializable private static Runtime $FLUTTER329; private static Runtime $FLUTTER332; private static Runtime $FLUTTER335; + private static Runtime $FLUTTER338; private string $value; @@ -245,27 +244,6 @@ public static function PYTHONML312(): Runtime } return self::$PYTHONML312; } - public static function DENO121(): Runtime - { - if (!isset(self::$DENO121)) { - self::$DENO121 = new Runtime('deno-1.21'); - } - return self::$DENO121; - } - public static function DENO124(): Runtime - { - if (!isset(self::$DENO124)) { - self::$DENO124 = new Runtime('deno-1.24'); - } - return self::$DENO124; - } - public static function DENO135(): Runtime - { - if (!isset(self::$DENO135)) { - self::$DENO135 = new Runtime('deno-1.35'); - } - return self::$DENO135; - } public static function DENO140(): Runtime { if (!isset(self::$DENO140)) { @@ -364,6 +342,13 @@ public static function DART39(): Runtime } return self::$DART39; } + public static function DART310(): Runtime + { + if (!isset(self::$DART310)) { + self::$DART310 = new Runtime('dart-3.10'); + } + return self::$DART310; + } public static function DOTNET60(): Runtime { if (!isset(self::$DOTNET60)) { @@ -560,4 +545,11 @@ public static function FLUTTER335(): Runtime } return self::$FLUTTER335; } + public static function FLUTTER338(): Runtime + { + if (!isset(self::$FLUTTER338)) { + self::$FLUTTER338 = new Runtime('flutter-3.38'); + } + return self::$FLUTTER338; + } } \ No newline at end of file diff --git a/src/Appwrite/Enums/Scopes.php b/src/Appwrite/Enums/Scopes.php new file mode 100644 index 0000000..9634724 --- /dev/null +++ b/src/Appwrite/Enums/Scopes.php @@ -0,0 +1,531 @@ +value = $value; + } + + public function __toString(): string + { + return $this->value; + } + + public function jsonSerialize(): string + { + return $this->value; + } + + public static function SESSIONSWRITE(): Scopes + { + if (!isset(self::$SESSIONSWRITE)) { + self::$SESSIONSWRITE = new Scopes('sessions.write'); + } + return self::$SESSIONSWRITE; + } + public static function USERSREAD(): Scopes + { + if (!isset(self::$USERSREAD)) { + self::$USERSREAD = new Scopes('users.read'); + } + return self::$USERSREAD; + } + public static function USERSWRITE(): Scopes + { + if (!isset(self::$USERSWRITE)) { + self::$USERSWRITE = new Scopes('users.write'); + } + return self::$USERSWRITE; + } + public static function TEAMSREAD(): Scopes + { + if (!isset(self::$TEAMSREAD)) { + self::$TEAMSREAD = new Scopes('teams.read'); + } + return self::$TEAMSREAD; + } + public static function TEAMSWRITE(): Scopes + { + if (!isset(self::$TEAMSWRITE)) { + self::$TEAMSWRITE = new Scopes('teams.write'); + } + return self::$TEAMSWRITE; + } + public static function DATABASESREAD(): Scopes + { + if (!isset(self::$DATABASESREAD)) { + self::$DATABASESREAD = new Scopes('databases.read'); + } + return self::$DATABASESREAD; + } + public static function DATABASESWRITE(): Scopes + { + if (!isset(self::$DATABASESWRITE)) { + self::$DATABASESWRITE = new Scopes('databases.write'); + } + return self::$DATABASESWRITE; + } + public static function COLLECTIONSREAD(): Scopes + { + if (!isset(self::$COLLECTIONSREAD)) { + self::$COLLECTIONSREAD = new Scopes('collections.read'); + } + return self::$COLLECTIONSREAD; + } + public static function COLLECTIONSWRITE(): Scopes + { + if (!isset(self::$COLLECTIONSWRITE)) { + self::$COLLECTIONSWRITE = new Scopes('collections.write'); + } + return self::$COLLECTIONSWRITE; + } + public static function TABLESREAD(): Scopes + { + if (!isset(self::$TABLESREAD)) { + self::$TABLESREAD = new Scopes('tables.read'); + } + return self::$TABLESREAD; + } + public static function TABLESWRITE(): Scopes + { + if (!isset(self::$TABLESWRITE)) { + self::$TABLESWRITE = new Scopes('tables.write'); + } + return self::$TABLESWRITE; + } + public static function ATTRIBUTESREAD(): Scopes + { + if (!isset(self::$ATTRIBUTESREAD)) { + self::$ATTRIBUTESREAD = new Scopes('attributes.read'); + } + return self::$ATTRIBUTESREAD; + } + public static function ATTRIBUTESWRITE(): Scopes + { + if (!isset(self::$ATTRIBUTESWRITE)) { + self::$ATTRIBUTESWRITE = new Scopes('attributes.write'); + } + return self::$ATTRIBUTESWRITE; + } + public static function COLUMNSREAD(): Scopes + { + if (!isset(self::$COLUMNSREAD)) { + self::$COLUMNSREAD = new Scopes('columns.read'); + } + return self::$COLUMNSREAD; + } + public static function COLUMNSWRITE(): Scopes + { + if (!isset(self::$COLUMNSWRITE)) { + self::$COLUMNSWRITE = new Scopes('columns.write'); + } + return self::$COLUMNSWRITE; + } + public static function INDEXESREAD(): Scopes + { + if (!isset(self::$INDEXESREAD)) { + self::$INDEXESREAD = new Scopes('indexes.read'); + } + return self::$INDEXESREAD; + } + public static function INDEXESWRITE(): Scopes + { + if (!isset(self::$INDEXESWRITE)) { + self::$INDEXESWRITE = new Scopes('indexes.write'); + } + return self::$INDEXESWRITE; + } + public static function DOCUMENTSREAD(): Scopes + { + if (!isset(self::$DOCUMENTSREAD)) { + self::$DOCUMENTSREAD = new Scopes('documents.read'); + } + return self::$DOCUMENTSREAD; + } + public static function DOCUMENTSWRITE(): Scopes + { + if (!isset(self::$DOCUMENTSWRITE)) { + self::$DOCUMENTSWRITE = new Scopes('documents.write'); + } + return self::$DOCUMENTSWRITE; + } + public static function ROWSREAD(): Scopes + { + if (!isset(self::$ROWSREAD)) { + self::$ROWSREAD = new Scopes('rows.read'); + } + return self::$ROWSREAD; + } + public static function ROWSWRITE(): Scopes + { + if (!isset(self::$ROWSWRITE)) { + self::$ROWSWRITE = new Scopes('rows.write'); + } + return self::$ROWSWRITE; + } + public static function FILESREAD(): Scopes + { + if (!isset(self::$FILESREAD)) { + self::$FILESREAD = new Scopes('files.read'); + } + return self::$FILESREAD; + } + public static function FILESWRITE(): Scopes + { + if (!isset(self::$FILESWRITE)) { + self::$FILESWRITE = new Scopes('files.write'); + } + return self::$FILESWRITE; + } + public static function BUCKETSREAD(): Scopes + { + if (!isset(self::$BUCKETSREAD)) { + self::$BUCKETSREAD = new Scopes('buckets.read'); + } + return self::$BUCKETSREAD; + } + public static function BUCKETSWRITE(): Scopes + { + if (!isset(self::$BUCKETSWRITE)) { + self::$BUCKETSWRITE = new Scopes('buckets.write'); + } + return self::$BUCKETSWRITE; + } + public static function FUNCTIONSREAD(): Scopes + { + if (!isset(self::$FUNCTIONSREAD)) { + self::$FUNCTIONSREAD = new Scopes('functions.read'); + } + return self::$FUNCTIONSREAD; + } + public static function FUNCTIONSWRITE(): Scopes + { + if (!isset(self::$FUNCTIONSWRITE)) { + self::$FUNCTIONSWRITE = new Scopes('functions.write'); + } + return self::$FUNCTIONSWRITE; + } + public static function SITESREAD(): Scopes + { + if (!isset(self::$SITESREAD)) { + self::$SITESREAD = new Scopes('sites.read'); + } + return self::$SITESREAD; + } + public static function SITESWRITE(): Scopes + { + if (!isset(self::$SITESWRITE)) { + self::$SITESWRITE = new Scopes('sites.write'); + } + return self::$SITESWRITE; + } + public static function LOGREAD(): Scopes + { + if (!isset(self::$LOGREAD)) { + self::$LOGREAD = new Scopes('log.read'); + } + return self::$LOGREAD; + } + public static function LOGWRITE(): Scopes + { + if (!isset(self::$LOGWRITE)) { + self::$LOGWRITE = new Scopes('log.write'); + } + return self::$LOGWRITE; + } + public static function EXECUTIONREAD(): Scopes + { + if (!isset(self::$EXECUTIONREAD)) { + self::$EXECUTIONREAD = new Scopes('execution.read'); + } + return self::$EXECUTIONREAD; + } + public static function EXECUTIONWRITE(): Scopes + { + if (!isset(self::$EXECUTIONWRITE)) { + self::$EXECUTIONWRITE = new Scopes('execution.write'); + } + return self::$EXECUTIONWRITE; + } + public static function LOCALEREAD(): Scopes + { + if (!isset(self::$LOCALEREAD)) { + self::$LOCALEREAD = new Scopes('locale.read'); + } + return self::$LOCALEREAD; + } + public static function AVATARSREAD(): Scopes + { + if (!isset(self::$AVATARSREAD)) { + self::$AVATARSREAD = new Scopes('avatars.read'); + } + return self::$AVATARSREAD; + } + public static function HEALTHREAD(): Scopes + { + if (!isset(self::$HEALTHREAD)) { + self::$HEALTHREAD = new Scopes('health.read'); + } + return self::$HEALTHREAD; + } + public static function PROVIDERSREAD(): Scopes + { + if (!isset(self::$PROVIDERSREAD)) { + self::$PROVIDERSREAD = new Scopes('providers.read'); + } + return self::$PROVIDERSREAD; + } + public static function PROVIDERSWRITE(): Scopes + { + if (!isset(self::$PROVIDERSWRITE)) { + self::$PROVIDERSWRITE = new Scopes('providers.write'); + } + return self::$PROVIDERSWRITE; + } + public static function MESSAGESREAD(): Scopes + { + if (!isset(self::$MESSAGESREAD)) { + self::$MESSAGESREAD = new Scopes('messages.read'); + } + return self::$MESSAGESREAD; + } + public static function MESSAGESWRITE(): Scopes + { + if (!isset(self::$MESSAGESWRITE)) { + self::$MESSAGESWRITE = new Scopes('messages.write'); + } + return self::$MESSAGESWRITE; + } + public static function TOPICSREAD(): Scopes + { + if (!isset(self::$TOPICSREAD)) { + self::$TOPICSREAD = new Scopes('topics.read'); + } + return self::$TOPICSREAD; + } + public static function TOPICSWRITE(): Scopes + { + if (!isset(self::$TOPICSWRITE)) { + self::$TOPICSWRITE = new Scopes('topics.write'); + } + return self::$TOPICSWRITE; + } + public static function SUBSCRIBERSREAD(): Scopes + { + if (!isset(self::$SUBSCRIBERSREAD)) { + self::$SUBSCRIBERSREAD = new Scopes('subscribers.read'); + } + return self::$SUBSCRIBERSREAD; + } + public static function SUBSCRIBERSWRITE(): Scopes + { + if (!isset(self::$SUBSCRIBERSWRITE)) { + self::$SUBSCRIBERSWRITE = new Scopes('subscribers.write'); + } + return self::$SUBSCRIBERSWRITE; + } + public static function TARGETSREAD(): Scopes + { + if (!isset(self::$TARGETSREAD)) { + self::$TARGETSREAD = new Scopes('targets.read'); + } + return self::$TARGETSREAD; + } + public static function TARGETSWRITE(): Scopes + { + if (!isset(self::$TARGETSWRITE)) { + self::$TARGETSWRITE = new Scopes('targets.write'); + } + return self::$TARGETSWRITE; + } + public static function RULESREAD(): Scopes + { + if (!isset(self::$RULESREAD)) { + self::$RULESREAD = new Scopes('rules.read'); + } + return self::$RULESREAD; + } + public static function RULESWRITE(): Scopes + { + if (!isset(self::$RULESWRITE)) { + self::$RULESWRITE = new Scopes('rules.write'); + } + return self::$RULESWRITE; + } + public static function MIGRATIONSREAD(): Scopes + { + if (!isset(self::$MIGRATIONSREAD)) { + self::$MIGRATIONSREAD = new Scopes('migrations.read'); + } + return self::$MIGRATIONSREAD; + } + public static function MIGRATIONSWRITE(): Scopes + { + if (!isset(self::$MIGRATIONSWRITE)) { + self::$MIGRATIONSWRITE = new Scopes('migrations.write'); + } + return self::$MIGRATIONSWRITE; + } + public static function VCSREAD(): Scopes + { + if (!isset(self::$VCSREAD)) { + self::$VCSREAD = new Scopes('vcs.read'); + } + return self::$VCSREAD; + } + public static function VCSWRITE(): Scopes + { + if (!isset(self::$VCSWRITE)) { + self::$VCSWRITE = new Scopes('vcs.write'); + } + return self::$VCSWRITE; + } + public static function ASSISTANTREAD(): Scopes + { + if (!isset(self::$ASSISTANTREAD)) { + self::$ASSISTANTREAD = new Scopes('assistant.read'); + } + return self::$ASSISTANTREAD; + } + public static function TOKENSREAD(): Scopes + { + if (!isset(self::$TOKENSREAD)) { + self::$TOKENSREAD = new Scopes('tokens.read'); + } + return self::$TOKENSREAD; + } + public static function TOKENSWRITE(): Scopes + { + if (!isset(self::$TOKENSWRITE)) { + self::$TOKENSWRITE = new Scopes('tokens.write'); + } + return self::$TOKENSWRITE; + } + public static function POLICIESWRITE(): Scopes + { + if (!isset(self::$POLICIESWRITE)) { + self::$POLICIESWRITE = new Scopes('policies.write'); + } + return self::$POLICIESWRITE; + } + public static function POLICIESREAD(): Scopes + { + if (!isset(self::$POLICIESREAD)) { + self::$POLICIESREAD = new Scopes('policies.read'); + } + return self::$POLICIESREAD; + } + public static function ARCHIVESREAD(): Scopes + { + if (!isset(self::$ARCHIVESREAD)) { + self::$ARCHIVESREAD = new Scopes('archives.read'); + } + return self::$ARCHIVESREAD; + } + public static function ARCHIVESWRITE(): Scopes + { + if (!isset(self::$ARCHIVESWRITE)) { + self::$ARCHIVESWRITE = new Scopes('archives.write'); + } + return self::$ARCHIVESWRITE; + } + public static function RESTORATIONSREAD(): Scopes + { + if (!isset(self::$RESTORATIONSREAD)) { + self::$RESTORATIONSREAD = new Scopes('restorations.read'); + } + return self::$RESTORATIONSREAD; + } + public static function RESTORATIONSWRITE(): Scopes + { + if (!isset(self::$RESTORATIONSWRITE)) { + self::$RESTORATIONSWRITE = new Scopes('restorations.write'); + } + return self::$RESTORATIONSWRITE; + } + public static function DOMAINSREAD(): Scopes + { + if (!isset(self::$DOMAINSREAD)) { + self::$DOMAINSREAD = new Scopes('domains.read'); + } + return self::$DOMAINSREAD; + } + public static function DOMAINSWRITE(): Scopes + { + if (!isset(self::$DOMAINSWRITE)) { + self::$DOMAINSWRITE = new Scopes('domains.write'); + } + return self::$DOMAINSWRITE; + } +} \ No newline at end of file diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php index cb1b838..75586e6 100644 --- a/src/Appwrite/Query.php +++ b/src/Appwrite/Query.php @@ -338,6 +338,40 @@ public static function notEndsWith(string $attribute, string $value): string return (new Query('notEndsWith', $attribute, $value))->__toString(); } + /** + * Filter resources where attribute matches a regular expression pattern. + * + * @param string $attribute The attribute to filter on. + * @param string $pattern The regular expression pattern to match. + * @return string + */ + public static function regex(string $attribute, string $pattern): string + { + return (new Query('regex', $attribute, $pattern))->__toString(); + } + + /** + * Filter resources where the specified attributes exist. + * + * @param array $attributes The list of attributes that must exist. + * @return string + */ + public static function exists(array $attributes): string + { + return (new Query('exists', null, $attributes))->__toString(); + } + + /** + * Filter resources where the specified attributes do not exist. + * + * @param array $attributes The list of attributes that must not exist. + * @return string + */ + public static function notExists(array $attributes): string + { + return (new Query('notExists', null, $attributes))->__toString(); + } + /** * Created Before * @@ -434,6 +468,22 @@ public static function and(array $queries): string return (new Query('and', null, $queries))->__toString(); } + /** + * Filter array elements where at least one element matches all the specified queries. + * + * @param string $attribute The attribute containing the array to filter on. + * @param array $queries The list of query strings to match against array elements. + * @return string + */ + public static function elemMatch(string $attribute, array $queries): string + { + foreach ($queries as &$query) { + $query = \json_decode($query, true); + } + + return (new Query('elemMatch', $attribute, $queries))->__toString(); + } + /** * Distance Equal * diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index cfb1b34..0460a23 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -6,6 +6,7 @@ use Appwrite\Client; use Appwrite\Service; use Appwrite\InputFile; +use Appwrite\Enums\Scopes; use Appwrite\Enums\AuthenticatorType; use Appwrite\Enums\AuthenticationFactor; use Appwrite\Enums\OAuthProvider; @@ -197,10 +198,11 @@ public function deleteIdentity(string $identityId): string * from its creation and will be invalid if the user will logout in that time * frame. * + * @param ?int $duration * @throws AppwriteException * @return array */ - public function createJWT(): array + public function createJWT(?int $duration = null): array { $apiPath = str_replace( [], @@ -210,6 +212,74 @@ public function createJWT(): array $apiParams = []; + if (!is_null($duration)) { + $apiParams['duration'] = $duration; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a list of all API keys from the current account. + * + * @param ?bool $total + * @throws AppwriteException + * @return array + */ + public function listKeys(?bool $total = null): array + { + $apiPath = str_replace( + [], + [], + '/account/keys' + ); + + $apiParams = []; + + if (!is_null($total)) { + $apiParams['total'] = $total; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new account API key. + * + * @param string $name + * @param array $scopes + * @param ?string $expire + * @throws AppwriteException + * @return array + */ + public function createKey(string $name, array $scopes, ?string $expire = null): array + { + $apiPath = str_replace( + [], + [], + '/account/keys' + ); + + $apiParams = []; + $apiParams['name'] = $name; + $apiParams['scopes'] = $scopes; + $apiParams['expire'] = $expire; + $apiHeaders = []; $apiHeaders['content-type'] = 'application/json'; @@ -221,6 +291,101 @@ public function createJWT(): array ); } + /** + * Get a key by its unique ID. This endpoint returns details about a specific + * API key in your account including it's scopes. + * + * @param string $keyId + * @throws AppwriteException + * @return array + */ + public function getKey(string $keyId): array + { + $apiPath = str_replace( + ['{keyId}'], + [$keyId], + '/account/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['keyId'] = $keyId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a key by its unique ID. Use this endpoint to update the name, + * scopes, or expiration time of an API key. + * + * @param string $keyId + * @param string $name + * @param array $scopes + * @param ?string $expire + * @throws AppwriteException + * @return array + */ + public function updateKey(string $keyId, string $name, array $scopes, ?string $expire = null): array + { + $apiPath = str_replace( + ['{keyId}'], + [$keyId], + '/account/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['keyId'] = $keyId; + $apiParams['name'] = $name; + $apiParams['scopes'] = $scopes; + $apiParams['expire'] = $expire; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PUT, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used + * to authenticate API calls. + * + * @param string $keyId + * @throws AppwriteException + * @return string + */ + public function deleteKey(string $keyId): string + { + $apiPath = str_replace( + ['{keyId}'], + [$keyId], + '/account/keys/{keyId}' + ); + + $apiParams = []; + $apiParams['keyId'] = $keyId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the list of latest security activity logs for the currently logged in * user. Each log returns user IP address, location and date and time of log. diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index 4b5dfb7..86e29d9 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -11,7 +11,8 @@ use Appwrite\Enums\Flag; use Appwrite\Enums\Theme; use Appwrite\Enums\Timezone; -use Appwrite\Enums\Output; +use Appwrite\Enums\BrowserPermission; +use Appwrite\Enums\ImageFormat; class Avatars extends Service { @@ -391,11 +392,11 @@ public function getQR(string $text, ?int $size = null, ?int $margin = null, ?boo * @param ?int $width * @param ?int $height * @param ?int $quality - * @param ?Output $output + * @param ?ImageFormat $output * @throws AppwriteException * @return string */ - public function getScreenshot(string $url, ?array $headers = null, ?int $viewportWidth = null, ?int $viewportHeight = null, ?float $scale = null, ?Theme $theme = null, ?string $userAgent = null, ?bool $fullpage = null, ?string $locale = null, ?Timezone $timezone = null, ?float $latitude = null, ?float $longitude = null, ?float $accuracy = null, ?bool $touch = null, ?array $permissions = null, ?int $sleep = null, ?int $width = null, ?int $height = null, ?int $quality = null, ?Output $output = null): string + public function getScreenshot(string $url, ?array $headers = null, ?int $viewportWidth = null, ?int $viewportHeight = null, ?float $scale = null, ?Theme $theme = null, ?string $userAgent = null, ?bool $fullpage = null, ?string $locale = null, ?Timezone $timezone = null, ?float $latitude = null, ?float $longitude = null, ?float $accuracy = null, ?bool $touch = null, ?array $permissions = null, ?int $sleep = null, ?int $width = null, ?int $height = null, ?int $quality = null, ?ImageFormat $output = null): string { $apiPath = str_replace( [], diff --git a/src/Appwrite/Services/Backups.php b/src/Appwrite/Services/Backups.php new file mode 100644 index 0000000..bca41ac --- /dev/null +++ b/src/Appwrite/Services/Backups.php @@ -0,0 +1,411 @@ +client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new archive asynchronously for a project. + * + * @param array $services + * @param ?string $resourceId + * @throws AppwriteException + * @return array + */ + public function createArchive(array $services, ?string $resourceId = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/archives' + ); + + $apiParams = []; + $apiParams['services'] = $services; + $apiParams['resourceId'] = $resourceId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a backup archive using it's ID. + * + * @param string $archiveId + * @throws AppwriteException + * @return array + */ + public function getArchive(string $archiveId): array + { + $apiPath = str_replace( + ['{archiveId}'], + [$archiveId], + '/backups/archives/{archiveId}' + ); + + $apiParams = []; + $apiParams['archiveId'] = $archiveId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete an existing archive for a project. + * + * @param string $archiveId + * @throws AppwriteException + * @return string + */ + public function deleteArchive(string $archiveId): string + { + $apiPath = str_replace( + ['{archiveId}'], + [$archiveId], + '/backups/archives/{archiveId}' + ); + + $apiParams = []; + $apiParams['archiveId'] = $archiveId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all policies for a project. + * + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listPolicies(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/policies' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a new backup policy. + * + * @param string $policyId + * @param array $services + * @param int $retention + * @param string $schedule + * @param ?string $name + * @param ?string $resourceId + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function createPolicy(string $policyId, array $services, int $retention, string $schedule, ?string $name = null, ?string $resourceId = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/policies' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + $apiParams['services'] = $services; + $apiParams['retention'] = $retention; + $apiParams['schedule'] = $schedule; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } + $apiParams['resourceId'] = $resourceId; + + if (!is_null($enabled)) { + $apiParams['enabled'] = $enabled; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get a backup policy using it's ID. + * + * @param string $policyId + * @throws AppwriteException + * @return array + */ + public function getPolicy(string $policyId): array + { + $apiPath = str_replace( + ['{policyId}'], + [$policyId], + '/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update an existing policy using it's ID. + * + * @param string $policyId + * @param ?string $name + * @param ?int $retention + * @param ?string $schedule + * @param ?bool $enabled + * @throws AppwriteException + * @return array + */ + public function updatePolicy(string $policyId, ?string $name = null, ?int $retention = null, ?string $schedule = null, ?bool $enabled = null): array + { + $apiPath = str_replace( + ['{policyId}'], + [$policyId], + '/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + $apiParams['name'] = $name; + $apiParams['retention'] = $retention; + + if (!is_null($schedule)) { + $apiParams['schedule'] = $schedule; + } + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Delete a policy using it's ID. + * + * @param string $policyId + * @throws AppwriteException + * @return string + */ + public function deletePolicy(string $policyId): string + { + $apiPath = str_replace( + ['{policyId}'], + [$policyId], + '/backups/policies/{policyId}' + ); + + $apiParams = []; + $apiParams['policyId'] = $policyId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create and trigger a new restoration for a backup on a project. + * + * @param string $archiveId + * @param array $services + * @param ?string $newResourceId + * @param ?string $newResourceName + * @throws AppwriteException + * @return array + */ + public function createRestoration(string $archiveId, array $services, ?string $newResourceId = null, ?string $newResourceName = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/restoration' + ); + + $apiParams = []; + $apiParams['archiveId'] = $archiveId; + $apiParams['services'] = $services; + + if (!is_null($newResourceId)) { + $apiParams['newResourceId'] = $newResourceId; + } + + if (!is_null($newResourceName)) { + $apiParams['newResourceName'] = $newResourceName; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * List all backup restorations for a project. + * + * @param ?array $queries + * @throws AppwriteException + * @return array + */ + public function listRestorations(?array $queries = null): array + { + $apiPath = str_replace( + [], + [], + '/backups/restorations' + ); + + $apiParams = []; + + if (!is_null($queries)) { + $apiParams['queries'] = $queries; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get the current status of a backup restoration. + * + * @param string $restorationId + * @throws AppwriteException + * @return array + */ + public function getRestoration(string $restorationId): array + { + $apiPath = str_replace( + ['{restorationId}'], + [$restorationId], + '/backups/restorations/{restorationId}' + ); + + $apiParams = []; + $apiParams['restorationId'] = $restorationId; + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index e9796fa..b4aa42c 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -9,6 +9,7 @@ use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; class Databases extends Service { @@ -331,7 +332,7 @@ public function get(string $databaseId): array * Update a database by its unique ID. * * @param string $databaseId - * @param string $name + * @param ?string $name * @param ?bool $enabled * @throws AppwriteException * @return array @@ -339,7 +340,7 @@ public function get(string $databaseId): array * @deprecated This API has been deprecated since 1.8.0. Please use `update` instead. * @see TablesDB::update */ - public function update(string $databaseId, string $name, ?bool $enabled = null): array + public function update(string $databaseId, ?string $name = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}'], @@ -349,7 +350,10 @@ public function update(string $databaseId, string $name, ?bool $enabled = null): $apiParams = []; $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } if (!is_null($enabled)) { $apiParams['enabled'] = $enabled; @@ -546,7 +550,7 @@ public function getCollection(string $databaseId, string $collectionId): array * * @param string $databaseId * @param string $collectionId - * @param string $name + * @param ?string $name * @param ?array $permissions * @param ?bool $documentSecurity * @param ?bool $enabled @@ -556,7 +560,7 @@ public function getCollection(string $databaseId, string $collectionId): array * @deprecated This API has been deprecated since 1.8.0. Please use `updateTable` instead. * @see TablesDB::updateTable */ - public function updateCollection(string $databaseId, string $collectionId, string $name, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array + public function updateCollection(string $databaseId, string $collectionId, ?string $name = null, ?array $permissions = null, ?bool $documentSecurity = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}'], @@ -567,7 +571,10 @@ public function updateCollection(string $databaseId, string $collectionId, strin $apiParams = []; $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } $apiParams['permissions'] = $permissions; if (!is_null($documentSecurity)) { @@ -1400,6 +1407,174 @@ public function updateLineAttribute(string $databaseId, string $collectionId, st ); } + /** + * Create a longtext attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createLongtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/longtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a longtext attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateLongtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a mediumtext attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createMediumtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a mediumtext attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateMediumtextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a geometric point attribute. * @@ -1719,6 +1894,90 @@ public function updateStringAttribute(string $databaseId, string $collectionId, ); } + /** + * Create a text attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createTextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/text' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a text attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateTextAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a URL attribute. * @@ -1809,6 +2068,94 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str ); } + /** + * Create a varchar attribute. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param int $size + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createVarcharAttribute(string $databaseId, string $collectionId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}'], + [$databaseId, $collectionId], + '/databases/{databaseId}/collections/{collectionId}/attributes/varchar' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['size'] = $size; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a varchar attribute. Changing the `default` value will not update + * already existing documents. + * + * + * @param string $databaseId + * @param string $collectionId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?int $size + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateVarcharAttribute(string $databaseId, string $collectionId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{collectionId}', '{key}'], + [$databaseId, $collectionId, $key], + '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['collectionId'] = $collectionId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['size'] = $size; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get attribute by ID. * @@ -2244,7 +2591,7 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @param string $databaseId * @param string $collectionId * @param string $documentId - * @param array $data + * @param ?array $data * @param ?array $permissions * @param ?string $transactionId * @throws AppwriteException @@ -2253,7 +2600,7 @@ public function getDocument(string $databaseId, string $collectionId, string $do * @deprecated This API has been deprecated since 1.8.0. Please use `upsertRow` instead. * @see TablesDB::upsertRow */ - public function upsertDocument(string $databaseId, string $collectionId, string $documentId, array $data, ?array $permissions = null, ?string $transactionId = null): array + public function upsertDocument(string $databaseId, string $collectionId, string $documentId, ?array $data = null, ?array $permissions = null, ?string $transactionId = null): array { $apiPath = str_replace( ['{databaseId}', '{collectionId}', '{documentId}'], @@ -2265,7 +2612,10 @@ public function upsertDocument(string $databaseId, string $collectionId, string $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['documentId'] = $documentId; - $apiParams['data'] = $data; + + if (!is_null($data)) { + $apiParams['data'] = $data; + } $apiParams['permissions'] = $permissions; $apiParams['transactionId'] = $transactionId; diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 0279cb7..561adab 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -7,6 +7,7 @@ use Appwrite\Service; use Appwrite\InputFile; use Appwrite\Enums\Runtime; +use Appwrite\Enums\Scopes; use Appwrite\Enums\TemplateReferenceType; use Appwrite\Enums\VCSReferenceType; use Appwrite\Enums\DeploymentDownloadType; @@ -485,7 +486,7 @@ public function listDeployments(string $functionId, ?array $queries = null, ?str * @throws AppwriteException * @return array */ - public function createDeployment(string $functionId, InputFile $code, bool $activate, ?string $entrypoint = null, ?string $commands = null, callable $onProgress = null): array + public function createDeployment(string $functionId, InputFile $code, bool $activate, ?string $entrypoint = null, ?string $commands = null, ?callable $onProgress = null): array { $apiPath = str_replace( ['{functionId}'], @@ -552,7 +553,7 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti fseek($handle, $start); $chunk = @fread($handle, Client::CHUNK_SIZE); } else { - $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); + $chunk = substr($code->getData(), $start, Client::CHUNK_SIZE); } $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index 86183b4..0644a0f 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -177,6 +177,100 @@ public function getPubSub(): array ); } + /** + * Get the number of audit logs that are waiting to be processed in the + * Appwrite internal queue server. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueAudits(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/audits' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get billing project aggregation queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueBillingProjectAggregation(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/billing-project-aggregation' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get billing team aggregation queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueBillingTeamAggregation(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/billing-team-aggregation' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of builds that are waiting to be processed in the Appwrite * internal queue server. @@ -209,6 +303,37 @@ public function getQueueBuilds(?int $threshold = null): array ); } + /** + * Get the priority builds queue size. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueuePriorityBuilds(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/builds-priority' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of certificates that are waiting to be issued against * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue @@ -505,6 +630,37 @@ public function getQueueMigrations(?int $threshold = null): array ); } + /** + * Get region manager queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueRegionManager(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/region-manager' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of metrics that are waiting to be processed in the Appwrite * stats resources queue. @@ -569,6 +725,37 @@ public function getQueueUsage(?int $threshold = null): array ); } + /** + * Get threats queue. + * + * @param ?int $threshold + * @throws AppwriteException + * @return array + */ + public function getQueueThreats(?int $threshold = null): array + { + $apiPath = str_replace( + [], + [], + '/health/queue/threats' + ); + + $apiParams = []; + + if (!is_null($threshold)) { + $apiParams['threshold'] = $threshold; + } + + $apiHeaders = []; + + return $this->client->call( + Client::METHOD_GET, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get the number of webhooks that are waiting to be processed in the Appwrite * internal queue server. diff --git a/src/Appwrite/Services/Organizations.php b/src/Appwrite/Services/Organizations.php new file mode 100644 index 0000000..9e340ab --- /dev/null +++ b/src/Appwrite/Services/Organizations.php @@ -0,0 +1,74 @@ +client->call( + Client::METHOD_DELETE, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Get estimation for deleting an organization. + * + * @param string $organizationId + * @throws AppwriteException + * @return array + */ + public function estimationDeleteOrganization(string $organizationId): array + { + $apiPath = str_replace( + ['{organizationId}'], + [$organizationId], + '/organizations/{organizationId}/estimations/delete-organization' + ); + + $apiParams = []; + $apiParams['organizationId'] = $organizationId; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } +} \ No newline at end of file diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index cabd1a6..50788f9 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -475,7 +475,7 @@ public function listDeployments(string $siteId, ?array $queries = null, ?string * @throws AppwriteException * @return array */ - public function createDeployment(string $siteId, InputFile $code, bool $activate, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, callable $onProgress = null): array + public function createDeployment(string $siteId, InputFile $code, bool $activate, ?string $installCommand = null, ?string $buildCommand = null, ?string $outputDirectory = null, ?callable $onProgress = null): array { $apiPath = str_replace( ['{siteId}'], @@ -546,7 +546,7 @@ public function createDeployment(string $siteId, InputFile $code, bool $activate fseek($handle, $start); $chunk = @fread($handle, Client::CHUNK_SIZE); } else { - $chunk = substr($file->getData(), $start, Client::CHUNK_SIZE); + $chunk = substr($code->getData(), $start, Client::CHUNK_SIZE); } $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunk), $mimeType, $postedName); $apiHeaders['content-range'] = 'bytes ' . ($counter * Client::CHUNK_SIZE) . '-' . min(((($counter * Client::CHUNK_SIZE) + Client::CHUNK_SIZE) - 1), $size - 1) . '/' . $size; diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 67a7611..199cd61 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -334,7 +334,7 @@ public function listFiles(string $bucketId, ?array $queries = null, ?string $sea * @throws AppwriteException * @return array */ - public function createFile(string $bucketId, string $fileId, InputFile $file, ?array $permissions = null, callable $onProgress = null): array + public function createFile(string $bucketId, string $fileId, InputFile $file, ?array $permissions = null, ?callable $onProgress = null): array { $apiPath = str_replace( ['{bucketId}'], @@ -485,7 +485,10 @@ public function updateFile(string $bucketId, string $fileId, ?string $name = nul $apiParams = []; $apiParams['bucketId'] = $bucketId; $apiParams['fileId'] = $fileId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } $apiParams['permissions'] = $permissions; $apiHeaders = []; diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index a7fd576..685378f 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -9,6 +9,7 @@ use Appwrite\Enums\RelationshipType; use Appwrite\Enums\RelationMutate; use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; class TablesDB extends Service { @@ -322,12 +323,12 @@ public function get(string $databaseId): array * Update a database by its unique ID. * * @param string $databaseId - * @param string $name + * @param ?string $name * @param ?bool $enabled * @throws AppwriteException * @return array */ - public function update(string $databaseId, string $name, ?bool $enabled = null): array + public function update(string $databaseId, ?string $name = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}'], @@ -337,7 +338,10 @@ public function update(string $databaseId, string $name, ?bool $enabled = null): $apiParams = []; $apiParams['databaseId'] = $databaseId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } if (!is_null($enabled)) { $apiParams['enabled'] = $enabled; @@ -522,14 +526,14 @@ public function getTable(string $databaseId, string $tableId): array * * @param string $databaseId * @param string $tableId - * @param string $name + * @param ?string $name * @param ?array $permissions * @param ?bool $rowSecurity * @param ?bool $enabled * @throws AppwriteException * @return array */ - public function updateTable(string $databaseId, string $tableId, string $name, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): array + public function updateTable(string $databaseId, string $tableId, ?string $name = null, ?array $permissions = null, ?bool $rowSecurity = null, ?bool $enabled = null): array { $apiPath = str_replace( ['{databaseId}', '{tableId}'], @@ -540,7 +544,10 @@ public function updateTable(string $databaseId, string $tableId, string $name, ? $apiParams = []; $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; - $apiParams['name'] = $name; + + if (!is_null($name)) { + $apiParams['name'] = $name; + } $apiParams['permissions'] = $permissions; if (!is_null($rowSecurity)) { @@ -1318,6 +1325,174 @@ public function updateLineColumn(string $databaseId, string $tableId, string $ke ); } + /** + * Create a longtext column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a longtext column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateLongtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Create a mediumtext column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a mediumtext column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateMediumtextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a geometric point column. * @@ -1537,6 +1712,9 @@ public function createRelationshipColumn(string $databaseId, string $tableId, st * @param ?bool $encrypt * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.9.0. Please use `createTextColumn` instead. + * @see TablesDB::createTextColumn */ public function createStringColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null, ?bool $encrypt = null): array { @@ -1587,6 +1765,9 @@ public function createStringColumn(string $databaseId, string $tableId, string $ * @param ?string $newKey * @throws AppwriteException * @return array + * + * @deprecated This API has been deprecated since 1.8.0. Please use `updateTextColumn` instead. + * @see TablesDB::updateTextColumn */ public function updateStringColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array { @@ -1616,6 +1797,90 @@ public function updateStringColumn(string $databaseId, string $tableId, string $ ); } + /** + * Create a text column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/text' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a text column. Changing the `default` value will not update already + * existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateTextColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Create a URL column. * @@ -1700,6 +1965,94 @@ public function updateUrlColumn(string $databaseId, string $tableId, string $key ); } + /** + * Create a varchar column. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param int $size + * @param bool $required + * @param ?string $xdefault + * @param ?bool $xarray + * @throws AppwriteException + * @return array + */ + public function createVarcharColumn(string $databaseId, string $tableId, string $key, int $size, bool $required, ?string $xdefault = null, ?bool $xarray = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}'], + [$databaseId, $tableId], + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['size'] = $size; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + + if (!is_null($xarray)) { + $apiParams['array'] = $xarray; + } + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_POST, + $apiPath, + $apiHeaders, + $apiParams + ); + } + + /** + * Update a varchar column. Changing the `default` value will not update + * already existing rows. + * + * + * @param string $databaseId + * @param string $tableId + * @param string $key + * @param bool $required + * @param ?string $xdefault + * @param ?int $size + * @param ?string $newKey + * @throws AppwriteException + * @return array + */ + public function updateVarcharColumn(string $databaseId, string $tableId, string $key, bool $required, ?string $xdefault, ?int $size = null, ?string $newKey = null): array + { + $apiPath = str_replace( + ['{databaseId}', '{tableId}', '{key}'], + [$databaseId, $tableId, $key], + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}' + ); + + $apiParams = []; + $apiParams['databaseId'] = $databaseId; + $apiParams['tableId'] = $tableId; + $apiParams['key'] = $key; + $apiParams['required'] = $required; + $apiParams['default'] = $xdefault; + $apiParams['size'] = $size; + $apiParams['newKey'] = $newKey; + + $apiHeaders = []; + $apiHeaders['content-type'] = 'application/json'; + + return $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + } + /** * Get column by ID. * diff --git a/tests/Appwrite/IDTest.php b/tests/Appwrite/IDTest.php index 4914377..b12e817 100644 --- a/tests/Appwrite/IDTest.php +++ b/tests/Appwrite/IDTest.php @@ -6,7 +6,8 @@ final class IDTest extends TestCase { public function testUnique(): void { - $this->assertSame('unique()', ID::unique()); + $id = ID::unique(); + $this->assertSame(20, strlen($id)); } public function testCustom(): void { diff --git a/tests/Appwrite/QueryTest.php b/tests/Appwrite/QueryTest.php index 283a867..6b4cd6c 100644 --- a/tests/Appwrite/QueryTest.php +++ b/tests/Appwrite/QueryTest.php @@ -37,169 +37,290 @@ function __construct(string $name) public function testBasicFilterEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "equal(\"attr\", $test->expectedValues)", - Query::equal('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::equal('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('equal', $query['method'], $test->description); } } public function testBasicFilterNotEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "notEqual(\"attr\", $test->expectedValues)", - Query::notEqual('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::notEqual('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('notEqual', $query['method'], $test->description); } } public function testBasicFilterLessThan(): void { foreach($this->tests as $test) { - $this->assertSame( - "lessThan(\"attr\", $test->expectedValues)", - Query::lessThan('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::lessThan('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('lessThan', $query['method'], $test->description); } } public function testBasicFilterLessThanEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "lessThanEqual(\"attr\", $test->expectedValues)", - Query::lessThanEqual('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::lessThanEqual('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('lessThanEqual', $query['method'], $test->description); } } public function testBasicFilterGreaterThan(): void { foreach($this->tests as $test) { - $this->assertSame( - "greaterThan(\"attr\", $test->expectedValues)", - Query::greaterThan('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::greaterThan('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('greaterThan', $query['method'], $test->description); } } public function testBasicFilterGreaterThanEqual(): void { foreach($this->tests as $test) { - $this->assertSame( - "greaterThanEqual(\"attr\", $test->expectedValues)", - Query::greaterThanEqual('attr', $test->value), - $test->description, - ); + $query = json_decode(Query::greaterThanEqual('attr', $test->value), true); + $expected = json_decode($test->expectedValues, true); + $this->assertSame('attr', $query['attribute'], $test->description); + $this->assertSame($expected, $query['values'], $test->description); + $this->assertSame('greaterThanEqual', $query['method'], $test->description); } } public function testSearch(): void { - $this->assertSame('search("attr", ["keyword1 keyword2"])', Query::search('attr', 'keyword1 keyword2')); + $query = json_decode(Query::search('attr', 'keyword1 keyword2'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['keyword1 keyword2'], $query['values']); + $this->assertSame('search', $query['method']); } public function testIsNull(): void { - $this->assertSame('isNull("attr")', Query::isNull('attr')); + $query = json_decode(Query::isNull('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('isNull', $query['method']); } public function testIsNotNull(): void { - $this->assertSame('isNotNull("attr")', Query::isNotNull('attr')); + $query = json_decode(Query::isNotNull('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('isNotNull', $query['method']); } public function testBetweenWithIntegers(): void { - $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1, 2)); + $query = json_decode(Query::between('attr', 1, 2), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('between', $query['method']); } public function testBetweenWithDoubles(): void { - $this->assertSame('between("attr", 1, 2)', Query::between('attr', 1.0, 2.0)); + $query = json_decode(Query::between('attr', 1.0, 2.0), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('between', $query['method']); } public function testBetweenWithStrings(): void { - $this->assertSame('between("attr", "a", "z")', Query::between('attr', 'a', 'z')); + $query = json_decode(Query::between('attr', 'a', 'z'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['a', 'z'], $query['values']); + $this->assertSame('between', $query['method']); } public function testSelect(): void { - $this->assertSame('select(["attr1","attr2"])', Query::select(['attr1', 'attr2'])); + $query = json_decode(Query::select(['attr1', 'attr2']), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr1', 'attr2'], $query['values']); + $this->assertSame('select', $query['method']); } public function testOrderAsc(): void { - $this->assertSame('orderAsc("attr")', Query::orderAsc('attr')); + $query = json_decode(Query::orderAsc('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('orderAsc', $query['method']); } public function testOrderDesc(): void { - $this->assertSame('orderDesc("attr")', Query::orderDesc('attr')); + $query = json_decode(Query::orderDesc('attr'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertNull($query['values'] ?? null); + $this->assertSame('orderDesc', $query['method']); } public function testOrderRandom(): void { - $this->assertSame('{"method":"orderRandom"}', Query::orderRandom()); + $query = json_decode(Query::orderRandom(), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertNull($query['values'] ?? null); + $this->assertSame('orderRandom', $query['method']); } public function testCursorBefore(): void { - $this->assertSame('cursorBefore("attr")', Query::cursorBefore('attr')); + $query = json_decode(Query::cursorBefore('attr'), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr'], $query['values']); + $this->assertSame('cursorBefore', $query['method']); } public function testCursorAfter(): void { - $this->assertSame('cursorAfter("attr")', Query::cursorAfter('attr')); + $query = json_decode(Query::cursorAfter('attr'), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr'], $query['values']); + $this->assertSame('cursorAfter', $query['method']); } public function testLimit(): void { - $this->assertSame('limit(1)', Query::limit(1)); + $query = json_decode(Query::limit(1), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame([1], $query['values']); + $this->assertSame('limit', $query['method']); } public function testOffset(): void { - $this->assertSame('offset(1)', Query::offset(1)); + $query = json_decode(Query::offset(1), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame([1], $query['values']); + $this->assertSame('offset', $query['method']); } public function testNotContains(): void { - $this->assertSame('notContains("attr", ["value"])', Query::notContains('attr', 'value')); + $query = json_decode(Query::notContains('attr', 'value'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['value'], $query['values']); + $this->assertSame('notContains', $query['method']); } public function testNotSearch(): void { - $this->assertSame('notSearch("attr", ["keyword1 keyword2"])', Query::notSearch('attr', 'keyword1 keyword2')); + $query = json_decode(Query::notSearch('attr', 'keyword1 keyword2'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['keyword1 keyword2'], $query['values']); + $this->assertSame('notSearch', $query['method']); } public function testNotBetweenWithIntegers(): void { - $this->assertSame('notBetween("attr", 1, 2)', Query::notBetween('attr', 1, 2)); + $query = json_decode(Query::notBetween('attr', 1, 2), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('notBetween', $query['method']); } public function testNotBetweenWithDoubles(): void { - $this->assertSame('notBetween("attr", 1, 2)', Query::notBetween('attr', 1.0, 2.0)); + $query = json_decode(Query::notBetween('attr', 1.0, 2.0), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame([1, 2], $query['values']); + $this->assertSame('notBetween', $query['method']); } public function testNotBetweenWithStrings(): void { - $this->assertSame('notBetween("attr", "a", "z")', Query::notBetween('attr', 'a', 'z')); + $query = json_decode(Query::notBetween('attr', 'a', 'z'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['a', 'z'], $query['values']); + $this->assertSame('notBetween', $query['method']); } public function testNotStartsWith(): void { - $this->assertSame('notStartsWith("attr", ["prefix"])', Query::notStartsWith('attr', 'prefix')); + $query = json_decode(Query::notStartsWith('attr', 'prefix'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['prefix'], $query['values']); + $this->assertSame('notStartsWith', $query['method']); } public function testNotEndsWith(): void { - $this->assertSame('notEndsWith("attr", ["suffix"])', Query::notEndsWith('attr', 'suffix')); + $query = json_decode(Query::notEndsWith('attr', 'suffix'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['suffix'], $query['values']); + $this->assertSame('notEndsWith', $query['method']); + } + + public function testRegex(): void { + $query = json_decode(Query::regex('attr', 'pattern.*'), true); + $this->assertSame('attr', $query['attribute']); + $this->assertSame(['pattern.*'], $query['values']); + $this->assertSame('regex', $query['method']); + } + + public function testExists(): void { + $query = json_decode(Query::exists(['attr1', 'attr2']), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr1', 'attr2'], $query['values']); + $this->assertSame('exists', $query['method']); + } + + public function testNotExists(): void { + $query = json_decode(Query::notExists(['attr1', 'attr2']), true); + $this->assertNull($query['attribute'] ?? null); + $this->assertSame(['attr1', 'attr2'], $query['values']); + $this->assertSame('notExists', $query['method']); + } + + public function testElemMatch(): void { + $inner1 = Query::equal('name', 'Alice'); + $inner2 = Query::greaterThan('age', 18); + + $query = json_decode(Query::elemMatch('friends', [$inner1, $inner2]), true); + + $this->assertSame('friends', $query['attribute']); + $this->assertSame('elemMatch', $query['method']); + $this->assertCount(2, $query['values']); + + $this->assertSame('equal', $query['values'][0]['method']); + $this->assertSame('name', $query['values'][0]['attribute']); + $this->assertSame(['Alice'], $query['values'][0]['values']); + + $this->assertSame('greaterThan', $query['values'][1]['method']); + $this->assertSame('age', $query['values'][1]['attribute']); + $this->assertSame([18], $query['values'][1]['values']); } public function testCreatedBefore(): void { - $this->assertSame('lessThan("$createdAt", ["2023-01-01"])', Query::createdBefore('2023-01-01')); + $query = json_decode(Query::createdBefore('2023-01-01'), true); + $this->assertSame('$createdAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('lessThan', $query['method']); } public function testCreatedAfter(): void { - $this->assertSame('greaterThan("$createdAt", ["2023-01-01"])', Query::createdAfter('2023-01-01')); + $query = json_decode(Query::createdAfter('2023-01-01'), true); + $this->assertSame('$createdAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('greaterThan', $query['method']); } public function testCreatedBetween(): void { - $this->assertSame('between("$createdAt", ["2023-01-01","2023-12-31"])', Query::createdBetween('2023-01-01', '2023-12-31')); + $query = json_decode(Query::createdBetween('2023-01-01', '2023-12-31'), true); + $this->assertSame('$createdAt', $query['attribute']); + $this->assertSame(['2023-01-01', '2023-12-31'], $query['values']); + $this->assertSame('between', $query['method']); } public function testUpdatedBefore(): void { - $this->assertSame('lessThan("$updatedAt", ["2023-01-01"])', Query::updatedBefore('2023-01-01')); + $query = json_decode(Query::updatedBefore('2023-01-01'), true); + $this->assertSame('$updatedAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('lessThan', $query['method']); } public function testUpdatedAfter(): void { - $this->assertSame('greaterThan("$updatedAt", ["2023-01-01"])', Query::updatedAfter('2023-01-01')); + $query = json_decode(Query::updatedAfter('2023-01-01'), true); + $this->assertSame('$updatedAt', $query['attribute']); + $this->assertSame(['2023-01-01'], $query['values']); + $this->assertSame('greaterThan', $query['method']); } public function testUpdatedBetween(): void { - $this->assertSame('between("$updatedAt", ["2023-01-01","2023-12-31"])', Query::updatedBetween('2023-01-01', '2023-12-31')); + $query = json_decode(Query::updatedBetween('2023-01-01', '2023-12-31'), true); + $this->assertSame('$updatedAt', $query['attribute']); + $this->assertSame(['2023-01-01', '2023-12-31'], $query['values']); + $this->assertSame('between', $query['method']); } } diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index 28ced55..0f53979 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -6,6 +6,10 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Scopes; +use Appwrite\Enums\AuthenticatorType; +use Appwrite\Enums\AuthenticationFactor; +use Appwrite\Enums\OAuthProvider; final class AccountTest extends TestCase { private $client; @@ -34,8 +38,7 @@ public function testMethodGet(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -65,8 +68,7 @@ public function testMethodCreate(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -99,8 +101,7 @@ public function testMethodUpdateEmail(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -118,8 +119,7 @@ public function testMethodListIdentities(): void { $data = array( "total" => 5, - "identities" => array(),); - + "identities" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -135,7 +135,6 @@ public function testMethodDeleteIdentity(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -150,8 +149,7 @@ public function testMethodDeleteIdentity(): void { public function testMethodCreateJWT(): void { $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); - + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -163,12 +161,117 @@ public function testMethodCreateJWT(): void { $this->assertSame($data, $response); } - public function testMethodListLogs(): void { + public function testMethodListKeys(): void { $data = array( "total" => 5, - "logs" => array(),); + "keys" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->listKeys( + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateKey(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "scopes" => array(), + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->createKey( + "", + array(Scopes::ACCOUNT()) + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetKey(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "scopes" => array(), + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->getKey( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateKey(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "My API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "scopes" => array(), + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->updateKey( + "", + "", + array(Scopes::ACCOUNT()) + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteKey(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->account->deleteKey( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListLogs(): void { + + $data = array( + "total" => 5, + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -198,8 +301,7 @@ public function testMethodUpdateMFA(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -216,15 +318,14 @@ public function testMethodCreateMFAAuthenticator(): void { $data = array( "secret" => "1", - "uri" => "1",); - + "uri" => "1"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->createMFAAuthenticator( - "totp" + AuthenticatorType::TOTP() ); $this->assertSame($data, $response); @@ -248,15 +349,14 @@ public function testMethodUpdateMFAAuthenticator(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->updateMFAAuthenticator( - "totp", + AuthenticatorType::TOTP(), "" ); @@ -267,13 +367,12 @@ public function testMethodDeleteMFAAuthenticator(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->deleteMFAAuthenticator( - "totp" + AuthenticatorType::TOTP() ); $this->assertSame($data, $response); @@ -285,15 +384,14 @@ public function testMethodCreateMFAChallenge(): void { "\$id" => "bb8ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5ea5c168bb8", - "expire" => "2020-10-15T06:38:00.000+00:00",); - + "expire" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->createMFAChallenge( - "email" + AuthenticationFactor::EMAIL() ); $this->assertSame($data, $response); @@ -330,8 +428,7 @@ public function testMethodUpdateMFAChallenge(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -351,8 +448,7 @@ public function testMethodListMFAFactors(): void { "totp" => true, "phone" => true, "email" => true, - "recoveryCode" => true,); - + "recoveryCode" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -367,8 +463,7 @@ public function testMethodListMFAFactors(): void { public function testMethodGetMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -383,8 +478,7 @@ public function testMethodGetMFARecoveryCodes(): void { public function testMethodCreateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -399,8 +493,7 @@ public function testMethodCreateMFARecoveryCodes(): void { public function testMethodUpdateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -430,8 +523,7 @@ public function testMethodUpdateName(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -462,8 +554,7 @@ public function testMethodUpdatePassword(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -494,8 +585,7 @@ public function testMethodUpdatePhone(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -513,7 +603,6 @@ public function testMethodGetPrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -542,8 +631,7 @@ public function testMethodUpdatePrefs(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -564,8 +652,7 @@ public function testMethodCreateRecovery(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -587,8 +674,7 @@ public function testMethodUpdateRecovery(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -607,8 +693,7 @@ public function testMethodListSessions(): void { $data = array( "total" => 5, - "sessions" => array(),); - + "sessions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -624,7 +709,6 @@ public function testMethodDeleteSessions(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -666,8 +750,7 @@ public function testMethodCreateAnonymousSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -710,8 +793,7 @@ public function testMethodCreateEmailPasswordSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -756,8 +838,7 @@ public function testMethodUpdateMagicURLSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -802,8 +883,7 @@ public function testMethodUpdatePhoneSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -848,8 +928,7 @@ public function testMethodCreateSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -894,8 +973,7 @@ public function testMethodGetSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,8 +1017,7 @@ public function testMethodUpdateSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -957,7 +1034,6 @@ public function testMethodDeleteSession(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -987,8 +1063,7 @@ public function testMethodUpdateStatus(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1008,8 +1083,7 @@ public function testMethodCreateEmailToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1031,8 +1105,7 @@ public function testMethodCreateMagicURLToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1048,15 +1121,14 @@ public function testMethodCreateMagicURLToken(): void { public function testMethodCreateOAuth2Token(): void { - $data = array(); - + $data = ''; $this->client - ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->account->createOAuth2Token( - "amazon" + OAuthProvider::AMAZON() ); $this->assertSame($data, $response); @@ -1070,8 +1142,7 @@ public function testMethodCreatePhoneToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1093,8 +1164,7 @@ public function testMethodCreateEmailVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1115,8 +1185,7 @@ public function testMethodCreateVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1137,8 +1206,7 @@ public function testMethodUpdateEmailVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1160,8 +1228,7 @@ public function testMethodUpdateVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1183,8 +1250,7 @@ public function testMethodCreatePhoneVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1204,8 +1270,7 @@ public function testMethodUpdatePhoneVerification(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/AvatarsTest.php b/tests/Appwrite/Services/AvatarsTest.php index ece3c24..4b75f42 100644 --- a/tests/Appwrite/Services/AvatarsTest.php +++ b/tests/Appwrite/Services/AvatarsTest.php @@ -6,6 +6,13 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Browser; +use Appwrite\Enums\CreditCard; +use Appwrite\Enums\Flag; +use Appwrite\Enums\Theme; +use Appwrite\Enums\Timezone; +use Appwrite\Enums\BrowserPermission; +use Appwrite\Enums\ImageFormat; final class AvatarsTest extends TestCase { private $client; @@ -20,13 +27,12 @@ public function testMethodGetBrowser(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->avatars->getBrowser( - "aa" + Browser::AVANTBROWSER() ); $this->assertSame($data, $response); @@ -36,13 +42,12 @@ public function testMethodGetCreditCard(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->avatars->getCreditCard( - "amex" + CreditCard::AMERICANEXPRESS() ); $this->assertSame($data, $response); @@ -52,7 +57,6 @@ public function testMethodGetFavicon(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -68,13 +72,12 @@ public function testMethodGetFlag(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->avatars->getFlag( - "af" + Flag::AFGHANISTAN() ); $this->assertSame($data, $response); @@ -84,7 +87,6 @@ public function testMethodGetImage(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -100,7 +102,6 @@ public function testMethodGetInitials(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -115,7 +116,6 @@ public function testMethodGetQR(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -131,7 +131,6 @@ public function testMethodGetScreenshot(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/BackupsTest.php b/tests/Appwrite/Services/BackupsTest.php new file mode 100644 index 0000000..c485ef7 --- /dev/null +++ b/tests/Appwrite/Services/BackupsTest.php @@ -0,0 +1,276 @@ +client = Mockery::mock(Client::class); + $this->backups = new Backups($this->client); + } + + public function testMethodListArchives(): void { + + $data = array( + "total" => 5, + "archives" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->listArchives( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateArchive(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->createArchive( + array(BackupServices::DATABASES()) + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetArchive(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "policyId" => "did8jx6ws45jana098ab7", + "size" => 100000, + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->getArchive( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeleteArchive(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->deleteArchive( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodListPolicies(): void { + + $data = array( + "total" => 5, + "policies" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->listPolicies( + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePolicy(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->createPolicy( + "", + array(BackupServices::DATABASES()), + 1, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetPolicy(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->getPolicy( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdatePolicy(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "name" => "Hourly backups", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "services" => array(), + "resources" => array(), + "retention" => 7, + "schedule" => "0 * * * *", + "enabled" => true); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->updatePolicy( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodDeletePolicy(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->deletePolicy( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateRestoration(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "archiveId" => "did8jx6ws45jana098ab7", + "policyId" => "did8jx6ws45jana098ab7", + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array(), + "options" => "{databases.database[{oldId, newId, newName}]}"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->createRestoration( + "", + array(BackupServices::DATABASES()) + ); + + $this->assertSame($data, $response); + } + + public function testMethodListRestorations(): void { + + $data = array( + "total" => 5, + "restorations" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->listRestorations( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetRestoration(): void { + + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "archiveId" => "did8jx6ws45jana098ab7", + "policyId" => "did8jx6ws45jana098ab7", + "status" => "completed", + "startedAt" => "2020-10-15T06:38:00.000+00:00", + "migrationId" => "did8jx6ws45jana098ab7", + "services" => array(), + "resources" => array(), + "options" => "{databases.database[{oldId, newId, newName}]}"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->backups->getRestoration( + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index 8aa6a6b..551944c 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -6,6 +6,10 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\RelationshipType; +use Appwrite\Enums\RelationMutate; +use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; final class DatabasesTest extends TestCase { private $client; @@ -20,8 +24,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "databases" => array(),); - + "databases" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -41,8 +44,9 @@ public function testMethodCreate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -60,8 +64,7 @@ public function testMethodListTransactions(): void { $data = array( "total" => 5, - "transactions" => array(),); - + "transactions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -81,8 +84,7 @@ public function testMethodCreateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -102,8 +104,7 @@ public function testMethodGetTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -124,8 +125,7 @@ public function testMethodUpdateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -142,7 +142,6 @@ public function testMethodDeleteTransaction(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -162,8 +161,7 @@ public function testMethodCreateOperations(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -184,8 +182,9 @@ public function testMethodGet(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -206,16 +205,16 @@ public function testMethodUpdate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->databases->update( - "", - "" + "" ); $this->assertSame($data, $response); @@ -225,7 +224,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -241,8 +239,7 @@ public function testMethodListCollections(): void { $data = array( "total" => 5, - "collections" => array(),); - + "collections" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -267,8 +264,9 @@ public function testMethodCreateCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array(),); - + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -295,8 +293,9 @@ public function testMethodGetCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array(),); - + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -322,8 +321,9 @@ public function testMethodUpdateCollection(): void { "enabled" => true, "documentSecurity" => true, "attributes" => array(), - "indexes" => array(),); - + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -331,8 +331,7 @@ public function testMethodUpdateCollection(): void { $response = $this->databases->updateCollection( "", - "", - "" + "" ); $this->assertSame($data, $response); @@ -342,7 +341,6 @@ public function testMethodDeleteCollection(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -359,8 +357,7 @@ public function testMethodListAttributes(): void { $data = array( "total" => 5, - "attributes" => array(),); - + "attributes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -383,8 +380,7 @@ public function testMethodCreateBooleanAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -409,8 +405,7 @@ public function testMethodUpdateBooleanAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -437,8 +432,7 @@ public function testMethodCreateDatetimeAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -464,8 +458,7 @@ public function testMethodUpdateDatetimeAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -492,8 +485,7 @@ public function testMethodCreateEmailAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -519,8 +511,7 @@ public function testMethodUpdateEmailAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,8 +539,7 @@ public function testMethodCreateEnumAttribute(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -577,8 +567,7 @@ public function testMethodUpdateEnumAttribute(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -605,8 +594,7 @@ public function testMethodCreateFloatAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -631,8 +619,7 @@ public function testMethodUpdateFloatAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -658,8 +645,7 @@ public function testMethodCreateIntegerAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -684,8 +670,7 @@ public function testMethodUpdateIntegerAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -712,8 +697,7 @@ public function testMethodCreateIpAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +723,7 @@ public function testMethodUpdateIpAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -766,8 +749,7 @@ public function testMethodCreateLineAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -792,8 +774,7 @@ public function testMethodUpdateLineAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -809,7 +790,7 @@ public function testMethodUpdateLineAttribute(): void { $this->assertSame($data, $response); } - public function testMethodCreatePointAttribute(): void { + public function testMethodCreateLongtextAttribute(): void { $data = array( "key" => "fullName", @@ -818,8 +799,109 @@ public function testMethodCreatePointAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createLongtextAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateLongtextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateLongtextAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMediumtextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createMediumtextAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMediumtextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateMediumtextAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePointAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -844,8 +926,7 @@ public function testMethodUpdatePointAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -870,8 +951,7 @@ public function testMethodCreatePolygonAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -896,8 +976,7 @@ public function testMethodUpdatePolygonAttribute(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -928,8 +1007,7 @@ public function testMethodCreateRelationshipAttribute(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,7 +1017,7 @@ public function testMethodCreateRelationshipAttribute(): void { "", "", "", - "oneToOne" + RelationshipType::ONETOONE() ); $this->assertSame($data, $response); @@ -955,8 +1033,7 @@ public function testMethodCreateStringAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -983,8 +1060,7 @@ public function testMethodUpdateStringAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1001,6 +1077,57 @@ public function testMethodUpdateStringAttribute(): void { $this->assertSame($data, $response); } + public function testMethodCreateTextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->createTextAttribute( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTextAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateTextAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateUrlAttribute(): void { $data = array( @@ -1011,8 +1138,7 @@ public function testMethodCreateUrlAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1038,8 +1164,7 @@ public function testMethodUpdateUrlAttribute(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1056,10 +1181,70 @@ public function testMethodUpdateUrlAttribute(): void { $this->assertSame($data, $response); } - public function testMethodGetAttribute(): void { + public function testMethodCreateVarcharAttribute(): void { - $data = ''; + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $response = $this->databases->createVarcharAttribute( + "", + "", + "", + 1, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVarcharAttribute(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->databases->updateVarcharAttribute( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetAttribute(): void { + + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1078,7 +1263,6 @@ public function testMethodDeleteAttribute(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1107,8 +1291,7 @@ public function testMethodUpdateRelationshipAttribute(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1127,8 +1310,7 @@ public function testMethodListDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1151,8 +1333,7 @@ public function testMethodCreateDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1172,8 +1353,7 @@ public function testMethodCreateDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1192,8 +1372,7 @@ public function testMethodUpsertDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1212,8 +1391,7 @@ public function testMethodUpdateDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1231,8 +1409,7 @@ public function testMethodDeleteDocuments(): void { $data = array( "total" => 5, - "documents" => array(),); - + "documents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1255,8 +1432,7 @@ public function testMethodGetDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1280,8 +1456,7 @@ public function testMethodUpsertDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1290,8 +1465,7 @@ public function testMethodUpsertDocument(): void { $response = $this->databases->upsertDocument( "", "", - "", - array() + "" ); $this->assertSame($data, $response); @@ -1306,8 +1480,7 @@ public function testMethodUpdateDocument(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1326,7 +1499,6 @@ public function testMethodDeleteDocument(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1349,8 +1521,7 @@ public function testMethodDecrementDocumentAttribute(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1375,8 +1546,7 @@ public function testMethodIncrementDocumentAttribute(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1396,8 +1566,7 @@ public function testMethodListIndexes(): void { $data = array( "total" => 5, - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1422,8 +1591,7 @@ public function testMethodCreateIndex(): void { "status" => "available", "error" => "string", "attributes" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1433,7 +1601,7 @@ public function testMethodCreateIndex(): void { "", "", "", - "key", + IndexType::KEY(), array() ); @@ -1451,8 +1619,7 @@ public function testMethodGetIndex(): void { "status" => "available", "error" => "string", "attributes" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1471,7 +1638,6 @@ public function testMethodDeleteIndex(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/FunctionsTest.php b/tests/Appwrite/Services/FunctionsTest.php index 9d034cf..9d468cd 100644 --- a/tests/Appwrite/Services/FunctionsTest.php +++ b/tests/Appwrite/Services/FunctionsTest.php @@ -6,6 +6,12 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Runtime; +use Appwrite\Enums\Scopes; +use Appwrite\Enums\TemplateReferenceType; +use Appwrite\Enums\VCSReferenceType; +use Appwrite\Enums\DeploymentDownloadType; +use Appwrite\Enums\ExecutionMethod; final class FunctionsTest extends TestCase { private $client; @@ -20,8 +26,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "functions" => array(),); - + "functions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -63,8 +68,7 @@ public function testMethodCreate(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -73,7 +77,7 @@ public function testMethodCreate(): void { $response = $this->functions->create( "", "", - "node-14.5" + Runtime::NODE145() ); $this->assertSame($data, $response); @@ -83,8 +87,7 @@ public function testMethodListRuntimes(): void { $data = array( "total" => 5, - "runtimes" => array(),); - + "runtimes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -100,8 +103,7 @@ public function testMethodListSpecifications(): void { $data = array( "total" => 5, - "specifications" => array(),); - + "specifications" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -143,8 +145,7 @@ public function testMethodGet(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -187,8 +188,7 @@ public function testMethodUpdate(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -206,7 +206,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -248,8 +247,7 @@ public function testMethodUpdateFunctionDeployment(): void { "providerBranch" => "main", "providerRootDirectory" => "functions/helloWorld", "providerSilentMode" => true, - "specification" => "s-1vcpu-512mb",); - + "specification" => "s-1vcpu-512mb"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -267,8 +265,7 @@ public function testMethodListDeployments(): void { $data = array( "total" => 5, - "deployments" => array(),); - + "deployments" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -310,8 +307,7 @@ public function testMethodCreateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -355,8 +351,7 @@ public function testMethodCreateDuplicateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -399,8 +394,7 @@ public function testMethodCreateTemplateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -411,7 +405,7 @@ public function testMethodCreateTemplateDeployment(): void { "", "", "", - "commit", + TemplateReferenceType::COMMIT(), "" ); @@ -447,8 +441,7 @@ public function testMethodCreateVcsDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -456,7 +449,7 @@ public function testMethodCreateVcsDeployment(): void { $response = $this->functions->createVcsDeployment( "", - "branch", + VCSReferenceType::BRANCH(), "" ); @@ -492,8 +485,7 @@ public function testMethodGetDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -511,7 +503,6 @@ public function testMethodDeleteDeployment(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -528,7 +519,6 @@ public function testMethodGetDeploymentDownload(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -570,8 +560,7 @@ public function testMethodUpdateDeploymentStatus(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -589,8 +578,7 @@ public function testMethodListExecutions(): void { $data = array( "total" => 5, - "executions" => array(),); - + "executions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -622,8 +610,7 @@ public function testMethodCreateExecution(): void { "responseHeaders" => array(), "logs" => "", "errors" => "", - "duration" => 0.4,); - + "duration" => 0.4); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -655,8 +642,7 @@ public function testMethodGetExecution(): void { "responseHeaders" => array(), "logs" => "", "errors" => "", - "duration" => 0.4,); - + "duration" => 0.4); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -674,7 +660,6 @@ public function testMethodDeleteExecution(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -691,8 +676,7 @@ public function testMethodListVariables(): void { $data = array( "total" => 5, - "variables" => array(),); - + "variables" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -715,8 +699,7 @@ public function testMethodCreateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -741,8 +724,7 @@ public function testMethodGetVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -766,8 +748,7 @@ public function testMethodUpdateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -786,7 +767,6 @@ public function testMethodDeleteVariable(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/GraphqlTest.php b/tests/Appwrite/Services/GraphqlTest.php index 6c587b8..669edf9 100644 --- a/tests/Appwrite/Services/GraphqlTest.php +++ b/tests/Appwrite/Services/GraphqlTest.php @@ -20,7 +20,6 @@ public function testMethodQuery(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -36,7 +35,6 @@ public function testMethodMutation(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/HealthTest.php b/tests/Appwrite/Services/HealthTest.php index cf0f754..bf501d9 100644 --- a/tests/Appwrite/Services/HealthTest.php +++ b/tests/Appwrite/Services/HealthTest.php @@ -6,6 +6,7 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Name; final class HealthTest extends TestCase { private $client; @@ -21,8 +22,7 @@ public function testMethodGet(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -38,8 +38,7 @@ public function testMethodGetAntivirus(): void { $data = array( "version" => "1.0.0", - "status" => "online",); - + "status" => "online"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -54,10 +53,8 @@ public function testMethodGetAntivirus(): void { public function testMethodGetCache(): void { $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - + "total" => 5, + "statuses" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -77,8 +74,7 @@ public function testMethodGetCertificate(): void { "issuerOrganisation" => "", "validFrom" => "1704200998", "validTo" => "1711458597", - "signatureTypeSN" => "RSA-SHA256",); - + "signatureTypeSN" => "RSA-SHA256"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -93,10 +89,8 @@ public function testMethodGetCertificate(): void { public function testMethodGetDB(): void { $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - + "total" => 5, + "statuses" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -111,10 +105,8 @@ public function testMethodGetDB(): void { public function testMethodGetPubSub(): void { $data = array( - "name" => "database", - "ping" => 128, - "status" => "pass",); - + "total" => 5, + "statuses" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -126,11 +118,55 @@ public function testMethodGetPubSub(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueBuilds(): void { + public function testMethodGetQueueAudits(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueAudits( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBillingProjectAggregation(): void { $data = array( - "size" => 8,); + "size" => 8); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueBillingProjectAggregation( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBillingTeamAggregation(): void { + + $data = array( + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueBillingTeamAggregation( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueBuilds(): void { + + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -142,11 +178,25 @@ public function testMethodGetQueueBuilds(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueCertificates(): void { + public function testMethodGetQueuePriorityBuilds(): void { $data = array( - "size" => 8,); + "size" => 8); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueuePriorityBuilds( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueCertificates(): void { + + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -161,8 +211,7 @@ public function testMethodGetQueueCertificates(): void { public function testMethodGetQueueDatabases(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -177,8 +226,7 @@ public function testMethodGetQueueDatabases(): void { public function testMethodGetQueueDeletes(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -193,15 +241,14 @@ public function testMethodGetQueueDeletes(): void { public function testMethodGetFailedJobs(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->health->getFailedJobs( - "v1-database" + Name::V1DATABASE() ); $this->assertSame($data, $response); @@ -210,8 +257,7 @@ public function testMethodGetFailedJobs(): void { public function testMethodGetQueueFunctions(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -226,8 +272,7 @@ public function testMethodGetQueueFunctions(): void { public function testMethodGetQueueLogs(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -242,8 +287,7 @@ public function testMethodGetQueueLogs(): void { public function testMethodGetQueueMails(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -258,8 +302,7 @@ public function testMethodGetQueueMails(): void { public function testMethodGetQueueMessaging(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -274,8 +317,7 @@ public function testMethodGetQueueMessaging(): void { public function testMethodGetQueueMigrations(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -287,11 +329,25 @@ public function testMethodGetQueueMigrations(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueStatsResources(): void { + public function testMethodGetQueueRegionManager(): void { $data = array( - "size" => 8,); + "size" => 8); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $response = $this->health->getQueueRegionManager( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueStatsResources(): void { + + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -306,8 +362,7 @@ public function testMethodGetQueueStatsResources(): void { public function testMethodGetQueueUsage(): void { $data = array( - "size" => 8,); - + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -319,11 +374,25 @@ public function testMethodGetQueueUsage(): void { $this->assertSame($data, $response); } - public function testMethodGetQueueWebhooks(): void { + public function testMethodGetQueueThreats(): void { $data = array( - "size" => 8,); + "size" => 8); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->health->getQueueThreats( + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetQueueWebhooks(): void { + + $data = array( + "size" => 8); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -340,8 +409,7 @@ public function testMethodGetStorage(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -358,8 +426,7 @@ public function testMethodGetStorageLocal(): void { $data = array( "name" => "database", "ping" => 128, - "status" => "pass",); - + "status" => "pass"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -376,8 +443,7 @@ public function testMethodGetTime(): void { $data = array( "remoteTime" => 1639490751, "localTime" => 1639490844, - "diff" => 93,); - + "diff" => 93); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/LocaleTest.php b/tests/Appwrite/Services/LocaleTest.php index 6e8f9db..88af7d5 100644 --- a/tests/Appwrite/Services/LocaleTest.php +++ b/tests/Appwrite/Services/LocaleTest.php @@ -25,8 +25,7 @@ public function testMethodGet(): void { "continentCode" => "NA", "continent" => "North America", "eu" => true, - "currency" => "USD",); - + "currency" => "USD"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -42,8 +41,7 @@ public function testMethodListCodes(): void { $data = array( "total" => 5, - "localeCodes" => array(),); - + "localeCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -59,8 +57,7 @@ public function testMethodListContinents(): void { $data = array( "total" => 5, - "continents" => array(),); - + "continents" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -76,8 +73,7 @@ public function testMethodListCountries(): void { $data = array( "total" => 5, - "countries" => array(),); - + "countries" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -93,8 +89,7 @@ public function testMethodListCountriesEU(): void { $data = array( "total" => 5, - "countries" => array(),); - + "countries" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -110,8 +105,7 @@ public function testMethodListCountriesPhones(): void { $data = array( "total" => 5, - "phones" => array(),); - + "phones" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -127,8 +121,7 @@ public function testMethodListCurrencies(): void { $data = array( "total" => 5, - "currencies" => array(),); - + "currencies" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -144,8 +137,7 @@ public function testMethodListLanguages(): void { $data = array( "total" => 5, - "languages" => array(),); - + "languages" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/MessagingTest.php b/tests/Appwrite/Services/MessagingTest.php index ad2aab3..3bc8e69 100644 --- a/tests/Appwrite/Services/MessagingTest.php +++ b/tests/Appwrite/Services/MessagingTest.php @@ -6,6 +6,8 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\MessagePriority; +use Appwrite\Enums\SmtpEncryption; final class MessagingTest extends TestCase { private $client; @@ -20,8 +22,7 @@ public function testMethodListMessages(): void { $data = array( "total" => 5, - "messages" => array(),); - + "messages" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -45,8 +46,7 @@ public function testMethodCreateEmail(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -73,8 +73,7 @@ public function testMethodUpdateEmail(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -99,8 +98,7 @@ public function testMethodCreatePush(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -125,8 +123,7 @@ public function testMethodUpdatePush(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -151,8 +148,7 @@ public function testMethodCreateSMS(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -178,8 +174,7 @@ public function testMethodUpdateSMS(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -204,8 +199,7 @@ public function testMethodGetMessage(): void { "targets" => array(), "deliveredTotal" => 1, "data" => array(), - "status" => "Message status can be one of the following: draft, processing, scheduled, sent, or failed.",); - + "status" => "processing"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -222,7 +216,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -238,8 +231,7 @@ public function testMethodListMessageLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -256,8 +248,7 @@ public function testMethodListTargets(): void { $data = array( "total" => 5, - "targets" => array(),); - + "targets" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -274,8 +265,7 @@ public function testMethodListProviders(): void { $data = array( "total" => 5, - "providers" => array(),); - + "providers" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -297,8 +287,7 @@ public function testMethodCreateAPNSProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -322,8 +311,7 @@ public function testMethodUpdateAPNSProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -346,8 +334,7 @@ public function testMethodCreateFCMProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -371,8 +358,7 @@ public function testMethodUpdateFCMProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -395,8 +381,7 @@ public function testMethodCreateMailgunProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -420,8 +405,7 @@ public function testMethodUpdateMailgunProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -444,8 +428,7 @@ public function testMethodCreateMsg91Provider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -469,8 +452,7 @@ public function testMethodUpdateMsg91Provider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -493,8 +475,7 @@ public function testMethodCreateResendProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -518,8 +499,7 @@ public function testMethodUpdateResendProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -542,8 +522,7 @@ public function testMethodCreateSendgridProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -567,8 +546,7 @@ public function testMethodUpdateSendgridProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -591,8 +569,7 @@ public function testMethodCreateSMTPProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -617,8 +594,7 @@ public function testMethodUpdateSMTPProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -641,8 +617,7 @@ public function testMethodCreateTelesignProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -666,8 +641,7 @@ public function testMethodUpdateTelesignProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -690,8 +664,7 @@ public function testMethodCreateTextmagicProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -715,8 +688,7 @@ public function testMethodUpdateTextmagicProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +711,7 @@ public function testMethodCreateTwilioProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -764,8 +735,7 @@ public function testMethodUpdateTwilioProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -788,8 +758,7 @@ public function testMethodCreateVonageProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -813,8 +782,7 @@ public function testMethodUpdateVonageProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -837,8 +805,7 @@ public function testMethodGetProvider(): void { "provider" => "mailgun", "enabled" => true, "type" => "sms", - "credentials" => array(),); - + "credentials" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -855,7 +822,6 @@ public function testMethodDeleteProvider(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -871,8 +837,7 @@ public function testMethodListProviderLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -889,8 +854,7 @@ public function testMethodListSubscriberLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -907,8 +871,7 @@ public function testMethodListTopics(): void { $data = array( "total" => 5, - "topics" => array(),); - + "topics" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -930,8 +893,7 @@ public function testMethodCreateTopic(): void { "emailTotal" => 100, "smsTotal" => 100, "pushTotal" => 100, - "subscribe" => array(),); - + "subscribe" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -955,8 +917,7 @@ public function testMethodGetTopic(): void { "emailTotal" => 100, "smsTotal" => 100, "pushTotal" => 100, - "subscribe" => array(),); - + "subscribe" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -979,8 +940,7 @@ public function testMethodUpdateTopic(): void { "emailTotal" => 100, "smsTotal" => 100, "pushTotal" => 100, - "subscribe" => array(),); - + "subscribe" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -997,7 +957,6 @@ public function testMethodDeleteTopic(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1013,8 +972,7 @@ public function testMethodListTopicLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1031,8 +989,7 @@ public function testMethodListSubscribers(): void { $data = array( "total" => 5, - "subscribers" => array(),); - + "subscribers" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1056,8 +1013,7 @@ public function testMethodCreateSubscriber(): void { "userId" => "5e5ea5c16897e", "userName" => "Aegon Targaryen", "topicId" => "259125845563242502", - "providerType" => "email",); - + "providerType" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1083,8 +1039,7 @@ public function testMethodGetSubscriber(): void { "userId" => "5e5ea5c16897e", "userName" => "Aegon Targaryen", "topicId" => "259125845563242502", - "providerType" => "email",); - + "providerType" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1102,7 +1057,6 @@ public function testMethodDeleteSubscriber(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/OrganizationsTest.php b/tests/Appwrite/Services/OrganizationsTest.php new file mode 100644 index 0000000..ad96680 --- /dev/null +++ b/tests/Appwrite/Services/OrganizationsTest.php @@ -0,0 +1,50 @@ +client = Mockery::mock(Client::class); + $this->organizations = new Organizations($this->client); + } + + public function testMethodDelete(): void { + + $data = ''; + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->organizations->delete( + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodEstimationDeleteOrganization(): void { + + $data = array( + "unpaidInvoices" => array()); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->organizations->estimationDeleteOrganization( + "" + ); + + $this->assertSame($data, $response); + } + +} diff --git a/tests/Appwrite/Services/SitesTest.php b/tests/Appwrite/Services/SitesTest.php index 831d7bb..2d3a2bc 100644 --- a/tests/Appwrite/Services/SitesTest.php +++ b/tests/Appwrite/Services/SitesTest.php @@ -6,6 +6,12 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Framework; +use Appwrite\Enums\BuildRuntime; +use Appwrite\Enums\Adapter; +use Appwrite\Enums\TemplateReferenceType; +use Appwrite\Enums\VCSReferenceType; +use Appwrite\Enums\DeploymentDownloadType; final class SitesTest extends TestCase { private $client; @@ -20,8 +26,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "sites" => array(),); - + "sites" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -64,8 +69,7 @@ public function testMethodCreate(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -74,8 +78,8 @@ public function testMethodCreate(): void { $response = $this->sites->create( "", "", - "analog", - "node-14.5" + Framework::ANALOG(), + BuildRuntime::NODE145() ); $this->assertSame($data, $response); @@ -85,8 +89,7 @@ public function testMethodListFrameworks(): void { $data = array( "total" => 5, - "frameworks" => array(),); - + "frameworks" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -102,8 +105,7 @@ public function testMethodListSpecifications(): void { $data = array( "total" => 5, - "specifications" => array(),); - + "specifications" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -146,8 +148,7 @@ public function testMethodGet(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -191,8 +192,7 @@ public function testMethodUpdate(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -201,7 +201,7 @@ public function testMethodUpdate(): void { $response = $this->sites->update( "", "", - "analog" + Framework::ANALOG() ); $this->assertSame($data, $response); @@ -211,7 +211,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -254,8 +253,7 @@ public function testMethodUpdateSiteDeployment(): void { "specification" => "s-1vcpu-512mb", "buildRuntime" => "node-22", "adapter" => "static", - "fallbackFile" => "index.html",); - + "fallbackFile" => "index.html"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -273,8 +271,7 @@ public function testMethodListDeployments(): void { $data = array( "total" => 5, - "deployments" => array(),); - + "deployments" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -316,8 +313,7 @@ public function testMethodCreateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -361,8 +357,7 @@ public function testMethodCreateDuplicateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -405,8 +400,7 @@ public function testMethodCreateTemplateDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -417,7 +411,7 @@ public function testMethodCreateTemplateDeployment(): void { "", "", "", - "branch", + TemplateReferenceType::BRANCH(), "" ); @@ -453,8 +447,7 @@ public function testMethodCreateVcsDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -462,7 +455,7 @@ public function testMethodCreateVcsDeployment(): void { $response = $this->sites->createVcsDeployment( "", - "branch", + VCSReferenceType::BRANCH(), "" ); @@ -498,8 +491,7 @@ public function testMethodGetDeployment(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -517,7 +509,6 @@ public function testMethodDeleteDeployment(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -534,7 +525,6 @@ public function testMethodGetDeploymentDownload(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -576,8 +566,7 @@ public function testMethodUpdateDeploymentStatus(): void { "providerCommitMessage" => "Update index.js", "providerCommitUrl" => "https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb", "providerBranch" => "0.7.x", - "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x",); - + "providerBranchUrl" => "https://github.com/vermakhushboo/appwrite/tree/0.7.x"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -595,8 +584,7 @@ public function testMethodListLogs(): void { $data = array( "total" => 5, - "executions" => array(),); - + "executions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -628,8 +616,7 @@ public function testMethodGetLog(): void { "responseHeaders" => array(), "logs" => "", "errors" => "", - "duration" => 0.4,); - + "duration" => 0.4); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -647,7 +634,6 @@ public function testMethodDeleteLog(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -664,8 +650,7 @@ public function testMethodListVariables(): void { $data = array( "total" => 5, - "variables" => array(),); - + "variables" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -688,8 +673,7 @@ public function testMethodCreateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -714,8 +698,7 @@ public function testMethodGetVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +722,7 @@ public function testMethodUpdateVariable(): void { "value" => "myPa\$\$word1", "secret" => true, "resourceType" => "function", - "resourceId" => "myAwesomeFunction",); - + "resourceId" => "myAwesomeFunction"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -759,7 +741,6 @@ public function testMethodDeleteVariable(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/StorageTest.php b/tests/Appwrite/Services/StorageTest.php index 0f2ce53..4d01dae 100644 --- a/tests/Appwrite/Services/StorageTest.php +++ b/tests/Appwrite/Services/StorageTest.php @@ -6,6 +6,9 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\Compression; +use Appwrite\Enums\ImageGravity; +use Appwrite\Enums\ImageFormat; final class StorageTest extends TestCase { private $client; @@ -20,8 +23,7 @@ public function testMethodListBuckets(): void { $data = array( "total" => 5, - "buckets" => array(),); - + "buckets" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -48,8 +50,8 @@ public function testMethodCreateBucket(): void { "compression" => "gzip", "encryption" => true, "antivirus" => true, - "transformations" => true,); - + "transformations" => true, + "totalSize" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -78,8 +80,8 @@ public function testMethodGetBucket(): void { "compression" => "gzip", "encryption" => true, "antivirus" => true, - "transformations" => true,); - + "transformations" => true, + "totalSize" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -107,8 +109,8 @@ public function testMethodUpdateBucket(): void { "compression" => "gzip", "encryption" => true, "antivirus" => true, - "transformations" => true,); - + "transformations" => true, + "totalSize" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -126,7 +128,6 @@ public function testMethodDeleteBucket(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -142,8 +143,7 @@ public function testMethodListFiles(): void { $data = array( "total" => 5, - "files" => array(),); - + "files" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -169,8 +169,9 @@ public function testMethodCreateFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -198,8 +199,9 @@ public function testMethodGetFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -226,8 +228,9 @@ public function testMethodUpdateFile(): void { "mimeType" => "image/png", "sizeOriginal" => 17890, "chunksTotal" => 17890, - "chunksUploaded" => 17890,); - + "chunksUploaded" => 17890, + "encryption" => true, + "compression" => "gzip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -245,7 +248,6 @@ public function testMethodDeleteFile(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -262,7 +264,6 @@ public function testMethodGetFileDownload(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -279,7 +280,6 @@ public function testMethodGetFilePreview(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -296,7 +296,6 @@ public function testMethodGetFileView(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index 5b5d008..fb91185 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -6,6 +6,10 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\RelationshipType; +use Appwrite\Enums\RelationMutate; +use Appwrite\Enums\IndexType; +use Appwrite\Enums\OrderBy; final class TablesDBTest extends TestCase { private $client; @@ -20,8 +24,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "databases" => array(),); - + "databases" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -41,8 +44,9 @@ public function testMethodCreate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -60,8 +64,7 @@ public function testMethodListTransactions(): void { $data = array( "total" => 5, - "transactions" => array(),); - + "transactions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -81,8 +84,7 @@ public function testMethodCreateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -102,8 +104,7 @@ public function testMethodGetTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -124,8 +125,7 @@ public function testMethodUpdateTransaction(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -142,7 +142,6 @@ public function testMethodDeleteTransaction(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -162,8 +161,7 @@ public function testMethodCreateOperations(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "status" => "pending", "operations" => 5, - "expiresAt" => "2020-10-15T06:38:00.000+00:00",); - + "expiresAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -184,8 +182,9 @@ public function testMethodGet(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -206,16 +205,16 @@ public function testMethodUpdate(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "enabled" => true, - "type" => "legacy",); - + "type" => "legacy", + "policies" => array(), + "archives" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->tablesDB->update( - "", - "" + "" ); $this->assertSame($data, $response); @@ -225,7 +224,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -241,8 +239,7 @@ public function testMethodListTables(): void { $data = array( "total" => 5, - "tables" => array(),); - + "tables" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -267,8 +264,9 @@ public function testMethodCreateTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array(),); - + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -295,8 +293,9 @@ public function testMethodGetTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array(),); - + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -322,8 +321,9 @@ public function testMethodUpdateTable(): void { "enabled" => true, "rowSecurity" => true, "columns" => array(), - "indexes" => array(),); - + "indexes" => array(), + "bytesMax" => 65535, + "bytesUsed" => 1500); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -331,8 +331,7 @@ public function testMethodUpdateTable(): void { $response = $this->tablesDB->updateTable( "", - "", - "" + "" ); $this->assertSame($data, $response); @@ -342,7 +341,6 @@ public function testMethodDeleteTable(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -359,8 +357,7 @@ public function testMethodListColumns(): void { $data = array( "total" => 5, - "columns" => array(),); - + "columns" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -383,8 +380,7 @@ public function testMethodCreateBooleanColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -409,8 +405,7 @@ public function testMethodUpdateBooleanColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -437,8 +432,7 @@ public function testMethodCreateDatetimeColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -464,8 +458,7 @@ public function testMethodUpdateDatetimeColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "datetime",); - + "format" => "datetime"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -492,8 +485,7 @@ public function testMethodCreateEmailColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -519,8 +511,7 @@ public function testMethodUpdateEmailColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "email",); - + "format" => "email"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,8 +539,7 @@ public function testMethodCreateEnumColumn(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -577,8 +567,7 @@ public function testMethodUpdateEnumColumn(): void { "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "elements" => array(), - "format" => "enum",); - + "format" => "enum"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -605,8 +594,7 @@ public function testMethodCreateFloatColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -631,8 +619,7 @@ public function testMethodUpdateFloatColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -658,8 +645,7 @@ public function testMethodCreateIntegerColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -684,8 +670,7 @@ public function testMethodUpdateIntegerColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -712,8 +697,7 @@ public function testMethodCreateIpColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -739,8 +723,7 @@ public function testMethodUpdateIpColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "ip",); - + "format" => "ip"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -766,8 +749,7 @@ public function testMethodCreateLineColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -792,8 +774,7 @@ public function testMethodUpdateLineColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -809,7 +790,32 @@ public function testMethodUpdateLineColumn(): void { $this->assertSame($data, $response); } - public function testMethodCreatePointColumn(): void { + public function testMethodCreateLongtextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createLongtextColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateLongtextColumn(): void { $data = array( "key" => "fullName", @@ -818,8 +824,84 @@ public function testMethodCreatePointColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateLongtextColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreateMediumtextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createMediumtextColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateMediumtextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateMediumtextColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodCreatePointColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -844,8 +926,7 @@ public function testMethodUpdatePointColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -870,8 +951,7 @@ public function testMethodCreatePolygonColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -896,8 +976,7 @@ public function testMethodUpdatePolygonColumn(): void { "error" => "string", "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -928,8 +1007,7 @@ public function testMethodCreateRelationshipColumn(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -939,7 +1017,7 @@ public function testMethodCreateRelationshipColumn(): void { "", "", "", - "oneToOne" + RelationshipType::ONETOONE() ); $this->assertSame($data, $response); @@ -955,8 +1033,7 @@ public function testMethodCreateStringColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -983,8 +1060,7 @@ public function testMethodUpdateStringColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "size" => 128,); - + "size" => 128); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1001,6 +1077,57 @@ public function testMethodUpdateStringColumn(): void { $this->assertSame($data, $response); } + public function testMethodCreateTextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createTextColumn( + "", + "", + "", + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateTextColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateTextColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + public function testMethodCreateUrlColumn(): void { $data = array( @@ -1011,8 +1138,7 @@ public function testMethodCreateUrlColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1038,8 +1164,7 @@ public function testMethodUpdateUrlColumn(): void { "required" => true, "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "format" => "url",); - + "format" => "url"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1056,10 +1181,70 @@ public function testMethodUpdateUrlColumn(): void { $this->assertSame($data, $response); } - public function testMethodGetColumn(): void { + public function testMethodCreateVarcharColumn(): void { - $data = ''; + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->createVarcharColumn( + "", + "", + "", + 1, + true + ); + + $this->assertSame($data, $response); + } + + public function testMethodUpdateVarcharColumn(): void { + + $data = array( + "key" => "fullName", + "type" => "string", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "size" => 128); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + + $response = $this->tablesDB->updateVarcharColumn( + "", + "", + "", + true, + "" + ); + + $this->assertSame($data, $response); + } + + public function testMethodGetColumn(): void { + + $data = array( + "key" => "isEnabled", + "type" => "boolean", + "status" => "available", + "error" => "string", + "required" => true, + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1078,7 +1263,6 @@ public function testMethodDeleteColumn(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1107,8 +1291,7 @@ public function testMethodUpdateRelationshipColumn(): void { "twoWay" => true, "twoWayKey" => "string", "onDelete" => "restrict|cascade|setNull", - "side" => "parent|child",); - + "side" => "parent|child"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1127,8 +1310,7 @@ public function testMethodListIndexes(): void { $data = array( "total" => 5, - "indexes" => array(),); - + "indexes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1153,8 +1335,7 @@ public function testMethodCreateIndex(): void { "status" => "available", "error" => "string", "columns" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1164,7 +1345,7 @@ public function testMethodCreateIndex(): void { "", "", "", - "key", + IndexType::KEY(), array() ); @@ -1182,8 +1363,7 @@ public function testMethodGetIndex(): void { "status" => "available", "error" => "string", "columns" => array(), - "lengths" => array(),); - + "lengths" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1202,7 +1382,6 @@ public function testMethodDeleteIndex(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1220,8 +1399,7 @@ public function testMethodListRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1244,8 +1422,7 @@ public function testMethodCreateRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1265,8 +1442,7 @@ public function testMethodCreateRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1285,8 +1461,7 @@ public function testMethodUpsertRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1305,8 +1480,7 @@ public function testMethodUpdateRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1324,8 +1498,7 @@ public function testMethodDeleteRows(): void { $data = array( "total" => 5, - "rows" => array(),); - + "rows" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1348,8 +1521,7 @@ public function testMethodGetRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1373,8 +1545,7 @@ public function testMethodUpsertRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1398,8 +1569,7 @@ public function testMethodUpdateRow(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1418,7 +1588,6 @@ public function testMethodDeleteRow(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1441,8 +1610,7 @@ public function testMethodDecrementRowColumn(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1467,8 +1635,7 @@ public function testMethodIncrementRowColumn(): void { "\$databaseId" => "5e5ea5c15117e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "\$permissions" => array(),); - + "\$permissions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php index d77d0de..d909af5 100644 --- a/tests/Appwrite/Services/TeamsTest.php +++ b/tests/Appwrite/Services/TeamsTest.php @@ -20,8 +20,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "teams" => array(),); - + "teams" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -41,8 +40,7 @@ public function testMethodCreate(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "VIP", "total" => 7, - "prefs" => array(),); - + "prefs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -64,8 +62,7 @@ public function testMethodGet(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "VIP", "total" => 7, - "prefs" => array(),); - + "prefs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -86,8 +83,7 @@ public function testMethodUpdateName(): void { "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "name" => "VIP", "total" => 7, - "prefs" => array(),); - + "prefs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -105,7 +101,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -121,8 +116,7 @@ public function testMethodListMemberships(): void { $data = array( "total" => 5, - "memberships" => array(),); - + "memberships" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -150,8 +144,7 @@ public function testMethodCreateMembership(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -180,8 +173,7 @@ public function testMethodGetMembership(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -210,8 +202,7 @@ public function testMethodUpdateMembership(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -230,7 +221,6 @@ public function testMethodDeleteMembership(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -258,8 +248,7 @@ public function testMethodUpdateMembershipStatus(): void { "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, - "roles" => array(),); - + "roles" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -279,7 +268,6 @@ public function testMethodGetPrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -295,7 +283,6 @@ public function testMethodUpdatePrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/TokensTest.php b/tests/Appwrite/Services/TokensTest.php index 550b608..59dff5a 100644 --- a/tests/Appwrite/Services/TokensTest.php +++ b/tests/Appwrite/Services/TokensTest.php @@ -20,8 +20,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "tokens" => array(),); - + "tokens" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -44,8 +43,7 @@ public function testMethodCreateFileToken(): void { "resourceType" => "files", "expire" => "2020-10-15T06:38:00.000+00:00", "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -68,8 +66,7 @@ public function testMethodGet(): void { "resourceType" => "files", "expire" => "2020-10-15T06:38:00.000+00:00", "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -91,8 +88,7 @@ public function testMethodUpdate(): void { "resourceType" => "files", "expire" => "2020-10-15T06:38:00.000+00:00", "secret" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -109,7 +105,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index 101d1af..83d2bbc 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -6,6 +6,9 @@ use Appwrite\InputFile; use Mockery; use PHPUnit\Framework\TestCase; +use Appwrite\Enums\PasswordHash; +use Appwrite\Enums\AuthenticatorType; +use Appwrite\Enums\MessagingProviderType; final class UsersTest extends TestCase { private $client; @@ -20,8 +23,7 @@ public function testMethodList(): void { $data = array( "total" => 5, - "users" => array(),); - + "users" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -51,8 +53,7 @@ public function testMethodCreate(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -83,8 +84,7 @@ public function testMethodCreateArgon2User(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -117,8 +117,7 @@ public function testMethodCreateBcryptUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -137,8 +136,7 @@ public function testMethodListIdentities(): void { $data = array( "total" => 5, - "identities" => array(),); - + "identities" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -154,7 +152,6 @@ public function testMethodDeleteIdentity(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -184,8 +181,7 @@ public function testMethodCreateMD5User(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -218,8 +214,7 @@ public function testMethodCreatePHPassUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -252,8 +247,7 @@ public function testMethodCreateScryptUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -291,8 +285,7 @@ public function testMethodCreateScryptModifiedUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -328,8 +321,7 @@ public function testMethodCreateSHAUser(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -362,8 +354,7 @@ public function testMethodGet(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -380,7 +371,6 @@ public function testMethodDelete(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -410,8 +400,7 @@ public function testMethodUpdateEmail(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -428,8 +417,7 @@ public function testMethodUpdateEmail(): void { public function testMethodCreateJWT(): void { $data = array( - "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",); - + "jwt" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -460,8 +448,7 @@ public function testMethodUpdateLabels(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -479,8 +466,7 @@ public function testMethodListLogs(): void { $data = array( "total" => 5, - "logs" => array(),); - + "logs" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -497,8 +483,7 @@ public function testMethodListMemberships(): void { $data = array( "total" => 5, - "memberships" => array(),); - + "memberships" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -529,8 +514,7 @@ public function testMethodUpdateMFA(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -548,14 +532,13 @@ public function testMethodDeleteMFAAuthenticator(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); $response = $this->users->deleteMFAAuthenticator( "", - "totp" + AuthenticatorType::TOTP() ); $this->assertSame($data, $response); @@ -567,8 +550,7 @@ public function testMethodListMFAFactors(): void { "totp" => true, "phone" => true, "email" => true, - "recoveryCode" => true,); - + "recoveryCode" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -584,8 +566,7 @@ public function testMethodListMFAFactors(): void { public function testMethodGetMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -601,8 +582,7 @@ public function testMethodGetMFARecoveryCodes(): void { public function testMethodUpdateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -618,8 +598,7 @@ public function testMethodUpdateMFARecoveryCodes(): void { public function testMethodCreateMFARecoveryCodes(): void { $data = array( - "recoveryCodes" => array(),); - + "recoveryCodes" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -650,8 +629,7 @@ public function testMethodUpdateName(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -683,8 +661,7 @@ public function testMethodUpdatePassword(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -716,8 +693,7 @@ public function testMethodUpdatePhone(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -735,7 +711,6 @@ public function testMethodGetPrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -751,7 +726,6 @@ public function testMethodUpdatePrefs(): void { $data = array(); - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -768,8 +742,7 @@ public function testMethodListSessions(): void { $data = array( "total" => 5, - "sessions" => array(),); - + "sessions" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -813,8 +786,7 @@ public function testMethodCreateSession(): void { "current" => true, "factors" => array(), "secret" => "5e5bb8c16897e", - "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00",); - + "mfaUpdatedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -831,7 +803,6 @@ public function testMethodDeleteSessions(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -847,7 +818,6 @@ public function testMethodDeleteSession(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -878,8 +848,7 @@ public function testMethodUpdateStatus(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -897,8 +866,7 @@ public function testMethodListTargets(): void { $data = array( "total" => 5, - "targets" => array(),); - + "targets" => array()); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -921,8 +889,7 @@ public function testMethodCreateTarget(): void { "userId" => "259125845563242502", "providerType" => "email", "identifier" => "token", - "expired" => true,); - + "expired" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -931,7 +898,7 @@ public function testMethodCreateTarget(): void { $response = $this->users->createTarget( "", "", - "email", + MessagingProviderType::EMAIL(), "" ); @@ -948,8 +915,7 @@ public function testMethodGetTarget(): void { "userId" => "259125845563242502", "providerType" => "email", "identifier" => "token", - "expired" => true,); - + "expired" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -973,8 +939,7 @@ public function testMethodUpdateTarget(): void { "userId" => "259125845563242502", "providerType" => "email", "identifier" => "token", - "expired" => true,); - + "expired" => true); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -992,7 +957,6 @@ public function testMethodDeleteTarget(): void { $data = ''; - $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) ->andReturn($data); @@ -1013,8 +977,7 @@ public function testMethodCreateToken(): void { "userId" => "5e5ea5c168bb8", "secret" => "", "expire" => "2020-10-15T06:38:00.000+00:00", - "phrase" => "Golden Fox",); - + "phrase" => "Golden Fox"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1045,8 +1008,7 @@ public function testMethodUpdateEmailVerification(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) @@ -1078,8 +1040,7 @@ public function testMethodUpdatePhoneVerification(): void { "mfa" => true, "prefs" => array(), "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); - + "accessedAt" => "2020-10-15T06:38:00.000+00:00"); $this->client ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any())