diff --git a/README.md b/README.md index eb3640f0..a5f343b7 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ This client has the following external dependencies: ### Launchers -DocuSign provides a sample application code referred to as a [Launcher](https://github.com/docusign/code-examples-php). The Launcher contains a set of 31 common use cases and associated source files. These examples use either DocuSign's [Authorization Code Grant](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant) or [JSON Web Tokens (JWT)](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-jsonwebtoken) flows. +DocuSign provides a sample application referred to as a [Launcher](https://github.com/docusign/eg-03-php-auth-code-grant). The Launcher contains a set of 18 common use cases and associated source files. These examples use DocuSign's [Authorization Code Grant](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant) flow. ## Proof-of-concept applications @@ -76,9 +76,3 @@ The DocuSign PHP Client is licensed under the [MIT License](https://github.com/d [travis-image]: https://img.shields.io/travis/docusign/docusign-php-client.svg?style=flat [travis-url]: https://travis-ci.org/docusign/docusign-php-client - -### Additional Resources -* [DocuSign Developer Center](https://developers.docusign.com) -* [DocuSign API on Twitter](https://twitter.com/docusignapi) -* [DocuSign For Developers on LinkedIn](https://www.linkedin.com/showcase/docusign-for-developers/) -* [DocuSign For Developers on YouTube](https://www.youtube.com/channel/UCJSJ2kMs_qeQotmw4-lX2NQ) \ No newline at end of file diff --git a/src/Api/TrustServiceProvidersApi.php b/src/Api/TrustServiceProvidersApi.php new file mode 100644 index 00000000..daa19f99 --- /dev/null +++ b/src/Api/TrustServiceProvidersApi.php @@ -0,0 +1,187 @@ +apiClient = $apiClient; + } + + /** + * Get API client + * + * @return \DocuSign\eSign\Client\ApiClient get the API client + */ + public function getApiClient() + { + return $this->apiClient; + } + + /** + * Set the API client + * + * @param \DocuSign\eSign\Client\ApiClient $apiClient set the API client + * + * @return TrustServiceProvidersApi + */ + public function setApiClient(\DocuSign\eSign\Client\ApiClient $apiClient) + { + $this->apiClient = $apiClient; + return $this; + } + + /** + * Operation getSealProviders + * + * Returns Account available seals for specified account. + * + * @param string $account_id The external account number (int) or account ID Guid. + * @throws \DocuSign\eSign\Client\ApiException on non-2xx response + * @return \DocuSign\eSign\Model\AccountSeals + */ + public function getSealProviders($account_id) + { + list($response) = $this->getSealProvidersWithHttpInfo($account_id); + return $response; + } + + /** + * Operation getSealProvidersWithHttpInfo + * + * Returns Account available seals for specified account. + * + * @param string $account_id The external account number (int) or account ID Guid. + * @throws \DocuSign\eSign\Client\ApiException on non-2xx response + * @return array of \DocuSign\eSign\Model\AccountSeals, HTTP status code, HTTP response headers (array of strings) + */ + public function getSealProvidersWithHttpInfo($account_id) + { + // verify the required parameter 'account_id' is set + if ($account_id === null) { + throw new \InvalidArgumentException('Missing the required parameter $account_id when calling getSealProviders'); + } + // parse inputs + $resourcePath = "/v2.1/accounts/{accountId}/seals"; + $httpBody = ''; + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); + + + // path params + if ($account_id !== null) { + $resourcePath = str_replace( + "{" . "accountId" . "}", + $this->apiClient->getSerializer()->toPathValue($account_id), + $resourcePath + ); + } + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // this endpoint requires OAuth (access token) + if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { + $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, + 'GET', + $queryParams, + $httpBody, + $headerParams, + '\DocuSign\eSign\Model\AccountSeals', + '/v2.1/accounts/{accountId}/seals' + ); + + return [$this->apiClient->getSerializer()->deserialize($response, '\DocuSign\eSign\Model\AccountSeals', $httpHeader), $statusCode, $httpHeader]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\DocuSign\eSign\Model\AccountSeals', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + case 400: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\DocuSign\eSign\Model\ErrorDetails', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } +} diff --git a/src/Model/BulkSendResponse.php b/src/Model/BulkSendResponse.php index 3c9dbda5..9ab66151 100644 --- a/src/Model/BulkSendResponse.php +++ b/src/Model/BulkSendResponse.php @@ -58,9 +58,12 @@ class BulkSendResponse implements ModelInterface, ArrayAccess */ protected static $swaggerTypes = [ 'batch_id' => 'string', + 'batch_size' => 'string', 'envelope_or_template_id' => 'string', 'error_details' => 'string[]', - 'errors' => 'string[]' + 'errors' => 'string[]', + 'queue_limit' => 'string', + 'total_queued' => 'string' ]; /** @@ -70,9 +73,12 @@ class BulkSendResponse implements ModelInterface, ArrayAccess */ protected static $swaggerFormats = [ 'batch_id' => null, + 'batch_size' => null, 'envelope_or_template_id' => null, 'error_details' => null, - 'errors' => null + 'errors' => null, + 'queue_limit' => null, + 'total_queued' => null ]; /** @@ -103,9 +109,12 @@ public static function swaggerFormats() */ protected static $attributeMap = [ 'batch_id' => 'batchId', + 'batch_size' => 'batchSize', 'envelope_or_template_id' => 'envelopeOrTemplateId', 'error_details' => 'errorDetails', - 'errors' => 'errors' + 'errors' => 'errors', + 'queue_limit' => 'queueLimit', + 'total_queued' => 'totalQueued' ]; /** @@ -115,9 +124,12 @@ public static function swaggerFormats() */ protected static $setters = [ 'batch_id' => 'setBatchId', + 'batch_size' => 'setBatchSize', 'envelope_or_template_id' => 'setEnvelopeOrTemplateId', 'error_details' => 'setErrorDetails', - 'errors' => 'setErrors' + 'errors' => 'setErrors', + 'queue_limit' => 'setQueueLimit', + 'total_queued' => 'setTotalQueued' ]; /** @@ -127,9 +139,12 @@ public static function swaggerFormats() */ protected static $getters = [ 'batch_id' => 'getBatchId', + 'batch_size' => 'getBatchSize', 'envelope_or_template_id' => 'getEnvelopeOrTemplateId', 'error_details' => 'getErrorDetails', - 'errors' => 'getErrors' + 'errors' => 'getErrors', + 'queue_limit' => 'getQueueLimit', + 'total_queued' => 'getTotalQueued' ]; /** @@ -193,9 +208,12 @@ public function getModelName() public function __construct(array $data = null) { $this->container['batch_id'] = isset($data['batch_id']) ? $data['batch_id'] : null; + $this->container['batch_size'] = isset($data['batch_size']) ? $data['batch_size'] : null; $this->container['envelope_or_template_id'] = isset($data['envelope_or_template_id']) ? $data['envelope_or_template_id'] : null; $this->container['error_details'] = isset($data['error_details']) ? $data['error_details'] : null; $this->container['errors'] = isset($data['errors']) ? $data['errors'] : null; + $this->container['queue_limit'] = isset($data['queue_limit']) ? $data['queue_limit'] : null; + $this->container['total_queued'] = isset($data['total_queued']) ? $data['total_queued'] : null; } /** @@ -246,6 +264,30 @@ public function setBatchId($batch_id) return $this; } + /** + * Gets batch_size + * + * @return string + */ + public function getBatchSize() + { + return $this->container['batch_size']; + } + + /** + * Sets batch_size + * + * @param string $batch_size + * + * @return $this + */ + public function setBatchSize($batch_size) + { + $this->container['batch_size'] = $batch_size; + + return $this; + } + /** * Gets envelope_or_template_id * @@ -317,6 +359,54 @@ public function setErrors($errors) return $this; } + + /** + * Gets queue_limit + * + * @return string + */ + public function getQueueLimit() + { + return $this->container['queue_limit']; + } + + /** + * Sets queue_limit + * + * @param string $queue_limit + * + * @return $this + */ + public function setQueueLimit($queue_limit) + { + $this->container['queue_limit'] = $queue_limit; + + return $this; + } + + /** + * Gets total_queued + * + * @return string + */ + public function getTotalQueued() + { + return $this->container['total_queued']; + } + + /** + * Sets total_queued + * + * @param string $total_queued + * + * @return $this + */ + public function setTotalQueued($total_queued) + { + $this->container['total_queued'] = $total_queued; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/ObjectSerializer.php b/src/ObjectSerializer.php index 2e98bc99..8275a890 100644 --- a/src/ObjectSerializer.php +++ b/src/ObjectSerializer.php @@ -282,8 +282,13 @@ public static function deserialize($data, $class, $httpHeaders = null) } $file = fopen($filename, 'w'); - while ($chunk = $data->read(200)) { - fwrite($file, $chunk); + if(is_string($data)){ + fwrite($file, $data); + } + else{ + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } } fclose($file); diff --git a/test/UnitTests.php b/test/UnitTests.php index 1b6ed165..af5fde4c 100644 --- a/test/UnitTests.php +++ b/test/UnitTests.php @@ -313,8 +313,8 @@ public function testListDocumentsAndDownload($testConfig) foreach($docsList->getEnvelopeDocuments() as $document) { $this->assertNotEmpty($document->getDocumentId()); - //$file = $envelopeApi->getDocument($testConfig->getAccountId(), $testConfig->getEnvelopeId(), $document->getDocumentId()); - //$this->assertNotEmpty($file); + $file = $envelopeApi->getDocument($testConfig->getAccountId(), $document->getDocumentId(), $testConfig->getEnvelopeId()); + $this->assertNotEmpty($file); } }