diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 091cfb1..f7014c3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.10.0" + ".": "0.11.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index e7b8198..8fb9d77 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 20 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser/cas-parser-cd8e042a9746bbe9bd180614fccc7597b85f4e8f6a29da6cd2f4cbf831fb2fbe.yml -openapi_spec_hash: e27c0d9cd8cdeb348c88e6c4e8777e39 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser/cas-parser-5c6cdb8b7a2c0ba449927687bc378823ac947b26b7c2e6c379ae14668b73979a.yml +openapi_spec_hash: 6bc024b866f01da53e2cfd6e404157c7 config_hash: 5509bb7a961ae2e79114b24c381606d4 diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c925e..f6db388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.11.0 (2026-08-08) + +Full Changelog: [v0.10.0...v0.11.0](https://github.com/CASParser/cas-parser-php/compare/v0.10.0...v0.11.0) + +### Features + +* **api:** api update ([2b43dbc](https://github.com/CASParser/cas-parser-php/commit/2b43dbcf6cfb7b88b74a1ae6315e41919a952457)) + ## 0.10.0 (2026-08-02) Full Changelog: [v0.9.0...v0.10.0](https://github.com/CASParser/cas-parser-php/compare/v0.9.0...v0.10.0) diff --git a/src/Inbox/InboxConnectEmailParams.php b/src/Inbox/InboxConnectEmailParams.php index c871809..c68cf75 100644 --- a/src/Inbox/InboxConnectEmailParams.php +++ b/src/Inbox/InboxConnectEmailParams.php @@ -9,6 +9,7 @@ use CasParser\Core\Concerns\SdkModel; use CasParser\Core\Concerns\SdkParams; use CasParser\Core\Contracts\BaseModel; +use CasParser\Inbox\InboxConnectEmailParams\Provider; /** * Initiate OAuth flow to connect user's email inbox. @@ -30,7 +31,9 @@ * @see CasParser\Services\InboxService::connectEmail() * * @phpstan-type InboxConnectEmailParamsShape = array{ - * redirectUri: string, state?: string|null + * redirectUri: string, + * provider?: null|Provider|value-of, + * state?: string|null, * } */ final class InboxConnectEmailParams implements BaseModel @@ -45,6 +48,20 @@ final class InboxConnectEmailParams implements BaseModel #[Required('redirect_uri')] public string $redirectUri; + /** + * Mail provider to connect. Defaults to `gmail`. + * + * - `gmail` - Google accounts + * - `outlook` - Microsoft accounts + * + * Any value other than `outlook` is treated as `gmail`. The + * resolved provider is returned in the response. + * + * @var value-of|null $provider + */ + #[Optional(enum: Provider::class)] + public ?string $provider; + /** * State parameter for CSRF protection (returned in redirect). */ @@ -74,13 +91,19 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param Provider|value-of|null $provider */ - public static function with(string $redirectUri, ?string $state = null): self - { + public static function with( + string $redirectUri, + Provider|string|null $provider = null, + ?string $state = null + ): self { $self = new self; $self['redirectUri'] = $redirectUri; + null !== $provider && $self['provider'] = $provider; null !== $state && $self['state'] = $state; return $self; @@ -97,6 +120,25 @@ public function withRedirectUri(string $redirectUri): self return $self; } + /** + * Mail provider to connect. Defaults to `gmail`. + * + * - `gmail` - Google accounts + * - `outlook` - Microsoft accounts + * + * Any value other than `outlook` is treated as `gmail`. The + * resolved provider is returned in the response. + * + * @param Provider|value-of $provider + */ + public function withProvider(Provider|string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + /** * State parameter for CSRF protection (returned in redirect). */ diff --git a/src/Inbox/InboxConnectEmailParams/Provider.php b/src/Inbox/InboxConnectEmailParams/Provider.php new file mode 100644 index 0000000..cef58cb --- /dev/null +++ b/src/Inbox/InboxConnectEmailParams/Provider.php @@ -0,0 +1,21 @@ +, + * status?: string|null, * } */ final class InboxConnectEmailResponse implements BaseModel @@ -30,6 +34,14 @@ final class InboxConnectEmailResponse implements BaseModel #[Optional('oauth_url')] public ?string $oauthURL; + /** + * The provider this OAuth URL was generated for. + * + * @var value-of|null $provider + */ + #[Optional(enum: Provider::class)] + public ?string $provider; + #[Optional] public ?string $status; @@ -42,16 +54,20 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param Provider|value-of|null $provider */ public static function with( ?int $expiresIn = null, ?string $oauthURL = null, - ?string $status = null + Provider|string|null $provider = null, + ?string $status = null, ): self { $self = new self; null !== $expiresIn && $self['expiresIn'] = $expiresIn; null !== $oauthURL && $self['oauthURL'] = $oauthURL; + null !== $provider && $self['provider'] = $provider; null !== $status && $self['status'] = $status; return $self; @@ -79,6 +95,19 @@ public function withOAuthURL(string $oauthURL): self return $self; } + /** + * The provider this OAuth URL was generated for. + * + * @param Provider|value-of $provider + */ + public function withProvider(Provider|string $provider): self + { + $self = clone $this; + $self['provider'] = $provider; + + return $self; + } + public function withStatus(string $status): self { $self = clone $this; diff --git a/src/Inbox/InboxConnectEmailResponse/Provider.php b/src/Inbox/InboxConnectEmailResponse/Provider.php new file mode 100644 index 0000000..fa9133e --- /dev/null +++ b/src/Inbox/InboxConnectEmailResponse/Provider.php @@ -0,0 +1,15 @@ + $provider Mail provider to connect. Defaults to `gmail`. + * + * - `gmail` - Google accounts + * - `outlook` - Microsoft accounts + * + * Any value other than `outlook` is treated as `gmail`. The + * resolved provider is returned in the response. * @param string $state State parameter for CSRF protection (returned in redirect) * @param RequestOpts|null $requestOptions * @@ -41,6 +49,7 @@ public function checkConnectionStatus( */ public function connectEmail( string $redirectUri, + Provider|string $provider = 'gmail', ?string $state = null, RequestOptions|array|null $requestOptions = null, ): InboxConnectEmailResponse; diff --git a/src/Services/InboxRawService.php b/src/Services/InboxRawService.php index 0f8cd85..07e181a 100644 --- a/src/Services/InboxRawService.php +++ b/src/Services/InboxRawService.php @@ -11,6 +11,7 @@ use CasParser\Inbox\InboxCheckConnectionStatusParams; use CasParser\Inbox\InboxCheckConnectionStatusResponse; use CasParser\Inbox\InboxConnectEmailParams; +use CasParser\Inbox\InboxConnectEmailParams\Provider; use CasParser\Inbox\InboxConnectEmailResponse; use CasParser\Inbox\InboxDisconnectEmailParams; use CasParser\Inbox\InboxDisconnectEmailResponse; @@ -104,7 +105,7 @@ public function checkConnectionStatus( * **Store the `inbox_token` client-side** and use it for all subsequent inbox API calls. * * @param array{ - * redirectUri: string, state?: string + * redirectUri: string, provider?: Provider|value-of, state?: string * }|InboxConnectEmailParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/InboxService.php b/src/Services/InboxService.php index fefca88..aac569c 100644 --- a/src/Services/InboxService.php +++ b/src/Services/InboxService.php @@ -8,6 +8,7 @@ use CasParser\Core\Exceptions\APIException; use CasParser\Core\Util; use CasParser\Inbox\InboxCheckConnectionStatusResponse; +use CasParser\Inbox\InboxConnectEmailParams\Provider; use CasParser\Inbox\InboxConnectEmailResponse; use CasParser\Inbox\InboxDisconnectEmailResponse; use CasParser\Inbox\InboxListCasFilesParams\CasType; @@ -94,6 +95,13 @@ public function checkConnectionStatus( * **Store the `inbox_token` client-side** and use it for all subsequent inbox API calls. * * @param string $redirectUri Your callback URL to receive the inbox_token (must be http or https) + * @param Provider|value-of $provider Mail provider to connect. Defaults to `gmail`. + * + * - `gmail` - Google accounts + * - `outlook` - Microsoft accounts + * + * Any value other than `outlook` is treated as `gmail`. The + * resolved provider is returned in the response. * @param string $state State parameter for CSRF protection (returned in redirect) * @param RequestOpts|null $requestOptions * @@ -101,11 +109,16 @@ public function checkConnectionStatus( */ public function connectEmail( string $redirectUri, + Provider|string $provider = 'gmail', ?string $state = null, RequestOptions|array|null $requestOptions = null, ): InboxConnectEmailResponse { $params = Util::removeNulls( - ['redirectUri' => $redirectUri, 'state' => $state] + [ + 'redirectUri' => $redirectUri, + 'provider' => $provider, + 'state' => $state, + ], ); // @phpstan-ignore-next-line argument.type diff --git a/src/Version.php b/src/Version.php index fabeb74..05fd03f 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace CasParser; // x-release-please-start-version -const VERSION = '0.10.0'; +const VERSION = '0.11.0'; // x-release-please-end diff --git a/tests/Services/InboxTest.php b/tests/Services/InboxTest.php index f7d2e8e..1bc357f 100644 --- a/tests/Services/InboxTest.php +++ b/tests/Services/InboxTest.php @@ -85,7 +85,8 @@ public function testConnectEmailWithOptionalParams(): void $result = $this->client->inbox->connectEmail( redirectUri: 'https://yourapp.com/oauth-callback', - state: 'abc123' + provider: 'outlook', + state: 'abc123', ); // @phpstan-ignore-next-line method.alreadyNarrowedType