diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore index a93e7b0..91471a5 100644 --- a/.swagger-codegen-ignore +++ b/.swagger-codegen-ignore @@ -40,6 +40,5 @@ autoload.php phpunit.xml.dist docs/ test/ -src/ApiClient.php src/ApiException.php -src/Client/ +src/Client/Auth/** diff --git a/CHANGELOG.md b/CHANGELOG.md index ecba5a0..f1723d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,12 @@ # DocuSign Admin Java Client Changelog See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for Product Release Notes. -## [v2.1.0] - Admin API v2.1-1.4.3 - 2026-03-05 +## [v2.1.1] - Admin API v2.1-1.4.3 - 2026-06-09 +### Changed +- Added support for version v2.1-26.1.1.00 of the DocuSign ESignature API. +- Updated the SDK release version. + +## [v2.1.0] - Admin API v2.1-1.4.3 - 2026-03-09 ### Changed - Added support for version v2.1-1.4.3 of the DocuSign Admin API. - Updated the SDK release version. diff --git a/composer.json b/composer.json index 43c396a..20dc86c 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", - "firebase/php-jwt": "^6.0" + "adhocore/jwt": "^1.1" }, "require-dev": { "phpunit/phpunit": "~4.8", diff --git a/src/Api/BulkExportsApi.php b/src/Api/BulkExportsApi.php index 7e7ffbc..a8994b8 100644 --- a/src/Api/BulkExportsApi.php +++ b/src/Api/BulkExportsApi.php @@ -116,7 +116,7 @@ public function updateResourcePath(string $resourcePath, string $baseName, strin /** * Operation createAccountSettingsExport * - * Creates a new Account Setting Export request. + * Creates a new Account Setting Export request. * * @param ?string $organization_id The organization ID Guid * @param \DocuSign\Admin\Model\OrganizationAccountsRequest $request Request body containing details about the accounts be compared (required) @@ -133,7 +133,7 @@ public function createAccountSettingsExport($organization_id, $request) /** * Operation createAccountSettingsExportWithHttpInfo * - * Creates a new Account Setting Export request. + * Creates a new Account Setting Export request. * * @param ?string $organization_id The organization ID Guid * @param \DocuSign\Admin\Model\OrganizationAccountsRequest $request Request body containing details about the accounts be compared (required) diff --git a/src/Client/ApiClient.php b/src/Client/ApiClient.php index 24a2a4c..f820ac7 100644 --- a/src/Client/ApiClient.php +++ b/src/Client/ApiClient.php @@ -1,8 +1,9 @@ + * @license The Docusign PHP Client SDK is licensed under the MIT License. * @link https://github.com/swagger-api/swagger-codegen */ class ApiClient @@ -53,8 +55,6 @@ class ApiClient public static $PUT = "PUT"; public static $DELETE = "DELETE"; - - public static $SCOPE_SIGNATURE = "signature"; public static $SCOPE_EXTENDED = "extended"; public static $SCOPE_IMPERSONATION = "impersonation"; @@ -88,7 +88,7 @@ class ApiClient * @param Configuration $config Rest API config for this ApiClient * @param OAuth $oAuth OAuth config for this ApiClient */ - public function __construct(Configuration $config = null, OAuth $oAuth = null) + public function __construct(?Configuration $config = null, ?OAuth $oAuth = null) { if ($config === null) { $config = Configuration::getDefaultConfiguration(); @@ -170,14 +170,14 @@ public function getApiKeyWithPrefix($apiKeyIdentifier) * @param string $endpointPath path to method endpoint before expanding parameters * @param bool $oAuth pass true in case of oAuth requests * - * @throws ApiException on a non 2xx response + * @throws DocuSign\Admin\Client\ApiException on a non 2xx response * @return mixed */ public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null, $oAuth = false) { $headers = []; - // DocuSign: Add DocuSign tracking headers + // Docusign: Add Docusign tracking headers $this->config->addDefaultHeader("X-DocuSign-SDK", "PHP"); $url = $this->config->getHost() . $resourcePath; @@ -202,7 +202,7 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header $postData = json_encode(ObjectSerializer::sanitizeForSerialization($postData)); } - if (in_array("Content-Type: multipart/form-data", $headers, true)) + if (in_array('Content-Type: multipart/form-data', $headers, true)) { foreach($postData as $property => $value) { @@ -220,11 +220,12 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header if ($this->config->getCurlTimeout() !== 0) { curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); } + // set connect timeout, if needed if ($this->config->getCurlConnectTimeout() != 0) { curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->config->getCurlConnectTimeout()); } - + // return the result on success, rather than just true curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); @@ -333,15 +334,17 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header } } else { $data = json_decode($http_body); + $serializedData = $data; if (json_last_error() > 0) { // if response is a string $data = $http_body; } - if(is_object($data)){ - $data = serialize($data); + + if(is_object($serializedData)){ + $serializedData = serialize($serializedData); } throw new ApiException( - "Error while requesting server, received a non successful HTTP code [".$response_info['http_code']."] with response Body: $data", + "Error while requesting server, received a non successful HTTP code [".$response_info['http_code']."] with response Body: $serializedData", $response_info['http_code'], $http_header, $data @@ -428,7 +431,7 @@ protected function httpParseHeaders($raw_headers) /** * Helper method to configure the OAuth accessCode/implicit flow parameters * - * @param string $client_id DocuSign OAuth Client Id(AKA Integrator Key) + * @param string $client_id Docusign OAuth Client Id(AKA Integrator Key) * @param string|array $scopes the list of requested scopes. Client applications may be scoped to a limited set of system access. * @param string $redirect_uri This determines where to deliver the response containing the authorization code * @param string $response_type Determines the response type of the authorization request, NOTE: these response types are @@ -464,8 +467,8 @@ public function getAuthorizationURI($client_id, $scopes, $redirect_uri, $respons /** * GenerateAccessToken will exchange the authorization code for an access token and refresh tokens. * - * @param string $client_id DocuSign OAuth Client Id(AKA Integrator Key) - * @param string $client_secret The secret key you generated when you set up the integration in DocuSign Admin console. + * @param string $client_id Docusign OAuth Client Id(AKA Integrator Key) + * @param string $client_secret The secret key you generated when you set up the integration in Docusign Admin console. * @param string $code The authorization code * * @return array @@ -477,7 +480,7 @@ public function generateAccessToken($client_id = null, $client_secret = null, $c if (!$client_id) { throw new \InvalidArgumentException('Missing the required parameter $client_id when calling generateAccessToken'); } - if (!$client_secret || !$code) { + if (!$client_secret) { throw new \InvalidArgumentException('Missing the required parameter $client_secret when calling generateAccessToken'); } if (!$code) { @@ -500,11 +503,50 @@ public function generateAccessToken($client_id = null, $client_secret = null, $c $this->config->addDefaultHeader("Authorization", "{$response->token_type} {$response->access_token}"); return [$this->getSerializer()->deserialize($response, '\DocuSign\Admin\Client\Auth\OAuthToken', $httpHeader), $statusCode, $httpHeader]; } + + /** + * Refresh Access Token + * + * @param string $client_id Docusign OAuth Client Id(AKA Integrator Key) + * @param string $client_secret The secret key you generated when you set up the integration in Docusign Admin console. + * @param string $code The authorization code + * + * @return array + * @throws ApiException + * @throws InvalidArgumentException + */ + public function refreshAccessToken($client_id = null, $client_secret = null, $refresh_token = null) + { + if (!$client_id) { + throw new \InvalidArgumentException('Missing the required parameter $client_id when calling refreshAccessToken'); + } + if (!$client_secret) { + throw new \InvalidArgumentException('Missing the required parameter $client_secret when calling refreshAccessToken'); + } + if (!$refresh_token) { + throw new \InvalidArgumentException('Missing the required parameter $refresh_token when calling refreshAccessToken'); + } + $resourcePath = "/oauth/token"; + $queryParams = []; + $integrator_and_secret_key = "Basic " . utf8_decode(base64_encode("{$client_id}:{$client_secret}")); + $headers = [ + "Authorization" => $integrator_and_secret_key, + "Content-Type" => "application/x-www-form-urlencoded", + ]; + $postData = [ + "grant_type" => "refresh_token", + "refresh_token" => $refresh_token, + ]; + list($response, $statusCode, $httpHeader) = $this->callApi($resourcePath, self::$POST, $queryParams, $postData, $headers, null, null, true); + if (isset($response->access_token)) + $this->config->addDefaultHeader("Authorization", "{$response->token_type} {$response->access_token}"); + return [$this->getSerializer()->deserialize($response, '\DocuSign\Admin\Client\Auth\OAuthToken', $httpHeader), $statusCode, $httpHeader]; + } /** * Request JWT User Token * - * @param string $client_id DocuSign OAuth Client Id(AKA Integrator Key) + * @param string $client_id Docusign OAuth Client Id(AKA Integrator Key) * @param string $rsa_private_key the RSA private key * @param string|string[] $scopes array optional The list of requested scopes may include (but not limited to) You can also pass any advanced scope. * @param string $user_id @@ -543,7 +585,15 @@ public function requestJWTUserToken($client_id, $user_id, $rsa_private_key, $sco "scope" => is_array($scopes)?implode(" ", $scopes): $scopes ]; - $jwt = JWT::encode($claim, $rsa_private_key, 'RS256'); + $private_key = openssl_pkey_get_private($rsa_private_key); + if ($private_key === false && is_file($rsa_private_key)) { + $private_key = openssl_pkey_get_private('file://' . $rsa_private_key); + } + if ($private_key === false) { + throw new \InvalidArgumentException('Invalid RSA private key provided when calling requestJWTUserToken'); + } + + $jwt = (new JWT($private_key, 'RS256'))->encode($claim); $resourcePath = "/oauth/token"; $queryParams = []; @@ -565,7 +615,7 @@ public function requestJWTUserToken($client_id, $user_id, $rsa_private_key, $sco /** * Request JWT Application Token * - * @param string $client_id DocuSign OAuth Client Id(AKA Integrator Key) + * @param string $client_id Docusign OAuth Client Id(AKA Integrator Key) * @param string $rsa_private_key the RSA private key * @param string|string[] $scopes array optional The list of requested scopes may include (but not limited to) You can also pass any advanced scope. * @param int $expires_in int Number of minutes token will be valid @@ -599,7 +649,15 @@ public function requestJWTApplicationToken($client_id, $rsa_private_key, $scopes "scope" => is_array($scopes)?implode(" ", $scopes):$scopes ]; - $jwt = JWT::encode($claim, $rsa_private_key, 'RS256'); + $private_key = openssl_pkey_get_private($rsa_private_key); + if ($private_key === false && is_file($rsa_private_key)) { + $private_key = openssl_pkey_get_private('file://' . $rsa_private_key); + } + if ($private_key === false) { + throw new \InvalidArgumentException('Invalid RSA private key provided when calling requestJWTApplicationToken'); + } + + $jwt = (new JWT($private_key, 'RS256'))->encode($claim); $resourcePath = "/oauth/token"; $queryParams = []; @@ -654,4 +712,4 @@ public function getUserInfo($access_token) $httpHeader ]; } -} +} \ No newline at end of file diff --git a/src/Configuration.php b/src/Configuration.php index b7f294f..2496bcb 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -111,7 +111,7 @@ class Configuration * * @var string */ - protected $userAgent = 'Swagger-Codegen/v2.1/2.1.0/php/' . PHP_VERSION; + protected $userAgent = 'Swagger-Codegen/v2.1/2.1.1/php/' . PHP_VERSION; /** * Debug switch (default set to false) @@ -774,7 +774,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' OpenAPI Spec Version: v2.1' . PHP_EOL; - $report .= ' SDK Package Version: 2.1.0' . PHP_EOL; + $report .= ' SDK Package Version: 2.1.1' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/src/Model/UpdateUsersRequest.php b/src/Model/UpdateUsersRequest.php index aec571f..dc39883 100644 --- a/src/Model/UpdateUsersRequest.php +++ b/src/Model/UpdateUsersRequest.php @@ -59,7 +59,8 @@ class UpdateUsersRequest implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerTypes = [ - 'users' => '\DocuSign\Admin\Model\UpdateUserRequest[]' + 'users' => '\DocuSign\Admin\Model\UpdateUserRequest[]', + 'auto_activate_memberships_on_reactivation' => '?bool' ]; /** @@ -68,7 +69,8 @@ class UpdateUsersRequest implements ModelInterface, ArrayAccess * @var string[] */ protected static $swaggerFormats = [ - 'users' => null + 'users' => null, + 'auto_activate_memberships_on_reactivation' => null ]; /** @@ -98,7 +100,8 @@ public static function swaggerFormats() * @var string[] */ protected static $attributeMap = [ - 'users' => 'users' + 'users' => 'users', + 'auto_activate_memberships_on_reactivation' => 'auto_activate_memberships_on_reactivation' ]; /** @@ -107,7 +110,8 @@ public static function swaggerFormats() * @var string[] */ protected static $setters = [ - 'users' => 'setUsers' + 'users' => 'setUsers', + 'auto_activate_memberships_on_reactivation' => 'setAutoActivateMembershipsOnReactivation' ]; /** @@ -116,7 +120,8 @@ public static function swaggerFormats() * @var string[] */ protected static $getters = [ - 'users' => 'getUsers' + 'users' => 'getUsers', + 'auto_activate_memberships_on_reactivation' => 'getAutoActivateMembershipsOnReactivation' ]; /** @@ -180,6 +185,7 @@ public function getModelName() public function __construct(?array $data = null) { $this->container['users'] = isset($data['users']) ? $data['users'] : null; + $this->container['auto_activate_memberships_on_reactivation'] = isset($data['auto_activate_memberships_on_reactivation']) ? $data['auto_activate_memberships_on_reactivation'] : null; } /** @@ -229,6 +235,30 @@ public function setUsers($users) return $this; } + + /** + * Gets auto_activate_memberships_on_reactivation + * + * @return ?bool + */ + public function getAutoActivateMembershipsOnReactivation() + { + return $this->container['auto_activate_memberships_on_reactivation']; + } + + /** + * Sets auto_activate_memberships_on_reactivation + * + * @param ?bool $auto_activate_memberships_on_reactivation When set to **true**, the user's memberships will be automatically activated on reactivation. + * + * @return $this + */ + public function setAutoActivateMembershipsOnReactivation($auto_activate_memberships_on_reactivation) + { + $this->container['auto_activate_memberships_on_reactivation'] = $auto_activate_memberships_on_reactivation; + + return $this; + } /** * Returns true if offset exists. False otherwise. *