diff --git a/codegen/Oauth/Api/AccessTokensApi.php b/codegen/Oauth/Api/AccessTokensApi.php index 7aac0e578..4c268df5f 100644 --- a/codegen/Oauth/Api/AccessTokensApi.php +++ b/codegen/Oauth/Api/AccessTokensApi.php @@ -44,6 +44,8 @@ /** * AccessTokensApi Class Doc Comment * + * @deprecated use \HubSpot\Client\Oauth\V3\Api\AdvancedApi instead + * * @category Class * @package HubSpot\Client\Oauth * @author OpenAPI Generator team diff --git a/codegen/Oauth/Api/RefreshTokensApi.php b/codegen/Oauth/Api/RefreshTokensApi.php index fd313cd0c..4ba3ff799 100644 --- a/codegen/Oauth/Api/RefreshTokensApi.php +++ b/codegen/Oauth/Api/RefreshTokensApi.php @@ -44,6 +44,8 @@ /** * RefreshTokensApi Class Doc Comment * + * @deprecated use \HubSpot\Client\Oauth\V3\Api\AdvancedApi instead + * * @category Class * @package HubSpot\Client\Oauth * @author OpenAPI Generator team diff --git a/codegen/Oauth/Api/TokensApi.php b/codegen/Oauth/Api/TokensApi.php index 56d4f21b2..44bfe3c1f 100644 --- a/codegen/Oauth/Api/TokensApi.php +++ b/codegen/Oauth/Api/TokensApi.php @@ -44,6 +44,8 @@ /** * TokensApi Class Doc Comment * + * @deprecated use \HubSpot\Client\Oauth\V3\Api\AdvancedApi instead + * * @category Class * @package HubSpot\Client\Oauth * @author OpenAPI Generator team @@ -142,6 +144,7 @@ public function getConfig() * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \HubSpot\Client\Oauth\Model\TokenResponseIF|\HubSpot\Client\Oauth\Model\Error + * @deprecated */ public function create($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, $code_verifier = null, $scope = null, string $contentType = self::contentTypes['create'][0]) { @@ -167,6 +170,7 @@ public function create($grant_type = null, $code = null, $redirect_uri = null, $ * @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Oauth\Model\TokenResponseIF|\HubSpot\Client\Oauth\Model\Error, HTTP status code, HTTP response headers (array of strings) + * @deprecated */ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, $code_verifier = null, $scope = null, string $contentType = self::contentTypes['create'][0]) { @@ -272,6 +276,7 @@ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_u * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated */ public function createAsync($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, $code_verifier = null, $scope = null, string $contentType = self::contentTypes['create'][0]) { @@ -300,6 +305,7 @@ function ($response) { * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface + * @deprecated */ public function createAsyncWithHttpInfo($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, $code_verifier = null, $scope = null, string $contentType = self::contentTypes['create'][0]) { @@ -357,6 +363,7 @@ function ($exception) { * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request + * @deprecated */ public function createRequest($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, $code_verifier = null, $scope = null, string $contentType = self::contentTypes['create'][0]) { diff --git a/lib/Discovery/Oauth/Discovery.php b/lib/Discovery/Oauth/Discovery.php index 595185674..94e4f97af 100644 --- a/lib/Discovery/Oauth/Discovery.php +++ b/lib/Discovery/Oauth/Discovery.php @@ -5,11 +5,35 @@ use HubSpot\Client\Oauth\Api\AccessTokensApi; use HubSpot\Client\Oauth\Api\RefreshTokensApi; use HubSpot\Client\Oauth\Api\TokensApi; +use HubSpot\Client\Oauth\Configuration; use HubSpot\Discovery\DiscoveryBase; /** - * @method AccessTokensApi accessTokensApi() - * @method RefreshTokensApi refreshTokensApi() - * @method TokensApi tokensApi() + * @method V3\Discovery v3() */ -class Discovery extends DiscoveryBase {} +class Discovery extends DiscoveryBase +{ + /** + * @deprecated use v3()->advancedApi() instead + */ + public function accessTokensApi(): AccessTokensApi + { + return new AccessTokensApi($this->client, $this->config->convertToClientConfig(Configuration::class)); + } + + /** + * @deprecated use v3()->advancedApi() instead + */ + public function refreshTokensApi(): RefreshTokensApi + { + return new RefreshTokensApi($this->client, $this->config->convertToClientConfig(Configuration::class)); + } + + /** + * @deprecated use v3()->advancedApi() instead + */ + public function tokensApi(): TokensApi + { + return new TokensApi($this->client, $this->config->convertToClientConfig(Configuration::class)); + } +} diff --git a/lib/Discovery/Oauth/V3/Discovery.php b/lib/Discovery/Oauth/V3/Discovery.php new file mode 100644 index 000000000..6b22deb29 --- /dev/null +++ b/lib/Discovery/Oauth/V3/Discovery.php @@ -0,0 +1,11 @@ +accessTokensApi()->shouldHaveType(AccessTokensApi::class); $this->refreshTokensApi()->shouldHaveType(RefreshTokensApi::class); $this->tokensApi()->shouldHaveType(TokensApi::class); + $this->v3()->shouldHaveType(V3Discovery::class); } } diff --git a/tests/spec/Discovery/Oauth/V3/DiscoverySpec.php b/tests/spec/Discovery/Oauth/V3/DiscoverySpec.php new file mode 100644 index 000000000..575c36ac7 --- /dev/null +++ b/tests/spec/Discovery/Oauth/V3/DiscoverySpec.php @@ -0,0 +1,27 @@ +beConstructedWith($client, $config); + } + + public function it_is_initializable() + { + $this->shouldHaveType(Discovery::class); + } + + public function it_creates_clients() + { + $this->advancedApi()->shouldHaveType(AdvancedApi::class); + } +}