Skip to content

Commit

Permalink
Version 5.6.0 release (#124)
Browse files Browse the repository at this point in the history
* Version 5.6.0-v2.1-20.3.01 release

* corrected travis file

Co-authored-by: DevCenter-DocuSign <dcdev@docusign.com>
Co-authored-by: Dhaval Brahmbhatt <dhaval.brahmbhatt@dsa017178.docusignhq.com>
  • Loading branch information
3 people authored Nov 1, 2020
1 parent e7a7eaf commit 2743b1d
Show file tree
Hide file tree
Showing 8 changed files with 3,190 additions and 14 deletions.
47 changes: 47 additions & 0 deletions .swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Swagger Codegen Ignore

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

# Swagger and Git files
.swagger-codegen-ignore
git_push.sh
.gitignore
README.md
CHANGELOG.md
best_practices.md


# Project files
LICENSE
.travis.yml
.php_cs
autoload.php
composer.json

# Specific src and test files
phpunit.xml.dist
docs/
test/
src/Configuration.php
src/ApiClient.php
src/ApiException.php
src/Client/
1 change: 1 addition & 0 deletions .swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.4.13-SNAPSHOT
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file.

See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for Product Release Notes.

## [5.7.0] - eSignature API v2-20.3.01 - 2020-10-30
### Changed

* Added support for version v2-20.3.01 of the DocuSign eSignature API.
* Updated the SDK release version.

### Fixed

* Added Refresh Token
* [#121](https://github.com/docusign/docusign-php-client/issues/121) - DCM-4819
* Resolved Update Brand Resource issue
* [#52](https://github.com/docusign/docusign-python-client/issues/52) - DCM-3869

## [5.5.0] - eSignature API v2-20.3.00 - 2020-09-24
### Changed

Expand Down Expand Up @@ -80,4 +93,4 @@ See [DocuSign Support Center](https://support.docusign.com/en/releasenotes/) for

## [2.0.0] - New shiny PHP client - 2017-12-05

## [1.0.0] - Old legacy version - 2016-02-18
## [1.0.0] - Old legacy version - 2016-02-18
40 changes: 28 additions & 12 deletions src/Api/AccountsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ public function createAccountSignaturesWithHttpInfo($account_id, $account_signat
*
* Creates one or more brand profile files for the account.
*
* @param string $account_id The external account number (int) or account ID Guid.
* @param string $account_id The external account number (int) or account ID GUID.
* @param \DocuSign\eSign\Model\Brand $brand (optional)
* @throws \DocuSign\eSign\Client\ApiException on non-2xx response
* @return \DocuSign\eSign\Model\BrandsResponse
Expand All @@ -1342,7 +1342,7 @@ public function createBrand($account_id, $brand = null)
*
* Creates one or more brand profile files for the account.
*
* @param string $account_id The external account number (int) or account ID Guid.
* @param string $account_id The external account number (int) or account ID GUID.
* @param \DocuSign\eSign\Model\Brand $brand (optional)
* @throws \DocuSign\eSign\Client\ApiException on non-2xx response
* @return array of \DocuSign\eSign\Model\BrandsResponse, HTTP status code, HTTP response headers (array of strings)
Expand Down Expand Up @@ -7439,15 +7439,16 @@ public function updateBrandLogoByTypeWithHttpInfo($account_id, $brand_id, $logo_
*
* Uploads a branding resource file.
*
* @param string $account_id The external account number (int) or account ID Guid.
* @param string $brand_id The unique identifier of a brand.
* @param string $resource_content_type
* @param string $account_id The external account number (int) or account ID GUID.
* @param string $brand_id The id of the brand.
* @param string $resource_content_type The type of brand resource file that you are updating. Valid values are: - &#x60;sending&#x60; - &#x60;signing&#x60; - &#x60;email&#x60; - &#x60;signing_captive&#x60;
* @param \SplFileObject $file_xml Brand resource XML file. (required)
* @throws \DocuSign\eSign\Client\ApiException on non-2xx response
* @return \DocuSign\eSign\Model\BrandResources
*/
public function updateBrandResourcesByContentType($account_id, $brand_id, $resource_content_type)
public function updateBrandResourcesByContentType($account_id, $brand_id, $resource_content_type, $file_xml)
{
list($response) = $this->updateBrandResourcesByContentTypeWithHttpInfo($account_id, $brand_id, $resource_content_type);
list($response) = $this->updateBrandResourcesByContentTypeWithHttpInfo($account_id, $brand_id, $resource_content_type, $file_xml);
return $response;
}

Expand All @@ -7456,13 +7457,14 @@ public function updateBrandResourcesByContentType($account_id, $brand_id, $resou
*
* Uploads a branding resource file.
*
* @param string $account_id The external account number (int) or account ID Guid.
* @param string $brand_id The unique identifier of a brand.
* @param string $resource_content_type
* @param string $account_id The external account number (int) or account ID GUID.
* @param string $brand_id The id of the brand.
* @param string $resource_content_type The type of brand resource file that you are updating. Valid values are: - &#x60;sending&#x60; - &#x60;signing&#x60; - &#x60;email&#x60; - &#x60;signing_captive&#x60;
* @param \SplFileObject $file_xml Brand resource XML file. (required)
* @throws \DocuSign\eSign\Client\ApiException on non-2xx response
* @return array of \DocuSign\eSign\Model\BrandResources, HTTP status code, HTTP response headers (array of strings)
*/
public function updateBrandResourcesByContentTypeWithHttpInfo($account_id, $brand_id, $resource_content_type)
public function updateBrandResourcesByContentTypeWithHttpInfo($account_id, $brand_id, $resource_content_type, $file_xml)
{
// verify the required parameter 'account_id' is set
if ($account_id === null) {
Expand All @@ -7476,6 +7478,10 @@ public function updateBrandResourcesByContentTypeWithHttpInfo($account_id, $bran
if ($resource_content_type === null) {
throw new \InvalidArgumentException('Missing the required parameter $resource_content_type when calling updateBrandResourcesByContentType');
}
// verify the required parameter 'file_xml' is set
if ($file_xml === null) {
throw new \InvalidArgumentException('Missing the required parameter $file_xml when calling updateBrandResourcesByContentType');
}
// parse inputs
$resourcePath = "/v2.1/accounts/{accountId}/brands/{brandId}/resources/{resourceContentType}";
$httpBody = '';
Expand All @@ -7486,7 +7492,7 @@ public function updateBrandResourcesByContentTypeWithHttpInfo($account_id, $bran
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['multipart/form-data']);


// path params
Expand Down Expand Up @@ -7516,6 +7522,16 @@ public function updateBrandResourcesByContentTypeWithHttpInfo($account_id, $bran
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);

// form params
if ($file_xml !== null) {
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
// See: https://wiki.php.net/rfc/curl-file-upload
if (function_exists('curl_file_create')) {
$formParams['file.xml'] = curl_file_create($this->apiClient->getSerializer()->toFormValue($file_xml));
} else {
$formParams['file.xml'] = '@' . $this->apiClient->getSerializer()->toFormValue($file_xml);
}
}

// for model (json/xml)
if (isset($_tempBody)) {
Expand Down
54 changes: 53 additions & 1 deletion src/Client/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header
$postData = json_encode(ObjectSerializer::sanitizeForSerialization($postData));
}

if (in_array('Content-Type: multipart/form-data', $headers, true))
{
foreach($postData as $property => $value)
{
if($postData[$property] instanceof \CURLFile)
{
$headers[] = 'Content-Disposition: form-data; name="file"; filename="' . $postData[$property]->getFileName() . '"';
$postData = file_get_contents($postData[$property]->getFileName());
break;
}
}
}

$curl = curl_init();
// set timeout, if needed
if ($this->config->getCurlTimeout() !== 0) {
Expand Down Expand Up @@ -465,7 +478,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 @@ -488,6 +501,45 @@ 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\eSign\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\eSign\Client\Auth\OAuthToken', $httpHeader), $statusCode, $httpHeader];
}

/**
* Request JWT User Token
Expand Down
Loading

0 comments on commit 2743b1d

Please sign in to comment.