Skip to content

Commit a03158c

Browse files
authored
Added 'separete_files' GET parameter for document download endpoint; Added 'id' field to linked_objects (#8)
1 parent 93e4086 commit a03158c

File tree

7 files changed

+99
-32
lines changed

7 files changed

+99
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ or add the following to `composer.json`:
1919
```json
2020
{
2121
"require": {
22-
"pandadoc/php-client": "5.0.1"
22+
"pandadoc/php-client": "5.1.0"
2323
}
2424
}
2525
```

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pandadoc/php-client",
3-
"version": "5.0.1",
3+
"version": "5.1.0",
44
"description": "The Official PandaDoc PHP client SDK",
55
"keywords": [
66
"openapi",

docs/Api/DocumentsApi.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ Name | Type | Description | Notes
465465
## `downloadDocument()`
466466

467467
```php
468-
downloadDocument($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText): \SplFileObject
468+
downloadDocument($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText, $separateFiles): \SplFileObject
469469
```
470470

471471
Document download
@@ -497,9 +497,10 @@ $watermarkColor = #FF5733; // string | HEX code (for example `#FF5733`).
497497
$watermarkFontSize = 12; // int | Font size of the watermark.
498498
$watermarkOpacity = 0.5; // float | In range 0.0-1.0
499499
$watermarkText = John Doe inc.; // string | Specify watermark text.
500+
$separateFiles = True; // bool | Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1.
500501

501502
try {
502-
$result = $apiInstance->downloadDocument($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText);
503+
$result = $apiInstance->downloadDocument($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText, $separateFiles);
503504
print_r($result);
504505
} catch (Exception $e) {
505506
echo 'Exception when calling DocumentsApi->downloadDocument: ', $e->getMessage(), PHP_EOL;
@@ -515,6 +516,7 @@ Name | Type | Description | Notes
515516
**watermarkFontSize** | **int**| Font size of the watermark. | [optional]
516517
**watermarkOpacity** | **float**| In range 0.0-1.0 | [optional]
517518
**watermarkText** | **string**| Specify watermark text. | [optional]
519+
**separateFiles** | **bool**| Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. | [optional]
518520

519521
### Return type
520522

@@ -535,7 +537,7 @@ Name | Type | Description | Notes
535537
## `downloadProtectedDocument()`
536538

537539
```php
538-
downloadProtectedDocument($id): \SplFileObject
540+
downloadProtectedDocument($id, $separateFiles): \SplFileObject
539541
```
540542

541543
Download document protected
@@ -565,9 +567,10 @@ $apiInstance = new PandaDoc\Client\Api\DocumentsApi(
565567
$config
566568
);
567569
$id = Mebvyy3NGsGBnY2rPLkH84; // string | Specify document ID.
570+
$separateFiles = True; // bool | Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1.
568571

569572
try {
570-
$result = $apiInstance->downloadProtectedDocument($id);
573+
$result = $apiInstance->downloadProtectedDocument($id, $separateFiles);
571574
print_r($result);
572575
} catch (Exception $e) {
573576
echo 'Exception when calling DocumentsApi->downloadProtectedDocument: ', $e->getMessage(), PHP_EOL;
@@ -579,6 +582,7 @@ try {
579582
Name | Type | Description | Notes
580583
------------- | ------------- | ------------- | -------------
581584
**id** | **string**| Specify document ID. |
585+
**separateFiles** | **bool**| Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. | [optional]
582586

583587
### Return type
584588

docs/Model/DocumentDetailsResponseLinkedObjects.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ Name | Type | Description | Notes
77
**provider** | **string** | | [optional]
88
**entityType** | **string** | | [optional]
99
**entityId** | **string** | | [optional]
10+
**id** | **string** | | [optional]
1011

1112
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

src/Api/DocumentsApi.php

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,14 +2480,15 @@ public function detailsDocumentRequest($id)
24802480
* @param int $watermarkFontSize Font size of the watermark. (optional)
24812481
* @param float $watermarkOpacity In range 0.0-1.0 (optional)
24822482
* @param string $watermarkText Specify watermark text. (optional)
2483+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
24832484
*
24842485
* @throws \PandaDoc\Client\ApiException on non-2xx response
24852486
* @throws \InvalidArgumentException
24862487
* @return \SplFileObject|object|object|object|object|object|object
24872488
*/
2488-
public function downloadDocument($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null)
2489+
public function downloadDocument($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null, $separateFiles = null)
24892490
{
2490-
list($response) = $this->downloadDocumentWithHttpInfo($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText);
2491+
list($response) = $this->downloadDocumentWithHttpInfo($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText, $separateFiles);
24912492
return $response;
24922493
}
24932494

@@ -2501,14 +2502,15 @@ public function downloadDocument($id, $watermarkColor = null, $watermarkFontSize
25012502
* @param int $watermarkFontSize Font size of the watermark. (optional)
25022503
* @param float $watermarkOpacity In range 0.0-1.0 (optional)
25032504
* @param string $watermarkText Specify watermark text. (optional)
2505+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
25042506
*
25052507
* @throws \PandaDoc\Client\ApiException on non-2xx response
25062508
* @throws \InvalidArgumentException
25072509
* @return array of \SplFileObject|object|object|object|object|object|object, HTTP status code, HTTP response headers (array of strings)
25082510
*/
2509-
public function downloadDocumentWithHttpInfo($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null)
2511+
public function downloadDocumentWithHttpInfo($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null, $separateFiles = null)
25102512
{
2511-
$request = $this->downloadDocumentRequest($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText);
2513+
$request = $this->downloadDocumentRequest($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText, $separateFiles);
25122514

25132515
try {
25142516
$options = $this->createHttpClientOption();
@@ -2718,13 +2720,14 @@ public function downloadDocumentWithHttpInfo($id, $watermarkColor = null, $water
27182720
* @param int $watermarkFontSize Font size of the watermark. (optional)
27192721
* @param float $watermarkOpacity In range 0.0-1.0 (optional)
27202722
* @param string $watermarkText Specify watermark text. (optional)
2723+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
27212724
*
27222725
* @throws \InvalidArgumentException
27232726
* @return \GuzzleHttp\Promise\PromiseInterface
27242727
*/
2725-
public function downloadDocumentAsync($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null)
2728+
public function downloadDocumentAsync($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null, $separateFiles = null)
27262729
{
2727-
return $this->downloadDocumentAsyncWithHttpInfo($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText)
2730+
return $this->downloadDocumentAsyncWithHttpInfo($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText, $separateFiles)
27282731
->then(
27292732
function ($response) {
27302733
return $response[0];
@@ -2742,14 +2745,15 @@ function ($response) {
27422745
* @param int $watermarkFontSize Font size of the watermark. (optional)
27432746
* @param float $watermarkOpacity In range 0.0-1.0 (optional)
27442747
* @param string $watermarkText Specify watermark text. (optional)
2748+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
27452749
*
27462750
* @throws \InvalidArgumentException
27472751
* @return \GuzzleHttp\Promise\PromiseInterface
27482752
*/
2749-
public function downloadDocumentAsyncWithHttpInfo($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null)
2753+
public function downloadDocumentAsyncWithHttpInfo($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null, $separateFiles = null)
27502754
{
27512755
$returnType = '\SplFileObject';
2752-
$request = $this->downloadDocumentRequest($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText);
2756+
$request = $this->downloadDocumentRequest($id, $watermarkColor, $watermarkFontSize, $watermarkOpacity, $watermarkText, $separateFiles);
27532757

27542758
return $this->client
27552759
->sendAsync($request, $this->createHttpClientOption())
@@ -2792,11 +2796,12 @@ function ($exception) {
27922796
* @param int $watermarkFontSize Font size of the watermark. (optional)
27932797
* @param float $watermarkOpacity In range 0.0-1.0 (optional)
27942798
* @param string $watermarkText Specify watermark text. (optional)
2799+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
27952800
*
27962801
* @throws \InvalidArgumentException
27972802
* @return \GuzzleHttp\Psr7\Request
27982803
*/
2799-
public function downloadDocumentRequest($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null)
2804+
public function downloadDocumentRequest($id, $watermarkColor = null, $watermarkFontSize = null, $watermarkOpacity = null, $watermarkText = null, $separateFiles = null)
28002805
{
28012806
// verify the required parameter 'id' is set
28022807
if ($id === null || (is_array($id) && count($id) === 0)) {
@@ -2856,6 +2861,17 @@ public function downloadDocumentRequest($id, $watermarkColor = null, $watermarkF
28562861
$queryParams['watermark_text'] = $watermarkText;
28572862
}
28582863
}
2864+
// query params
2865+
if ($separateFiles !== null) {
2866+
if('form' === 'form' && is_array($separateFiles)) {
2867+
foreach($separateFiles as $key => $value) {
2868+
$queryParams[$key] = $value;
2869+
}
2870+
}
2871+
else {
2872+
$queryParams['separate_files'] = $separateFiles;
2873+
}
2874+
}
28592875

28602876

28612877
// path params
@@ -2940,14 +2956,15 @@ public function downloadDocumentRequest($id, $watermarkColor = null, $watermarkF
29402956
* Download document protected
29412957
*
29422958
* @param string $id Specify document ID. (required)
2959+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
29432960
*
29442961
* @throws \PandaDoc\Client\ApiException on non-2xx response
29452962
* @throws \InvalidArgumentException
29462963
* @return \SplFileObject|object|object|object|object|object
29472964
*/
2948-
public function downloadProtectedDocument($id)
2965+
public function downloadProtectedDocument($id, $separateFiles = null)
29492966
{
2950-
list($response) = $this->downloadProtectedDocumentWithHttpInfo($id);
2967+
list($response) = $this->downloadProtectedDocumentWithHttpInfo($id, $separateFiles);
29512968
return $response;
29522969
}
29532970

@@ -2957,14 +2974,15 @@ public function downloadProtectedDocument($id)
29572974
* Download document protected
29582975
*
29592976
* @param string $id Specify document ID. (required)
2977+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
29602978
*
29612979
* @throws \PandaDoc\Client\ApiException on non-2xx response
29622980
* @throws \InvalidArgumentException
29632981
* @return array of \SplFileObject|object|object|object|object|object, HTTP status code, HTTP response headers (array of strings)
29642982
*/
2965-
public function downloadProtectedDocumentWithHttpInfo($id)
2983+
public function downloadProtectedDocumentWithHttpInfo($id, $separateFiles = null)
29662984
{
2967-
$request = $this->downloadProtectedDocumentRequest($id);
2985+
$request = $this->downloadProtectedDocumentRequest($id, $separateFiles);
29682986

29692987
try {
29702988
$options = $this->createHttpClientOption();
@@ -3150,13 +3168,14 @@ public function downloadProtectedDocumentWithHttpInfo($id)
31503168
* Download document protected
31513169
*
31523170
* @param string $id Specify document ID. (required)
3171+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
31533172
*
31543173
* @throws \InvalidArgumentException
31553174
* @return \GuzzleHttp\Promise\PromiseInterface
31563175
*/
3157-
public function downloadProtectedDocumentAsync($id)
3176+
public function downloadProtectedDocumentAsync($id, $separateFiles = null)
31583177
{
3159-
return $this->downloadProtectedDocumentAsyncWithHttpInfo($id)
3178+
return $this->downloadProtectedDocumentAsyncWithHttpInfo($id, $separateFiles)
31603179
->then(
31613180
function ($response) {
31623181
return $response[0];
@@ -3170,14 +3189,15 @@ function ($response) {
31703189
* Download document protected
31713190
*
31723191
* @param string $id Specify document ID. (required)
3192+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
31733193
*
31743194
* @throws \InvalidArgumentException
31753195
* @return \GuzzleHttp\Promise\PromiseInterface
31763196
*/
3177-
public function downloadProtectedDocumentAsyncWithHttpInfo($id)
3197+
public function downloadProtectedDocumentAsyncWithHttpInfo($id, $separateFiles = null)
31783198
{
31793199
$returnType = '\SplFileObject';
3180-
$request = $this->downloadProtectedDocumentRequest($id);
3200+
$request = $this->downloadProtectedDocumentRequest($id, $separateFiles);
31813201

31823202
return $this->client
31833203
->sendAsync($request, $this->createHttpClientOption())
@@ -3216,11 +3236,12 @@ function ($exception) {
32163236
* Create request for operation 'downloadProtectedDocument'
32173237
*
32183238
* @param string $id Specify document ID. (required)
3239+
* @param bool $separateFiles Set as `true` if you want to receive a zip file with all documents in separate when document transaction contains more than 1. (optional)
32193240
*
32203241
* @throws \InvalidArgumentException
32213242
* @return \GuzzleHttp\Psr7\Request
32223243
*/
3223-
public function downloadProtectedDocumentRequest($id)
3244+
public function downloadProtectedDocumentRequest($id, $separateFiles = null)
32243245
{
32253246
// verify the required parameter 'id' is set
32263247
if ($id === null || (is_array($id) && count($id) === 0)) {
@@ -3236,6 +3257,17 @@ public function downloadProtectedDocumentRequest($id)
32363257
$httpBody = '';
32373258
$multipart = false;
32383259

3260+
// query params
3261+
if ($separateFiles !== null) {
3262+
if('form' === 'form' && is_array($separateFiles)) {
3263+
foreach($separateFiles as $key => $value) {
3264+
$queryParams[$key] = $value;
3265+
}
3266+
}
3267+
else {
3268+
$queryParams['separate_files'] = $separateFiles;
3269+
}
3270+
}
32393271

32403272

32413273
// path params

src/Configuration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class Configuration
8888
*
8989
* @var string
9090
*/
91-
protected $userAgent = 'pandadoc_php_client/5.0.1';
91+
protected $userAgent = 'pandadoc_php_client/5.1.0';
9292

9393
/**
9494
* Debug switch (default set to false)
@@ -396,8 +396,8 @@ public static function toDebugReport()
396396
$report = 'PHP SDK (PandaDoc\Client) Debug Report:' . PHP_EOL;
397397
$report .= ' OS: ' . php_uname() . PHP_EOL;
398398
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
399-
$report .= ' The version of the OpenAPI document: 5.0.1' . PHP_EOL;
400-
$report .= ' SDK Package Version: 5.0.1' . PHP_EOL;
399+
$report .= ' The version of the OpenAPI document: 5.1.0' . PHP_EOL;
400+
$report .= ' SDK Package Version: 5.1.0' . PHP_EOL;
401401
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
402402

403403
return $report;

src/Model/DocumentDetailsResponseLinkedObjects.php

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class DocumentDetailsResponseLinkedObjects implements ModelInterface, ArrayAcces
5959
protected static $openAPITypes = [
6060
'provider' => 'string',
6161
'entityType' => 'string',
62-
'entityId' => 'string'
62+
'entityId' => 'string',
63+
'id' => 'string'
6364
];
6465

6566
/**
@@ -72,7 +73,8 @@ class DocumentDetailsResponseLinkedObjects implements ModelInterface, ArrayAcces
7273
protected static $openAPIFormats = [
7374
'provider' => null,
7475
'entityType' => null,
75-
'entityId' => null
76+
'entityId' => null,
77+
'id' => null
7678
];
7779

7880
/**
@@ -104,7 +106,8 @@ public static function openAPIFormats()
104106
protected static $attributeMap = [
105107
'provider' => 'provider',
106108
'entityType' => 'entity_type',
107-
'entityId' => 'entity_id'
109+
'entityId' => 'entity_id',
110+
'id' => 'id'
108111
];
109112

110113
/**
@@ -115,7 +118,8 @@ public static function openAPIFormats()
115118
protected static $setters = [
116119
'provider' => 'setProvider',
117120
'entityType' => 'setEntityType',
118-
'entityId' => 'setEntityId'
121+
'entityId' => 'setEntityId',
122+
'id' => 'setId'
119123
];
120124

121125
/**
@@ -126,7 +130,8 @@ public static function openAPIFormats()
126130
protected static $getters = [
127131
'provider' => 'getProvider',
128132
'entityType' => 'getEntityType',
129-
'entityId' => 'getEntityId'
133+
'entityId' => 'getEntityId',
134+
'id' => 'getId'
130135
];
131136

132137
/**
@@ -189,6 +194,7 @@ public function __construct(array $data = null)
189194
$this->container['provider'] = $data['provider'] ?? null;
190195
$this->container['entityType'] = $data['entityType'] ?? null;
191196
$this->container['entityId'] = $data['entityId'] ?? null;
197+
$this->container['id'] = $data['id'] ?? null;
192198
}
193199

194200
/**
@@ -286,6 +292,30 @@ public function setEntityId($entityId)
286292

287293
return $this;
288294
}
295+
296+
/**
297+
* Gets id
298+
*
299+
* @return string|null
300+
*/
301+
public function getId()
302+
{
303+
return $this->container['id'];
304+
}
305+
306+
/**
307+
* Sets id
308+
*
309+
* @param string|null $id id
310+
*
311+
* @return self
312+
*/
313+
public function setId($id)
314+
{
315+
$this->container['id'] = $id;
316+
317+
return $this;
318+
}
289319
/**
290320
* Returns true if offset exists. False otherwise.
291321
*

0 commit comments

Comments
 (0)