Skip to content

Commit f6e5d20

Browse files
authored
Merge pull request #8 from shotstack/output-features-update
Output features, crop and audio asset effects (includes breaking changes)
2 parents e325d6b + 94c104a commit f6e5d20

31 files changed

+2049
-525
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.idea
22
src/autoload.php
33
src/composer.json
4+
composer.lock
5+
vendor

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"minimum-stability": "dev",
77
"keywords": ["shotstack", "video", "video editing", "api"],
88
"require": {
9-
"php": ">=5.5",
9+
"php": ">=7.2",
1010
"ext-curl": "*",
1111
"ext-json": "*",
1212
"ext-mbstring": "*",

src/Api/EndpointsApi.php

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* EndpointsApi
4-
* PHP version 5
4+
* PHP version 7.2
55
*
66
* @category Class
77
* @package Shotstack\Client
@@ -17,7 +17,7 @@
1717
* The version of the OpenAPI document: v1
1818
*
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 4.2.1
20+
* OpenAPI Generator version: 5.0.0
2121
*/
2222

2323
/**
@@ -73,34 +73,34 @@ class EndpointsApi
7373
* @param ClientInterface $client
7474
* @param Configuration $config
7575
* @param HeaderSelector $selector
76-
* @param int $host_index (Optional) host index to select the list of hosts if defined in the OpenAPI spec
76+
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
7777
*/
7878
public function __construct(
7979
ClientInterface $client = null,
8080
Configuration $config = null,
8181
HeaderSelector $selector = null,
82-
$host_index = 0
82+
$hostIndex = 0
8383
) {
8484
$this->client = $client ?: new Client();
8585
$this->config = $config ?: new Configuration();
8686
$this->headerSelector = $selector ?: new HeaderSelector();
87-
$this->hostIndex = $host_index;
87+
$this->hostIndex = $hostIndex;
8888
}
8989

9090
/**
9191
* Set the host index
9292
*
93-
* @param int Host index (required)
93+
* @param int $hostIndex Host index (required)
9494
*/
95-
public function setHostIndex($host_index)
95+
public function setHostIndex($hostIndex)
9696
{
97-
$this->hostIndex = $host_index;
97+
$this->hostIndex = $hostIndex;
9898
}
9999

100100
/**
101101
* Get the host index
102102
*
103-
* @return Host index
103+
* @return int Host index
104104
*/
105105
public function getHostIndex()
106106
{
@@ -156,7 +156,7 @@ public function getRenderWithHttpInfo($id)
156156
"[{$e->getCode()}] {$e->getMessage()}",
157157
$e->getCode(),
158158
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
159-
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
159+
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
160160
);
161161
}
162162

@@ -181,7 +181,7 @@ public function getRenderWithHttpInfo($id)
181181
if ('\Shotstack\Client\Model\RenderResponse' === '\SplFileObject') {
182182
$content = $responseBody; //stream goes to serializer
183183
} else {
184-
$content = $responseBody->getContents();
184+
$content = (string) $responseBody;
185185
}
186186

