Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions codegen/Oauth/Api/AccessTokensApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions codegen/Oauth/Api/RefreshTokensApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions codegen/Oauth/Api/TokensApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])
{
Expand All @@ -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])
{
Expand Down Expand Up @@ -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])
{
Expand Down Expand Up @@ -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])
{
Expand Down Expand Up @@ -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])
{
Expand Down
32 changes: 28 additions & 4 deletions lib/Discovery/Oauth/Discovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
11 changes: 11 additions & 0 deletions lib/Discovery/Oauth/V3/Discovery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace HubSpot\Discovery\Oauth\V3;

use HubSpot\Client\Oauth\V3\Api\AdvancedApi;
use HubSpot\Discovery\DiscoveryBase;

/**
* @method AdvancedApi advancedApi()
*/
class Discovery extends DiscoveryBase {}
2 changes: 2 additions & 0 deletions tests/spec/Discovery/Oauth/DiscoverySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use HubSpot\Client\Oauth\Api\TokensApi;
use HubSpot\Config;
use HubSpot\Discovery\Oauth\Discovery;
use HubSpot\Discovery\Oauth\V3\Discovery as V3Discovery;
use PhpSpec\ObjectBehavior;

class DiscoverySpec extends ObjectBehavior
Expand All @@ -27,5 +28,6 @@ public function it_creates_clients()
$this->accessTokensApi()->shouldHaveType(AccessTokensApi::class);
$this->refreshTokensApi()->shouldHaveType(RefreshTokensApi::class);
$this->tokensApi()->shouldHaveType(TokensApi::class);
$this->v3()->shouldHaveType(V3Discovery::class);
}
}
27 changes: 27 additions & 0 deletions tests/spec/Discovery/Oauth/V3/DiscoverySpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace spec\HubSpot\Discovery\Oauth\V3;

use GuzzleHttp\Client;
use HubSpot\Client\Oauth\V3\Api\AdvancedApi;
use HubSpot\Config;
use HubSpot\Discovery\Oauth\V3\Discovery;
use PhpSpec\ObjectBehavior;

class DiscoverySpec extends ObjectBehavior
{
public function let(Client $client, Config $config)
{
$this->beConstructedWith($client, $config);
}

public function it_is_initializable()
{
$this->shouldHaveType(Discovery::class);
}

public function it_creates_clients()
{
$this->advancedApi()->shouldHaveType(AdvancedApi::class);
}
}
Loading