diff --git a/codegen/Oauth/Api/TokensApi.php b/codegen/Oauth/Api/TokensApi.php index 11dd298b..f4b0b1e0 100644 --- a/codegen/Oauth/Api/TokensApi.php +++ b/codegen/Oauth/Api/TokensApi.php @@ -136,15 +136,17 @@ public function getConfig() * @param string|null $client_id client_id (optional) * @param string|null $client_secret client_secret (optional) * @param string|null $refresh_token refresh_token (optional) + * @param string|null $code_verifier code_verifier (optional) + * @param string|null $scope scope (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] 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 * @throws \InvalidArgumentException * @return \HubSpot\Client\Oauth\Model\TokenResponseIF|\HubSpot\Client\Oauth\Model\Error */ - public function create($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, string $contentType = self::contentTypes['create'][0]) + 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]) { - list($response) = $this->createWithHttpInfo($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $contentType); + list($response) = $this->createWithHttpInfo($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $code_verifier, $scope, $contentType); return $response; } @@ -159,15 +161,17 @@ public function create($grant_type = null, $code = null, $redirect_uri = null, $ * @param string|null $client_id (optional) * @param string|null $client_secret (optional) * @param string|null $refresh_token (optional) + * @param string|null $code_verifier (optional) + * @param string|null $scope (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] 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 * @throws \InvalidArgumentException * @return array of \HubSpot\Client\Oauth\Model\TokenResponseIF|\HubSpot\Client\Oauth\Model\Error, HTTP status code, HTTP response headers (array of strings) */ - public function createWithHttpInfo($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, string $contentType = self::contentTypes['create'][0]) + 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]) { - $request = $this->createRequest($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $contentType); + $request = $this->createRequest($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $code_verifier, $scope, $contentType); try { $options = $this->createHttpClientOption(); @@ -207,7 +211,7 @@ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_u ); } - + if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( @@ -246,7 +250,7 @@ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_u $e->setResponseObject($data); throw $e; } - + throw $e; } @@ -263,14 +267,16 @@ public function createWithHttpInfo($grant_type = null, $code = null, $redirect_u * @param string|null $client_id (optional) * @param string|null $client_secret (optional) * @param string|null $refresh_token (optional) + * @param string|null $code_verifier (optional) + * @param string|null $scope (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsync($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, string $contentType = self::contentTypes['create'][0]) + 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]) { - return $this->createAsyncWithHttpInfo($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $contentType) + return $this->createAsyncWithHttpInfo($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $code_verifier, $scope, $contentType) ->then( function ($response) { return $response[0]; @@ -289,15 +295,17 @@ function ($response) { * @param string|null $client_id (optional) * @param string|null $client_secret (optional) * @param string|null $refresh_token (optional) + * @param string|null $code_verifier (optional) + * @param string|null $scope (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createAsyncWithHttpInfo($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, string $contentType = self::contentTypes['create'][0]) + 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]) { $returnType = '\HubSpot\Client\Oauth\Model\TokenResponseIF'; - $request = $this->createRequest($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $contentType); + $request = $this->createRequest($grant_type, $code, $redirect_uri, $client_id, $client_secret, $refresh_token, $code_verifier, $scope, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -344,12 +352,14 @@ function ($exception) { * @param string|null $client_id (optional) * @param string|null $client_secret (optional) * @param string|null $refresh_token (optional) + * @param string|null $code_verifier (optional) + * @param string|null $scope (optional) * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createRequest($grant_type = null, $code = null, $redirect_uri = null, $client_id = null, $client_secret = null, $refresh_token = null, string $contentType = self::contentTypes['create'][0]) + 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]) { @@ -359,6 +369,8 @@ public function createRequest($grant_type = null, $code = null, $redirect_uri = + + $resourcePath = '/oauth/v1/token'; $formParams = []; $queryParams = []; @@ -379,6 +391,8 @@ public function createRequest($grant_type = null, $code = null, $redirect_uri = 'client_id' => $client_id, 'client_secret' => $client_secret, 'refresh_token' => $refresh_token, + 'code_verifier' => $code_verifier, + 'scope' => $scope, ]); $formParams = $formDataProcessor->flatten($formData); diff --git a/codegen/Oauth/Model/AccessTokenInfoResponse.php b/codegen/Oauth/Model/AccessTokenInfoResponse.php index ee3317f0..6b932d47 100644 --- a/codegen/Oauth/Model/AccessTokenInfoResponse.php +++ b/codegen/Oauth/Model/AccessTokenInfoResponse.php @@ -528,7 +528,7 @@ public function getScopes() /** * Sets scopes * - * @param string[] $scopes scopes + * @param string[] $scopes An array of strings indicating the scopes * * @return self */ diff --git a/codegen/Oauth/Model/RefreshTokenInfoResponse.php b/codegen/Oauth/Model/RefreshTokenInfoResponse.php index 6600fbb5..c2aec76e 100644 --- a/codegen/Oauth/Model/RefreshTokenInfoResponse.php +++ b/codegen/Oauth/Model/RefreshTokenInfoResponse.php @@ -450,7 +450,7 @@ public function getScopes() /** * Sets scopes * - * @param string[] $scopes scopes + * @param string[] $scopes An array of strings detailing the scopes * * @return self */ diff --git a/codegen/Oauth/Model/TokenResponseIF.php b/codegen/Oauth/Model/TokenResponseIF.php index 8056bad8..5bb877b2 100644 --- a/codegen/Oauth/Model/TokenResponseIF.php +++ b/codegen/Oauth/Model/TokenResponseIF.php @@ -58,6 +58,7 @@ class TokenResponseIF implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'access_token' => 'string', + 'refresh_token' => 'string', 'expires_in' => 'int', 'hub_id' => 'int', 'id_token' => 'string', @@ -75,6 +76,7 @@ class TokenResponseIF implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'access_token' => null, + 'refresh_token' => null, 'expires_in' => 'int64', 'hub_id' => 'int32', 'id_token' => null, @@ -90,6 +92,7 @@ class TokenResponseIF implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'access_token' => false, + 'refresh_token' => false, 'expires_in' => false, 'hub_id' => false, 'id_token' => false, @@ -184,12 +187,13 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'access_token' => 'accessToken', - 'expires_in' => 'expiresIn', - 'hub_id' => 'hubId', + 'access_token' => 'access_token', + 'refresh_token' => 'refresh_token', + 'expires_in' => 'expires_in', + 'hub_id' => 'hub_id', 'id_token' => 'idToken', 'scopes' => 'scopes', - 'token_type' => 'tokenType', + 'token_type' => 'token_type', 'user_id' => 'userId' ]; @@ -200,6 +204,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'access_token' => 'setAccessToken', + 'refresh_token' => 'setRefreshToken', 'expires_in' => 'setExpiresIn', 'hub_id' => 'setHubId', 'id_token' => 'setIdToken', @@ -215,6 +220,7 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'access_token' => 'getAccessToken', + 'refresh_token' => 'getRefreshToken', 'expires_in' => 'getExpiresIn', 'hub_id' => 'getHubId', 'id_token' => 'getIdToken', @@ -281,6 +287,7 @@ public function getModelName() public function __construct(?array $data = null) { $this->setIfExists('access_token', $data ?? [], null); + $this->setIfExists('refresh_token', $data ?? [], null); $this->setIfExists('expires_in', $data ?? [], null); $this->setIfExists('hub_id', $data ?? [], null); $this->setIfExists('id_token', $data ?? [], null); @@ -358,6 +365,33 @@ public function setAccessToken($access_token) return $this; } + /** + * Gets refresh_token + * + * @return string|null + */ + public function getRefreshToken() + { + return $this->container['refresh_token']; + } + + /** + * Sets refresh_token + * + * @param string|null $refresh_token refresh_token + * + * @return self + */ + public function setRefreshToken($refresh_token) + { + if (is_null($refresh_token)) { + throw new \InvalidArgumentException('non-nullable refresh_token cannot be null'); + } + $this->container['refresh_token'] = $refresh_token; + + return $this; + } + /** * Gets expires_in * @@ -452,7 +486,7 @@ public function getScopes() /** * Sets scopes * - * @param string[]|null $scopes scopes + * @param string[]|null $scopes An array of strings indicating the scopes * * @return self */