187187
return [
@@ -196,7 +196,7 @@ public function getRenderWithHttpInfo($id)
196196
if ($returnType === '\SplFileObject') {
197197
$content = $responseBody; //stream goes to serializer
198198
} else {
199-
$content = $responseBody->getContents();
199+
$content = (string) $responseBody;
200200
}
201201

202202
return [
@@ -263,7 +263,7 @@ function ($response) use ($returnType) {
263263
if ($returnType === '\SplFileObject') {
264264
$content = $responseBody; //stream goes to serializer
265265
} else {
266-
$content = $responseBody->getContents();
266+
$content = (string) $responseBody;
267267
}
268268

269269
return [
@@ -297,7 +297,7 @@ function ($exception) {
297297
* @throws \InvalidArgumentException
298298
* @return \GuzzleHttp\Psr7\Request
299299
*/
300-
protected function getRenderRequest($id)
300+
public function getRenderRequest($id)
301301
{
302302
// verify the required parameter 'id' is set
303303
if ($id === null || (is_array($id) && count($id) === 0)) {
@@ -318,6 +318,7 @@ protected function getRenderRequest($id)
318318
$multipart = false;
319319

320320

321+
321322
// path params
322323
if ($id !== null) {
323324
$resourcePath = str_replace(
@@ -327,8 +328,6 @@ protected function getRenderRequest($id)
327328
);
328329
}
329330

330-
// body params
331-
$_tempBody = null;
332331

333332
if ($multipart) {
334333
$headers = $this->headerSelector->selectHeadersForMultipart(
@@ -342,21 +341,17 @@ protected function getRenderRequest($id)
342341
}
343342

344343
// for model (json/xml)
345-
if (isset($_tempBody)) {
346-
// $_tempBody is the method argument, if present
347-
if ($headers['Content-Type'] === 'application/json') {
348-
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));
349-
} else {
350-
$httpBody = $_tempBody;
351-
}
352-
} elseif (count($formParams) > 0) {
344+
if (count($formParams) > 0) {
353345
if ($multipart) {
354346
$multipartContents = [];
355347
foreach ($formParams as $formParamName => $formParamValue) {
356-
$multipartContents[] = [
357-
'name' => $formParamName,
358-
'contents' => $formParamValue
359-
];
348+
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
349+
foreach ($formParamValueItems as $formParamValueItem) {
350+
$multipartContents[] = [
351+
'name' => $formParamName,
352+
'contents' => $formParamValueItem
353+
];
354+
}
360355
}
361356
// for HTTP post (form)
362357
$httpBody = new MultipartStream($multipartContents);
@@ -439,7 +434,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
439434
"[{$e->getCode()}] {$e->getMessage()}",
440435
$e->getCode(),
441436
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
442-
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
437+
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
443438
);
444439
}
445440

@@ -464,7 +459,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
464459
if ('\Shotstack\Client\Model\QueuedResponse' === '\SplFileObject') {
465460
$content = $responseBody; //stream goes to serializer
466461
} else {
467-
$content = $responseBody->getContents();
462+
$content = (string) $responseBody;
468463
}
469464

470465
return [
@@ -479,7 +474,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
479474
if ($returnType === '\SplFileObject') {
480475
$content = $responseBody; //stream goes to serializer
481476
} else {
482-
$content = $responseBody->getContents();
477+
$content = (string) $responseBody;
483478
}
484479

485480
return [
@@ -548,7 +543,7 @@ function ($response) use ($returnType) {
548543
if ($returnType === '\SplFileObject') {
549544
$content = $responseBody; //stream goes to serializer
550545
} else {
551-
$content = $responseBody->getContents();
546+
$content = (string) $responseBody;
552547
}
553548

554549
return [
@@ -583,7 +578,7 @@ function ($exception) {
583578
* @throws \InvalidArgumentException
584579
* @return \GuzzleHttp\Psr7\Request
585580
*/
586-
protected function postRenderRequest($edit, $x_api_queue_id = null)
581+
public function postRenderRequest($edit, $x_api_queue_id = null)
587582
{
588583
// verify the required parameter 'edit' is set
589584
if ($edit === null || (is_array($edit) && count($edit) === 0)) {
@@ -599,17 +594,13 @@ protected function postRenderRequest($edit, $x_api_queue_id = null)
599594
$httpBody = '';
600595
$multipart = false;
601596

597+
602598
// header params
603599
if ($x_api_queue_id !== null) {
604600
$headerParams['x-api-queue-id'] = ObjectSerializer::toHeaderValue($x_api_queue_id);
605601
}
606602

607603

608-
// body params
609-
$_tempBody = null;
610-
if (isset($edit)) {
611-
$_tempBody = $edit;
612-
}
613604

614605
if ($multipart) {
615606
$headers = $this->headerSelector->selectHeadersForMultipart(
@@ -623,21 +614,23 @@ protected function postRenderRequest($edit, $x_api_queue_id = null)
623614
}
624615

625616
// for model (json/xml)
626-
if (isset($_tempBody)) {
627-
// $_tempBody is the method argument, if present
617+
if (isset($edit)) {
628618
if ($headers['Content-Type'] === 'application/json') {
629-
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));
619+
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($edit));
630620
} else {
631-
$httpBody = $_tempBody;
621+
$httpBody = $edit;
632622
}
633623
} elseif (count($formParams) > 0) {
634624
if ($multipart) {
635625
$multipartContents = [];
636626
foreach ($formParams as $formParamName => $formParamValue) {
637-
$multipartContents[] = [
638-
'name' => $formParamName,
639-
'contents' => $formParamValue
640-
];
627+
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
628+
foreach ($formParamValueItems as $formParamValueItem) {
629+
$multipartContents[] = [
630+
'name' => $formParamName,
631+
'contents' => $formParamValueItem
632+
];
633+
}
641634
}
642635
// for HTTP post (form)
643636
$httpBody = new MultipartStream($multipartContents);

src/ApiException.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* ApiException
4-
* PHP version 5
4+
* PHP version 7.2
55
*
66
* @category Class
77
* @package Shotstack\Client
@@ -17,7 +17,7 @@
1717
* The version of the OpenAPI document: v1
1818
*
1919
* Generated by: https://openapi-generator.tech
20-
* OpenAPI Generator version: 4.2.1
20+
* OpenAPI Generator version: 5.0.0
2121
*/
2222

2323
/**
@@ -44,7 +44,7 @@ class ApiException extends Exception
4444
/**
4545
* The HTTP body of the server response either as Json or string.
4646
*
47-
* @var mixed
47+
* @var \stdClass|string|null
4848
*/
4949
protected $responseBody;
5050

@@ -58,17 +58,17 @@ class ApiException extends Exception
5858
/**
5959
* The deserialized response object
6060
*
61-
* @var $responseObject;
61+
* @var \stdClass|string|null
6262
*/
6363
protected $responseObject;
6464

6565
/**
6666
* Constructor
6767
*
68-
* @param string $message Error message
69-
* @param int $code HTTP status code
70-
* @param string[]|null $responseHeaders HTTP response header
71-
* @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string
68+
* @param string $message Error message
69+
* @param int $code HTTP status code
70+
* @param string[]|null $responseHeaders HTTP response header
71+
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
7272
*/
7373
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
7474
{
@@ -90,7 +90,7 @@ public function getResponseHeaders()
9090
/**
9191
* Gets the HTTP body of the server response either as Json or string
9292
*
93-
* @return mixed HTTP body of the server response either as \stdClass or string
93+
* @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
9494
*/
9595
public function getResponseBody()
9696
{

0 commit comments

Comments
 (0)