Skip to content

Commit

Permalink
Merge pull request shotstack#8 from shotstack/output-features-update
Browse files Browse the repository at this point in the history
Output features, crop and audio asset effects (includes breaking changes)
  • Loading branch information
jeffski authored Dec 29, 2020
2 parents e325d6b + 94c104a commit f6e5d20
Show file tree
Hide file tree
Showing 31 changed files with 2,049 additions and 525 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
src/autoload.php
src/composer.json
composer.lock
vendor
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"minimum-stability": "dev",
"keywords": ["shotstack", "video", "video editing", "api"],
"require": {
"php": ">=5.5",
"php": ">=7.2",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
Expand Down
85 changes: 39 additions & 46 deletions src/Api/EndpointsApi.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* EndpointsApi
* PHP version 5
* PHP version 7.2
*
* @category Class
* @package Shotstack\Client
Expand All @@ -17,7 +17,7 @@
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 4.2.1
* OpenAPI Generator version: 5.0.0
*/

/**
Expand Down Expand Up @@ -73,34 +73,34 @@ class EndpointsApi
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $host_index (Optional) host index to select the list of hosts if defined in the OpenAPI spec
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
HeaderSelector $selector = null,
$host_index = 0
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $host_index;
$this->hostIndex = $hostIndex;
}

/**
* Set the host index
*
* @param int Host index (required)
* @param int $hostIndex Host index (required)
*/
public function setHostIndex($host_index)
public function setHostIndex($hostIndex)
{
$this->hostIndex = $host_index;
$this->hostIndex = $hostIndex;
}

/**
* Get the host index
*
* @return Host index
* @return int Host index
*/
public function getHostIndex()
{
Expand Down Expand Up @@ -156,7 +156,7 @@ public function getRenderWithHttpInfo($id)
"[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
}

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

return [
Expand All @@ -196,7 +196,7 @@ public function getRenderWithHttpInfo($id)
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
$content = (string) $responseBody;
}

return [
Expand Down Expand Up @@ -263,7 +263,7 @@ function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
$content = (string) $responseBody;
}

return [
Expand Down Expand Up @@ -297,7 +297,7 @@ function ($exception) {
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function getRenderRequest($id)
public function getRenderRequest($id)
{
// verify the required parameter 'id' is set
if ($id === null || (is_array($id) && count($id) === 0)) {
Expand All @@ -318,6 +318,7 @@ protected function getRenderRequest($id)
$multipart = false;



// path params
if ($id !== null) {
$resourcePath = str_replace(
Expand All @@ -327,8 +328,6 @@ protected function getRenderRequest($id)
);
}

// body params
$_tempBody = null;

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

// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
if ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));
} else {
$httpBody = $_tempBody;
}
} elseif (count($formParams) > 0) {
if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
Expand Down Expand Up @@ -439,7 +434,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
"[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
$e->getResponse() ? (string) $e->getResponse()->getBody() : null
);
}

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

return [
Expand All @@ -479,7 +474,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
$content = (string) $responseBody;
}

return [
Expand Down Expand Up @@ -548,7 +543,7 @@ function ($response) use ($returnType) {
if ($returnType === '\SplFileObject') {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
$content = (string) $responseBody;
}

return [
Expand Down Expand Up @@ -583,7 +578,7 @@ function ($exception) {
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
protected function postRenderRequest($edit, $x_api_queue_id = null)
public function postRenderRequest($edit, $x_api_queue_id = null)
{
// verify the required parameter 'edit' is set
if ($edit === null || (is_array($edit) && count($edit) === 0)) {
Expand All @@ -599,17 +594,13 @@ protected function postRenderRequest($edit, $x_api_queue_id = null)
$httpBody = '';
$multipart = false;


// header params
if ($x_api_queue_id !== null) {
$headerParams['x-api-queue-id'] = ObjectSerializer::toHeaderValue($x_api_queue_id);
}


// body params
$_tempBody = null;
if (isset($edit)) {
$_tempBody = $edit;
}

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

// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
if (isset($edit)) {
if ($headers['Content-Type'] === 'application/json') {
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody));
$httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($edit));
} else {
$httpBody = $_tempBody;
$httpBody = $edit;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue
];
$formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
foreach ($formParamValueItems as $formParamValueItem) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValueItem
];
}
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
Expand Down
18 changes: 9 additions & 9 deletions src/ApiException.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ApiException
* PHP version 5
* PHP version 7.2
*
* @category Class
* @package Shotstack\Client
Expand All @@ -17,7 +17,7 @@
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 4.2.1
* OpenAPI Generator version: 5.0.0
*/

/**
Expand All @@ -44,7 +44,7 @@ class ApiException extends Exception
/**
* The HTTP body of the server response either as Json or string.
*
* @var mixed
* @var \stdClass|string|null
*/
protected $responseBody;

Expand All @@ -58,17 +58,17 @@ class ApiException extends Exception
/**
* The deserialized response object
*
* @var $responseObject;
* @var \stdClass|string|null
*/
protected $responseObject;

/**
* Constructor
*
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string
*/
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
{
Expand All @@ -90,7 +90,7 @@ public function getResponseHeaders()
/**
* Gets the HTTP body of the server response either as Json or string
*
* @return mixed HTTP body of the server response either as \stdClass or string
* @return \stdClass|string|null HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
{
Expand Down
Loading

0 comments on commit f6e5d20

Please sign in to comment.