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
55 changes: 32 additions & 23 deletions codegen/Oauth/Api/AccessTokensApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v1
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -83,13 +83,13 @@ class AccessTokensApi
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
?ClientInterface $client = null,
?Configuration $config = null,
?HeaderSelector $selector = null,
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->config = $config ?: Configuration::getDefaultConfiguration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
Expand Down Expand Up @@ -125,7 +125,9 @@ public function getConfig()
/**
* Operation get
*
* @param string $token token (required)
* Retrieve OAuth token metadata
*
* @param string $token The access token that you want to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -141,7 +143,9 @@ public function get($token, string $contentType = self::contentTypes['get'][0])
/**
* Operation getWithHttpInfo
*
* @param string $token (required)
* Retrieve OAuth token metadata
*
* @param string $token The access token that you want to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format
Expand Down Expand Up @@ -174,18 +178,6 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

switch($statusCode) {
case 200:
Expand Down Expand Up @@ -244,6 +236,19 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

$returnType = '\HubSpot\Client\Oauth\Model\AccessTokenInfoResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
Expand Down Expand Up @@ -298,7 +303,9 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes
/**
* Operation getAsync
*
* @param string $token (required)
* Retrieve OAuth token metadata
*
* @param string $token The access token that you want to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand All @@ -317,7 +324,9 @@ function ($response) {
/**
* Operation getAsyncWithHttpInfo
*
* @param string $token (required)
* Retrieve OAuth token metadata
*
* @param string $token The access token that you want to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down Expand Up @@ -367,7 +376,7 @@ function ($exception) {
/**
* Create request for operation 'get'
*
* @param string $token (required)
* @param string $token The access token that you want to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down
85 changes: 45 additions & 40 deletions codegen/Oauth/Api/RefreshTokensApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: v1
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 7.3.0
* Generator version: 7.12.0
*/

/**
Expand Down Expand Up @@ -86,13 +86,13 @@ class RefreshTokensApi
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$hostIndex = 0
?ClientInterface $client = null,
?Configuration $config = null,
?HeaderSelector $selector = null,
int $hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->config = $config ?: Configuration::getDefaultConfiguration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
Expand Down Expand Up @@ -128,7 +128,9 @@ public function getConfig()
/**
* Operation archive
*
* @param string $token token (required)
* Delete a refresh token
*
* @param string $token The refresh token to delete. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -143,7 +145,9 @@ public function archive($token, string $contentType = self::contentTypes['archiv
/**
* Operation archiveWithHttpInfo
*
* @param string $token (required)
* Delete a refresh token
*
* @param string $token The refresh token to delete. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format
Expand Down Expand Up @@ -176,18 +180,6 @@ public function archiveWithHttpInfo($token, string $contentType = self::contentT

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

return [null, $statusCode, $response->getHeaders()];

Expand All @@ -209,7 +201,9 @@ public function archiveWithHttpInfo($token, string $contentType = self::contentT
/**
* Operation archiveAsync
*
* @param string $token (required)
* Delete a refresh token
*
* @param string $token The refresh token to delete. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand All @@ -228,7 +222,9 @@ function ($response) {
/**
* Operation archiveAsyncWithHttpInfo
*
* @param string $token (required)
* Delete a refresh token
*
* @param string $token The refresh token to delete. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down Expand Up @@ -265,7 +261,7 @@ function ($exception) {
/**
* Create request for operation 'archive'
*
* @param string $token (required)
* @param string $token The refresh token to delete. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['archive'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down Expand Up @@ -357,7 +353,9 @@ public function archiveRequest($token, string $contentType = self::contentTypes[
/**
* Operation get
*
* @param string $token token (required)
* Retrieve refresh token metadata
*
* @param string $token The refresh token to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -373,7 +371,9 @@ public function get($token, string $contentType = self::contentTypes['get'][0])
/**
* Operation getWithHttpInfo
*
* @param string $token (required)
* Retrieve refresh token metadata
*
* @param string $token The refresh token to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \HubSpot\Client\Oauth\ApiException on non-2xx response or if the response body is not in the expected format
Expand Down Expand Up @@ -406,18 +406,6 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

switch($statusCode) {
case 200:
Expand Down Expand Up @@ -476,6 +464,19 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

$returnType = '\HubSpot\Client\Oauth\Model\RefreshTokenInfoResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
Expand Down Expand Up @@ -530,7 +531,9 @@ public function getWithHttpInfo($token, string $contentType = self::contentTypes
/**
* Operation getAsync
*
* @param string $token (required)
* Retrieve refresh token metadata
*
* @param string $token The refresh token to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand All @@ -549,7 +552,9 @@ function ($response) {
/**
* Operation getAsyncWithHttpInfo
*
* @param string $token (required)
* Retrieve refresh token metadata
*
* @param string $token The refresh token to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down Expand Up @@ -599,7 +604,7 @@ function ($exception) {
/**
* Create request for operation 'get'
*
* @param string $token (required)
* @param string $token The refresh token to retrieve information about. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['get'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
Expand Down
Loading