diff --git a/CHANGELOG.md b/CHANGELOG.md index f650f409..5494201f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## 26.0.0 + +* Breaking: Removed client, OS, and device fields (`osCode`, `clientName`, `deviceModel`, etc.) from `ActivityEvent` +* Breaking: Inserted `authorizationDetailsTypes` mid-signature in `project.updateOAuth2Server` +* Added: OAuth2 device flow options `verificationUrl`, `userCodeLength`, `userCodeFormat`, and `deviceCodeDuration` to `updateOAuth2Server` +* Added: `updateDenyCorporateEmailPolicy` and `PolicyDenyCorporateEmail` to `project` +* Added: `deny-corporate-email` to `ProjectPolicyId` +* Added: `oauth2` to `ProjectServiceId` and `dedicatedDatabases.execute` to `ProjectKeyScopes` +* Added: `emailCanonical`, `emailIsFree`, `emailIsDisposable`, `emailIsCorporate`, and `emailIsCanonical` to `User` +* Added: `userAccessedAt` to `Membership` and `PolicyMembershipPrivacy` +* Added: `type` to `BackupPolicy` +* Updated: Send an `accept` header on all requests, including chunked uploads + ## 25.1.0 * Added: `createSesProvider` and `updateSesProvider` to `messaging` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 8975698b..123538ca 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -14,6 +14,6 @@ $account = new Account($client); $result = $account->create( userId: '', email: 'email@example.com', - password: '', + password: 'password', name: '' // optional );``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 3bb64e7f..13f03c87 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -12,6 +12,6 @@ $client = (new Client()) $account = new Account($client); $result = $account->updatePassword( - password: '', - oldPassword: '' // optional + password: 'password', + oldPassword: 'password' // optional );``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 7b5c1d0b..23a626e3 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -14,5 +14,5 @@ $account = new Account($client); $result = $account->updateRecovery( userId: '', secret: '', - password: '' + password: 'password' );``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 05386125..a55fd0fc 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -18,7 +18,7 @@ $result = $messaging->createSMTPProvider( host: '', port: 1, // optional username: '', // optional - password: '', // optional + password: 'password', // optional encryption: SmtpEncryption::NONE(), // optional autoTLS: false, // optional mailer: '', // optional diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 5701b3c2..73b4b3af 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -18,7 +18,7 @@ $result = $messaging->updateSMTPProvider( host: '', // optional port: 1, // optional username: '', // optional - password: '', // optional + password: 'password', // optional encryption: SmtpEncryption::NONE(), // optional autoTLS: false, // optional mailer: '', // optional diff --git a/docs/examples/project/update-deny-corporate-email-policy.md b/docs/examples/project/update-deny-corporate-email-policy.md new file mode 100644 index 00000000..69ed3907 --- /dev/null +++ b/docs/examples/project/update-deny-corporate-email-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 + +$project = new Project($client); + +$result = $project->updateDenyCorporateEmailPolicy( + enabled: false +);``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md index a62ace78..c41ce611 100644 --- a/docs/examples/project/update-membership-privacy-policy.md +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -16,5 +16,6 @@ $result = $project->updateMembershipPrivacyPolicy( userEmail: false, // optional userPhone: false, // optional userName: false, // optional - userMFA: false // optional + userMFA: false, // optional + userAccessedAt: false // optional );``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index 4ee150f8..d8974303 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -15,9 +15,14 @@ $result = $project->updateOAuth2Server( enabled: false, authorizationUrl: 'https://example.com', scopes: [], // optional + authorizationDetailsTypes: [], // optional accessTokenDuration: 60, // optional refreshTokenDuration: 60, // optional publicAccessTokenDuration: 60, // optional publicRefreshTokenDuration: 60, // optional - confidentialPkce: false // optional + confidentialPkce: false, // optional + verificationUrl: 'https://example.com', // optional + userCodeLength: 6, // optional + userCodeFormat: 'numeric', // optional + deviceCodeDuration: 60 // optional );``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index 452a3d86..71a7b8f0 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -16,7 +16,7 @@ $result = $project->updateSMTP( host: '', // optional port: null, // optional username: '', // optional - password: '', // optional + password: 'password', // optional senderEmail: 'email@example.com', // optional senderName: '', // optional replyToEmail: 'email@example.com', // optional diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 2265fc9b..34d30569 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -14,5 +14,6 @@ $tablesDB = new TablesDB($client); $result = $tablesDB->create( databaseId: '', name: '', - enabled: false // optional + enabled: false, // optional + dedicatedDatabaseId: '' // optional );``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index ec9b6839..a2feb7c3 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -15,6 +15,6 @@ $result = $users->create( userId: '', email: 'email@example.com', // optional phone: '+12065550100', // optional - password: '', // optional + password: 'password', // optional name: '' // optional );``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 69d93300..d8f2ed1c 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -13,5 +13,5 @@ $users = new Users($client); $result = $users->updatePassword( userId: '', - password: '' + password: 'password' );``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index 4e017506..dd8eb1cd 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -19,6 +19,6 @@ $result = $webhooks->create( enabled: false, // optional tls: false, // optional authUsername: '', // optional - authPassword: '', // optional + authPassword: 'password', // optional secret: '' // optional );``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index 8b71a93f..c6bf00b2 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -19,5 +19,5 @@ $result = $webhooks->update( enabled: false, // optional tls: false, // optional authUsername: '', // optional - authPassword: '' // optional + authPassword: 'password' // optional );``` diff --git a/docs/project.md b/docs/project.md index 49e98ef6..6cb25b4a 100644 --- a/docs/project.md +++ b/docs/project.md @@ -227,11 +227,16 @@ PUT https://cloud.appwrite.io/v1/project/oauth2-server | enabled | boolean | Enable or disable the OAuth2 server. | | | authorizationUrl | string | URL to your application with consent screen. | | | scopes | array | List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. | [] | +| authorizationDetailsTypes | array | List of accepted `authorization_details` types. Maximum of 100 types are allowed, each up to 128 characters long. | [] | | accessTokenDuration | integer | Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. | | | refreshTokenDuration | integer | Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. | | | publicAccessTokenDuration | integer | Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. | | | publicRefreshTokenDuration | integer | Refresh token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 30 days. | | | confidentialPkce | boolean | When enabled, PKCE is required for confidential clients (server-side flows using client_secret). PKCE is always required for public clients regardless of this setting. | | +| verificationUrl | string | URL to your application page where users enter the device flow user code. Required to enable the Device Authorization Grant. | | +| userCodeLength | integer | Number of characters in the device flow user code, excluding the formatting separator. Shorter codes are easier to type but weaker; pair short codes with short expiry. Leave empty to use default 8. | | +| userCodeFormat | string | Character set for device flow user codes: `numeric` (digits only — best for numeric keypads and TV remotes), `alphabetic` (letters only), or `alphanumeric` (letters and digits — highest entropy per character). Defaults to `alphanumeric`. | alphanumeric | +| deviceCodeDuration | integer | Lifetime in seconds of device flow device codes and user codes. Device codes are intentionally short-lived. Leave empty to use default 600. | | ```http request @@ -1110,6 +1115,19 @@ PATCH https://cloud.appwrite.io/v1/project/policies/deny-aliased-email | enabled | boolean | Set whether or not to block aliased emails during signup and email updates. | | +```http request +PATCH https://cloud.appwrite.io/v1/project/policies/deny-corporate-email +``` + +** Configures if only corporate email addresses (non-free and non-disposable domains) are allowed during new user sign-ups and email updates. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| enabled | boolean | Set whether or not to restrict sign-ups and email updates to corporate email addresses only. | | + + ```http request PATCH https://cloud.appwrite.io/v1/project/policies/deny-disposable-email ``` @@ -1151,6 +1169,7 @@ PATCH https://cloud.appwrite.io/v1/project/policies/membership-privacy | userPhone | boolean | Set to true if you want make user phone number visible to all team members, or false to hide it. | | | userName | boolean | Set to true if you want make user name visible to all team members, or false to hide it. | | | userMFA | boolean | Set to true if you want make user MFA status visible to all team members, or false to hide it. | | +| userAccessedAt | boolean | Set to true if you want make user last access time visible to all team members, or false to hide it. | | ```http request @@ -1286,7 +1305,7 @@ GET https://cloud.appwrite.io/v1/project/policies/{policyId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| policyId | string | **Required** Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. | | +| policyId | string | **Required** Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email. | | ```http request @@ -1313,7 +1332,7 @@ PATCH https://cloud.appwrite.io/v1/project/services/{serviceId} | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| serviceId | string | **Required** Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor | | +| serviceId | string | **Required** Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor, oauth2 | | | enabled | boolean | Service status. | | diff --git a/docs/tablesdb.md b/docs/tablesdb.md index b8ef008f..7580ce10 100644 --- a/docs/tablesdb.md +++ b/docs/tablesdb.md @@ -30,6 +30,7 @@ POST https://cloud.appwrite.io/v1/tablesdb | databaseId | string | Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | | | name | string | Database name. Max length: 128 chars. | | | enabled | boolean | Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. | 1 | +| dedicatedDatabaseId | string | Optional dedicated database (compute) ID to attach this database to. Leave empty to create a database on the shared pool. | | ```http request diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 014a12ba..397d2ade 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected array $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/25.1.0 ()', + 'user-agent' => 'AppwritePHPSDK/26.0.0 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '25.1.0', + 'x-sdk-version'=> '26.0.0', ]; /** @@ -210,7 +210,7 @@ public function setCookie(string $value): Client /** * Set ImpersonateUserId * - * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * Impersonate a user by ID * * @param string $value * @@ -227,7 +227,7 @@ public function setImpersonateUserId(string $value): Client /** * Set ImpersonateUserEmail * - * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * Impersonate a user by email * * @param string $value * @@ -244,7 +244,7 @@ public function setImpersonateUserEmail(string $value): Client /** * Set ImpersonateUserPhone * - * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * Impersonate a user by phone * * @param string $value * @@ -427,10 +427,8 @@ public function call( } } - switch(substr($contentType, 0, strpos($contentType, ';'))) { - case 'application/json': - $responseBody = json_decode($responseBody, true); - break; + if (str_starts_with($contentType, 'application/json')) { + $responseBody = json_decode($responseBody, true); } if (curl_errno($ch)) { diff --git a/src/Appwrite/Enums/ProjectKeyScopes.php b/src/Appwrite/Enums/ProjectKeyScopes.php index b352e4f7..2c78383f 100644 --- a/src/Appwrite/Enums/ProjectKeyScopes.php +++ b/src/Appwrite/Enums/ProjectKeyScopes.php @@ -96,6 +96,7 @@ class ProjectKeyScopes implements JsonSerializable private static ProjectKeyScopes $ARCHIVESWRITE; private static ProjectKeyScopes $RESTORATIONSREAD; private static ProjectKeyScopes $RESTORATIONSWRITE; + private static ProjectKeyScopes $DEDICATEDDATABASESEXECUTE; private static ProjectKeyScopes $DOMAINSREAD; private static ProjectKeyScopes $DOMAINSWRITE; private static ProjectKeyScopes $EVENTSREAD; @@ -750,6 +751,13 @@ public static function RESTORATIONSWRITE(): ProjectKeyScopes } return self::$RESTORATIONSWRITE; } + public static function DEDICATEDDATABASESEXECUTE(): ProjectKeyScopes + { + if (!isset(self::$DEDICATEDDATABASESEXECUTE)) { + self::$DEDICATEDDATABASESEXECUTE = new ProjectKeyScopes('dedicatedDatabases.execute'); + } + return self::$DEDICATEDDATABASESEXECUTE; + } public static function DOMAINSREAD(): ProjectKeyScopes { if (!isset(self::$DOMAINSREAD)) { @@ -886,6 +894,7 @@ public static function from(string $value): self 'archives.write' => self::ARCHIVESWRITE(), 'restorations.read' => self::RESTORATIONSREAD(), 'restorations.write' => self::RESTORATIONSWRITE(), + 'dedicatedDatabases.execute' => self::DEDICATEDDATABASESEXECUTE(), 'domains.read' => self::DOMAINSREAD(), 'domains.write' => self::DOMAINSWRITE(), 'events.read' => self::EVENTSREAD(), diff --git a/src/Appwrite/Enums/ProjectPolicyId.php b/src/Appwrite/Enums/ProjectPolicyId.php index 619f5554..64562d88 100644 --- a/src/Appwrite/Enums/ProjectPolicyId.php +++ b/src/Appwrite/Enums/ProjectPolicyId.php @@ -19,6 +19,7 @@ class ProjectPolicyId implements JsonSerializable private static ProjectPolicyId $DENYALIASEDEMAIL; private static ProjectPolicyId $DENYDISPOSABLEEMAIL; private static ProjectPolicyId $DENYFREEEMAIL; + private static ProjectPolicyId $DENYCORPORATEEMAIL; private string $value; @@ -128,6 +129,13 @@ public static function DENYFREEEMAIL(): ProjectPolicyId } return self::$DENYFREEEMAIL; } + public static function DENYCORPORATEEMAIL(): ProjectPolicyId + { + if (!isset(self::$DENYCORPORATEEMAIL)) { + self::$DENYCORPORATEEMAIL = new ProjectPolicyId('deny-corporate-email'); + } + return self::$DENYCORPORATEEMAIL; + } public static function from(string $value): self { @@ -145,6 +153,7 @@ public static function from(string $value): self 'deny-aliased-email' => self::DENYALIASEDEMAIL(), 'deny-disposable-email' => self::DENYDISPOSABLEEMAIL(), 'deny-free-email' => self::DENYFREEEMAIL(), + 'deny-corporate-email' => self::DENYCORPORATEEMAIL(), default => throw new \InvalidArgumentException('Unknown ProjectPolicyId value: ' . $value), }; } diff --git a/src/Appwrite/Enums/ProjectServiceId.php b/src/Appwrite/Enums/ProjectServiceId.php index fa3e947c..59921ae9 100644 --- a/src/Appwrite/Enums/ProjectServiceId.php +++ b/src/Appwrite/Enums/ProjectServiceId.php @@ -24,6 +24,7 @@ class ProjectServiceId implements JsonSerializable private static ProjectServiceId $MIGRATIONS; private static ProjectServiceId $MESSAGING; private static ProjectServiceId $ADVISOR; + private static ProjectServiceId $OAUTH2; private string $value; @@ -168,6 +169,13 @@ public static function ADVISOR(): ProjectServiceId } return self::$ADVISOR; } + public static function OAUTH2(): ProjectServiceId + { + if (!isset(self::$OAUTH2)) { + self::$OAUTH2 = new ProjectServiceId('oauth2'); + } + return self::$OAUTH2; + } public static function from(string $value): self { @@ -190,6 +198,7 @@ public static function from(string $value): self 'migrations' => self::MIGRATIONS(), 'messaging' => self::MESSAGING(), 'advisor' => self::ADVISOR(), + 'oauth2' => self::OAUTH2(), default => throw new \InvalidArgumentException('Unknown ProjectServiceId value: ' . $value), }; } diff --git a/src/Appwrite/Models/ActivityEvent.php b/src/Appwrite/Models/ActivityEvent.php index e019fcb5..287011dd 100644 --- a/src/Appwrite/Models/ActivityEvent.php +++ b/src/Appwrite/Models/ActivityEvent.php @@ -30,18 +30,6 @@ * @param string $projectId project id. * @param string $teamId team id. * @param string $hostname hostname. - * @param string $osCode operating system code name. view list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - * @param string $osName operating system name. - * @param string $osVersion operating system version. - * @param string $clientType client type. - * @param string $clientCode client code name. view list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - * @param string $clientName client name. - * @param string $clientVersion client version. - * @param string $clientEngine client engine name. - * @param string $clientEngineVersion client engine name. - * @param string $deviceName device name. - * @param string $deviceBrand device brand name. - * @param string $deviceModel device model name. * @param string $countryCode country two-character iso 3166-1 alpha code. * @param string $countryName country name. */ @@ -64,18 +52,6 @@ public function __construct( public string $projectId, public string $teamId, public string $hostname, - public string $osCode, - public string $osName, - public string $osVersion, - public string $clientType, - public string $clientCode, - public string $clientName, - public string $clientVersion, - public string $clientEngine, - public string $clientEngineVersion, - public string $deviceName, - public string $deviceBrand, - public string $deviceModel, public string $countryCode, public string $countryName ) { @@ -140,42 +116,6 @@ public static function from(array $data): static if (!array_key_exists('hostname', $data)) { throw new \InvalidArgumentException('Missing required field "hostname" for ' . static::class . '.'); } - if (!array_key_exists('osCode', $data)) { - throw new \InvalidArgumentException('Missing required field "osCode" for ' . static::class . '.'); - } - if (!array_key_exists('osName', $data)) { - throw new \InvalidArgumentException('Missing required field "osName" for ' . static::class . '.'); - } - if (!array_key_exists('osVersion', $data)) { - throw new \InvalidArgumentException('Missing required field "osVersion" for ' . static::class . '.'); - } - if (!array_key_exists('clientType', $data)) { - throw new \InvalidArgumentException('Missing required field "clientType" for ' . static::class . '.'); - } - if (!array_key_exists('clientCode', $data)) { - throw new \InvalidArgumentException('Missing required field "clientCode" for ' . static::class . '.'); - } - if (!array_key_exists('clientName', $data)) { - throw new \InvalidArgumentException('Missing required field "clientName" for ' . static::class . '.'); - } - if (!array_key_exists('clientVersion', $data)) { - throw new \InvalidArgumentException('Missing required field "clientVersion" for ' . static::class . '.'); - } - if (!array_key_exists('clientEngine', $data)) { - throw new \InvalidArgumentException('Missing required field "clientEngine" for ' . static::class . '.'); - } - if (!array_key_exists('clientEngineVersion', $data)) { - throw new \InvalidArgumentException('Missing required field "clientEngineVersion" for ' . static::class . '.'); - } - if (!array_key_exists('deviceName', $data)) { - throw new \InvalidArgumentException('Missing required field "deviceName" for ' . static::class . '.'); - } - if (!array_key_exists('deviceBrand', $data)) { - throw new \InvalidArgumentException('Missing required field "deviceBrand" for ' . static::class . '.'); - } - if (!array_key_exists('deviceModel', $data)) { - throw new \InvalidArgumentException('Missing required field "deviceModel" for ' . static::class . '.'); - } if (!array_key_exists('countryCode', $data)) { throw new \InvalidArgumentException('Missing required field "countryCode" for ' . static::class . '.'); } @@ -202,18 +142,6 @@ public static function from(array $data): static projectId: $data['projectId'], teamId: $data['teamId'], hostname: $data['hostname'], - osCode: $data['osCode'], - osName: $data['osName'], - osVersion: $data['osVersion'], - clientType: $data['clientType'], - clientCode: $data['clientCode'], - clientName: $data['clientName'], - clientVersion: $data['clientVersion'], - clientEngine: $data['clientEngine'], - clientEngineVersion: $data['clientEngineVersion'], - deviceName: $data['deviceName'], - deviceBrand: $data['deviceBrand'], - deviceModel: $data['deviceModel'], countryCode: $data['countryCode'], countryName: $data['countryName'] ); @@ -243,18 +171,6 @@ public function toArray(): array 'projectId' => static::serializeValue($this->projectId), 'teamId' => static::serializeValue($this->teamId), 'hostname' => static::serializeValue($this->hostname), - 'osCode' => static::serializeValue($this->osCode), - 'osName' => static::serializeValue($this->osName), - 'osVersion' => static::serializeValue($this->osVersion), - 'clientType' => static::serializeValue($this->clientType), - 'clientCode' => static::serializeValue($this->clientCode), - 'clientName' => static::serializeValue($this->clientName), - 'clientVersion' => static::serializeValue($this->clientVersion), - 'clientEngine' => static::serializeValue($this->clientEngine), - 'clientEngineVersion' => static::serializeValue($this->clientEngineVersion), - 'deviceName' => static::serializeValue($this->deviceName), - 'deviceBrand' => static::serializeValue($this->deviceBrand), - 'deviceModel' => static::serializeValue($this->deviceModel), 'countryCode' => static::serializeValue($this->countryCode), 'countryName' => static::serializeValue($this->countryName) ]; diff --git a/src/Appwrite/Models/BackupPolicy.php b/src/Appwrite/Models/BackupPolicy.php index 08a4b2ab..424f002c 100644 --- a/src/Appwrite/Models/BackupPolicy.php +++ b/src/Appwrite/Models/BackupPolicy.php @@ -20,6 +20,7 @@ * @param array $resources the resources that are backed up by this policy. * @param int $retention how many days to keep the backup before it will be automatically deleted. * @param string $schedule policy backup schedule in cron format. + * @param string $type backup type. possible values: full (complete database snapshot), incremental (changes since last backup). * @param bool $enabled is this policy enabled. * @param string|null $resourceId the resource id to backup. set only if this policy should backup a single resource. * @param string|null $resourceType the resource type to backup. set only if this policy should backup a single resource. @@ -33,6 +34,7 @@ public function __construct( public array $resources, public int $retention, public string $schedule, + public string $type, public bool $enabled, public ?string $resourceId = null, public ?string $resourceType = null @@ -68,6 +70,9 @@ public static function from(array $data): static if (!array_key_exists('schedule', $data)) { throw new \InvalidArgumentException('Missing required field "schedule" for ' . static::class . '.'); } + if (!array_key_exists('type', $data)) { + throw new \InvalidArgumentException('Missing required field "type" for ' . static::class . '.'); + } if (!array_key_exists('enabled', $data)) { throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); } @@ -81,6 +86,7 @@ public static function from(array $data): static resources: $data['resources'], retention: $data['retention'], schedule: $data['schedule'], + type: $data['type'], enabled: $data['enabled'], resourceId: array_key_exists('resourceId', $data) ? $data['resourceId'] : null, resourceType: array_key_exists('resourceType', $data) ? $data['resourceType'] : null @@ -103,6 +109,7 @@ public function toArray(): array 'resourceType' => static::serializeValue($this->resourceType), 'retention' => static::serializeValue($this->retention), 'schedule' => static::serializeValue($this->schedule), + 'type' => static::serializeValue($this->type), 'enabled' => static::serializeValue($this->enabled) ]; diff --git a/src/Appwrite/Models/Membership.php b/src/Appwrite/Models/Membership.php index e5db4567..5f78877a 100644 --- a/src/Appwrite/Models/Membership.php +++ b/src/Appwrite/Models/Membership.php @@ -25,6 +25,7 @@ * @param string $joined date, the user has accepted the invitation to join the team in iso 8601 format. * @param bool $confirm user confirmation status, true if the user has joined the team or false otherwise. * @param bool $mfa multi factor authentication status, true if the user has mfa enabled or false otherwise. hide this attribute by toggling membership privacy in the console. + * @param string $userAccessedAt most recent access date in iso 8601 format. show this attribute by toggling membership privacy in the console. * @param array $roles user list of roles */ public function __construct( @@ -41,6 +42,7 @@ public function __construct( public string $joined, public bool $confirm, public bool $mfa, + public string $userAccessedAt, public array $roles ) { } @@ -89,6 +91,9 @@ public static function from(array $data): static if (!array_key_exists('mfa', $data)) { throw new \InvalidArgumentException('Missing required field "mfa" for ' . static::class . '.'); } + if (!array_key_exists('userAccessedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "userAccessedAt" for ' . static::class . '.'); + } if (!array_key_exists('roles', $data)) { throw new \InvalidArgumentException('Missing required field "roles" for ' . static::class . '.'); } @@ -107,6 +112,7 @@ public static function from(array $data): static joined: $data['joined'], confirm: $data['confirm'], mfa: $data['mfa'], + userAccessedAt: $data['userAccessedAt'], roles: $data['roles'] ); } @@ -130,6 +136,7 @@ public function toArray(): array 'joined' => static::serializeValue($this->joined), 'confirm' => static::serializeValue($this->confirm), 'mfa' => static::serializeValue($this->mfa), + 'userAccessedAt' => static::serializeValue($this->userAccessedAt), 'roles' => static::serializeValue($this->roles) ]; diff --git a/src/Appwrite/Models/PolicyDenyCorporateEmail.php b/src/Appwrite/Models/PolicyDenyCorporateEmail.php new file mode 100644 index 00000000..9a48fbf3 --- /dev/null +++ b/src/Appwrite/Models/PolicyDenyCorporateEmail.php @@ -0,0 +1,54 @@ + $data + */ + public static function from(array $data): static + { + if (!array_key_exists('$id', $data)) { + throw new \InvalidArgumentException('Missing required field "$id" for ' . static::class . '.'); + } + if (!array_key_exists('enabled', $data)) { + throw new \InvalidArgumentException('Missing required field "enabled" for ' . static::class . '.'); + } + + return new static( + id: $data['$id'], + enabled: $data['enabled'] + ); + } + + /** + * @return array + */ + public function toArray(): array + { + $result = [ + '$id' => static::serializeValue($this->id), + 'enabled' => static::serializeValue($this->enabled) + ]; + + return $result; + } +} diff --git a/src/Appwrite/Models/PolicyMembershipPrivacy.php b/src/Appwrite/Models/PolicyMembershipPrivacy.php index e7f8bb75..5c3423d1 100644 --- a/src/Appwrite/Models/PolicyMembershipPrivacy.php +++ b/src/Appwrite/Models/PolicyMembershipPrivacy.php @@ -18,6 +18,7 @@ * @param bool $userPhone whether user phone is visible in memberships. * @param bool $userName whether user name is visible in memberships. * @param bool $userMFA whether user mfa status is visible in memberships. + * @param bool $userAccessedAt whether user last access time is visible in memberships. */ public function __construct( public string $id, @@ -25,7 +26,8 @@ public function __construct( public bool $userEmail, public bool $userPhone, public bool $userName, - public bool $userMFA + public bool $userMFA, + public bool $userAccessedAt ) { } @@ -52,6 +54,9 @@ public static function from(array $data): static if (!array_key_exists('userMFA', $data)) { throw new \InvalidArgumentException('Missing required field "userMFA" for ' . static::class . '.'); } + if (!array_key_exists('userAccessedAt', $data)) { + throw new \InvalidArgumentException('Missing required field "userAccessedAt" for ' . static::class . '.'); + } return new static( id: $data['$id'], @@ -59,7 +64,8 @@ public static function from(array $data): static userEmail: $data['userEmail'], userPhone: $data['userPhone'], userName: $data['userName'], - userMFA: $data['userMFA'] + userMFA: $data['userMFA'], + userAccessedAt: $data['userAccessedAt'] ); } @@ -74,7 +80,8 @@ public function toArray(): array 'userEmail' => static::serializeValue($this->userEmail), 'userPhone' => static::serializeValue($this->userPhone), 'userName' => static::serializeValue($this->userName), - 'userMFA' => static::serializeValue($this->userMFA) + 'userMFA' => static::serializeValue($this->userMFA), + 'userAccessedAt' => static::serializeValue($this->userAccessedAt) ]; return $result; diff --git a/src/Appwrite/Models/Project.php b/src/Appwrite/Models/Project.php index 0fd92cef..4b026bbe 100644 --- a/src/Appwrite/Models/Project.php +++ b/src/Appwrite/Models/Project.php @@ -41,11 +41,16 @@ * @param bool $oAuth2ServerEnabled oauth2 server status * @param string $oAuth2ServerAuthorizationUrl oauth2 server authorization url * @param array $oAuth2ServerScopes oauth2 server allowed scopes + * @param array $oAuth2ServerAuthorizationDetailsTypes oauth2 server accepted rfc 9396 authorization_details types * @param int $oAuth2ServerAccessTokenDuration oauth2 server access token duration in seconds for confidential clients * @param int $oAuth2ServerRefreshTokenDuration oauth2 server refresh token duration in seconds for confidential clients * @param int $oAuth2ServerPublicAccessTokenDuration oauth2 server access token duration in seconds for public clients (spas, mobile, native) * @param int $oAuth2ServerPublicRefreshTokenDuration oauth2 server refresh token duration in seconds for public clients (spas, mobile, native) * @param bool $oAuth2ServerConfidentialPkce when enabled, pkce is required for confidential clients (server-side flows using client_secret). pkce is always required for public clients regardless of this setting. + * @param string $oAuth2ServerVerificationUrl url to your application page where users enter the device flow user code. empty when the device authorization grant is not configured. + * @param int $oAuth2ServerUserCodeLength number of characters in the device flow user code, excluding the formatting separator. + * @param string $oAuth2ServerUserCodeFormat character set for device flow user codes: `numeric`, `alphabetic`, or `alphanumeric`. + * @param int $oAuth2ServerDeviceCodeDuration lifetime in seconds of device flow device codes and user codes. * @param string $oAuth2ServerDiscoveryUrl oauth2 server discovery url * @param BillingLimits|null $billingLimits billing limits reached */ @@ -79,11 +84,16 @@ public function __construct( public bool $oAuth2ServerEnabled, public string $oAuth2ServerAuthorizationUrl, public array $oAuth2ServerScopes, + public array $oAuth2ServerAuthorizationDetailsTypes, public int $oAuth2ServerAccessTokenDuration, public int $oAuth2ServerRefreshTokenDuration, public int $oAuth2ServerPublicAccessTokenDuration, public int $oAuth2ServerPublicRefreshTokenDuration, public bool $oAuth2ServerConfidentialPkce, + public string $oAuth2ServerVerificationUrl, + public int $oAuth2ServerUserCodeLength, + public string $oAuth2ServerUserCodeFormat, + public int $oAuth2ServerDeviceCodeDuration, public string $oAuth2ServerDiscoveryUrl, public ?BillingLimits $billingLimits = null ) { @@ -181,6 +191,9 @@ public static function from(array $data): static if (!array_key_exists('oAuth2ServerScopes', $data)) { throw new \InvalidArgumentException('Missing required field "oAuth2ServerScopes" for ' . static::class . '.'); } + if (!array_key_exists('oAuth2ServerAuthorizationDetailsTypes', $data)) { + throw new \InvalidArgumentException('Missing required field "oAuth2ServerAuthorizationDetailsTypes" for ' . static::class . '.'); + } if (!array_key_exists('oAuth2ServerAccessTokenDuration', $data)) { throw new \InvalidArgumentException('Missing required field "oAuth2ServerAccessTokenDuration" for ' . static::class . '.'); } @@ -196,6 +209,18 @@ public static function from(array $data): static if (!array_key_exists('oAuth2ServerConfidentialPkce', $data)) { throw new \InvalidArgumentException('Missing required field "oAuth2ServerConfidentialPkce" for ' . static::class . '.'); } + if (!array_key_exists('oAuth2ServerVerificationUrl', $data)) { + throw new \InvalidArgumentException('Missing required field "oAuth2ServerVerificationUrl" for ' . static::class . '.'); + } + if (!array_key_exists('oAuth2ServerUserCodeLength', $data)) { + throw new \InvalidArgumentException('Missing required field "oAuth2ServerUserCodeLength" for ' . static::class . '.'); + } + if (!array_key_exists('oAuth2ServerUserCodeFormat', $data)) { + throw new \InvalidArgumentException('Missing required field "oAuth2ServerUserCodeFormat" for ' . static::class . '.'); + } + if (!array_key_exists('oAuth2ServerDeviceCodeDuration', $data)) { + throw new \InvalidArgumentException('Missing required field "oAuth2ServerDeviceCodeDuration" for ' . static::class . '.'); + } if (!array_key_exists('oAuth2ServerDiscoveryUrl', $data)) { throw new \InvalidArgumentException('Missing required field "oAuth2ServerDiscoveryUrl" for ' . static::class . '.'); } @@ -255,11 +280,16 @@ public static function from(array $data): static oAuth2ServerEnabled: $data['oAuth2ServerEnabled'], oAuth2ServerAuthorizationUrl: $data['oAuth2ServerAuthorizationUrl'], oAuth2ServerScopes: $data['oAuth2ServerScopes'], + oAuth2ServerAuthorizationDetailsTypes: $data['oAuth2ServerAuthorizationDetailsTypes'], oAuth2ServerAccessTokenDuration: $data['oAuth2ServerAccessTokenDuration'], oAuth2ServerRefreshTokenDuration: $data['oAuth2ServerRefreshTokenDuration'], oAuth2ServerPublicAccessTokenDuration: $data['oAuth2ServerPublicAccessTokenDuration'], oAuth2ServerPublicRefreshTokenDuration: $data['oAuth2ServerPublicRefreshTokenDuration'], oAuth2ServerConfidentialPkce: $data['oAuth2ServerConfidentialPkce'], + oAuth2ServerVerificationUrl: $data['oAuth2ServerVerificationUrl'], + oAuth2ServerUserCodeLength: $data['oAuth2ServerUserCodeLength'], + oAuth2ServerUserCodeFormat: $data['oAuth2ServerUserCodeFormat'], + oAuth2ServerDeviceCodeDuration: $data['oAuth2ServerDeviceCodeDuration'], oAuth2ServerDiscoveryUrl: $data['oAuth2ServerDiscoveryUrl'], billingLimits: array_key_exists('billingLimits', $data) ? static::hydrateTypedValue(BillingLimits::class, $data['billingLimits'], true) : null ); @@ -301,11 +331,16 @@ public function toArray(): array 'oAuth2ServerEnabled' => static::serializeValue($this->oAuth2ServerEnabled), 'oAuth2ServerAuthorizationUrl' => static::serializeValue($this->oAuth2ServerAuthorizationUrl), 'oAuth2ServerScopes' => static::serializeValue($this->oAuth2ServerScopes), + 'oAuth2ServerAuthorizationDetailsTypes' => static::serializeValue($this->oAuth2ServerAuthorizationDetailsTypes), 'oAuth2ServerAccessTokenDuration' => static::serializeValue($this->oAuth2ServerAccessTokenDuration), 'oAuth2ServerRefreshTokenDuration' => static::serializeValue($this->oAuth2ServerRefreshTokenDuration), 'oAuth2ServerPublicAccessTokenDuration' => static::serializeValue($this->oAuth2ServerPublicAccessTokenDuration), 'oAuth2ServerPublicRefreshTokenDuration' => static::serializeValue($this->oAuth2ServerPublicRefreshTokenDuration), 'oAuth2ServerConfidentialPkce' => static::serializeValue($this->oAuth2ServerConfidentialPkce), + 'oAuth2ServerVerificationUrl' => static::serializeValue($this->oAuth2ServerVerificationUrl), + 'oAuth2ServerUserCodeLength' => static::serializeValue($this->oAuth2ServerUserCodeLength), + 'oAuth2ServerUserCodeFormat' => static::serializeValue($this->oAuth2ServerUserCodeFormat), + 'oAuth2ServerDeviceCodeDuration' => static::serializeValue($this->oAuth2ServerDeviceCodeDuration), 'oAuth2ServerDiscoveryUrl' => static::serializeValue($this->oAuth2ServerDiscoveryUrl) ]; diff --git a/src/Appwrite/Models/User.php b/src/Appwrite/Models/User.php index 2688bf50..a7decdcc 100644 --- a/src/Appwrite/Models/User.php +++ b/src/Appwrite/Models/User.php @@ -31,6 +31,11 @@ * @param string|null $password hashed user password. * @param string|null $hash password hashing algorithm. * @param array|null $hashOptions password hashing algorithm configuration. + * @param string|null $emailCanonical canonical form of the user email address. + * @param bool|null $emailIsFree whether the user email is from a free email provider. + * @param bool|null $emailIsDisposable whether the user email is from a disposable email provider. + * @param bool|null $emailIsCorporate whether the user email is from a corporate domain. + * @param bool|null $emailIsCanonical whether the user email is in its canonical form. * @param bool|null $impersonator whether the user can impersonate other users. * @param string|null $impersonatorUserId id of the original actor performing the impersonation. present only when the current request is impersonating another user. internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. */ @@ -54,6 +59,11 @@ public function __construct( public ?string $password = null, public ?string $hash = null, public ?array $hashOptions = null, + public ?string $emailCanonical = null, + public ?bool $emailIsFree = null, + public ?bool $emailIsDisposable = null, + public ?bool $emailIsCorporate = null, + public ?bool $emailIsCanonical = null, public ?bool $impersonator = null, public ?string $impersonatorUserId = null ) { @@ -138,6 +148,11 @@ public static function from(array $data): static password: array_key_exists('password', $data) ? $data['password'] : null, hash: array_key_exists('hash', $data) ? $data['hash'] : null, hashOptions: array_key_exists('hashOptions', $data) ? $data['hashOptions'] : null, + emailCanonical: array_key_exists('emailCanonical', $data) ? $data['emailCanonical'] : null, + emailIsFree: array_key_exists('emailIsFree', $data) ? $data['emailIsFree'] : null, + emailIsDisposable: array_key_exists('emailIsDisposable', $data) ? $data['emailIsDisposable'] : null, + emailIsCorporate: array_key_exists('emailIsCorporate', $data) ? $data['emailIsCorporate'] : null, + emailIsCanonical: array_key_exists('emailIsCanonical', $data) ? $data['emailIsCanonical'] : null, impersonator: array_key_exists('impersonator', $data) ? $data['impersonator'] : null, impersonatorUserId: array_key_exists('impersonatorUserId', $data) ? $data['impersonatorUserId'] : null ); @@ -163,6 +178,11 @@ public function toArray(): array 'email' => static::serializeValue($this->email), 'phone' => static::serializeValue($this->phone), 'emailVerification' => static::serializeValue($this->emailVerification), + 'emailCanonical' => static::serializeValue($this->emailCanonical), + 'emailIsFree' => static::serializeValue($this->emailIsFree), + 'emailIsDisposable' => static::serializeValue($this->emailIsDisposable), + 'emailIsCorporate' => static::serializeValue($this->emailIsCorporate), + 'emailIsCanonical' => static::serializeValue($this->emailIsCanonical), 'phoneVerification' => static::serializeValue($this->phoneVerification), 'mfa' => static::serializeValue($this->mfa), 'prefs' => static::serializeValue($this->prefs), diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index dc7711f0..e5b62b63 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -35,6 +35,7 @@ public function get(): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -87,6 +88,7 @@ public function create(string $userId, string $email, string $password, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -133,6 +135,7 @@ public function updateEmail(string $email, string $password): \Appwrite\Models\U $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -177,6 +180,7 @@ public function listIdentities(?array $queries = null, ?bool $total = null): \Ap $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -254,6 +258,7 @@ public function createJWT(?int $duration = null): \Appwrite\Models\Jwt $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -299,6 +304,7 @@ public function listLogs(?array $queries = null, ?bool $total = null): \Appwrite $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -336,6 +342,7 @@ public function updateMFA(bool $mfa): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -376,6 +383,7 @@ public function createMFAAuthenticator(AuthenticatorType $type): \Appwrite\Model $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -417,6 +425,7 @@ public function updateMFAAuthenticator(AuthenticatorType $type, string $otp): \A $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -489,6 +498,7 @@ public function createMFAChallenge(AuthenticationFactor $factor): \Appwrite\Mode $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -532,6 +542,7 @@ public function updateMFAChallenge(string $challengeId, string $otp): \Appwrite\ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -566,6 +577,7 @@ public function listMFAFactors(): \Appwrite\Models\MfaFactors $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -603,6 +615,7 @@ public function getMFARecoveryCodes(): \Appwrite\Models\MfaRecoveryCodes $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -642,6 +655,7 @@ public function createMFARecoveryCodes(): \Appwrite\Models\MfaRecoveryCodes $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -680,6 +694,7 @@ public function updateMFARecoveryCodes(): \Appwrite\Models\MfaRecoveryCodes $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -717,6 +732,7 @@ public function updateName(string $name): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -761,6 +777,7 @@ public function updatePassword(string $password, ?string $oldPassword = null): \ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -804,6 +821,7 @@ public function updatePhone(string $phone, string $password): \Appwrite\Models\U $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -838,6 +856,7 @@ public function getPrefs(): \Appwrite\Models\Preferences $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -877,6 +896,7 @@ public function updatePrefs(array $prefs): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -923,6 +943,7 @@ public function createRecovery(string $email, string $url): \Appwrite\Models\Tok $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -973,6 +994,7 @@ public function updateRecovery(string $userId, string $secret, string $password) $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -1008,6 +1030,7 @@ public function listSessions(): \Appwrite\Models\SessionList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1081,6 +1104,7 @@ public function createAnonymousSession(): \Appwrite\Models\Session $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1125,6 +1149,7 @@ public function createEmailPasswordSession(string $email, string $password): \Ap $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1169,6 +1194,7 @@ public function updateMagicURLSession(string $userId, string $secret): \Appwrite $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -1213,6 +1239,7 @@ public function updatePhoneSession(string $userId, string $secret): \Appwrite\Mo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -1254,6 +1281,7 @@ public function createSession(string $userId, string $secret): \Appwrite\Models\ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1291,6 +1319,7 @@ public function getSession(string $sessionId): \Appwrite\Models\Session $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1330,6 +1359,7 @@ public function updateSession(string $sessionId): \Appwrite\Models\Session $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1404,6 +1434,7 @@ public function updateStatus(): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1461,6 +1492,7 @@ public function createEmailToken(string $userId, string $email, ?bool $phrase = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1523,6 +1555,7 @@ public function createMagicURLToken(string $userId, string $email, ?string $url $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1587,6 +1620,7 @@ public function createOAuth2Token(OAuthProvider $provider, ?string $success = nu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'text/html'; $response = $this->client->call( Client::METHOD_GET, @@ -1631,6 +1665,7 @@ public function createPhoneToken(string $userId, string $phone): \Appwrite\Model $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1682,6 +1717,7 @@ public function createEmailVerification(string $url): \Appwrite\Models\Token $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1736,6 +1772,7 @@ public function createVerification(string $url): \Appwrite\Models\Token $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1778,6 +1815,7 @@ public function updateEmailVerification(string $userId, string $secret): \Appwri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -1823,6 +1861,7 @@ public function updateVerification(string $userId, string $secret): \Appwrite\Mo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -1865,6 +1904,7 @@ public function createPhoneVerification(): \Appwrite\Models\Token $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1907,6 +1947,7 @@ public function updatePhoneVerification(string $userId, string $secret): \Appwri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, diff --git a/src/Appwrite/Services/Activities.php b/src/Appwrite/Services/Activities.php index f9707ffa..9111586a 100644 --- a/src/Appwrite/Services/Activities.php +++ b/src/Appwrite/Services/Activities.php @@ -37,6 +37,7 @@ public function listEvents(?string $queries = null): \Appwrite\Models\ActivityEv $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -74,6 +75,7 @@ public function getEvent(string $eventId): \Appwrite\Models\ActivityEvent $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Advisor.php b/src/Appwrite/Services/Advisor.php index 9a4efda6..253a08d9 100644 --- a/src/Appwrite/Services/Advisor.php +++ b/src/Appwrite/Services/Advisor.php @@ -44,6 +44,7 @@ public function listReports(?array $queries = null, ?bool $total = null): \Appwr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -82,6 +83,7 @@ public function getReport(string $reportId): \Appwrite\Models\Report $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -165,6 +167,7 @@ public function listInsights(string $reportId, ?array $queries = null, ?bool $to $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -204,6 +207,7 @@ public function getInsight(string $reportId, string $insightId): \Appwrite\Model $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Avatars.php b/src/Appwrite/Services/Avatars.php index 667c7028..3417a6d0 100644 --- a/src/Appwrite/Services/Avatars.php +++ b/src/Appwrite/Services/Avatars.php @@ -65,6 +65,7 @@ public function getBrowser(Browser $code, ?int $width = null, ?int $height = nul $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/png'; $response = $this->client->call( Client::METHOD_GET, @@ -120,6 +121,7 @@ public function getCreditCard(CreditCard $code, ?int $width = null, ?int $height $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/png'; $response = $this->client->call( Client::METHOD_GET, @@ -155,6 +157,7 @@ public function getFavicon(string $url): string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/*'; $response = $this->client->call( Client::METHOD_GET, @@ -211,6 +214,7 @@ public function getFlag(Flag $code, ?int $width = null, ?int $height = null, ?in $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/png'; $response = $this->client->call( Client::METHOD_GET, @@ -263,6 +267,7 @@ public function getImage(string $url, ?int $width = null, ?int $height = null): $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/*'; $response = $this->client->call( Client::METHOD_GET, @@ -328,6 +333,7 @@ public function getInitials(?string $name = null, ?int $width = null, ?int $heig $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/png'; $response = $this->client->call( Client::METHOD_GET, @@ -377,6 +383,7 @@ public function getQR(string $text, ?int $size = null, ?int $margin = null, ?boo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/png'; $response = $this->client->call( Client::METHOD_GET, @@ -513,6 +520,7 @@ public function getScreenshot(string $url, ?array $headers = null, ?int $viewpor $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/png'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Backups.php b/src/Appwrite/Services/Backups.php index 10a5b54a..d490f2a3 100644 --- a/src/Appwrite/Services/Backups.php +++ b/src/Appwrite/Services/Backups.php @@ -38,6 +38,7 @@ public function listArchives(?array $queries = null): \Appwrite\Models\BackupArc $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -77,6 +78,7 @@ public function createArchive(array $services, ?string $resourceId = null): \App $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -113,6 +115,7 @@ public function getArchive(string $archiveId): \Appwrite\Models\BackupArchive $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -150,6 +153,7 @@ public function deleteArchive(string $archiveId): string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_DELETE, @@ -185,6 +189,7 @@ public function listPolicies(?array $queries = null): \Appwrite\Models\BackupPol $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -240,6 +245,7 @@ public function createPolicy(string $policyId, array $services, int $retention, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -276,6 +282,7 @@ public function getPolicy(string $policyId): \Appwrite\Models\BackupPolicy $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -324,6 +331,7 @@ public function updatePolicy(string $policyId, ?string $name = null, ?int $reten $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -361,6 +369,7 @@ public function deletePolicy(string $policyId): string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_DELETE, @@ -406,6 +415,7 @@ public function createRestoration(string $archiveId, array $services, ?string $n $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -445,6 +455,7 @@ public function listRestorations(?array $queries = null): \Appwrite\Models\Backu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -481,6 +492,7 @@ public function getRestoration(string $restorationId): \Appwrite\Models\BackupRe $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Databases.php b/src/Appwrite/Services/Databases.php index da23e4cb..a9e1e766 100644 --- a/src/Appwrite/Services/Databases.php +++ b/src/Appwrite/Services/Databases.php @@ -55,6 +55,7 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -103,6 +104,7 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -142,6 +144,7 @@ public function listTransactions(?array $queries = null): \Appwrite\Models\Trans $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -182,6 +185,7 @@ public function createTransaction(?int $ttl = null): \Appwrite\Models\Transactio $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -218,6 +222,7 @@ public function getTransaction(string $transactionId): \Appwrite\Models\Transact $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -265,6 +270,7 @@ public function updateTransaction(string $transactionId, ?bool $commit = null, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -340,6 +346,7 @@ public function createOperations(string $transactionId, ?array $operations = nul $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -380,6 +387,7 @@ public function get(string $databaseId): \Appwrite\Models\Database $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -430,6 +438,7 @@ public function update(string $databaseId, ?string $name = null, ?bool $enabled $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -522,6 +531,7 @@ public function listCollections(string $databaseId, ?array $queries = null, ?str $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -591,6 +601,7 @@ public function createCollection(string $databaseId, string $collectionId, strin $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -633,6 +644,7 @@ public function getCollection(string $databaseId, string $collectionId): \Appwri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -697,6 +709,7 @@ public function updateCollection(string $databaseId, string $collectionId, ?stri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -787,6 +800,7 @@ public function listAttributes(string $databaseId, string $collectionId, ?array $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -846,6 +860,7 @@ public function createBigIntAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -902,6 +917,7 @@ public function updateBigIntAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -956,6 +972,7 @@ public function createBooleanAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1007,6 +1024,7 @@ public function updateBooleanAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1060,6 +1078,7 @@ public function createDatetimeAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1111,6 +1130,7 @@ public function updateDatetimeAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1165,6 +1185,7 @@ public function createEmailAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1217,6 +1238,7 @@ public function updateEmailAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1274,6 +1296,7 @@ public function createEnumAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1328,6 +1351,7 @@ public function updateEnumAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1387,6 +1411,7 @@ public function createFloatAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1443,6 +1468,7 @@ public function updateFloatAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1502,6 +1528,7 @@ public function createIntegerAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1558,6 +1585,7 @@ public function updateIntegerAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1612,6 +1640,7 @@ public function createIpAttribute(string $databaseId, string $collectionId, stri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1664,6 +1693,7 @@ public function updateIpAttribute(string $databaseId, string $collectionId, stri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1712,6 +1742,7 @@ public function createLineAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1763,6 +1794,7 @@ public function updateLineAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1819,6 +1851,7 @@ public function createLongtextAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1868,6 +1901,7 @@ public function updateLongtextAttribute(string $databaseId, string $collectionId $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1924,6 +1958,7 @@ public function createMediumtextAttribute(string $databaseId, string $collection $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1973,6 +2008,7 @@ public function updateMediumtextAttribute(string $databaseId, string $collection $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2021,6 +2057,7 @@ public function createPointAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2072,6 +2109,7 @@ public function updatePointAttribute(string $databaseId, string $collectionId, s $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2120,6 +2158,7 @@ public function createPolygonAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2171,6 +2210,7 @@ public function updatePolygonAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2233,6 +2273,7 @@ public function createRelationshipAttribute(string $databaseId, string $collecti $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2286,6 +2327,7 @@ public function updateRelationshipAttribute(string $databaseId, string $collecti $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2347,6 +2389,7 @@ public function createStringAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2401,6 +2444,7 @@ public function updateStringAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2457,6 +2501,7 @@ public function createTextAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2506,6 +2551,7 @@ public function updateTextAttribute(string $databaseId, string $collectionId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2560,6 +2606,7 @@ public function createUrlAttribute(string $databaseId, string $collectionId, str $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2612,6 +2659,7 @@ public function updateUrlAttribute(string $databaseId, string $collectionId, str $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2670,6 +2718,7 @@ public function createVarcharAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2721,6 +2770,7 @@ public function updateVarcharAttribute(string $databaseId, string $collectionId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2764,6 +2814,7 @@ public function getAttribute(string $databaseId, string $collectionId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2906,6 +2957,7 @@ public function listDocuments(string $databaseId, string $collectionId, ?array $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2959,6 +3011,7 @@ public function createDocument(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -3008,6 +3061,7 @@ public function createDocuments(string $databaseId, string $collectionId, array $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -3058,6 +3112,7 @@ public function upsertDocuments(string $databaseId, string $collectionId, array $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -3114,6 +3169,7 @@ public function updateDocuments(string $databaseId, string $collectionId, ?array $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3159,11 +3215,15 @@ public function deleteDocuments(string $databaseId, string $collectionId, ?array if (!is_null($queries)) { $apiParams['queries'] = $queries; } - $apiParams['transactionId'] = $transactionId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_DELETE, @@ -3218,6 +3278,7 @@ public function getDocument(string $databaseId, string $collectionId, string $do $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -3274,6 +3335,7 @@ public function upsertDocument(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -3328,6 +3390,7 @@ public function updateDocument(string $databaseId, string $collectionId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3369,7 +3432,10 @@ public function deleteDocument(string $databaseId, string $collectionId, string $apiParams['databaseId'] = $databaseId; $apiParams['collectionId'] = $collectionId; $apiParams['documentId'] = $documentId; - $apiParams['transactionId'] = $transactionId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -3425,6 +3491,7 @@ public function decrementDocumentAttribute(string $databaseId, string $collectio $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3480,6 +3547,7 @@ public function incrementDocumentAttribute(string $databaseId, string $collectio $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3531,6 +3599,7 @@ public function listIndexes(string $databaseId, string $collectionId, ?array $qu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -3591,6 +3660,7 @@ public function createIndex(string $databaseId, string $collectionId, string $ke $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -3634,6 +3704,7 @@ public function getIndex(string $databaseId, string $collectionId, string $key): $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Functions.php b/src/Appwrite/Services/Functions.php index 59f006fe..21628d65 100644 --- a/src/Appwrite/Services/Functions.php +++ b/src/Appwrite/Services/Functions.php @@ -54,6 +54,7 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -193,6 +194,7 @@ public function create(string $functionId, string $name, Runtime $runtime, ?arra $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -227,6 +229,7 @@ public function listRuntimes(): \Appwrite\Models\RuntimeList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -261,6 +264,7 @@ public function listSpecifications(): \Appwrite\Models\SpecificationList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -297,6 +301,7 @@ public function get(string $functionId): \Appwrite\Models\FunctionModel $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -427,6 +432,7 @@ public function update(string $functionId, string $name, ?Runtime $runtime = nul $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -500,6 +506,7 @@ public function updateFunctionDeployment(string $functionId, string $deploymentI $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -552,6 +559,7 @@ public function listDeployments(string $functionId, ?array $queries = null, ?str $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -612,6 +620,7 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'multipart/form-data'; + $apiHeaders['accept'] = 'application/json'; $size = 0; $mimeType = null; $postedName = null; @@ -623,6 +632,7 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($code->getData()), $mimeType, $postedName); $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ], $apiParams); if (!is_array($response)) { throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); @@ -639,6 +649,7 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti $apiParams['code'] = new \CURLFile($code->getPath(), $mimeType, $postedName); $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ], $apiParams); if (!is_array($response)) { throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); @@ -653,8 +664,9 @@ public function createDeployment(string $functionId, InputFile $code, bool $acti $apiHeaders = [ - 'content-type' => 'multipart/form-data', 'X-Appwrite-Project' => $this->client->getConfig('project'), + 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ]; $handle = null; @@ -894,6 +906,7 @@ public function createDuplicateDeployment(string $functionId, string $deployment $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -950,6 +963,7 @@ public function createTemplateDeployment(string $functionId, string $repository, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -998,6 +1012,7 @@ public function createVcsDeployment(string $functionId, VCSReferenceType $type, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1036,6 +1051,7 @@ public function getDeployment(string $functionId, string $deploymentId): \Appwri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1116,6 +1132,7 @@ public function getDeploymentDownload(string $functionId, string $deploymentId, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = '*/*'; $response = $this->client->call( Client::METHOD_GET, @@ -1155,6 +1172,7 @@ public function updateDeploymentStatus(string $functionId, string $deploymentId) $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1202,6 +1220,7 @@ public function listExecutions(string $functionId, ?array $queries = null, ?bool $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1269,6 +1288,7 @@ public function createExecution(string $functionId, ?string $body = null, ?bool $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1307,6 +1327,7 @@ public function getExecution(string $functionId, string $executionId): \Appwrite $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1388,6 +1409,7 @@ public function listVariables(string $functionId, ?array $queries = null, ?bool $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1437,6 +1459,7 @@ public function createVariable(string $functionId, string $variableId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1475,6 +1498,7 @@ public function getVariable(string $functionId, string $variableId): \Appwrite\M $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1520,6 +1544,7 @@ public function updateVariable(string $functionId, string $variableId, ?string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, diff --git a/src/Appwrite/Services/Graphql.php b/src/Appwrite/Services/Graphql.php index 923eb0f3..7be9c5c6 100644 --- a/src/Appwrite/Services/Graphql.php +++ b/src/Appwrite/Services/Graphql.php @@ -36,6 +36,7 @@ public function query(array $query): array $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['x-sdk-graphql'] = 'true'; $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -70,6 +71,7 @@ public function mutation(array $query): array $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['x-sdk-graphql'] = 'true'; $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, diff --git a/src/Appwrite/Services/Health.php b/src/Appwrite/Services/Health.php index be9c94c0..66ea3ea9 100644 --- a/src/Appwrite/Services/Health.php +++ b/src/Appwrite/Services/Health.php @@ -33,6 +33,7 @@ public function get(): \Appwrite\Models\HealthStatus $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -67,6 +68,7 @@ public function getAntivirus(): \Appwrite\Models\HealthAntivirus $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -104,6 +106,7 @@ public function getAuditsDB(): \Appwrite\Models\HealthStatusList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -139,6 +142,7 @@ public function getCache(): \Appwrite\Models\HealthStatusList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -178,6 +182,7 @@ public function getCertificate(?string $domain = null): \Appwrite\Models\HealthC $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -224,6 +229,7 @@ public function getConsolePausing(?int $threshold = null, ?int $inactivityDays = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -258,6 +264,7 @@ public function getDB(): \Appwrite\Models\HealthStatusList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -292,6 +299,7 @@ public function getPubSub(): \Appwrite\Models\HealthStatusList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -333,6 +341,7 @@ public function getQueueAudits(?int $threshold = null): \Appwrite\Models\HealthQ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -373,6 +382,7 @@ public function getQueueBuilds(?int $threshold = null): \Appwrite\Models\HealthQ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -414,6 +424,7 @@ public function getQueueCertificates(?int $threshold = null): \Appwrite\Models\H $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -459,6 +470,7 @@ public function getQueueDatabases(?string $name = null, ?int $threshold = null): $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -499,6 +511,7 @@ public function getQueueDeletes(?int $threshold = null): \Appwrite\Models\Health $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -541,6 +554,7 @@ public function getFailedJobs(HealthQueueName $name, ?int $threshold = null): \A $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -581,6 +595,7 @@ public function getQueueFunctions(?int $threshold = null): \Appwrite\Models\Heal $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -621,6 +636,7 @@ public function getQueueLogs(?int $threshold = null): \Appwrite\Models\HealthQue $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -661,6 +677,7 @@ public function getQueueMails(?int $threshold = null): \Appwrite\Models\HealthQu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -701,6 +718,7 @@ public function getQueueMessaging(?int $threshold = null): \Appwrite\Models\Heal $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -741,6 +759,7 @@ public function getQueueMigrations(?int $threshold = null): \Appwrite\Models\Hea $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -781,6 +800,7 @@ public function getQueueStatsResources(?int $threshold = null): \Appwrite\Models $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -821,6 +841,7 @@ public function getQueueUsage(?int $threshold = null): \Appwrite\Models\HealthQu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -861,6 +882,7 @@ public function getQueueWebhooks(?int $threshold = null): \Appwrite\Models\Healt $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -895,6 +917,7 @@ public function getStorage(): \Appwrite\Models\HealthStatus $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -929,6 +952,7 @@ public function getStorageLocal(): \Appwrite\Models\HealthStatus $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -969,6 +993,7 @@ public function getTime(): \Appwrite\Models\HealthTime $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Locale.php b/src/Appwrite/Services/Locale.php index ef1e7479..a84457f7 100644 --- a/src/Appwrite/Services/Locale.php +++ b/src/Appwrite/Services/Locale.php @@ -37,6 +37,7 @@ public function get(): \Appwrite\Models\Locale $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -72,6 +73,7 @@ public function listCodes(): \Appwrite\Models\LocaleCodeList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -107,6 +109,7 @@ public function listContinents(): \Appwrite\Models\ContinentList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -142,6 +145,7 @@ public function listCountries(): \Appwrite\Models\CountryList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -177,6 +181,7 @@ public function listCountriesEU(): \Appwrite\Models\CountryList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -212,6 +217,7 @@ public function listCountriesPhones(): \Appwrite\Models\PhoneList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -248,6 +254,7 @@ public function listCurrencies(): \Appwrite\Models\CurrencyList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -283,6 +290,7 @@ public function listLanguages(): \Appwrite\Models\LanguageList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index 1536bbab..76801acf 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -49,6 +49,7 @@ public function listMessages(?array $queries = null, ?string $search = null, ?bo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -132,6 +133,7 @@ public function createEmail(string $messageId, string $subject, string $content, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -194,6 +196,7 @@ public function updateEmail(string $messageId, ?array $topics = null, ?array $us $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -315,6 +318,7 @@ public function createPush(string $messageId, ?string $title = null, ?string $bo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -391,6 +395,7 @@ public function updatePush(string $messageId, ?array $topics = null, ?array $use $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -452,6 +457,7 @@ public function createSMS(string $messageId, string $content, ?array $topics = n $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -504,6 +510,7 @@ public function updateSMS(string $messageId, ?array $topics = null, ?array $user $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -541,6 +548,7 @@ public function getMessage(string $messageId): \Appwrite\Models\Message $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -621,6 +629,7 @@ public function listMessageLogs(string $messageId, ?array $queries = null, ?bool $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -667,6 +676,7 @@ public function listTargets(string $messageId, ?array $queries = null, ?bool $to $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -716,6 +726,7 @@ public function listProviders(?array $queries = null, ?string $search = null, ?b $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -782,6 +793,7 @@ public function createAPNSProvider(string $providerId, string $name, ?string $au $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -848,6 +860,7 @@ public function updateAPNSProvider(string $providerId, ?string $name = null, ?bo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -891,6 +904,7 @@ public function createFCMProvider(string $providerId, string $name, ?array $serv $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -937,6 +951,7 @@ public function updateFCMProvider(string $providerId, ?string $name = null, ?boo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1010,6 +1025,7 @@ public function createMailgunProvider(string $providerId, string $name, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1086,6 +1102,7 @@ public function updateMailgunProvider(string $providerId, ?string $name = null, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1142,6 +1159,7 @@ public function createMsg91Provider(string $providerId, string $name, ?string $t $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1201,6 +1219,7 @@ public function updateMsg91Provider(string $providerId, ?string $name = null, ?b $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1267,6 +1286,7 @@ public function createResendProvider(string $providerId, string $name, ?string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1336,6 +1356,7 @@ public function updateResendProvider(string $providerId, ?string $name = null, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1402,6 +1423,7 @@ public function createSendgridProvider(string $providerId, string $name, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1471,6 +1493,7 @@ public function updateSendgridProvider(string $providerId, ?string $name = null, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1547,6 +1570,7 @@ public function createSesProvider(string $providerId, string $name, ?string $acc $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1626,6 +1650,7 @@ public function updateSesProvider(string $providerId, ?string $name = null, ?boo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1719,6 +1744,7 @@ public function createSMTPProvider(string $providerId, string $name, string $hos $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1812,6 +1838,7 @@ public function updateSMTPProvider(string $providerId, ?string $name = null, ?st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1868,6 +1895,7 @@ public function createTelesignProvider(string $providerId, string $name, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1927,6 +1955,7 @@ public function updateTelesignProvider(string $providerId, ?string $name = null, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1983,6 +2012,7 @@ public function createTextmagicProvider(string $providerId, string $name, ?strin $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2042,6 +2072,7 @@ public function updateTextmagicProvider(string $providerId, ?string $name = null $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2098,6 +2129,7 @@ public function createTwilioProvider(string $providerId, string $name, ?string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2157,6 +2189,7 @@ public function updateTwilioProvider(string $providerId, ?string $name = null, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2213,6 +2246,7 @@ public function createVonageProvider(string $providerId, string $name, ?string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2272,6 +2306,7 @@ public function updateVonageProvider(string $providerId, ?string $name = null, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2309,6 +2344,7 @@ public function getProvider(string $providerId): \Appwrite\Models\Provider $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2388,6 +2424,7 @@ public function listProviderLogs(string $providerId, ?array $queries = null, ?bo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2434,6 +2471,7 @@ public function listSubscriberLogs(string $subscriberId, ?array $queries = null, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2483,6 +2521,7 @@ public function listTopics(?array $queries = null, ?string $search = null, ?bool $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2527,6 +2566,7 @@ public function createTopic(string $topicId, string $name, ?array $subscribe = n $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2564,6 +2604,7 @@ public function getTopic(string $topicId): \Appwrite\Models\Topic $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2606,6 +2647,7 @@ public function updateTopic(string $topicId, ?string $name = null, ?array $subsc $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2685,6 +2727,7 @@ public function listTopicLogs(string $topicId, ?array $queries = null, ?bool $to $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2736,6 +2779,7 @@ public function listSubscribers(string $topicId, ?array $queries = null, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2777,6 +2821,7 @@ public function createSubscriber(string $topicId, string $subscriberId, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2816,6 +2861,7 @@ public function getSubscriber(string $topicId, string $subscriberId): \Appwrite\ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Organization.php b/src/Appwrite/Services/Organization.php index c4971bc5..d99efb5b 100644 --- a/src/Appwrite/Services/Organization.php +++ b/src/Appwrite/Services/Organization.php @@ -44,6 +44,7 @@ public function listKeys(?array $queries = null, ?bool $total = null): \Appwrite $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -87,6 +88,7 @@ public function createKey(string $keyId, string $name, array $scopes, ?string $e $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -124,6 +126,7 @@ public function getKey(string $keyId): \Appwrite\Models\Key $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -168,6 +171,7 @@ public function updateKey(string $keyId, string $name, array $scopes, ?string $e $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -252,6 +256,7 @@ public function listProjects(?array $queries = null, ?string $search = null, ?bo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -296,6 +301,7 @@ public function createProject(string $projectId, string $name, ?Region $region = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -371,6 +377,7 @@ public function updateProject(string $projectId, string $name): \Appwrite\Models $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, diff --git a/src/Appwrite/Services/Presences.php b/src/Appwrite/Services/Presences.php index 54be3e45..f4f09e42 100644 --- a/src/Appwrite/Services/Presences.php +++ b/src/Appwrite/Services/Presences.php @@ -48,6 +48,7 @@ public function list(?array $queries = null, ?bool $total = null, ?int $ttl = nu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -86,6 +87,7 @@ public function get(string $presenceId): \Appwrite\Models\Presence $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -143,6 +145,7 @@ public function upsert(string $presenceId, string $userId, string $status, ?arra $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -209,6 +212,7 @@ public function update(string $presenceId, string $userId, ?string $status = nul $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, diff --git a/src/Appwrite/Services/Project.php b/src/Appwrite/Services/Project.php index 6fa64456..5e3ba5ac 100644 --- a/src/Appwrite/Services/Project.php +++ b/src/Appwrite/Services/Project.php @@ -113,6 +113,7 @@ public function updateAuthMethod(ProjectAuthMethodId $methodId, bool $enabled): $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -157,6 +158,7 @@ public function listKeys(?array $queries = null, ?bool $total = null): \Appwrite $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -204,6 +206,7 @@ public function createKey(string $keyId, string $name, array $scopes, ?string $e $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -247,6 +250,7 @@ public function createEphemeralKey(array $scopes, int $duration): \Appwrite\Mode $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -283,6 +287,7 @@ public function getKey(string $keyId): \Appwrite\Models\Key $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -327,6 +332,7 @@ public function updateKey(string $keyId, string $name, array $scopes, ?string $e $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -399,6 +405,7 @@ public function updateLabels(array $labels): \Appwrite\Models\Project $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -444,6 +451,7 @@ public function listMockPhones(?array $queries = null, ?bool $total = null): \Ap $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -484,6 +492,7 @@ public function createMockPhone(string $number, string $otp): \Appwrite\Models\M $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -521,6 +530,7 @@ public function getMockPhone(string $number): \Appwrite\Models\MockNumber $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -561,6 +571,7 @@ public function updateMockPhone(string $number, string $otp): \Appwrite\Models\M $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -641,6 +652,7 @@ public function listOAuth2Providers(?array $queries = null, ?bool $total = null) $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -663,15 +675,20 @@ public function listOAuth2Providers(?array $queries = null, ?bool $total = null) * @param bool $enabled * @param string $authorizationUrl * @param ?array $scopes + * @param ?array $authorizationDetailsTypes * @param ?int $accessTokenDuration * @param ?int $refreshTokenDuration * @param ?int $publicAccessTokenDuration * @param ?int $publicRefreshTokenDuration * @param ?bool $confidentialPkce + * @param ?string $verificationUrl + * @param ?int $userCodeLength + * @param ?string $userCodeFormat + * @param ?int $deviceCodeDuration * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateOAuth2Server(bool $enabled, string $authorizationUrl, ?array $scopes = null, ?int $accessTokenDuration = null, ?int $refreshTokenDuration = null, ?int $publicAccessTokenDuration = null, ?int $publicRefreshTokenDuration = null, ?bool $confidentialPkce = null): \Appwrite\Models\Project + public function updateOAuth2Server(bool $enabled, string $authorizationUrl, ?array $scopes = null, ?array $authorizationDetailsTypes = null, ?int $accessTokenDuration = null, ?int $refreshTokenDuration = null, ?int $publicAccessTokenDuration = null, ?int $publicRefreshTokenDuration = null, ?bool $confidentialPkce = null, ?string $verificationUrl = null, ?int $userCodeLength = null, ?string $userCodeFormat = null, ?int $deviceCodeDuration = null): \Appwrite\Models\Project { $apiPath = str_replace( [], @@ -686,15 +703,30 @@ public function updateOAuth2Server(bool $enabled, string $authorizationUrl, ?arr if (!is_null($scopes)) { $apiParams['scopes'] = $scopes; } + + if (!is_null($authorizationDetailsTypes)) { + $apiParams['authorizationDetailsTypes'] = $authorizationDetailsTypes; + } $apiParams['accessTokenDuration'] = $accessTokenDuration; $apiParams['refreshTokenDuration'] = $refreshTokenDuration; $apiParams['publicAccessTokenDuration'] = $publicAccessTokenDuration; $apiParams['publicRefreshTokenDuration'] = $publicRefreshTokenDuration; $apiParams['confidentialPkce'] = $confidentialPkce; + if (!is_null($verificationUrl)) { + $apiParams['verificationUrl'] = $verificationUrl; + } + $apiParams['userCodeLength'] = $userCodeLength; + + if (!is_null($userCodeFormat)) { + $apiParams['userCodeFormat'] = $userCodeFormat; + } + $apiParams['deviceCodeDuration'] = $deviceCodeDuration; + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -736,6 +768,7 @@ public function updateOAuth2Amazon(?string $clientId = null, ?string $clientSecr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -781,6 +814,7 @@ public function updateOAuth2Apple(?string $serviceId = null, ?string $keyId = nu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -824,6 +858,7 @@ public function updateOAuth2Auth0(?string $clientId = null, ?string $clientSecre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -867,6 +902,7 @@ public function updateOAuth2Authentik(?string $clientId = null, ?string $clientS $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -908,6 +944,7 @@ public function updateOAuth2Autodesk(?string $clientId = null, ?string $clientSe $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -949,6 +986,7 @@ public function updateOAuth2Bitbucket(?string $key = null, ?string $secret = nul $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -990,6 +1028,7 @@ public function updateOAuth2Bitly(?string $clientId = null, ?string $clientSecre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1031,6 +1070,7 @@ public function updateOAuth2Box(?string $clientId = null, ?string $clientSecret $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1072,6 +1112,7 @@ public function updateOAuth2Dailymotion(?string $apiKey = null, ?string $apiSecr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1113,6 +1154,7 @@ public function updateOAuth2Discord(?string $clientId = null, ?string $clientSec $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1154,6 +1196,7 @@ public function updateOAuth2Disqus(?string $publicKey = null, ?string $secretKey $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1195,6 +1238,7 @@ public function updateOAuth2Dropbox(?string $appKey = null, ?string $appSecret = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1236,6 +1280,7 @@ public function updateOAuth2Etsy(?string $keyString = null, ?string $sharedSecre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1277,6 +1322,7 @@ public function updateOAuth2Facebook(?string $appId = null, ?string $appSecret = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1318,6 +1364,7 @@ public function updateOAuth2Figma(?string $clientId = null, ?string $clientSecre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1361,6 +1408,7 @@ public function updateOAuth2FusionAuth(?string $clientId = null, ?string $client $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1402,6 +1450,7 @@ public function updateOAuth2GitHub(?string $clientId = null, ?string $clientSecr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1445,6 +1494,7 @@ public function updateOAuth2Gitlab(?string $applicationId = null, ?string $secre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1488,6 +1538,7 @@ public function updateOAuth2Google(?string $clientId = null, ?string $clientSecr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1533,6 +1584,7 @@ public function updateOAuth2Keycloak(?string $clientId = null, ?string $clientSe $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1574,6 +1626,7 @@ public function updateOAuth2Kick(?string $clientId = null, ?string $clientSecret $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1615,6 +1668,7 @@ public function updateOAuth2Linkedin(?string $clientId = null, ?string $primaryC $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1658,6 +1712,7 @@ public function updateOAuth2Microsoft(?string $applicationId = null, ?string $ap $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1699,6 +1754,7 @@ public function updateOAuth2Notion(?string $oauthClientId = null, ?string $oauth $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1748,6 +1804,7 @@ public function updateOAuth2Oidc(?string $clientId = null, ?string $clientSecret $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1793,6 +1850,7 @@ public function updateOAuth2Okta(?string $clientId = null, ?string $clientSecret $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1834,6 +1892,7 @@ public function updateOAuth2Paypal(?string $clientId = null, ?string $secretKey $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1875,6 +1934,7 @@ public function updateOAuth2PaypalSandbox(?string $clientId = null, ?string $sec $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1916,6 +1976,7 @@ public function updateOAuth2Podio(?string $clientId = null, ?string $clientSecre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1957,6 +2018,7 @@ public function updateOAuth2Salesforce(?string $customerKey = null, ?string $cus $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1998,6 +2060,7 @@ public function updateOAuth2Slack(?string $clientId = null, ?string $clientSecre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2039,6 +2102,7 @@ public function updateOAuth2Spotify(?string $clientId = null, ?string $clientSec $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2080,6 +2144,7 @@ public function updateOAuth2Stripe(?string $clientId = null, ?string $apiSecretK $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2121,6 +2186,7 @@ public function updateOAuth2Tradeshift(?string $oauth2ClientId = null, ?string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2162,6 +2228,7 @@ public function updateOAuth2TradeshiftSandbox(?string $oauth2ClientId = null, ?s $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2203,6 +2270,7 @@ public function updateOAuth2Twitch(?string $clientId = null, ?string $clientSecr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2244,6 +2312,7 @@ public function updateOAuth2WordPress(?string $clientId = null, ?string $clientS $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2285,6 +2354,7 @@ public function updateOAuth2X(?string $customerKey = null, ?string $secretKey = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2326,6 +2396,7 @@ public function updateOAuth2Yahoo(?string $clientId = null, ?string $clientSecre $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2367,6 +2438,7 @@ public function updateOAuth2Yandex(?string $clientId = null, ?string $clientSecr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2408,6 +2480,7 @@ public function updateOAuth2Zoho(?string $clientId = null, ?string $clientSecret $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2449,6 +2522,7 @@ public function updateOAuth2Zoom(?string $clientId = null, ?string $clientSecret $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2486,6 +2560,7 @@ public function getOAuth2Provider(ProjectOAuthProviderId $providerId): \Appwrite $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2691,6 +2766,7 @@ public function listPlatforms(?array $queries = null, ?bool $total = null): \App $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2734,6 +2810,7 @@ public function createAndroidPlatform(string $platformId, string $name, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2776,6 +2853,7 @@ public function updateAndroidPlatform(string $platformId, string $name, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -2819,6 +2897,7 @@ public function createApplePlatform(string $platformId, string $name, string $bu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2861,6 +2940,7 @@ public function updateApplePlatform(string $platformId, string $name, string $bu $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -2904,6 +2984,7 @@ public function createLinuxPlatform(string $platformId, string $name, string $pa $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2946,6 +3027,7 @@ public function updateLinuxPlatform(string $platformId, string $name, string $pa $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -2989,6 +3071,7 @@ public function createWebPlatform(string $platformId, string $name, string $host $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -3031,6 +3114,7 @@ public function updateWebPlatform(string $platformId, string $name, string $host $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -3074,6 +3158,7 @@ public function createWindowsPlatform(string $platformId, string $name, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -3116,6 +3201,7 @@ public function updateWindowsPlatform(string $platformId, string $name, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -3153,6 +3239,7 @@ public function getPlatform(string $platformId): \Appwrite\Models\PlatformWeb|\A $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -3251,6 +3338,7 @@ public function listPolicies(?array $queries = null, ?bool $total = null): \Appw $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -3289,6 +3377,46 @@ public function updateDenyAliasedEmailPolicy(bool $enabled): \Appwrite\Models\Pr $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; + + $response = $this->client->call( + Client::METHOD_PATCH, + $apiPath, + $apiHeaders, + $apiParams + ); + + if (!is_array($response)) { + throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); + } + + return \Appwrite\Models\Project::from($response); + + } + + /** + * Configures if only corporate email addresses (non-free and non-disposable + * domains) are allowed during new user sign-ups and email updates. + * + * @param bool $enabled + * @throws AppwriteException + * @return \Appwrite\Models\Project + */ + public function updateDenyCorporateEmailPolicy(bool $enabled): \Appwrite\Models\Project + { + $apiPath = str_replace( + [], + [], + '/project/policies/deny-corporate-email' + ); + + $apiParams = []; + $apiParams['enabled'] = $enabled; + + $apiHeaders = []; + $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3327,6 +3455,7 @@ public function updateDenyDisposableEmailPolicy(bool $enabled): \Appwrite\Models $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3365,6 +3494,7 @@ public function updateDenyFreeEmailPolicy(bool $enabled): \Appwrite\Models\Proje $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3391,10 +3521,11 @@ public function updateDenyFreeEmailPolicy(bool $enabled): \Appwrite\Models\Proje * @param ?bool $userPhone * @param ?bool $userName * @param ?bool $userMFA + * @param ?bool $userAccessedAt * @throws AppwriteException * @return \Appwrite\Models\Project */ - public function updateMembershipPrivacyPolicy(?bool $userId = null, ?bool $userEmail = null, ?bool $userPhone = null, ?bool $userName = null, ?bool $userMFA = null): \Appwrite\Models\Project + public function updateMembershipPrivacyPolicy(?bool $userId = null, ?bool $userEmail = null, ?bool $userPhone = null, ?bool $userName = null, ?bool $userMFA = null, ?bool $userAccessedAt = null): \Appwrite\Models\Project { $apiPath = str_replace( [], @@ -3424,9 +3555,14 @@ public function updateMembershipPrivacyPolicy(?bool $userId = null, ?bool $userE $apiParams['userMFA'] = $userMFA; } + if (!is_null($userAccessedAt)) { + $apiParams['userAccessedAt'] = $userAccessedAt; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3466,6 +3602,7 @@ public function updatePasswordDictionaryPolicy(bool $enabled): \Appwrite\Models\ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3511,6 +3648,7 @@ public function updatePasswordHistoryPolicy(?int $total): \Appwrite\Models\Proje $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3551,6 +3689,7 @@ public function updatePasswordPersonalDataPolicy(bool $enabled): \Appwrite\Model $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3611,6 +3750,7 @@ public function updatePasswordStrengthPolicy(?int $min = null, ?bool $uppercase $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3652,6 +3792,7 @@ public function updateSessionAlertPolicy(bool $enabled): \Appwrite\Models\Projec $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3690,6 +3831,7 @@ public function updateSessionDurationPolicy(int $duration): \Appwrite\Models\Pro $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3729,6 +3871,7 @@ public function updateSessionInvalidationPolicy(bool $enabled): \Appwrite\Models $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3767,6 +3910,7 @@ public function updateSessionLimitPolicy(?int $total): \Appwrite\Models\Project $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3806,6 +3950,7 @@ public function updateUserLimitPolicy(?int $total): \Appwrite\Models\Project $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3828,9 +3973,9 @@ public function updateUserLimitPolicy(?int $total): \Appwrite\Models\Project * * @param ProjectPolicyId $policyId * @throws AppwriteException - * @return \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordStrength|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy|\Appwrite\Models\PolicyDenyAliasedEmail|\Appwrite\Models\PolicyDenyDisposableEmail|\Appwrite\Models\PolicyDenyFreeEmail + * @return \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordStrength|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy|\Appwrite\Models\PolicyDenyAliasedEmail|\Appwrite\Models\PolicyDenyDisposableEmail|\Appwrite\Models\PolicyDenyFreeEmail|\Appwrite\Models\PolicyDenyCorporateEmail */ - public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordStrength|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy|\Appwrite\Models\PolicyDenyAliasedEmail|\Appwrite\Models\PolicyDenyDisposableEmail|\Appwrite\Models\PolicyDenyFreeEmail + public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPasswordDictionary|\Appwrite\Models\PolicyPasswordHistory|\Appwrite\Models\PolicyPasswordStrength|\Appwrite\Models\PolicyPasswordPersonalData|\Appwrite\Models\PolicySessionAlert|\Appwrite\Models\PolicySessionDuration|\Appwrite\Models\PolicySessionInvalidation|\Appwrite\Models\PolicySessionLimit|\Appwrite\Models\PolicyUserLimit|\Appwrite\Models\PolicyMembershipPrivacy|\Appwrite\Models\PolicyDenyAliasedEmail|\Appwrite\Models\PolicyDenyDisposableEmail|\Appwrite\Models\PolicyDenyFreeEmail|\Appwrite\Models\PolicyDenyCorporateEmail { $apiPath = str_replace( ['{policyId}'], @@ -3843,6 +3988,7 @@ public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPas $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -3907,6 +4053,10 @@ public function getPolicy(ProjectPolicyId $policyId): \Appwrite\Models\PolicyPas return \Appwrite\Models\PolicyDenyFreeEmail::from($response); } + if (($response['$id'] ?? null) === 'deny-corporate-email') { + return \Appwrite\Models\PolicyDenyCorporateEmail::from($response); + } + throw new \UnexpectedValueException('Unable to match response to any expected response model.'); } @@ -3935,6 +4085,7 @@ public function updateProtocol(ProjectProtocolId $protocolId, bool $enabled): \A $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3975,6 +4126,7 @@ public function updateService(ProjectServiceId $serviceId, bool $enabled): \Appw $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -4032,6 +4184,7 @@ public function updateSMTP(?string $host = null, ?int $port = null, ?string $use $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -4111,6 +4264,7 @@ public function listEmailTemplates(?array $queries = null, ?bool $total = null): $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -4166,6 +4320,7 @@ public function updateEmailTemplate(ProjectEmailTemplateId $templateId, ?Project $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -4209,6 +4364,7 @@ public function getEmailTemplate(ProjectEmailTemplateId $templateId, ?ProjectEma $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -4253,6 +4409,7 @@ public function listVariables(?array $queries = null, ?bool $total = null): \App $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -4300,6 +4457,7 @@ public function createVariable(string $variableId, string $key, string $value, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -4336,6 +4494,7 @@ public function getVariable(string $variableId): \Appwrite\Models\Variable $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -4379,6 +4538,7 @@ public function updateVariable(string $variableId, ?string $key = null, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, diff --git a/src/Appwrite/Services/Proxy.php b/src/Appwrite/Services/Proxy.php index 5102dd02..074f7fa9 100644 --- a/src/Appwrite/Services/Proxy.php +++ b/src/Appwrite/Services/Proxy.php @@ -45,6 +45,7 @@ public function listRules(?array $queries = null, ?bool $total = null): \Appwrit $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -85,6 +86,7 @@ public function createAPIRule(string $domain): \Appwrite\Models\ProxyRule $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -132,6 +134,7 @@ public function createFunctionRule(string $domain, string $functionId, ?string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -181,6 +184,7 @@ public function createRedirectRule(string $domain, string $url, StatusCode $stat $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -228,6 +232,7 @@ public function createSiteRule(string $domain, string $siteId, ?string $branch = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -264,6 +269,7 @@ public function getRule(string $ruleId): \Appwrite\Models\ProxyRule $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -337,6 +343,7 @@ public function updateRuleStatus(string $ruleId): \Appwrite\Models\ProxyRule $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, diff --git a/src/Appwrite/Services/Sites.php b/src/Appwrite/Services/Sites.php index 9a30f359..6c2c25e3 100644 --- a/src/Appwrite/Services/Sites.php +++ b/src/Appwrite/Services/Sites.php @@ -54,6 +54,7 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -192,6 +193,7 @@ public function create(string $siteId, string $name, Framework $framework, Build $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -227,6 +229,7 @@ public function listFrameworks(): \Appwrite\Models\FrameworkList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -261,6 +264,7 @@ public function listSpecifications(): \Appwrite\Models\SpecificationList $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -297,6 +301,7 @@ public function get(string $siteId): \Appwrite\Models\Site $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -432,6 +437,7 @@ public function update(string $siteId, string $name, Framework $framework, ?bool $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -505,6 +511,7 @@ public function updateSiteDeployment(string $siteId, string $deploymentId): \App $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -557,6 +564,7 @@ public function listDeployments(string $siteId, ?array $queries = null, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -618,6 +626,7 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'multipart/form-data'; + $apiHeaders['accept'] = 'application/json'; $size = 0; $mimeType = null; $postedName = null; @@ -629,6 +638,7 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta $apiParams['code'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($code->getData()), $mimeType, $postedName); $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ], $apiParams); if (!is_array($response)) { throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); @@ -645,6 +655,7 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta $apiParams['code'] = new \CURLFile($code->getPath(), $mimeType, $postedName); $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ], $apiParams); if (!is_array($response)) { throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); @@ -659,8 +670,9 @@ public function createDeployment(string $siteId, InputFile $code, ?string $insta $apiHeaders = [ - 'content-type' => 'multipart/form-data', 'X-Appwrite-Project' => $this->client->getConfig('project'), + 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ]; $handle = null; @@ -895,6 +907,7 @@ public function createDuplicateDeployment(string $siteId, string $deploymentId): $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -951,6 +964,7 @@ public function createTemplateDeployment(string $siteId, string $repository, str $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -999,6 +1013,7 @@ public function createVcsDeployment(string $siteId, VCSReferenceType $type, stri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1037,6 +1052,7 @@ public function getDeployment(string $siteId, string $deploymentId): \Appwrite\M $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1117,6 +1133,7 @@ public function getDeploymentDownload(string $siteId, string $deploymentId, ?Dep $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = '*/*'; $response = $this->client->call( Client::METHOD_GET, @@ -1156,6 +1173,7 @@ public function updateDeploymentStatus(string $siteId, string $deploymentId): \A $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1203,6 +1221,7 @@ public function listLogs(string $siteId, ?array $queries = null, ?bool $total = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1241,6 +1260,7 @@ public function getLog(string $siteId, string $logId): \Appwrite\Models\Executio $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1280,6 +1300,7 @@ public function deleteLog(string $siteId, string $logId): string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_DELETE, @@ -1322,6 +1343,7 @@ public function listVariables(string $siteId, ?array $queries = null, ?bool $tot $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1371,6 +1393,7 @@ public function createVariable(string $siteId, string $variableId, string $key, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1409,6 +1432,7 @@ public function getVariable(string $siteId, string $variableId): \Appwrite\Model $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1454,6 +1478,7 @@ public function updateVariable(string $siteId, string $variableId, ?string $key $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, diff --git a/src/Appwrite/Services/Storage.php b/src/Appwrite/Services/Storage.php index 7ab142dc..b71fff62 100644 --- a/src/Appwrite/Services/Storage.php +++ b/src/Appwrite/Services/Storage.php @@ -51,6 +51,7 @@ public function listBuckets(?array $queries = null, ?string $search = null, ?boo $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -132,6 +133,7 @@ public function createBucket(string $bucketId, string $name, ?array $permissions $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -169,6 +171,7 @@ public function getBucket(string $bucketId): \Appwrite\Models\Bucket $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -250,6 +253,7 @@ public function updateBucket(string $bucketId, string $name, ?array $permissions $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -335,6 +339,7 @@ public function listFiles(string $bucketId, ?array $queries = null, ?string $sea $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -398,6 +403,7 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'multipart/form-data'; + $apiHeaders['accept'] = 'application/json'; $size = 0; $mimeType = null; $postedName = null; @@ -409,6 +415,7 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a $apiParams['file'] = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode($file->getData()), $mimeType, $postedName); $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ], $apiParams); if (!is_array($response)) { throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); @@ -425,6 +432,7 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a $apiParams['file'] = new \CURLFile($file->getPath(), $mimeType, $postedName); $response = $this->client->call(Client::METHOD_POST, $apiPath, [ 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ], $apiParams); if (!is_array($response)) { throw new \UnexpectedValueException('Expected array response when hydrating a response model.'); @@ -444,8 +452,9 @@ public function createFile(string $bucketId, string $fileId, InputFile $file, ?a } $apiHeaders = [ - 'content-type' => 'multipart/form-data', 'X-Appwrite-Project' => $this->client->getConfig('project'), + 'content-type' => 'multipart/form-data', + 'accept' => 'application/json', ]; $handle = null; @@ -677,6 +686,7 @@ public function getFile(string $bucketId, string $fileId): \Appwrite\Models\File $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -724,6 +734,7 @@ public function updateFile(string $bucketId, string $fileId, ?string $name = nul $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -805,6 +816,7 @@ public function getFileDownload(string $bucketId, string $fileId, ?string $token $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = '*/*'; $response = $this->client->call( Client::METHOD_GET, @@ -903,6 +915,7 @@ public function getFilePreview(string $bucketId, string $fileId, ?int $width = n $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'image/*'; $response = $this->client->call( Client::METHOD_GET, @@ -944,6 +957,7 @@ public function getFileView(string $bucketId, string $fileId, ?string $token = n $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = '*/*'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/TablesDB.php b/src/Appwrite/Services/TablesDB.php index 1403ed52..4834e5f2 100644 --- a/src/Appwrite/Services/TablesDB.php +++ b/src/Appwrite/Services/TablesDB.php @@ -52,6 +52,7 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -75,10 +76,11 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota * @param string $databaseId * @param string $name * @param ?bool $enabled + * @param ?string $dedicatedDatabaseId * @throws AppwriteException * @return \Appwrite\Models\Database */ - public function create(string $databaseId, string $name, ?bool $enabled = null): \Appwrite\Models\Database + public function create(string $databaseId, string $name, ?bool $enabled = null, ?string $dedicatedDatabaseId = null): \Appwrite\Models\Database { $apiPath = str_replace( [], @@ -94,9 +96,14 @@ public function create(string $databaseId, string $name, ?bool $enabled = null): $apiParams['enabled'] = $enabled; } + if (!is_null($dedicatedDatabaseId)) { + $apiParams['dedicatedDatabaseId'] = $dedicatedDatabaseId; + } + $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -136,6 +143,7 @@ public function listTransactions(?array $queries = null): \Appwrite\Models\Trans $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -176,6 +184,7 @@ public function createTransaction(?int $ttl = null): \Appwrite\Models\Transactio $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -212,6 +221,7 @@ public function getTransaction(string $transactionId): \Appwrite\Models\Transact $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -259,6 +269,7 @@ public function updateTransaction(string $transactionId, ?bool $commit = null, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -334,6 +345,7 @@ public function createOperations(string $transactionId, ?array $operations = nul $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -371,6 +383,7 @@ public function get(string $databaseId): \Appwrite\Models\Database $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -418,6 +431,7 @@ public function update(string $databaseId, ?string $name = null, ?bool $enabled $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -504,6 +518,7 @@ public function listTables(string $databaseId, ?array $queries = null, ?string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -570,6 +585,7 @@ public function createTable(string $databaseId, string $tableId, string $name, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -609,6 +625,7 @@ public function getTable(string $databaseId, string $tableId): \Appwrite\Models\ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -670,6 +687,7 @@ public function updateTable(string $databaseId, string $tableId, ?string $name = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -754,6 +772,7 @@ public function listColumns(string $databaseId, string $tableId, ?array $queries $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -810,6 +829,7 @@ public function createBigIntColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -863,6 +883,7 @@ public function updateBigIntColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -914,6 +935,7 @@ public function createBooleanColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -962,6 +984,7 @@ public function updateBooleanColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1012,6 +1035,7 @@ public function createDatetimeColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1060,6 +1084,7 @@ public function updateDatetimeColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1111,6 +1136,7 @@ public function createEmailColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1160,6 +1186,7 @@ public function updateEmailColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1213,6 +1240,7 @@ public function createEnumColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1264,6 +1292,7 @@ public function updateEnumColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1320,6 +1349,7 @@ public function createFloatColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1373,6 +1403,7 @@ public function updateFloatColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1429,6 +1460,7 @@ public function createIntegerColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1482,6 +1514,7 @@ public function updateIntegerColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1533,6 +1566,7 @@ public function createIpColumn(string $databaseId, string $tableId, string $key, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1582,6 +1616,7 @@ public function updateIpColumn(string $databaseId, string $tableId, string $key, $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1627,6 +1662,7 @@ public function createLineColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1675,6 +1711,7 @@ public function updateLineColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1731,6 +1768,7 @@ public function createLongtextColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1780,6 +1818,7 @@ public function updateLongtextColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1836,6 +1875,7 @@ public function createMediumtextColumn(string $databaseId, string $tableId, stri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1885,6 +1925,7 @@ public function updateMediumtextColumn(string $databaseId, string $tableId, stri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1930,6 +1971,7 @@ public function createPointColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1978,6 +2020,7 @@ public function updatePointColumn(string $databaseId, string $tableId, string $k $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2023,6 +2066,7 @@ public function createPolygonColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2071,6 +2115,7 @@ public function updatePolygonColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2130,6 +2175,7 @@ public function createRelationshipColumn(string $databaseId, string $tableId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2191,6 +2237,7 @@ public function createStringColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2245,6 +2292,7 @@ public function updateStringColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2301,6 +2349,7 @@ public function createTextColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2350,6 +2399,7 @@ public function updateTextColumn(string $databaseId, string $tableId, string $ke $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2401,6 +2451,7 @@ public function createUrlColumn(string $databaseId, string $tableId, string $key $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2450,6 +2501,7 @@ public function updateUrlColumn(string $databaseId, string $tableId, string $key $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2508,6 +2560,7 @@ public function createVarcharColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2559,6 +2612,7 @@ public function updateVarcharColumn(string $databaseId, string $tableId, string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2599,6 +2653,7 @@ public function getColumn(string $databaseId, string $tableId, string $key): \Ap $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2723,6 +2778,7 @@ public function updateRelationshipColumn(string $databaseId, string $tableId, st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -2771,6 +2827,7 @@ public function listIndexes(string $databaseId, string $tableId, ?array $queries $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2828,6 +2885,7 @@ public function createIndex(string $databaseId, string $tableId, string $key, Ta $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -2868,6 +2926,7 @@ public function getIndex(string $databaseId, string $tableId, string $key): \App $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -2964,6 +3023,7 @@ public function listRows(string $databaseId, string $tableId, ?array $queries = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -3014,6 +3074,7 @@ public function createRow(string $databaseId, string $tableId, string $rowId, ar $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -3060,6 +3121,7 @@ public function createRows(string $databaseId, string $tableId, array $rows, ?st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -3107,6 +3169,7 @@ public function upsertRows(string $databaseId, string $tableId, array $rows, ?st $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -3159,6 +3222,7 @@ public function updateRows(string $databaseId, string $tableId, ?array $data = n $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3201,11 +3265,15 @@ public function deleteRows(string $databaseId, string $tableId, ?array $queries if (!is_null($queries)) { $apiParams['queries'] = $queries; } - $apiParams['transactionId'] = $transactionId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_DELETE, @@ -3257,6 +3325,7 @@ public function getRow(string $databaseId, string $tableId, string $rowId, ?arra $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -3310,6 +3379,7 @@ public function upsertRow(string $databaseId, string $tableId, string $rowId, ?a $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -3361,6 +3431,7 @@ public function updateRow(string $databaseId, string $tableId, string $rowId, ?a $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3399,7 +3470,10 @@ public function deleteRow(string $databaseId, string $tableId, string $rowId, ?s $apiParams['databaseId'] = $databaseId; $apiParams['tableId'] = $tableId; $apiParams['rowId'] = $rowId; - $apiParams['transactionId'] = $transactionId; + + if (!is_null($transactionId)) { + $apiParams['transactionId'] = $transactionId; + } $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); @@ -3452,6 +3526,7 @@ public function decrementRowColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -3504,6 +3579,7 @@ public function incrementRowColumn(string $databaseId, string $tableId, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, diff --git a/src/Appwrite/Services/Teams.php b/src/Appwrite/Services/Teams.php index 80aaac70..4c17e3b9 100644 --- a/src/Appwrite/Services/Teams.php +++ b/src/Appwrite/Services/Teams.php @@ -48,6 +48,7 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -94,6 +95,7 @@ public function create(string $teamId, string $name, ?array $roles = null): \App $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -130,6 +132,7 @@ public function get(string $teamId): \Appwrite\Models\Team $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -169,6 +172,7 @@ public function updateName(string $teamId, string $name): \Appwrite\Models\Team $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -256,6 +260,7 @@ public function listMemberships(string $teamId, ?array $queries = null, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -340,6 +345,7 @@ public function createMembership(string $teamId, array $roles, ?string $email = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -380,6 +386,7 @@ public function getMembership(string $teamId, string $membershipId): \Appwrite\M $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -424,6 +431,7 @@ public function updateMembership(string $teamId, string $membershipId, array $ro $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -510,6 +518,7 @@ public function updateMembershipStatus(string $teamId, string $membershipId, str $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -548,6 +557,7 @@ public function getPrefs(string $teamId): \Appwrite\Models\Preferences $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -589,6 +599,7 @@ public function updatePrefs(string $teamId, array $prefs): \Appwrite\Models\Pref $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, diff --git a/src/Appwrite/Services/Tokens.php b/src/Appwrite/Services/Tokens.php index 3336c7f6..54066ff4 100644 --- a/src/Appwrite/Services/Tokens.php +++ b/src/Appwrite/Services/Tokens.php @@ -47,6 +47,7 @@ public function list(string $bucketId, string $fileId, ?array $queries = null, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -89,6 +90,7 @@ public function createFileToken(string $bucketId, string $fileId, ?string $expir $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -125,6 +127,7 @@ public function get(string $tokenId): \Appwrite\Models\ResourceToken $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -165,6 +168,7 @@ public function update(string $tokenId, ?string $expire = null): \Appwrite\Model $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, diff --git a/src/Appwrite/Services/Usage.php b/src/Appwrite/Services/Usage.php index 4d55127b..661bab13 100644 --- a/src/Appwrite/Services/Usage.php +++ b/src/Appwrite/Services/Usage.php @@ -53,6 +53,7 @@ public function listEvents(?array $queries = null, ?bool $total = null): \Appwri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -107,6 +108,7 @@ public function listGauges(?array $queries = null, ?bool $total = null): \Appwri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index e17e321c..81e7f97f 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -51,6 +51,7 @@ public function list(?array $queries = null, ?string $search = null, ?bool $tota $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -102,6 +103,7 @@ public function create(string $userId, ?string $email = null, ?string $phone = n $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -151,6 +153,7 @@ public function createArgon2User(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -200,6 +203,7 @@ public function createBcryptUser(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -249,6 +253,7 @@ public function listIdentities(?array $queries = null, ?string $search = null, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -331,6 +336,7 @@ public function createMD5User(string $userId, string $email, string $password, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -380,6 +386,7 @@ public function createPHPassUser(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -439,6 +446,7 @@ public function createScryptUser(string $userId, string $email, string $password $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -495,6 +503,7 @@ public function createScryptModifiedUser(string $userId, string $email, string $ $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -549,6 +558,7 @@ public function createSHAUser(string $userId, string $email, string $password, ? $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -585,6 +595,7 @@ public function get(string $userId): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -662,6 +673,7 @@ public function updateEmail(string $userId, string $email): \Appwrite\Models\Use $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -706,6 +718,7 @@ public function updateImpersonator(string $userId, bool $impersonator): \Appwrit $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -755,6 +768,7 @@ public function createJWT(string $userId, ?string $sessionId = null, ?int $durat $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -799,6 +813,7 @@ public function updateLabels(string $userId, array $labels): \Appwrite\Models\Us $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -845,6 +860,7 @@ public function listLogs(string $userId, ?array $queries = null, ?bool $total = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -896,6 +912,7 @@ public function listMemberships(string $userId, ?array $queries = null, ?string $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -935,6 +952,7 @@ public function updateMFA(string $userId, bool $mfa): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1006,6 +1024,7 @@ public function listMFAFactors(string $userId): \Appwrite\Models\MfaFactors $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1045,6 +1064,7 @@ public function getMFARecoveryCodes(string $userId): \Appwrite\Models\MfaRecover $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1085,6 +1105,7 @@ public function updateMFARecoveryCodes(string $userId): \Appwrite\Models\MfaReco $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -1125,6 +1146,7 @@ public function createMFARecoveryCodes(string $userId): \Appwrite\Models\MfaReco $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1164,6 +1186,7 @@ public function updateName(string $userId, string $name): \Appwrite\Models\User $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1203,6 +1226,7 @@ public function updatePassword(string $userId, string $password): \Appwrite\Mode $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1242,6 +1266,7 @@ public function updatePhone(string $userId, string $number): \Appwrite\Models\Us $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1278,6 +1303,7 @@ public function getPrefs(string $userId): \Appwrite\Models\Preferences $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1319,6 +1345,7 @@ public function updatePrefs(string $userId, array $prefs): \Appwrite\Models\Pref $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1360,6 +1387,7 @@ public function listSessions(string $userId, ?bool $total = null): \Appwrite\Mod $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1402,6 +1430,7 @@ public function createSession(string $userId): \Appwrite\Models\Session $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1510,6 +1539,7 @@ public function updateStatus(string $userId, bool $status): \Appwrite\Models\Use $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1556,6 +1586,7 @@ public function listTargets(string $userId, ?array $queries = null, ?bool $total $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1609,6 +1640,7 @@ public function createTarget(string $userId, string $targetId, MessagingProvider $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1647,6 +1679,7 @@ public function getTarget(string $userId, string $targetId): \Appwrite\Models\Ta $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -1701,6 +1734,7 @@ public function updateTarget(string $userId, string $targetId, ?string $identifi $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1787,6 +1821,7 @@ public function createToken(string $userId, ?int $length = null, ?int $expire = $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -1826,6 +1861,7 @@ public function updateEmailVerification(string $userId, bool $emailVerification) $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, @@ -1865,6 +1901,7 @@ public function updatePhoneVerification(string $userId, bool $phoneVerification) $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, diff --git a/src/Appwrite/Services/Webhooks.php b/src/Appwrite/Services/Webhooks.php index 3a9317bc..65e6fd18 100644 --- a/src/Appwrite/Services/Webhooks.php +++ b/src/Appwrite/Services/Webhooks.php @@ -43,6 +43,7 @@ public function list(?array $queries = null, ?bool $total = null): \Appwrite\Mod $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -109,6 +110,7 @@ public function create(string $webhookId, string $url, string $name, array $even $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_POST, @@ -146,6 +148,7 @@ public function get(string $webhookId): \Appwrite\Models\Webhook $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_GET, @@ -210,6 +213,7 @@ public function update(string $webhookId, string $name, string $url, array $even $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PUT, @@ -285,6 +289,7 @@ public function updateSecret(string $webhookId, ?string $secret = null): \Appwri $apiHeaders = []; $apiHeaders['X-Appwrite-Project'] = $this->client->getConfig('project'); $apiHeaders['content-type'] = 'application/json'; + $apiHeaders['accept'] = 'application/json'; $response = $this->client->call( Client::METHOD_PATCH, diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index 9694f853..b6c0220e 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -107,7 +107,7 @@ public function testMethodCreate(): void $response = $this->account->create( "", "email@example.com", - "" + "password" ); $this->assertInstanceOf(\Appwrite\Models\User::class, $response); @@ -637,7 +637,7 @@ public function testMethodUpdatePassword(): void ->andReturn(''); $response = $this->account->updatePassword( - "" + "password" ); $this->assertInstanceOf(\Appwrite\Models\User::class, $response); @@ -799,7 +799,7 @@ public function testMethodUpdateRecovery(): void $response = $this->account->updateRecovery( "", "", - "" + "password" ); $this->assertInstanceOf(\Appwrite\Models\Token::class, $response); diff --git a/tests/Appwrite/Services/ActivitiesTest.php b/tests/Appwrite/Services/ActivitiesTest.php index 003578f1..4f705395 100644 --- a/tests/Appwrite/Services/ActivitiesTest.php +++ b/tests/Appwrite/Services/ActivitiesTest.php @@ -42,18 +42,6 @@ public function testMethodListEvents(): void "projectId" => "610fc2f985ee0", "teamId" => "610fc2f985ee0", "hostname" => "appwrite.io", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", "countryCode" => "US", "countryName" => "United States" ) @@ -93,18 +81,6 @@ public function testMethodGetEvent(): void "projectId" => "610fc2f985ee0", "teamId" => "610fc2f985ee0", "hostname" => "appwrite.io", - "osCode" => "Mac", - "osName" => "Mac", - "osVersion" => "Mac", - "clientType" => "browser", - "clientCode" => "CM", - "clientName" => "Chrome Mobile iOS", - "clientVersion" => "84.0", - "clientEngine" => "WebKit", - "clientEngineVersion" => "605.1.15", - "deviceName" => "smartphone", - "deviceBrand" => "Google", - "deviceModel" => "Nexus 5", "countryCode" => "US", "countryName" => "United States" ); diff --git a/tests/Appwrite/Services/BackupsTest.php b/tests/Appwrite/Services/BackupsTest.php index f963a761..ee9d09d4 100644 --- a/tests/Appwrite/Services/BackupsTest.php +++ b/tests/Appwrite/Services/BackupsTest.php @@ -141,6 +141,7 @@ public function testMethodListPolicies(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ) @@ -169,6 +170,7 @@ public function testMethodCreatePolicy(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ); @@ -200,6 +202,7 @@ public function testMethodGetPolicy(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ); @@ -228,6 +231,7 @@ public function testMethodUpdatePolicy(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ); diff --git a/tests/Appwrite/Services/DatabasesTest.php b/tests/Appwrite/Services/DatabasesTest.php index 0111a6d0..f7a0e312 100644 --- a/tests/Appwrite/Services/DatabasesTest.php +++ b/tests/Appwrite/Services/DatabasesTest.php @@ -44,6 +44,7 @@ public function testMethodList(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), @@ -96,6 +97,7 @@ public function testMethodCreate(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), @@ -293,6 +295,7 @@ public function testMethodGet(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), @@ -345,6 +348,7 @@ public function testMethodUpdate(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), diff --git a/tests/Appwrite/Services/OrganizationTest.php b/tests/Appwrite/Services/OrganizationTest.php index 5cd93353..6f455a86 100644 --- a/tests/Appwrite/Services/OrganizationTest.php +++ b/tests/Appwrite/Services/OrganizationTest.php @@ -189,7 +189,7 @@ public function testMethodListProjects(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -229,11 +229,16 @@ public function testMethodListProjects(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ) ) @@ -280,7 +285,7 @@ public function testMethodCreateProject(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -320,11 +325,16 @@ public function testMethodCreateProject(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -372,7 +382,7 @@ public function testMethodGetProject(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -412,11 +422,16 @@ public function testMethodGetProject(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -463,7 +478,7 @@ public function testMethodUpdateProject(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -503,11 +518,16 @@ public function testMethodUpdateProject(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); diff --git a/tests/Appwrite/Services/ProjectTest.php b/tests/Appwrite/Services/ProjectTest.php index 5d572940..355543c6 100644 --- a/tests/Appwrite/Services/ProjectTest.php +++ b/tests/Appwrite/Services/ProjectTest.php @@ -57,7 +57,7 @@ public function testMethodGet(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -97,11 +97,16 @@ public function testMethodGet(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -162,7 +167,7 @@ public function testMethodUpdateAuthMethod(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -202,11 +207,16 @@ public function testMethodUpdateAuthMethod(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -420,7 +430,7 @@ public function testMethodUpdateLabels(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -460,11 +470,16 @@ public function testMethodUpdateLabels(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -645,7 +660,7 @@ public function testMethodUpdateOAuth2Server(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -685,11 +700,16 @@ public function testMethodUpdateOAuth2Server(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2020,7 +2040,7 @@ public function testMethodUpdateDenyAliasedEmailPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2060,11 +2080,16 @@ public function testMethodUpdateDenyAliasedEmailPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2082,6 +2107,102 @@ public function testMethodUpdateDenyAliasedEmailPolicy(): void $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); } + public function testMethodUpdateDenyCorporateEmailPolicy(): void + { + $data = array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "New Project", + "teamId" => "1592981250", + "region" => "fra", + "devKeys" => array( + array( + "\$id" => "5e5ea5c16897e", + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", + "name" => "Dev API Key", + "expire" => "2020-10-15T06:38:00.000+00:00", + "secret" => "919c2d18fb5d4...a2ae413da83346ad2", + "accessedAt" => "2020-10-15T06:38:00.000+00:00", + "sdks" => array() + ) + ), + "smtpEnabled" => true, + "smtpSenderName" => "John Appwrite", + "smtpSenderEmail" => "john@appwrite.io", + "smtpReplyToName" => "Support Team", + "smtpReplyToEmail" => "support@appwrite.io", + "smtpHost" => "mail.appwrite.io", + "smtpPort" => 25, + "smtpUsername" => "emailuser", + "smtpPassword" => "smtp-password", + "smtpSecure" => "tls", + "pingCount" => 1, + "pingedAt" => "2020-10-15T06:38:00.000+00:00", + "labels" => array(), + "status" => "active", + "authMethods" => array( + array( + "\$id" => "email-password", + "enabled" => true + ) + ), + "services" => array( + array( + "\$id" => "account", + "enabled" => true + ) + ), + "protocols" => array( + array( + "\$id" => "rest", + "enabled" => true + ) + ), + "blocks" => array( + array( + "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "resourceType" => "project", + "resourceId" => "5e5ea5c16897e", + "projectName" => "My Project", + "region" => "fra", + "organizationName" => "Acme Inc.", + "organizationId" => "5e5ea5c16897e", + "billingPlan" => "pro" + ) + ), + "consoleAccessedAt" => "2020-10-15T06:38:00.000+00:00", + "oAuth2ServerEnabled" => true, + "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", + "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), + "oAuth2ServerAccessTokenDuration" => 3600, + "oAuth2ServerRefreshTokenDuration" => 86400, + "oAuth2ServerPublicAccessTokenDuration" => 3600, + "oAuth2ServerPublicRefreshTokenDuration" => 2592000, + "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, + "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" + ); + + $this->client + ->allows()->call(Mockery::any(), Mockery::any(), Mockery::any(), Mockery::any()) + ->andReturn($data); + $this->client + ->allows()->getConfig(Mockery::any()) + ->andReturn(''); + + $response = $this->project->updateDenyCorporateEmailPolicy( + true + ); + + $this->assertInstanceOf(\Appwrite\Models\Project::class, $response); + } + public function testMethodUpdateDenyDisposableEmailPolicy(): void { $data = array( @@ -2111,7 +2232,7 @@ public function testMethodUpdateDenyDisposableEmailPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2151,11 +2272,16 @@ public function testMethodUpdateDenyDisposableEmailPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2202,7 +2328,7 @@ public function testMethodUpdateDenyFreeEmailPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2242,11 +2368,16 @@ public function testMethodUpdateDenyFreeEmailPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2293,7 +2424,7 @@ public function testMethodUpdateMembershipPrivacyPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2333,11 +2464,16 @@ public function testMethodUpdateMembershipPrivacyPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2382,7 +2518,7 @@ public function testMethodUpdatePasswordDictionaryPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2422,11 +2558,16 @@ public function testMethodUpdatePasswordDictionaryPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2473,7 +2614,7 @@ public function testMethodUpdatePasswordHistoryPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2513,11 +2654,16 @@ public function testMethodUpdatePasswordHistoryPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2564,7 +2710,7 @@ public function testMethodUpdatePasswordPersonalDataPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2604,11 +2750,16 @@ public function testMethodUpdatePasswordPersonalDataPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2678,7 +2829,7 @@ public function testMethodUpdateSessionAlertPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2718,11 +2869,16 @@ public function testMethodUpdateSessionAlertPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2769,7 +2925,7 @@ public function testMethodUpdateSessionDurationPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2809,11 +2965,16 @@ public function testMethodUpdateSessionDurationPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2860,7 +3021,7 @@ public function testMethodUpdateSessionInvalidationPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2900,11 +3061,16 @@ public function testMethodUpdateSessionInvalidationPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -2951,7 +3117,7 @@ public function testMethodUpdateSessionLimitPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -2991,11 +3157,16 @@ public function testMethodUpdateSessionLimitPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -3042,7 +3213,7 @@ public function testMethodUpdateUserLimitPolicy(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -3082,11 +3253,16 @@ public function testMethodUpdateUserLimitPolicy(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -3112,7 +3288,7 @@ public function testMethodGetPolicy(): void "enabled" => true ), array( - "\$id" => "deny-free-email" + "\$id" => "deny-corporate-email" ) ); @@ -3127,7 +3303,7 @@ public function testMethodGetPolicy(): void ProjectPolicyId::PASSWORDDICTIONARY() ); - $this->assertInstanceOf(\Appwrite\Models\PolicyDenyFreeEmail::class, $response); + $this->assertInstanceOf(\Appwrite\Models\PolicyDenyCorporateEmail::class, $response); } public function testMethodUpdateProtocol(): void @@ -3159,7 +3335,7 @@ public function testMethodUpdateProtocol(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -3199,11 +3375,16 @@ public function testMethodUpdateProtocol(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -3251,7 +3432,7 @@ public function testMethodUpdateService(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -3291,11 +3472,16 @@ public function testMethodUpdateService(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); @@ -3343,7 +3529,7 @@ public function testMethodUpdateSMTP(): void "smtpHost" => "mail.appwrite.io", "smtpPort" => 25, "smtpUsername" => "emailuser", - "smtpPassword" => "[SMTPPASSWORD]", + "smtpPassword" => "smtp-password", "smtpSecure" => "tls", "pingCount" => 1, "pingedAt" => "2020-10-15T06:38:00.000+00:00", @@ -3383,11 +3569,16 @@ public function testMethodUpdateSMTP(): void "oAuth2ServerEnabled" => true, "oAuth2ServerAuthorizationUrl" => "https://cloud.appwrite.io/oauth2/.well-known/openid-configuration", "oAuth2ServerScopes" => array(), + "oAuth2ServerAuthorizationDetailsTypes" => array(), "oAuth2ServerAccessTokenDuration" => 3600, "oAuth2ServerRefreshTokenDuration" => 86400, "oAuth2ServerPublicAccessTokenDuration" => 3600, "oAuth2ServerPublicRefreshTokenDuration" => 2592000, "oAuth2ServerConfidentialPkce" => true, + "oAuth2ServerVerificationUrl" => "https://cloud.appwrite.io/device", + "oAuth2ServerUserCodeLength" => 8, + "oAuth2ServerUserCodeFormat" => "alphanumeric", + "oAuth2ServerDeviceCodeDuration" => 600, "oAuth2ServerDiscoveryUrl" => "https://auth.example.com/.well-known/openid-configuration" ); diff --git a/tests/Appwrite/Services/TablesDBTest.php b/tests/Appwrite/Services/TablesDBTest.php index 3f9fb628..f298c097 100644 --- a/tests/Appwrite/Services/TablesDBTest.php +++ b/tests/Appwrite/Services/TablesDBTest.php @@ -44,6 +44,7 @@ public function testMethodList(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), @@ -96,6 +97,7 @@ public function testMethodCreate(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), @@ -293,6 +295,7 @@ public function testMethodGet(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), @@ -345,6 +348,7 @@ public function testMethodUpdate(): void "resources" => array(), "retention" => 7, "schedule" => "0 * * * *", + "type" => "full", "enabled" => true ) ), diff --git a/tests/Appwrite/Services/TeamsTest.php b/tests/Appwrite/Services/TeamsTest.php index 285c408c..1e7fb2ff 100644 --- a/tests/Appwrite/Services/TeamsTest.php +++ b/tests/Appwrite/Services/TeamsTest.php @@ -160,6 +160,7 @@ public function testMethodListMemberships(): void "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, + "userAccessedAt" => "2020-10-15T06:38:00.000+00:00", "roles" => array() ) ) @@ -195,6 +196,7 @@ public function testMethodCreateMembership(): void "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, + "userAccessedAt" => "2020-10-15T06:38:00.000+00:00", "roles" => array() ); @@ -229,6 +231,7 @@ public function testMethodGetMembership(): void "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, + "userAccessedAt" => "2020-10-15T06:38:00.000+00:00", "roles" => array() ); @@ -263,6 +266,7 @@ public function testMethodUpdateMembership(): void "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, + "userAccessedAt" => "2020-10-15T06:38:00.000+00:00", "roles" => array() ); @@ -317,6 +321,7 @@ public function testMethodUpdateMembershipStatus(): void "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, + "userAccessedAt" => "2020-10-15T06:38:00.000+00:00", "roles" => array() ); diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index 5fa0c763..9f9b0171 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -800,6 +800,7 @@ public function testMethodListMemberships(): void "joined" => "2020-10-15T06:38:00.000+00:00", "confirm" => true, "mfa" => true, + "userAccessedAt" => "2020-10-15T06:38:00.000+00:00", "roles" => array() ) ) @@ -1056,7 +1057,7 @@ public function testMethodUpdatePassword(): void $response = $this->users->updatePassword( "", - "" + "password" ); $this->assertInstanceOf(\Appwrite\Models\User::class, $response); diff --git a/tests/Appwrite/Services/WebhooksTest.php b/tests/Appwrite/Services/WebhooksTest.php index 6d85edfe..c8513b7c 100644 --- a/tests/Appwrite/Services/WebhooksTest.php +++ b/tests/Appwrite/Services/WebhooksTest.php @@ -32,7 +32,7 @@ public function testMethodList(): void "events" => array(), "tls" => true, "authUsername" => "username", - "authPassword" => "password", + "authPassword" => "webhook-password", "secret" => "ad3d581ca230e2b7059c545e5a", "enabled" => true, "logs" => "Failed to connect to remote server.", @@ -64,7 +64,7 @@ public function testMethodCreate(): void "events" => array(), "tls" => true, "authUsername" => "username", - "authPassword" => "password", + "authPassword" => "webhook-password", "secret" => "ad3d581ca230e2b7059c545e5a", "enabled" => true, "logs" => "Failed to connect to remote server.", @@ -99,7 +99,7 @@ public function testMethodGet(): void "events" => array(), "tls" => true, "authUsername" => "username", - "authPassword" => "password", + "authPassword" => "webhook-password", "secret" => "ad3d581ca230e2b7059c545e5a", "enabled" => true, "logs" => "Failed to connect to remote server.", @@ -131,7 +131,7 @@ public function testMethodUpdate(): void "events" => array(), "tls" => true, "authUsername" => "username", - "authPassword" => "password", + "authPassword" => "webhook-password", "secret" => "ad3d581ca230e2b7059c545e5a", "enabled" => true, "logs" => "Failed to connect to remote server.", @@ -184,7 +184,7 @@ public function testMethodUpdateSecret(): void "events" => array(), "tls" => true, "authUsername" => "username", - "authPassword" => "password", + "authPassword" => "webhook-password", "secret" => "ad3d581ca230e2b7059c545e5a", "enabled" => true, "logs" => "Failed to connect to remote server.",