diff --git a/README.md b/README.md index eb591d2..d95a2aa 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite PHP SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1) -![Version](https://img.shields.io/badge/api%20version-1.5.4-blue.svg?style=flat-square&v=1) +![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square&v=1) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/docs/account.md b/docs/account.md index b310dbd..3a74c26 100644 --- a/docs/account.md +++ b/docs/account.md @@ -112,7 +112,7 @@ PATCH https://cloud.appwrite.io/v1/account/mfa POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} ``` -** Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) method. ** +** Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. ** ### Parameters @@ -126,7 +126,7 @@ POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type} ``` -** Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method. ** +** Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. add ** ### Parameters diff --git a/docs/avatars.md b/docs/avatars.md index 1e17e44..6279e82 100644 --- a/docs/avatars.md +++ b/docs/avatars.md @@ -34,7 +34,7 @@ When one dimension is specified and the other is 0, the image is scaled with pre | Field Name | Type | Description | Default | | --- | --- | --- | --- | -| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro. | | +| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro. | | | width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | | height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | | quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index ee95fa0..2acafaf 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -21,5 +21,6 @@ $result = $messaging->updateEmail( html: false, // optional cc: [], // optional bcc: [], // optional - scheduledAt: '' // optional + scheduledAt: '', // optional + attachments: [] // optional ); \ No newline at end of file diff --git a/docs/messaging.md b/docs/messaging.md index f913667..f4fc48f 100644 --- a/docs/messaging.md +++ b/docs/messaging.md @@ -35,7 +35,7 @@ POST https://cloud.appwrite.io/v1/messaging/messages/email | targets | array | List of Targets IDs. | [] | | cc | array | Array of target IDs to be added as CC. | [] | | bcc | array | Array of target IDs to be added as BCC. | [] | -| attachments | array | Array of compound bucket IDs to file IDs to be attached to the email. | [] | +| attachments | array | Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :. | [] | | draft | boolean | Is message a draft | | | html | boolean | Is content of type HTML | | | scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | @@ -64,6 +64,7 @@ PATCH https://cloud.appwrite.io/v1/messaging/messages/email/{messageId} | cc | array | Array of target IDs to be added as CC. | | | bcc | array | Array of target IDs to be added as BCC. | | | scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | | +| attachments | array | Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as :. | | ## Create push notification @@ -85,7 +86,7 @@ POST https://cloud.appwrite.io/v1/messaging/messages/push | targets | array | List of Targets IDs. | [] | | data | object | Additional Data for push notification. | {} | | action | string | Action for push notification. | | -| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. | | +| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as :. | | | icon | string | Icon for push notification. Available only for Android and Web Platform. | | | sound | string | Sound for push notification. Available only for Android and IOS Platform. | | | color | string | Color for push notification. Available only for Android Platform. | | @@ -115,7 +116,7 @@ PATCH https://cloud.appwrite.io/v1/messaging/messages/push/{messageId} | body | string | Body for push notification. | | | data | object | Additional Data for push notification. | {} | | action | string | Action for push notification. | | -| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. | | +| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as :. | | | icon | string | Icon for push notification. Available only for Android and Web platforms. | | | sound | string | Sound for push notification. Available only for Android and iOS platforms. | | | color | string | Color for push notification. Available only for Android platforms. | | diff --git a/docs/users.md b/docs/users.md index 44139dc..7b9d959 100644 --- a/docs/users.md +++ b/docs/users.md @@ -601,7 +601,8 @@ DELETE https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId} POST https://cloud.appwrite.io/v1/users/{userId}/tokens ``` -** Returns a token with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession) endpoint to complete the login process. ** +** Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + ** ### Parameters diff --git a/src/Appwrite/Client.php b/src/Appwrite/Client.php index 3922d1d..4c9c2f5 100644 --- a/src/Appwrite/Client.php +++ b/src/Appwrite/Client.php @@ -37,11 +37,11 @@ class Client */ protected $headers = [ 'content-type' => '', - 'user-agent' => 'AppwritePHPSDK/11.0.1 ()', + 'user-agent' => 'AppwritePHPSDK/11.0.2 ()', 'x-sdk-name'=> 'PHP', 'x-sdk-platform'=> 'server', 'x-sdk-language'=> 'php', - 'x-sdk-version'=> '11.0.1', + 'x-sdk-version'=> '11.0.2', ]; /** diff --git a/src/Appwrite/Enums/CreditCard.php b/src/Appwrite/Enums/CreditCard.php index f634026..aba9592 100644 --- a/src/Appwrite/Enums/CreditCard.php +++ b/src/Appwrite/Enums/CreditCard.php @@ -9,7 +9,7 @@ class CreditCard implements JsonSerializable private static CreditCard $AMERICANEXPRESS; private static CreditCard $ARGENCARD; private static CreditCard $CABAL; - private static CreditCard $CONSOSUD; + private static CreditCard $CENCOSUD; private static CreditCard $DINERSCLUB; private static CreditCard $DISCOVER; private static CreditCard $ELO; @@ -61,12 +61,12 @@ public static function CABAL(): CreditCard } return self::$CABAL; } - public static function CONSOSUD(): CreditCard + public static function CENCOSUD(): CreditCard { - if (!isset(self::$CONSOSUD)) { - self::$CONSOSUD = new CreditCard('censosud'); + if (!isset(self::$CENCOSUD)) { + self::$CENCOSUD = new CreditCard('cencosud'); } - return self::$CONSOSUD; + return self::$CENCOSUD; } public static function DINERSCLUB(): CreditCard { diff --git a/src/Appwrite/Enums/Flag.php b/src/Appwrite/Enums/Flag.php index 5702423..e7145b1 100644 --- a/src/Appwrite/Enums/Flag.php +++ b/src/Appwrite/Enums/Flag.php @@ -147,6 +147,7 @@ class Flag implements JsonSerializable private static Flag $PALAU; private static Flag $PAPUANEWGUINEA; private static Flag $POLAND; + private static Flag $FRENCHPOLYNESIA; private static Flag $NORTHKOREA; private static Flag $PORTUGAL; private static Flag $PARAGUAY; @@ -1205,6 +1206,13 @@ public static function POLAND(): Flag } return self::$POLAND; } + public static function FRENCHPOLYNESIA(): Flag + { + if (!isset(self::$FRENCHPOLYNESIA)) { + self::$FRENCHPOLYNESIA = new Flag('pf'); + } + return self::$FRENCHPOLYNESIA; + } public static function NORTHKOREA(): Flag { if (!isset(self::$NORTHKOREA)) { diff --git a/src/Appwrite/Enums/Runtime.php b/src/Appwrite/Enums/Runtime.php index 2d25a24..3b7850e 100644 --- a/src/Appwrite/Enums/Runtime.php +++ b/src/Appwrite/Enums/Runtime.php @@ -25,6 +25,7 @@ class Runtime implements JsonSerializable private static Runtime $PYTHON310; private static Runtime $PYTHON311; private static Runtime $PYTHON312; + private static Runtime $PYTHONML311; private static Runtime $DENO140; private static Runtime $DART215; private static Runtime $DART216; @@ -201,6 +202,13 @@ public static function PYTHON312(): Runtime } return self::$PYTHON312; } + public static function PYTHONML311(): Runtime + { + if (!isset(self::$PYTHONML311)) { + self::$PYTHONML311 = new Runtime('python-ml-3.11'); + } + return self::$PYTHONML311; + } public static function DENO140(): Runtime { if (!isset(self::$DENO140)) { diff --git a/src/Appwrite/Query.php b/src/Appwrite/Query.php index bf01127..c8dc063 100644 --- a/src/Appwrite/Query.php +++ b/src/Appwrite/Query.php @@ -259,10 +259,10 @@ public static function offset(int $offset): string * Contains * * @param string $attribute - * @param string $value + * @param mixed $value * @return string */ - public static function contains(string $attribute, string $value): string + public static function contains(string $attribute, $value): string { return (new Query('contains', $attribute, $value))->__toString(); } diff --git a/src/Appwrite/Services/Account.php b/src/Appwrite/Services/Account.php index 0a1a73f..7a4f586 100644 --- a/src/Appwrite/Services/Account.php +++ b/src/Appwrite/Services/Account.php @@ -290,7 +290,7 @@ public function updateMFA(bool $mfa): array * * Add an authenticator app to be used as an MFA factor. Verify the * authenticator using the [verify - * authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) + * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) * method. * * @param AuthenticatorType $type @@ -320,8 +320,8 @@ public function createMfaAuthenticator(AuthenticatorType $type): array * Verify Authenticator * * Verify an authenticator app after adding it using the [add - * authenticator](/docs/references/cloud/client-web/account#addAuthenticator) - * method. + * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) + * method. add * * @param AuthenticatorType $type * @param string $otp @@ -361,10 +361,10 @@ public function updateMfaAuthenticator(AuthenticatorType $type, string $otp): ar * @param AuthenticatorType $type * @param string $otp * @throws AppwriteException - * @return array + * @return string */ - public function deleteMfaAuthenticator(AuthenticatorType $type, string $otp): array + public function deleteMfaAuthenticator(AuthenticatorType $type, string $otp): string { $apiPath = str_replace(['{type}'], [$type], '/account/mfa/authenticators/{type}'); diff --git a/src/Appwrite/Services/Messaging.php b/src/Appwrite/Services/Messaging.php index 695c997..5dbcece 100644 --- a/src/Appwrite/Services/Messaging.php +++ b/src/Appwrite/Services/Messaging.php @@ -145,11 +145,12 @@ public function createEmail(string $messageId, string $subject, string $content, * @param array $cc * @param array $bcc * @param string $scheduledAt + * @param array $attachments * @throws AppwriteException * @return array */ - public function updateEmail(string $messageId, array $topics = null, array $users = null, array $targets = null, string $subject = null, string $content = null, bool $draft = null, bool $html = null, array $cc = null, array $bcc = null, string $scheduledAt = null): array + public function updateEmail(string $messageId, array $topics = null, array $users = null, array $targets = null, string $subject = null, string $content = null, bool $draft = null, bool $html = null, array $cc = null, array $bcc = null, string $scheduledAt = null, array $attachments = null): array { $apiPath = str_replace(['{messageId}'], [$messageId], '/messaging/messages/email/{messageId}'); @@ -187,6 +188,9 @@ public function updateEmail(string $messageId, array $topics = null, array $user if (!is_null($scheduledAt)) { $apiParams['scheduledAt'] = $scheduledAt; } + if (!is_null($attachments)) { + $apiParams['attachments'] = $attachments; + } return $this->client->call( Client::METHOD_PATCH, $apiPath, diff --git a/src/Appwrite/Services/Users.php b/src/Appwrite/Services/Users.php index f386628..fc7e732 100644 --- a/src/Appwrite/Services/Users.php +++ b/src/Appwrite/Services/Users.php @@ -1493,11 +1493,11 @@ public function deleteTarget(string $userId, string $targetId): string /** * Create token * - * Returns a token with a secret key for creating a session. If the provided - * user ID has not be registered, a new user will be created. Use the returned - * user ID and secret and submit a request to the [PUT - * /account/sessions/custom](https://appwrite.io/docs/references/cloud/client-web/account#updateCustomSession) + * Returns a token with a secret key for creating a session. Use the user ID + * and secret and submit a request to the [PUT + * /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) * endpoint to complete the login process. + * * * @param string $userId * @param int $length diff --git a/tests/Appwrite/Services/AccountTest.php b/tests/Appwrite/Services/AccountTest.php index e9a3bc0..d974efd 100644 --- a/tests/Appwrite/Services/AccountTest.php +++ b/tests/Appwrite/Services/AccountTest.php @@ -265,23 +265,7 @@ public function testMethodUpdateMfaAuthenticator(): void { public function testMethodDeleteMfaAuthenticator(): void { - $data = array( - "\$id" => "5e5ea5c16897e", - "\$createdAt" => "2020-10-15T06:38:00.000+00:00", - "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", - "name" => "John Doe", - "registration" => "2020-10-15T06:38:00.000+00:00", - "status" => true, - "labels" => array(), - "passwordUpdate" => "2020-10-15T06:38:00.000+00:00", - "email" => "john@appwrite.io", - "phone" => "+4930901820", - "emailVerification" => true, - "phoneVerification" => true, - "mfa" => true, - "prefs" => array(), - "targets" => array(), - "accessedAt" => "2020-10-15T06:38:00.000+00:00",); + $data = ''; $this->client @@ -338,7 +322,8 @@ public function testMethodListMfaFactors(): void { $data = array( "totp" => true, "phone" => true, - "email" => true,); + "email" => true, + "recoveryCode" => true,); $this->client @@ -627,6 +612,7 @@ public function testMethodCreateAnonymousSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email", @@ -670,6 +656,7 @@ public function testMethodCreateEmailPasswordSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email", @@ -715,6 +702,7 @@ public function testMethodUpdateMagicURLSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email", @@ -760,6 +748,7 @@ public function testMethodUpdatePhoneSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email", @@ -805,6 +794,7 @@ public function testMethodCreateSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email", @@ -850,6 +840,7 @@ public function testMethodGetSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email", @@ -894,6 +885,7 @@ public function testMethodUpdateSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email", diff --git a/tests/Appwrite/Services/UsersTest.php b/tests/Appwrite/Services/UsersTest.php index e71ee56..39f0699 100644 --- a/tests/Appwrite/Services/UsersTest.php +++ b/tests/Appwrite/Services/UsersTest.php @@ -565,7 +565,8 @@ public function testMethodListMfaFactors(): void { $data = array( "totp" => true, "phone" => true, - "email" => true,); + "email" => true, + "recoveryCode" => true,); $this->client @@ -785,6 +786,7 @@ public function testMethodCreateSession(): void { $data = array( "\$id" => "5e5ea5c16897e", "\$createdAt" => "2020-10-15T06:38:00.000+00:00", + "\$updatedAt" => "2020-10-15T06:38:00.000+00:00", "userId" => "5e5bb8c16897e", "expire" => "2020-10-15T06:38:00.000+00:00", "provider" => "email",