Skip to content
Open
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
3 changes: 1 addition & 2 deletions .swagger-codegen-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ autoload.php
phpunit.xml.dist
docs/
test/
src/ApiClient.php
src/ApiException.php
src/Client/
src/Client/Auth/**
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/Api/BulkExportsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
108 changes: 83 additions & 25 deletions src/Client/ApiClient.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/**
* ApiClient
*
* PHP version 5
* PHP version 7.4
*
* @category Class
* @package DocuSign\Admin
Expand All @@ -11,13 +12,14 @@
*/

/**
* DocuSign REST API
* Docusign Admin API
*
* The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
* An API for an organization administrator to manage organizations, accounts and users
*
* OpenAPI spec version: v2.1
* Contact: devcenter@docusign.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
* Swagger Codegen version: 2.4.21
*/

/**
Expand All @@ -32,15 +34,15 @@
use \DocuSign\Admin\Configuration;
use \DocuSign\Admin\ObjectSerializer;
use SebastianBergmann\RecursionContext\InvalidArgumentException;
use Firebase\JWT\JWT;

use Ahc\Jwt\JWT;

/**
* ApiClient Class Doc Comment
*
* @category Class
* @package DocuSign\Admin
* @author Swagger Codegen team
* @author Swagger Codegen team <apihelp@docusign.com>
* @license The Docusign PHP Client SDK is licensed under the MIT License.
* @link https://github.com/swagger-api/swagger-codegen
*/
class ApiClient
Expand All @@ -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";
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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)
{
Expand All @@ -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);

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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
Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -654,4 +712,4 @@ public function getUserInfo($access_token)
$httpHeader
];
}
}
}
4 changes: 2 additions & 2 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Loading