diff --git a/.oas-version b/.oas-version index 18b3114..15b989e 100644 --- a/.oas-version +++ b/.oas-version @@ -1 +1 @@ -1.10.4 +1.16.0 diff --git a/src/Api/EditApi.php b/src/Api/EditApi.php index 4f51449..76771e7 100644 --- a/src/Api/EditApi.php +++ b/src/Api/EditApi.php @@ -74,6 +74,9 @@ class EditApi 'deleteTemplate' => [ 'application/json', ], + 'getGenerate' => [ + 'application/json', + ], 'getRender' => [ 'application/json', ], @@ -83,6 +86,9 @@ class EditApi 'getTemplates' => [ 'application/json', ], + 'postGenerate' => [ + 'application/json', + ], 'postRender' => [ 'application/json', ], @@ -384,42 +390,38 @@ public function deleteTemplateRequest($id, string $contentType = self::contentTy } /** - * Operation getRender + * Operation getGenerate * - * Get Render Status + * Get Generation Status * - * @param string $id The id of the timeline render task in UUID format (required) - * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) - * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation + * @param string $id The generation job id returned by the generate endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGenerate'] to see the possible values for this operation * * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \ShotstackClient\Model\RenderResponse + * @return object|object */ - public function getRender($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) + public function getGenerate($id, string $contentType = self::contentTypes['getGenerate'][0]) { - list($response) = $this->getRenderWithHttpInfo($id, $data, $merged, $contentType); + list($response) = $this->getGenerateWithHttpInfo($id, $contentType); return $response; } /** - * Operation getRenderWithHttpInfo + * Operation getGenerateWithHttpInfo * - * Get Render Status + * Get Generation Status * - * @param string $id The id of the timeline render task in UUID format (required) - * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) - * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation + * @param string $id The generation job id returned by the generate endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGenerate'] to see the possible values for this operation * * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \ShotstackClient\Model\RenderResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of object|object, HTTP status code, HTTP response headers (array of strings) */ - public function getRenderWithHttpInfo($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) + public function getGenerateWithHttpInfo($id, string $contentType = self::contentTypes['getGenerate'][0]) { - $request = $this->getRenderRequest($id, $data, $merged, $contentType); + $request = $this->getGenerateRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -458,11 +460,11 @@ public function getRenderWithHttpInfo($id, $data = null, $merged = null, string switch($statusCode) { case 200: - if ('\ShotstackClient\Model\RenderResponse' === '\SplFileObject') { + if ('object' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\ShotstackClient\Model\RenderResponse' !== 'string') { + if ('object' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -480,13 +482,40 @@ public function getRenderWithHttpInfo($id, $data = null, $merged = null, string } return [ - ObjectSerializer::deserialize($content, '\ShotstackClient\Model\RenderResponse', []), + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 202: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\ShotstackClient\Model\RenderResponse'; + $returnType = 'object'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -519,7 +548,15 @@ public function getRenderWithHttpInfo($id, $data = null, $merged = null, string case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\ShotstackClient\Model\RenderResponse', + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -530,21 +567,19 @@ public function getRenderWithHttpInfo($id, $data = null, $merged = null, string } /** - * Operation getRenderAsync + * Operation getGenerateAsync * - * Get Render Status + * Get Generation Status * - * @param string $id The id of the timeline render task in UUID format (required) - * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) - * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation + * @param string $id The generation job id returned by the generate endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGenerate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getRenderAsync($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) + public function getGenerateAsync($id, string $contentType = self::contentTypes['getGenerate'][0]) { - return $this->getRenderAsyncWithHttpInfo($id, $data, $merged, $contentType) + return $this->getGenerateAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -553,22 +588,20 @@ function ($response) { } /** - * Operation getRenderAsyncWithHttpInfo + * Operation getGenerateAsyncWithHttpInfo * - * Get Render Status + * Get Generation Status * - * @param string $id The id of the timeline render task in UUID format (required) - * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) - * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation + * @param string $id The generation job id returned by the generate endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGenerate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getRenderAsyncWithHttpInfo($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) + public function getGenerateAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getGenerate'][0]) { - $returnType = '\ShotstackClient\Model\RenderResponse'; - $request = $this->getRenderRequest($id, $data, $merged, $contentType); + $returnType = 'object'; + $request = $this->getGenerateRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -607,57 +640,32 @@ function ($exception) { } /** - * Create request for operation 'getRender' + * Create request for operation 'getGenerate' * - * @param string $id The id of the timeline render task in UUID format (required) - * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) - * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation + * @param string $id The generation job id returned by the generate endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getGenerate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getRenderRequest($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) + public function getGenerateRequest($id, string $contentType = self::contentTypes['getGenerate'][0]) { // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getRender' + 'Missing the required parameter $id when calling getGenerate' ); } - if (!preg_match("/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/", $id)) { - throw new \InvalidArgumentException("invalid value for \"id\" when calling EditApi.getRender, must conform to the pattern /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/."); - } - - - $resourcePath = '/render/{id}'; + $resourcePath = '/generate/{id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $data, - 'data', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $merged, - 'merged', // param base name - 'boolean', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); // path params @@ -729,38 +737,42 @@ public function getRenderRequest($id, $data = null, $merged = null, string $cont } /** - * Operation getTemplate + * Operation getRender * - * Retrieve Template + * Get Render Status * - * @param string $id The id of the template in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * @param string $id The id of the timeline render task in UUID format (required) + * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) + * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation * * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \ShotstackClient\Model\TemplateDataResponse + * @return \ShotstackClient\Model\RenderResponse */ - public function getTemplate($id, string $contentType = self::contentTypes['getTemplate'][0]) + public function getRender($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) { - list($response) = $this->getTemplateWithHttpInfo($id, $contentType); + list($response) = $this->getRenderWithHttpInfo($id, $data, $merged, $contentType); return $response; } /** - * Operation getTemplateWithHttpInfo + * Operation getRenderWithHttpInfo * - * Retrieve Template + * Get Render Status * - * @param string $id The id of the template in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * @param string $id The id of the timeline render task in UUID format (required) + * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) + * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation * * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \ShotstackClient\Model\TemplateDataResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \ShotstackClient\Model\RenderResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getTemplateWithHttpInfo($id, string $contentType = self::contentTypes['getTemplate'][0]) + public function getRenderWithHttpInfo($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) { - $request = $this->getTemplateRequest($id, $contentType); + $request = $this->getRenderRequest($id, $data, $merged, $contentType); try { $options = $this->createHttpClientOption(); @@ -799,11 +811,11 @@ public function getTemplateWithHttpInfo($id, string $contentType = self::content switch($statusCode) { case 200: - if ('\ShotstackClient\Model\TemplateDataResponse' === '\SplFileObject') { + if ('\ShotstackClient\Model\RenderResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\ShotstackClient\Model\TemplateDataResponse' !== 'string') { + if ('\ShotstackClient\Model\RenderResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -821,13 +833,13 @@ public function getTemplateWithHttpInfo($id, string $contentType = self::content } return [ - ObjectSerializer::deserialize($content, '\ShotstackClient\Model\TemplateDataResponse', []), + ObjectSerializer::deserialize($content, '\ShotstackClient\Model\RenderResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\ShotstackClient\Model\TemplateDataResponse'; + $returnType = '\ShotstackClient\Model\RenderResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -860,7 +872,7 @@ public function getTemplateWithHttpInfo($id, string $contentType = self::content case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\ShotstackClient\Model\TemplateDataResponse', + '\ShotstackClient\Model\RenderResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -871,19 +883,21 @@ public function getTemplateWithHttpInfo($id, string $contentType = self::content } /** - * Operation getTemplateAsync + * Operation getRenderAsync * - * Retrieve Template + * Get Render Status * - * @param string $id The id of the template in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * @param string $id The id of the timeline render task in UUID format (required) + * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) + * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTemplateAsync($id, string $contentType = self::contentTypes['getTemplate'][0]) + public function getRenderAsync($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) { - return $this->getTemplateAsyncWithHttpInfo($id, $contentType) + return $this->getRenderAsyncWithHttpInfo($id, $data, $merged, $contentType) ->then( function ($response) { return $response[0]; @@ -892,20 +906,22 @@ function ($response) { } /** - * Operation getTemplateAsyncWithHttpInfo + * Operation getRenderAsyncWithHttpInfo * - * Retrieve Template + * Get Render Status * - * @param string $id The id of the template in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * @param string $id The id of the timeline render task in UUID format (required) + * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) + * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTemplateAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getTemplate'][0]) + public function getRenderAsyncWithHttpInfo($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) { - $returnType = '\ShotstackClient\Model\TemplateDataResponse'; - $request = $this->getTemplateRequest($id, $contentType); + $returnType = '\ShotstackClient\Model\RenderResponse'; + $request = $this->getRenderRequest($id, $data, $merged, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -944,35 +960,57 @@ function ($exception) { } /** - * Create request for operation 'getTemplate' + * Create request for operation 'getRender' * - * @param string $id The id of the template in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation + * @param string $id The id of the timeline render task in UUID format (required) + * @param bool $data Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`. (optional) + * @param bool $merged Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getRender'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getTemplateRequest($id, string $contentType = self::contentTypes['getTemplate'][0]) + public function getRenderRequest($id, $data = null, $merged = null, string $contentType = self::contentTypes['getRender'][0]) { // verify the required parameter 'id' is set if ($id === null || (is_array($id) && count($id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $id when calling getTemplate' + 'Missing the required parameter $id when calling getRender' ); } if (!preg_match("/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/", $id)) { - throw new \InvalidArgumentException("invalid value for \"id\" when calling EditApi.getTemplate, must conform to the pattern /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/."); + throw new \InvalidArgumentException("invalid value for \"id\" when calling EditApi.getRender, must conform to the pattern /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/."); } - $resourcePath = '/templates/{id}'; + + + $resourcePath = '/render/{id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $data, + 'data', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $merged, + 'merged', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -1044,36 +1082,38 @@ public function getTemplateRequest($id, string $contentType = self::contentTypes } /** - * Operation getTemplates + * Operation getTemplate * - * List Templates + * Retrieve Template * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * @param string $id The id of the template in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation * * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return \ShotstackClient\Model\TemplateListResponse + * @return \ShotstackClient\Model\TemplateDataResponse */ - public function getTemplates(string $contentType = self::contentTypes['getTemplates'][0]) + public function getTemplate($id, string $contentType = self::contentTypes['getTemplate'][0]) { - list($response) = $this->getTemplatesWithHttpInfo($contentType); + list($response) = $this->getTemplateWithHttpInfo($id, $contentType); return $response; } /** - * Operation getTemplatesWithHttpInfo + * Operation getTemplateWithHttpInfo * - * List Templates + * Retrieve Template * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * @param string $id The id of the template in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation * * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException - * @return array of \ShotstackClient\Model\TemplateListResponse, HTTP status code, HTTP response headers (array of strings) + * @return array of \ShotstackClient\Model\TemplateDataResponse, HTTP status code, HTTP response headers (array of strings) */ - public function getTemplatesWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0]) + public function getTemplateWithHttpInfo($id, string $contentType = self::contentTypes['getTemplate'][0]) { - $request = $this->getTemplatesRequest($contentType); + $request = $this->getTemplateRequest($id, $contentType); try { $options = $this->createHttpClientOption(); @@ -1112,11 +1152,11 @@ public function getTemplatesWithHttpInfo(string $contentType = self::contentType switch($statusCode) { case 200: - if ('\ShotstackClient\Model\TemplateListResponse' === '\SplFileObject') { + if ('\ShotstackClient\Model\TemplateDataResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\ShotstackClient\Model\TemplateListResponse' !== 'string') { + if ('\ShotstackClient\Model\TemplateDataResponse' !== 'string') { try { $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { @@ -1134,13 +1174,13 @@ public function getTemplatesWithHttpInfo(string $contentType = self::contentType } return [ - ObjectSerializer::deserialize($content, '\ShotstackClient\Model\TemplateListResponse', []), + ObjectSerializer::deserialize($content, '\ShotstackClient\Model\TemplateDataResponse', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\ShotstackClient\Model\TemplateListResponse'; + $returnType = '\ShotstackClient\Model\TemplateDataResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -1173,7 +1213,7 @@ public function getTemplatesWithHttpInfo(string $contentType = self::contentType case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\ShotstackClient\Model\TemplateListResponse', + '\ShotstackClient\Model\TemplateDataResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -1184,18 +1224,19 @@ public function getTemplatesWithHttpInfo(string $contentType = self::contentType } /** - * Operation getTemplatesAsync + * Operation getTemplateAsync * - * List Templates + * Retrieve Template * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * @param string $id The id of the template in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTemplatesAsync(string $contentType = self::contentTypes['getTemplates'][0]) + public function getTemplateAsync($id, string $contentType = self::contentTypes['getTemplate'][0]) { - return $this->getTemplatesAsyncWithHttpInfo($contentType) + return $this->getTemplateAsyncWithHttpInfo($id, $contentType) ->then( function ($response) { return $response[0]; @@ -1204,19 +1245,20 @@ function ($response) { } /** - * Operation getTemplatesAsyncWithHttpInfo + * Operation getTemplateAsyncWithHttpInfo * - * List Templates + * Retrieve Template * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * @param string $id The id of the template in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getTemplatesAsyncWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0]) + public function getTemplateAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getTemplate'][0]) { - $returnType = '\ShotstackClient\Model\TemplateListResponse'; - $request = $this->getTemplatesRequest($contentType); + $returnType = '\ShotstackClient\Model\TemplateDataResponse'; + $request = $this->getTemplateRequest($id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1255,18 +1297,29 @@ function ($exception) { } /** - * Create request for operation 'getTemplates' + * Create request for operation 'getTemplate' * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * @param string $id The id of the template in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplate'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getTemplatesRequest(string $contentType = self::contentTypes['getTemplates'][0]) + public function getTemplateRequest($id, string $contentType = self::contentTypes['getTemplate'][0]) { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getTemplate' + ); + } + if (!preg_match("/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/", $id)) { + throw new \InvalidArgumentException("invalid value for \"id\" when calling EditApi.getTemplate, must conform to the pattern /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/."); + } + - $resourcePath = '/templates'; + $resourcePath = '/templates/{id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1275,6 +1328,14 @@ public function getTemplatesRequest(string $contentType = self::contentTypes['ge + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( @@ -1335,6 +1396,638 @@ public function getTemplatesRequest(string $contentType = self::contentTypes['ge ); } + /** + * Operation getTemplates + * + * List Templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \ShotstackClient\Model\TemplateListResponse + */ + public function getTemplates(string $contentType = self::contentTypes['getTemplates'][0]) + { + list($response) = $this->getTemplatesWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getTemplatesWithHttpInfo + * + * List Templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \ShotstackClient\Model\TemplateListResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getTemplatesWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0]) + { + $request = $this->getTemplatesRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\ShotstackClient\Model\TemplateListResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ShotstackClient\Model\TemplateListResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\ShotstackClient\Model\TemplateListResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\ShotstackClient\Model\TemplateListResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ShotstackClient\Model\TemplateListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getTemplatesAsync + * + * List Templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatesAsync(string $contentType = self::contentTypes['getTemplates'][0]) + { + return $this->getTemplatesAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getTemplatesAsyncWithHttpInfo + * + * List Templates + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getTemplatesAsyncWithHttpInfo(string $contentType = self::contentTypes['getTemplates'][0]) + { + $returnType = '\ShotstackClient\Model\TemplateListResponse'; + $request = $this->getTemplatesRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getTemplates' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getTemplates'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getTemplatesRequest(string $contentType = self::contentTypes['getTemplates'][0]) + { + + + $resourcePath = '/templates'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation postGenerate + * + * Generate Asset + * + * @param \ShotstackClient\Model\PostGenerateRequest $post_generate_request A prompt-bearing image, video or audio asset to generate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postGenerate'] to see the possible values for this operation + * + * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \ShotstackClient\Model\PostGenerate200Response|object + */ + public function postGenerate($post_generate_request = null, string $contentType = self::contentTypes['postGenerate'][0]) + { + list($response) = $this->postGenerateWithHttpInfo($post_generate_request, $contentType); + return $response; + } + + /** + * Operation postGenerateWithHttpInfo + * + * Generate Asset + * + * @param \ShotstackClient\Model\PostGenerateRequest $post_generate_request A prompt-bearing image, video or audio asset to generate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postGenerate'] to see the possible values for this operation + * + * @throws \ShotstackClient\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \ShotstackClient\Model\PostGenerate200Response|object, HTTP status code, HTTP response headers (array of strings) + */ + public function postGenerateWithHttpInfo($post_generate_request = null, string $contentType = self::contentTypes['postGenerate'][0]) + { + $request = $this->postGenerateRequest($post_generate_request, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\ShotstackClient\Model\PostGenerate200Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\ShotstackClient\Model\PostGenerate200Response' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\ShotstackClient\Model\PostGenerate200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 202: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\ShotstackClient\Model\PostGenerate200Response'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\ShotstackClient\Model\PostGenerate200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation postGenerateAsync + * + * Generate Asset + * + * @param \ShotstackClient\Model\PostGenerateRequest $post_generate_request A prompt-bearing image, video or audio asset to generate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postGenerate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function postGenerateAsync($post_generate_request = null, string $contentType = self::contentTypes['postGenerate'][0]) + { + return $this->postGenerateAsyncWithHttpInfo($post_generate_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation postGenerateAsyncWithHttpInfo + * + * Generate Asset + * + * @param \ShotstackClient\Model\PostGenerateRequest $post_generate_request A prompt-bearing image, video or audio asset to generate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postGenerate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function postGenerateAsyncWithHttpInfo($post_generate_request = null, string $contentType = self::contentTypes['postGenerate'][0]) + { + $returnType = '\ShotstackClient\Model\PostGenerate200Response'; + $request = $this->postGenerateRequest($post_generate_request, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'postGenerate' + * + * @param \ShotstackClient\Model\PostGenerateRequest $post_generate_request A prompt-bearing image, video or audio asset to generate. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['postGenerate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function postGenerateRequest($post_generate_request = null, string $contentType = self::contentTypes['postGenerate'][0]) + { + + + + $resourcePath = '/generate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($post_generate_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($post_generate_request)); + } else { + $httpBody = $post_generate_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('x-api-key'); + if ($apiKey !== null) { + $headers['x-api-key'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation postRender * diff --git a/src/Configuration.php b/src/Configuration.php index 9e404cf..315e435 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -100,7 +100,7 @@ class Configuration * * @var string */ - protected $userAgent = 'OpenAPI-Generator/1.10.4/PHP'; + protected $userAgent = 'OpenAPI-Generator/1.16.0/PHP'; /** * Debug switch (default set to false) @@ -433,7 +433,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: v1' . PHP_EOL; - $report .= ' SDK Package Version: 1.10.4' . PHP_EOL; + $report .= ' SDK Package Version: 1.16.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/src/Model/Asset.php b/src/Model/Asset.php index f48ad56..a35d275 100644 --- a/src/Model/Asset.php +++ b/src/Model/Asset.php @@ -60,6 +60,9 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'type' => 'string', 'src' => 'string', + 'prompt' => 'string', + 'model' => 'string', + 'options' => 'array', 'transcode' => 'bool', 'trim' => 'float', 'volume' => '\ShotstackClient\Model\AudioAssetVolume', @@ -87,6 +90,7 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable 'html' => 'string', 'css' => 'string', 'position' => 'string', + 'js' => 'string', 'color' => 'string', 'size' => 'string', 'offset' => '\ShotstackClient\Model\Offset', @@ -95,7 +99,6 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable 'rectangle' => '\ShotstackClient\Model\ShapeAssetRectangle', 'circle' => '\ShotstackClient\Model\ShapeAssetCircle', 'line' => '\ShotstackClient\Model\ShapeAssetLine', - 'prompt' => 'string', 'aspect_ratio' => 'string', 'voice' => 'string', 'language' => 'string', @@ -112,6 +115,9 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'type' => null, 'src' => null, + 'prompt' => null, + 'model' => null, + 'options' => null, 'transcode' => null, 'trim' => null, 'volume' => null, @@ -139,6 +145,7 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable 'html' => null, 'css' => null, 'position' => null, + 'js' => null, 'color' => null, 'size' => null, 'offset' => null, @@ -147,7 +154,6 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable 'rectangle' => null, 'circle' => null, 'line' => null, - 'prompt' => null, 'aspect_ratio' => null, 'voice' => null, 'language' => null, @@ -162,6 +168,9 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'type' => false, 'src' => false, + 'prompt' => false, + 'model' => false, + 'options' => false, 'transcode' => false, 'trim' => false, 'volume' => false, @@ -189,6 +198,7 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable 'html' => false, 'css' => false, 'position' => false, + 'js' => false, 'color' => false, 'size' => false, 'offset' => false, @@ -197,7 +207,6 @@ class Asset implements ModelInterface, ArrayAccess, \JsonSerializable 'rectangle' => false, 'circle' => false, 'line' => false, - 'prompt' => false, 'aspect_ratio' => false, 'voice' => false, 'language' => false, @@ -292,6 +301,9 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'type' => 'type', 'src' => 'src', + 'prompt' => 'prompt', + 'model' => 'model', + 'options' => 'options', 'transcode' => 'transcode', 'trim' => 'trim', 'volume' => 'volume', @@ -319,6 +331,7 @@ public function isNullableSetToNull(string $property): bool 'html' => 'html', 'css' => 'css', 'position' => 'position', + 'js' => 'js', 'color' => 'color', 'size' => 'size', 'offset' => 'offset', @@ -327,7 +340,6 @@ public function isNullableSetToNull(string $property): bool 'rectangle' => 'rectangle', 'circle' => 'circle', 'line' => 'line', - 'prompt' => 'prompt', 'aspect_ratio' => 'aspectRatio', 'voice' => 'voice', 'language' => 'language', @@ -342,6 +354,9 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'type' => 'setType', 'src' => 'setSrc', + 'prompt' => 'setPrompt', + 'model' => 'setModel', + 'options' => 'setOptions', 'transcode' => 'setTranscode', 'trim' => 'setTrim', 'volume' => 'setVolume', @@ -369,6 +384,7 @@ public function isNullableSetToNull(string $property): bool 'html' => 'setHtml', 'css' => 'setCss', 'position' => 'setPosition', + 'js' => 'setJs', 'color' => 'setColor', 'size' => 'setSize', 'offset' => 'setOffset', @@ -377,7 +393,6 @@ public function isNullableSetToNull(string $property): bool 'rectangle' => 'setRectangle', 'circle' => 'setCircle', 'line' => 'setLine', - 'prompt' => 'setPrompt', 'aspect_ratio' => 'setAspectRatio', 'voice' => 'setVoice', 'language' => 'setLanguage', @@ -392,6 +407,9 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'type' => 'getType', 'src' => 'getSrc', + 'prompt' => 'getPrompt', + 'model' => 'getModel', + 'options' => 'getOptions', 'transcode' => 'getTranscode', 'trim' => 'getTrim', 'volume' => 'getVolume', @@ -419,6 +437,7 @@ public function isNullableSetToNull(string $property): bool 'html' => 'getHtml', 'css' => 'getCss', 'position' => 'getPosition', + 'js' => 'getJs', 'color' => 'getColor', 'size' => 'getSize', 'offset' => 'getOffset', @@ -427,7 +446,6 @@ public function isNullableSetToNull(string $property): bool 'rectangle' => 'getRectangle', 'circle' => 'getCircle', 'line' => 'getLine', - 'prompt' => 'getPrompt', 'aspect_ratio' => 'getAspectRatio', 'voice' => 'getVoice', 'language' => 'getLanguage', @@ -484,6 +502,7 @@ public function getModelName() public const TYPE_CAPTION = 'caption'; public const TYPE_RICH_CAPTION = 'rich-caption'; public const TYPE_HTML = 'html'; + public const TYPE_HTML5 = 'html5'; public const TYPE_TITLE = 'title'; public const TYPE_SHAPE = 'shape'; public const TYPE_SVG = 'svg'; @@ -552,6 +571,7 @@ public function getTypeAllowableValues() self::TYPE_CAPTION, self::TYPE_RICH_CAPTION, self::TYPE_HTML, + self::TYPE_HTML5, self::TYPE_TITLE, self::TYPE_SHAPE, self::TYPE_SVG, @@ -699,6 +719,9 @@ public function __construct(array $data = null) { $this->setIfExists('type', $data ?? [], 'video'); $this->setIfExists('src', $data ?? [], null); + $this->setIfExists('prompt', $data ?? [], null); + $this->setIfExists('model', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('transcode', $data ?? [], null); $this->setIfExists('trim', $data ?? [], null); $this->setIfExists('volume', $data ?? [], null); @@ -726,6 +749,7 @@ public function __construct(array $data = null) $this->setIfExists('html', $data ?? [], null); $this->setIfExists('css', $data ?? [], null); $this->setIfExists('position', $data ?? [], null); + $this->setIfExists('js', $data ?? [], null); $this->setIfExists('color', $data ?? [], null); $this->setIfExists('size', $data ?? [], null); $this->setIfExists('offset', $data ?? [], null); @@ -734,7 +758,6 @@ public function __construct(array $data = null) $this->setIfExists('rectangle', $data ?? [], null); $this->setIfExists('circle', $data ?? [], null); $this->setIfExists('line', $data ?? [], null); - $this->setIfExists('prompt', $data ?? [], null); $this->setIfExists('aspect_ratio', $data ?? [], null); $this->setIfExists('voice', $data ?? [], null); $this->setIfExists('language', $data ?? [], null); @@ -790,6 +813,9 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'src', the character length must be bigger than or equal to 1."; } + if ($this->container['prompt'] === null) { + $invalidProperties[] = "'prompt' can't be null"; + } $allowedValues = $this->getVolumeEffectAllowableValues(); if (!is_null($this->container['volume_effect']) && !in_array($this->container['volume_effect'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -831,6 +857,14 @@ public function listInvalidProperties() if ($this->container['html'] === null) { $invalidProperties[] = "'html' can't be null"; } + if ((mb_strlen($this->container['html']) > 1000000)) { + $invalidProperties[] = "invalid value for 'html', the character length must be smaller than or equal to 1000000."; + } + + if (!is_null($this->container['css']) && (mb_strlen($this->container['css']) > 500000)) { + $invalidProperties[] = "invalid value for 'css', the character length must be smaller than or equal to 500000."; + } + $allowedValues = $this->getPositionAllowableValues(); if (!is_null($this->container['position']) && !in_array($this->container['position'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -840,6 +874,10 @@ public function listInvalidProperties() ); } + if (!is_null($this->container['js']) && (mb_strlen($this->container['js']) > 500000)) { + $invalidProperties[] = "invalid value for 'js', the character length must be smaller than or equal to 500000."; + } + $allowedValues = $this->getSizeAllowableValues(); if (!is_null($this->container['size']) && !in_array($this->container['size'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -861,9 +899,6 @@ public function listInvalidProperties() ); } - if ($this->container['prompt'] === null) { - $invalidProperties[] = "'prompt' can't be null"; - } $allowedValues = $this->getAspectRatioAllowableValues(); if (!is_null($this->container['aspect_ratio']) && !in_array($this->container['aspect_ratio'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -960,6 +995,87 @@ public function setSrc($src) return $this; } + /** + * Gets prompt + * + * @return string + */ + public function getPrompt() + { + return $this->container['prompt']; + } + + /** + * Sets prompt + * + * @param string $prompt The instructions for modifying the image into a video sequence. + * + * @return self + */ + public function setPrompt($prompt) + { + if (is_null($prompt)) { + throw new \InvalidArgumentException('non-nullable prompt cannot be null'); + } + $this->container['prompt'] = $prompt; + + return $this; + } + + /** + * Gets model + * + * @return string|null + */ + public function getModel() + { + return $this->container['model']; + } + + /** + * Sets model + * + * @param string|null $model The generation model to use when `prompt` is set (e.g. `polly-neural`, `elevenlabs-tts`, `elevenlabs-music`). Defaults to `elevenlabs-tts` (with a default voice) if omitted. Each model's available options are defined by the model registry. + * + * @return self + */ + public function setModel($model) + { + if (is_null($model)) { + throw new \InvalidArgumentException('non-nullable model cannot be null'); + } + $this->container['model'] = $model; + + return $this; + } + + /** + * Gets options + * + * @return array|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param array|null $options Model-specific generation settings. Valid keys and values depend on the chosen `model` and are defined by the model registry. Omitted options use the model's defaults. Unknown or invalid options are rejected. + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + /** * Gets transcode * @@ -1659,7 +1775,7 @@ public function getHtml() /** * Sets html * - * @param string $html The HTML text string. See list of [supported HTML tags](https://shotstack.io/docs/guide/architecting-an-application/html-support/#supported-html-tags). + * @param string $html The HTML markup for the asset. Max 1,000,000 characters. * * @return self */ @@ -1668,6 +1784,10 @@ public function setHtml($html) if (is_null($html)) { throw new \InvalidArgumentException('non-nullable html cannot be null'); } + if ((mb_strlen($html) > 1000000)) { + throw new \InvalidArgumentException('invalid length for $html when calling Asset., must be smaller than or equal to 1000000.'); + } + $this->container['html'] = $html; return $this; @@ -1686,7 +1806,7 @@ public function getCss() /** * Sets css * - * @param string|null $css The CSS text string to apply styling to the HTML. See list of [support CSS properties](https://shotstack.io/docs/guide/architecting-an-application/html-support/#supported-css-properties). + * @param string|null $css The CSS string applied to the HTML. Max 500,000 characters. * * @return self */ @@ -1695,6 +1815,10 @@ public function setCss($css) if (is_null($css)) { throw new \InvalidArgumentException('non-nullable css cannot be null'); } + if ((mb_strlen($css) > 500000)) { + throw new \InvalidArgumentException('invalid length for $css when calling Asset., must be smaller than or equal to 500000.'); + } + $this->container['css'] = $css; return $this; @@ -1737,6 +1861,37 @@ public function setPosition($position) return $this; } + /** + * Gets js + * + * @return string|null + */ + public function getJs() + { + return $this->container['js']; + } + + /** + * Sets js + * + * @param string|null $js Optional JavaScript. Use for chart libraries, animations, or DOM manipulation. `gsap`, `d3`, `anime` and `lottie` are always available. CSS animations, transitions, and `Element.animate()` are also captured automatically. Max 500,000 characters. + * + * @return self + */ + public function setJs($js) + { + if (is_null($js)) { + throw new \InvalidArgumentException('non-nullable js cannot be null'); + } + if ((mb_strlen($js) > 500000)) { + throw new \InvalidArgumentException('invalid length for $js when calling Asset., must be smaller than or equal to 500000.'); + } + + $this->container['js'] = $js; + + return $this; + } + /** * Gets color * @@ -1973,33 +2128,6 @@ public function setLine($line) return $this; } - /** - * Gets prompt - * - * @return string - */ - public function getPrompt() - { - return $this->container['prompt']; - } - - /** - * Sets prompt - * - * @param string $prompt The instructions for modifying the image into a video sequence. - * - * @return self - */ - public function setPrompt($prompt) - { - if (is_null($prompt)) { - throw new \InvalidArgumentException('non-nullable prompt cannot be null'); - } - $this->container['prompt'] = $prompt; - - return $this; - } - /** * Gets aspect_ratio * diff --git a/src/Model/AudioAsset.php b/src/Model/AudioAsset.php index fe9499c..840ae2f 100644 --- a/src/Model/AudioAsset.php +++ b/src/Model/AudioAsset.php @@ -35,7 +35,7 @@ * AudioAsset Class Doc Comment * * @category Class - * @description The AudioAsset is used to add sound effects and audio at specific intervals on the timeline. The src must be a publicly accessible URL to an audio resource such as an mp3 file. + * @description The AudioAsset adds audio to a Clip. The audio can be sourced from a URL (`src`), generated from a text prompt (`prompt`), or both. At least one of `src` or `prompt` must be provided. - **Source URL:** set `src` to a publicly accessible audio URL (e.g. mp3). - **Generated speech:** set `prompt` to the spoken text and choose a text-to-speech `model`; set the voice via `options`. - **Generated music or SFX:** set `prompt` describing the sound and choose a music generation `model`. - **Both:** `src` acts as a preview placeholder while `prompt` drives generation — the audio is regenerated from the prompt at render time. Unchanged prompts and options resolve from the generation cache. - Use `model` to choose the generator and `options` to configure it. The generated `src` is filled in automatically. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -60,6 +60,9 @@ class AudioAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'type' => 'string', 'src' => 'string', + 'prompt' => 'string', + 'model' => 'string', + 'options' => 'array', 'trim' => 'float', 'volume' => '\ShotstackClient\Model\AudioAssetVolume', 'speed' => 'float', @@ -76,6 +79,9 @@ class AudioAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'type' => null, 'src' => null, + 'prompt' => null, + 'model' => null, + 'options' => null, 'trim' => null, 'volume' => null, 'speed' => 'float', @@ -90,6 +96,9 @@ class AudioAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'type' => false, 'src' => false, + 'prompt' => false, + 'model' => false, + 'options' => false, 'trim' => false, 'volume' => false, 'speed' => false, @@ -184,6 +193,9 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'type' => 'type', 'src' => 'src', + 'prompt' => 'prompt', + 'model' => 'model', + 'options' => 'options', 'trim' => 'trim', 'volume' => 'volume', 'speed' => 'speed', @@ -198,6 +210,9 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'type' => 'setType', 'src' => 'setSrc', + 'prompt' => 'setPrompt', + 'model' => 'setModel', + 'options' => 'setOptions', 'trim' => 'setTrim', 'volume' => 'setVolume', 'speed' => 'setSpeed', @@ -212,6 +227,9 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'type' => 'getType', 'src' => 'getSrc', + 'prompt' => 'getPrompt', + 'model' => 'getModel', + 'options' => 'getOptions', 'trim' => 'getTrim', 'volume' => 'getVolume', 'speed' => 'getSpeed', @@ -309,6 +327,9 @@ public function __construct(array $data = null) { $this->setIfExists('type', $data ?? [], 'audio'); $this->setIfExists('src', $data ?? [], null); + $this->setIfExists('prompt', $data ?? [], null); + $this->setIfExists('model', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('trim', $data ?? [], null); $this->setIfExists('volume', $data ?? [], null); $this->setIfExists('speed', $data ?? [], null); @@ -354,17 +375,18 @@ public function listInvalidProperties() ); } - if ($this->container['src'] === null) { - $invalidProperties[] = "'src' can't be null"; - } - if ((mb_strlen($this->container['src']) < 1)) { + if (!is_null($this->container['src']) && (mb_strlen($this->container['src']) < 1)) { $invalidProperties[] = "invalid value for 'src', the character length must be bigger than or equal to 1."; } - if (!preg_match("/\\S/", $this->container['src'])) { + if (!is_null($this->container['src']) && !preg_match("/\\S/", $this->container['src'])) { $invalidProperties[] = "invalid value for 'src', must be conform to the pattern /\\S/."; } + if (!is_null($this->container['prompt']) && (mb_strlen($this->container['prompt']) > 4000)) { + $invalidProperties[] = "invalid value for 'prompt', the character length must be smaller than or equal to 4000."; + } + if (!is_null($this->container['speed']) && ($this->container['speed'] > 10)) { $invalidProperties[] = "invalid value for 'speed', must be smaller than or equal to 10."; } @@ -437,7 +459,7 @@ public function setType($type) /** * Gets src * - * @return string + * @return string|null */ public function getSrc() { @@ -447,7 +469,7 @@ public function getSrc() /** * Sets src * - * @param string $src The audio source URL. The URL must be publicly accessible or include credentials. + * @param string|null $src The audio source URL. The URL must be publicly accessible or include credentials. When `prompt` is also set, `src` serves as a preview placeholder and the audio is regenerated from the prompt at render time. * * @return self */ @@ -469,6 +491,91 @@ public function setSrc($src) return $this; } + /** + * Gets prompt + * + * @return string|null + */ + public function getPrompt() + { + return $this->container['prompt']; + } + + /** + * Sets prompt + * + * @param string|null $prompt A text prompt. For text-to-speech models the prompt is the spoken text; for music models it describes the sound to generate. The generated `src` is filled in automatically; an existing `src` is treated as a preview placeholder and replaced. + * + * @return self + */ + public function setPrompt($prompt) + { + if (is_null($prompt)) { + throw new \InvalidArgumentException('non-nullable prompt cannot be null'); + } + if ((mb_strlen($prompt) > 4000)) { + throw new \InvalidArgumentException('invalid length for $prompt when calling AudioAsset., must be smaller than or equal to 4000.'); + } + + $this->container['prompt'] = $prompt; + + return $this; + } + + /** + * Gets model + * + * @return string|null + */ + public function getModel() + { + return $this->container['model']; + } + + /** + * Sets model + * + * @param string|null $model The generation model to use when `prompt` is set (e.g. `polly-neural`, `elevenlabs-tts`, `elevenlabs-music`). Defaults to `elevenlabs-tts` (with a default voice) if omitted. Each model's available options are defined by the model registry. + * + * @return self + */ + public function setModel($model) + { + if (is_null($model)) { + throw new \InvalidArgumentException('non-nullable model cannot be null'); + } + $this->container['model'] = $model; + + return $this; + } + + /** + * Gets options + * + * @return array|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param array|null $options Model-specific generation settings. Valid keys and values depend on the chosen `model` and are defined by the model registry. Omitted options use the model's defaults. Unknown or invalid options are rejected. + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + /** * Gets trim * @@ -536,7 +643,7 @@ public function getSpeed() /** * Sets speed * - * @param float|null $speed Adjust the playback speed of the audio clip between 0 (paused) and 10 (10x normal speed), where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire audio (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire audio (i.e. original length / 2). + * @param float|null $speed Adjust the playback speed of the audio clip between 0 (paused) and 10 (10x normal speed), where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire audio (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire audio (i.e. original length / 2). * * @return self */ diff --git a/src/Model/Clip.php b/src/Model/Clip.php index b7ec8e3..20a0d7f 100644 --- a/src/Model/Clip.php +++ b/src/Model/Clip.php @@ -58,6 +58,7 @@ class Clip implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ + 'id' => 'string', 'asset' => '\ShotstackClient\Model\Asset', 'start' => '\ShotstackClient\Model\ClipStart', 'length' => '\ShotstackClient\Model\ClipLength', @@ -83,6 +84,7 @@ class Clip implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ + 'id' => null, 'asset' => null, 'start' => null, 'length' => null, @@ -106,6 +108,7 @@ class Clip implements ModelInterface, ArrayAccess, \JsonSerializable * @var boolean[] */ protected static array $openAPINullables = [ + 'id' => false, 'asset' => false, 'start' => false, 'length' => false, @@ -209,6 +212,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ + 'id' => 'id', 'asset' => 'asset', 'start' => 'start', 'length' => 'length', @@ -232,6 +236,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ + 'id' => 'setId', 'asset' => 'setAsset', 'start' => 'setStart', 'length' => 'setLength', @@ -255,6 +260,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ + 'id' => 'getId', 'asset' => 'getAsset', 'start' => 'getStart', 'length' => 'getLength', @@ -453,6 +459,7 @@ public function getFilterAllowableValues() */ public function __construct(array $data = null) { + $this->setIfExists('id', $data ?? [], null); $this->setIfExists('asset', $data ?? [], null); $this->setIfExists('start', $data ?? [], null); $this->setIfExists('length', $data ?? [], null); @@ -577,6 +584,33 @@ public function valid() } + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Optional client-generated identifier. Used by client SDKs (e.g. the Shotstack Studio SDK) to reference a clip across edits without relying on its position in the timeline. The render API does not use this field and it does not appear in render output. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** * Gets asset * diff --git a/src/Model/Destinations.php b/src/Model/Destinations.php index e0991ae..cfcde25 100644 --- a/src/Model/Destinations.php +++ b/src/Model/Destinations.php @@ -295,9 +295,6 @@ public function listInvalidProperties() if ($this->container['provider'] === null) { $invalidProperties[] = "'provider' can't be null"; } - if ($this->container['options'] === null) { - $invalidProperties[] = "'options' can't be null"; - } return $invalidProperties; } @@ -370,7 +367,7 @@ public function setExclude($exclude) /** * Gets options * - * @return \ShotstackClient\Model\DestinationsAnyOf2Options + * @return \ShotstackClient\Model\DestinationsAnyOf2Options|null */ public function getOptions() { @@ -380,7 +377,7 @@ public function getOptions() /** * Sets options * - * @param \ShotstackClient\Model\DestinationsAnyOf2Options $options options + * @param \ShotstackClient\Model\DestinationsAnyOf2Options|null $options options * * @return self */ diff --git a/src/Model/GoogleDriveDestination.php b/src/Model/GoogleDriveDestination.php index 4fdccbb..5895a45 100644 --- a/src/Model/GoogleDriveDestination.php +++ b/src/Model/GoogleDriveDestination.php @@ -285,9 +285,6 @@ public function listInvalidProperties() if ($this->container['provider'] === null) { $invalidProperties[] = "'provider' can't be null"; } - if ($this->container['options'] === null) { - $invalidProperties[] = "'options' can't be null"; - } return $invalidProperties; } @@ -333,7 +330,7 @@ public function setProvider($provider) /** * Gets options * - * @return \ShotstackClient\Model\GoogleDriveDestinationOptions + * @return \ShotstackClient\Model\GoogleDriveDestinationOptions|null */ public function getOptions() { @@ -343,7 +340,7 @@ public function getOptions() /** * Sets options * - * @param \ShotstackClient\Model\GoogleDriveDestinationOptions $options options + * @param \ShotstackClient\Model\GoogleDriveDestinationOptions|null $options options * * @return self */ diff --git a/src/Model/GoogleDriveDestinationOptions.php b/src/Model/GoogleDriveDestinationOptions.php index 3530bfa..2c79a07 100644 --- a/src/Model/GoogleDriveDestinationOptions.php +++ b/src/Model/GoogleDriveDestinationOptions.php @@ -282,9 +282,6 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['folder_id'] === null) { - $invalidProperties[] = "'folder_id' can't be null"; - } return $invalidProperties; } @@ -303,7 +300,7 @@ public function valid() /** * Gets folder_id * - * @return string + * @return string|null */ public function getFolderId() { @@ -313,7 +310,7 @@ public function getFolderId() /** * Sets folder_id * - * @param string $folder_id The Google Drive folder ID where asset will be stored. The folder ID is required and can be retrieved from the URL when logged in to Google Drive, e.g. https://drive.google.com/drive/u/0/folders/1r-eTY6OLO8tzQRKwMyq-fIrQ_7AJEI6A. + * @param string|null $folder_id The Google Drive folder ID where the asset will be stored. If omitted, the asset is saved to the root of My Drive. The folder ID can be retrieved from the URL when logged in to Google Drive, e.g. https://drive.google.com/drive/u/0/folders/1r-eTY6OLO8tzQRKwMyq-fIrQ_7AJEI6A. * * @return self */ diff --git a/src/Model/Html5Asset.php b/src/Model/Html5Asset.php new file mode 100644 index 0000000..ce0ab6f --- /dev/null +++ b/src/Model/Html5Asset.php @@ -0,0 +1,574 @@ + + */ +class Html5Asset implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Html5Asset'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'html' => 'string', + 'css' => 'string', + 'js' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'html' => null, + 'css' => null, + 'js' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'html' => false, + 'css' => false, + 'js' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'html' => 'html', + 'css' => 'css', + 'js' => 'js' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'html' => 'setHtml', + 'css' => 'setCss', + 'js' => 'setJs' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'html' => 'getHtml', + 'css' => 'getCss', + 'js' => 'getJs' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const TYPE_HTML5 = 'html5'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_HTML5, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], 'html5'); + $this->setIfExists('html', $data ?? [], null); + $this->setIfExists('css', $data ?? [], null); + $this->setIfExists('js', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['html'] === null) { + $invalidProperties[] = "'html' can't be null"; + } + if ((mb_strlen($this->container['html']) > 1000000)) { + $invalidProperties[] = "invalid value for 'html', the character length must be smaller than or equal to 1000000."; + } + + if (!is_null($this->container['css']) && (mb_strlen($this->container['css']) > 500000)) { + $invalidProperties[] = "invalid value for 'css', the character length must be smaller than or equal to 500000."; + } + + if (!is_null($this->container['js']) && (mb_strlen($this->container['js']) > 500000)) { + $invalidProperties[] = "invalid value for 'js', the character length must be smaller than or equal to 500000."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of asset - set to `html5` for HTML5/CSS3/JS. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets html + * + * @return string + */ + public function getHtml() + { + return $this->container['html']; + } + + /** + * Sets html + * + * @param string $html The HTML markup for the asset. Max 1,000,000 characters. + * + * @return self + */ + public function setHtml($html) + { + if (is_null($html)) { + throw new \InvalidArgumentException('non-nullable html cannot be null'); + } + if ((mb_strlen($html) > 1000000)) { + throw new \InvalidArgumentException('invalid length for $html when calling Html5Asset., must be smaller than or equal to 1000000.'); + } + + $this->container['html'] = $html; + + return $this; + } + + /** + * Gets css + * + * @return string|null + */ + public function getCss() + { + return $this->container['css']; + } + + /** + * Sets css + * + * @param string|null $css The CSS string applied to the HTML. Max 500,000 characters. + * + * @return self + */ + public function setCss($css) + { + if (is_null($css)) { + throw new \InvalidArgumentException('non-nullable css cannot be null'); + } + if ((mb_strlen($css) > 500000)) { + throw new \InvalidArgumentException('invalid length for $css when calling Html5Asset., must be smaller than or equal to 500000.'); + } + + $this->container['css'] = $css; + + return $this; + } + + /** + * Gets js + * + * @return string|null + */ + public function getJs() + { + return $this->container['js']; + } + + /** + * Sets js + * + * @param string|null $js Optional JavaScript. Use for chart libraries, animations, or DOM manipulation. `gsap`, `d3`, `anime` and `lottie` are always available. CSS animations, transitions, and `Element.animate()` are also captured automatically. Max 500,000 characters. + * + * @return self + */ + public function setJs($js) + { + if (is_null($js)) { + throw new \InvalidArgumentException('non-nullable js cannot be null'); + } + if ((mb_strlen($js) > 500000)) { + throw new \InvalidArgumentException('invalid length for $js when calling Html5Asset., must be smaller than or equal to 500000.'); + } + + $this->container['js'] = $js; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/HtmlAsset.php b/src/Model/HtmlAsset.php index 390e730..b7339a6 100644 --- a/src/Model/HtmlAsset.php +++ b/src/Model/HtmlAsset.php @@ -35,7 +35,7 @@ * HtmlAsset Class Doc Comment * * @category Class - * @description **Notice: The HtmlAsset is deprecated, use the [TextAsset](#tocs_textasset) instead.** The HtmlAsset clip type lets you create text based layout and formatting using HTML and CSS. You can also set the height and width of a bounding box for the HTML content to sit within. Text and elements will wrap within the bounding box. + * @description **Notice: The HtmlAsset is deprecated, use the [RichTextAsset](#tocs_richtextasset) instead.** The HtmlAsset clip type lets you create text based layout and formatting using HTML and CSS. You can also set the height and width of a bounding box for the HTML content to sit within. Text and elements will wrap within the bounding box. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/src/Model/ImageAsset.php b/src/Model/ImageAsset.php index 657e952..e8ef1ba 100644 --- a/src/Model/ImageAsset.php +++ b/src/Model/ImageAsset.php @@ -35,7 +35,7 @@ * ImageAsset Class Doc Comment * * @category Class - * @description The ImageAsset is used to create video from images to compose an image. The src must be a publicly accessible URL to an image resource such as a jpg or png file. + * @description The ImageAsset adds an image to a Clip. The image can be sourced from a URL (`src`), generated from a text prompt (`prompt`), or both. At least one of `src` or `prompt` must be provided. - **Source URL:** set `src` to the publicly accessible URL of a jpg or png file. - **Generated:** set `prompt` to describe the image. Choose a generator with `model` and configure it with model-specific `options`; the engine fills `src` in automatically. - **Both:** `src` acts as a preview placeholder while `prompt` drives generation — the image is regenerated from the prompt at render time. Unchanged prompts and options resolve from the generation cache. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -60,6 +60,9 @@ class ImageAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'type' => 'string', 'src' => 'string', + 'prompt' => 'string', + 'model' => 'string', + 'options' => 'array', 'crop' => '\ShotstackClient\Model\Crop' ]; @@ -73,6 +76,9 @@ class ImageAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'type' => null, 'src' => null, + 'prompt' => null, + 'model' => null, + 'options' => null, 'crop' => null ]; @@ -84,6 +90,9 @@ class ImageAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'type' => false, 'src' => false, + 'prompt' => false, + 'model' => false, + 'options' => false, 'crop' => false ]; @@ -175,6 +184,9 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'type' => 'type', 'src' => 'src', + 'prompt' => 'prompt', + 'model' => 'model', + 'options' => 'options', 'crop' => 'crop' ]; @@ -186,6 +198,9 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'type' => 'setType', 'src' => 'setSrc', + 'prompt' => 'setPrompt', + 'model' => 'setModel', + 'options' => 'setOptions', 'crop' => 'setCrop' ]; @@ -197,6 +212,9 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'type' => 'getType', 'src' => 'getSrc', + 'prompt' => 'getPrompt', + 'model' => 'getModel', + 'options' => 'getOptions', 'crop' => 'getCrop' ]; @@ -272,6 +290,9 @@ public function __construct(array $data = null) { $this->setIfExists('type', $data ?? [], 'image'); $this->setIfExists('src', $data ?? [], null); + $this->setIfExists('prompt', $data ?? [], null); + $this->setIfExists('model', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('crop', $data ?? [], null); } @@ -314,17 +335,18 @@ public function listInvalidProperties() ); } - if ($this->container['src'] === null) { - $invalidProperties[] = "'src' can't be null"; - } - if ((mb_strlen($this->container['src']) < 1)) { + if (!is_null($this->container['src']) && (mb_strlen($this->container['src']) < 1)) { $invalidProperties[] = "invalid value for 'src', the character length must be bigger than or equal to 1."; } - if (!preg_match("/\\S/", $this->container['src'])) { + if (!is_null($this->container['src']) && !preg_match("/\\S/", $this->container['src'])) { $invalidProperties[] = "invalid value for 'src', must be conform to the pattern /\\S/."; } + if (!is_null($this->container['prompt']) && (mb_strlen($this->container['prompt']) > 4000)) { + $invalidProperties[] = "invalid value for 'prompt', the character length must be smaller than or equal to 4000."; + } + return $invalidProperties; } @@ -380,7 +402,7 @@ public function setType($type) /** * Gets src * - * @return string + * @return string|null */ public function getSrc() { @@ -390,7 +412,7 @@ public function getSrc() /** * Sets src * - * @param string $src The image source URL. The URL must be publicly accessible or include credentials. + * @param string|null $src The image source URL. The URL must be publicly accessible or include credentials. When `prompt` is also set, `src` serves as a preview placeholder and the image is regenerated from the prompt at render time. * * @return self */ @@ -412,6 +434,91 @@ public function setSrc($src) return $this; } + /** + * Gets prompt + * + * @return string|null + */ + public function getPrompt() + { + return $this->container['prompt']; + } + + /** + * Sets prompt + * + * @param string|null $prompt A text prompt to generate the image from. The engine generates an image at render time and fills `src` automatically; an existing `src` is treated as a preview placeholder and replaced. Use `model` to choose the generator and `options` to configure it. + * + * @return self + */ + public function setPrompt($prompt) + { + if (is_null($prompt)) { + throw new \InvalidArgumentException('non-nullable prompt cannot be null'); + } + if ((mb_strlen($prompt) > 4000)) { + throw new \InvalidArgumentException('invalid length for $prompt when calling ImageAsset., must be smaller than or equal to 4000.'); + } + + $this->container['prompt'] = $prompt; + + return $this; + } + + /** + * Gets model + * + * @return string|null + */ + public function getModel() + { + return $this->container['model']; + } + + /** + * Sets model + * + * @param string|null $model The generation model to use when `prompt` is set (e.g. `flux-schnell`, `nano-banana-2`). Defaults to `nano-banana-2` if omitted. Each model's available options are defined by the model registry. + * + * @return self + */ + public function setModel($model) + { + if (is_null($model)) { + throw new \InvalidArgumentException('non-nullable model cannot be null'); + } + $this->container['model'] = $model; + + return $this; + } + + /** + * Gets options + * + * @return array|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param array|null $options Model-specific generation settings. Valid keys and values depend on the chosen `model` and are defined by the model registry. Omitted options use the model's defaults. Unknown or invalid options are rejected. + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + /** * Gets crop * diff --git a/src/Model/ImageToVideoAsset.php b/src/Model/ImageToVideoAsset.php index c4eb44f..afe1af5 100644 --- a/src/Model/ImageToVideoAsset.php +++ b/src/Model/ImageToVideoAsset.php @@ -35,7 +35,7 @@ * ImageToVideoAsset Class Doc Comment * * @category Class - * @description The ImageToVideoAsset lets you create a video from an image and a text prompt. + * @description **Notice: ImageToVideoAsset is deprecated. Use [VideoAsset](#tocs_videoasset) with `prompt` and `inputSrc` instead.** This type continues to function and is internally rewritten to VideoAsset; no behaviour change for existing integrations. The ImageToVideoAsset lets you create a video from an image and a text prompt. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/src/Model/Output.php b/src/Model/Output.php index 277a62f..6112b3a 100644 --- a/src/Model/Output.php +++ b/src/Model/Output.php @@ -35,7 +35,7 @@ * Output Class Doc Comment * * @category Class - * @description The output format, render range and type of media to generate. + * @description The output format, render range and type of media to generate. For all formats except `mp3`, either `resolution` or `size` (with both `width` and `height`) must be specified. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -625,7 +625,7 @@ public function getResolution() /** * Sets resolution * - * @param string|null $resolution The preset output resolution of the video or image. For custom sizes use the `size` property.
  • `preview` - 512px x 288px @ 15fps
  • `mobile` - 640px x 360px @ 25fps
  • `sd` - 1024px x 576px @ 25fps
  • `hd` - 1280px x 720px @ 25fps
  • `1080` - 1920px x 1080px @ 25fps
  • `4k` - 3840px x 2160px @ 25fps
+ * @param string|null $resolution The preset output resolution of the video or image. For custom sizes use the `size` property. Either `resolution` or `size` (with both `width` and `height`) must be specified for all formats except `mp3`.
  • `preview` - 512px x 288px @ 15fps
  • `mobile` - 640px x 360px @ 25fps
  • `sd` - 1024px x 576px @ 25fps
  • `hd` - 1280px x 720px @ 25fps
  • `1080` - 1920px x 1080px @ 25fps
  • `4k` - 3840px x 2160px @ 25fps
* * @return self */ diff --git a/src/Model/PostGenerate200Response.php b/src/Model/PostGenerate200Response.php new file mode 100644 index 0000000..c50c582 --- /dev/null +++ b/src/Model/PostGenerate200Response.php @@ -0,0 +1,556 @@ + + */ +class PostGenerate200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'postGenerate_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'status' => 'string', + 'url' => 'string', + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'status' => null, + 'url' => null, + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'status' => false, + 'url' => false, + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'status' => 'status', + 'url' => 'url', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'status' => 'setStatus', + 'url' => 'setUrl', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'status' => 'getStatus', + 'url' => 'getUrl', + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_QUEUED = 'queued'; + public const STATUS_PROCESSING = 'processing'; + public const STATUS_DONE = 'done'; + public const STATUS_FAILED = 'failed'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_QUEUED, + self::STATUS_PROCESSING, + self::STATUS_DONE, + self::STATUS_FAILED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('url', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id The generation job id. Deterministic for a given owner and asset payload (or idempotency key), so identical requests return the same job and cached result. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status The status of the generation job. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url The public URL of the generated asset. Present only when `status` is `done`. + * + * @return self + */ + public function setUrl($url) + { + if (is_null($url)) { + throw new \InvalidArgumentException('non-nullable url cannot be null'); + } + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error A human readable error message. Present only when `status` is `failed`. + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/PostGenerateRequest.php b/src/Model/PostGenerateRequest.php new file mode 100644 index 0000000..91b246a --- /dev/null +++ b/src/Model/PostGenerateRequest.php @@ -0,0 +1,412 @@ + + */ +class PostGenerateRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'postGenerate_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asset' => '\ShotstackClient\Model\PostGenerateRequestAsset' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asset' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asset' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'asset' => 'asset' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asset' => 'setAsset' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asset' => 'getAsset' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('asset', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['asset'] === null) { + $invalidProperties[] = "'asset' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets asset + * + * @return \ShotstackClient\Model\PostGenerateRequestAsset + */ + public function getAsset() + { + return $this->container['asset']; + } + + /** + * Sets asset + * + * @param \ShotstackClient\Model\PostGenerateRequestAsset $asset asset + * + * @return self + */ + public function setAsset($asset) + { + if (is_null($asset)) { + throw new \InvalidArgumentException('non-nullable asset cannot be null'); + } + $this->container['asset'] = $asset; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/PostGenerateRequestAsset.php b/src/Model/PostGenerateRequestAsset.php new file mode 100644 index 0000000..c4472de --- /dev/null +++ b/src/Model/PostGenerateRequestAsset.php @@ -0,0 +1,972 @@ + + */ +class PostGenerateRequestAsset implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'postGenerate_request_asset'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'src' => 'string', + 'prompt' => 'string', + 'model' => 'string', + 'options' => 'array', + 'crop' => '\ShotstackClient\Model\Crop', + 'transcode' => 'bool', + 'trim' => 'float', + 'volume' => '\ShotstackClient\Model\AudioAssetVolume', + 'volume_effect' => 'string', + 'speed' => 'float', + 'chroma_key' => '\ShotstackClient\Model\ChromaKey', + 'effect' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'src' => null, + 'prompt' => null, + 'model' => null, + 'options' => null, + 'crop' => null, + 'transcode' => null, + 'trim' => null, + 'volume' => null, + 'volume_effect' => null, + 'speed' => 'float', + 'chroma_key' => null, + 'effect' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'src' => false, + 'prompt' => false, + 'model' => false, + 'options' => false, + 'crop' => false, + 'transcode' => false, + 'trim' => false, + 'volume' => false, + 'volume_effect' => false, + 'speed' => false, + 'chroma_key' => false, + 'effect' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'src' => 'src', + 'prompt' => 'prompt', + 'model' => 'model', + 'options' => 'options', + 'crop' => 'crop', + 'transcode' => 'transcode', + 'trim' => 'trim', + 'volume' => 'volume', + 'volume_effect' => 'volumeEffect', + 'speed' => 'speed', + 'chroma_key' => 'chromaKey', + 'effect' => 'effect' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'src' => 'setSrc', + 'prompt' => 'setPrompt', + 'model' => 'setModel', + 'options' => 'setOptions', + 'crop' => 'setCrop', + 'transcode' => 'setTranscode', + 'trim' => 'setTrim', + 'volume' => 'setVolume', + 'volume_effect' => 'setVolumeEffect', + 'speed' => 'setSpeed', + 'chroma_key' => 'setChromaKey', + 'effect' => 'setEffect' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'src' => 'getSrc', + 'prompt' => 'getPrompt', + 'model' => 'getModel', + 'options' => 'getOptions', + 'crop' => 'getCrop', + 'transcode' => 'getTranscode', + 'trim' => 'getTrim', + 'volume' => 'getVolume', + 'volume_effect' => 'getVolumeEffect', + 'speed' => 'getSpeed', + 'chroma_key' => 'getChromaKey', + 'effect' => 'getEffect' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const TYPE_IMAGE = 'image'; + public const TYPE_VIDEO = 'video'; + public const TYPE_AUDIO = 'audio'; + public const VOLUME_EFFECT_NONE = 'none'; + public const VOLUME_EFFECT_FADE_IN = 'fadeIn'; + public const VOLUME_EFFECT_FADE_OUT = 'fadeOut'; + public const VOLUME_EFFECT_FADE_IN_FADE_OUT = 'fadeInFadeOut'; + public const EFFECT_NONE = 'none'; + public const EFFECT_FADE_IN = 'fadeIn'; + public const EFFECT_FADE_OUT = 'fadeOut'; + public const EFFECT_FADE_IN_FADE_OUT = 'fadeInFadeOut'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_IMAGE, + self::TYPE_VIDEO, + self::TYPE_AUDIO, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getVolumeEffectAllowableValues() + { + return [ + self::VOLUME_EFFECT_NONE, + self::VOLUME_EFFECT_FADE_IN, + self::VOLUME_EFFECT_FADE_OUT, + self::VOLUME_EFFECT_FADE_IN_FADE_OUT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEffectAllowableValues() + { + return [ + self::EFFECT_NONE, + self::EFFECT_FADE_IN, + self::EFFECT_FADE_OUT, + self::EFFECT_FADE_IN_FADE_OUT, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], 'image'); + $this->setIfExists('src', $data ?? [], null); + $this->setIfExists('prompt', $data ?? [], null); + $this->setIfExists('model', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('crop', $data ?? [], null); + $this->setIfExists('transcode', $data ?? [], null); + $this->setIfExists('trim', $data ?? [], null); + $this->setIfExists('volume', $data ?? [], null); + $this->setIfExists('volume_effect', $data ?? [], null); + $this->setIfExists('speed', $data ?? [], null); + $this->setIfExists('chroma_key', $data ?? [], null); + $this->setIfExists('effect', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['src']) && (mb_strlen($this->container['src']) < 1)) { + $invalidProperties[] = "invalid value for 'src', the character length must be bigger than or equal to 1."; + } + + if (!is_null($this->container['src']) && !preg_match("/\\S/", $this->container['src'])) { + $invalidProperties[] = "invalid value for 'src', must be conform to the pattern /\\S/."; + } + + if (!is_null($this->container['prompt']) && (mb_strlen($this->container['prompt']) > 4000)) { + $invalidProperties[] = "invalid value for 'prompt', the character length must be smaller than or equal to 4000."; + } + + $allowedValues = $this->getVolumeEffectAllowableValues(); + if (!is_null($this->container['volume_effect']) && !in_array($this->container['volume_effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'volume_effect', must be one of '%s'", + $this->container['volume_effect'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['speed']) && ($this->container['speed'] > 10)) { + $invalidProperties[] = "invalid value for 'speed', must be smaller than or equal to 10."; + } + + if (!is_null($this->container['speed']) && ($this->container['speed'] < 0)) { + $invalidProperties[] = "invalid value for 'speed', must be bigger than or equal to 0."; + } + + $allowedValues = $this->getEffectAllowableValues(); + if (!is_null($this->container['effect']) && !in_array($this->container['effect'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'effect', must be one of '%s'", + $this->container['effect'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of asset - set to `image` for images. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets src + * + * @return string|null + */ + public function getSrc() + { + return $this->container['src']; + } + + /** + * Sets src + * + * @param string|null $src The audio source URL. The URL must be publicly accessible or include credentials. When `prompt` is also set, `src` serves as a preview placeholder and the audio is regenerated from the prompt at render time. + * + * @return self + */ + public function setSrc($src) + { + if (is_null($src)) { + throw new \InvalidArgumentException('non-nullable src cannot be null'); + } + + if ((mb_strlen($src) < 1)) { + throw new \InvalidArgumentException('invalid length for $src when calling PostGenerateRequestAsset., must be bigger than or equal to 1.'); + } + if ((!preg_match("/\\S/", ObjectSerializer::toString($src)))) { + throw new \InvalidArgumentException("invalid value for \$src when calling PostGenerateRequestAsset., must conform to the pattern /\\S/."); + } + + $this->container['src'] = $src; + + return $this; + } + + /** + * Gets prompt + * + * @return string|null + */ + public function getPrompt() + { + return $this->container['prompt']; + } + + /** + * Sets prompt + * + * @param string|null $prompt A text prompt. For text-to-speech models the prompt is the spoken text; for music models it describes the sound to generate. The generated `src` is filled in automatically; an existing `src` is treated as a preview placeholder and replaced. + * + * @return self + */ + public function setPrompt($prompt) + { + if (is_null($prompt)) { + throw new \InvalidArgumentException('non-nullable prompt cannot be null'); + } + if ((mb_strlen($prompt) > 4000)) { + throw new \InvalidArgumentException('invalid length for $prompt when calling PostGenerateRequestAsset., must be smaller than or equal to 4000.'); + } + + $this->container['prompt'] = $prompt; + + return $this; + } + + /** + * Gets model + * + * @return string|null + */ + public function getModel() + { + return $this->container['model']; + } + + /** + * Sets model + * + * @param string|null $model The generation model to use when `prompt` is set (e.g. `polly-neural`, `elevenlabs-tts`, `elevenlabs-music`). Defaults to `elevenlabs-tts` (with a default voice) if omitted. Each model's available options are defined by the model registry. + * + * @return self + */ + public function setModel($model) + { + if (is_null($model)) { + throw new \InvalidArgumentException('non-nullable model cannot be null'); + } + $this->container['model'] = $model; + + return $this; + } + + /** + * Gets options + * + * @return array|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param array|null $options Model-specific generation settings. Valid keys and values depend on the chosen `model` and are defined by the model registry. Omitted options use the model's defaults. Unknown or invalid options are rejected. + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + + /** + * Gets crop + * + * @return \ShotstackClient\Model\Crop|null + */ + public function getCrop() + { + return $this->container['crop']; + } + + /** + * Sets crop + * + * @param \ShotstackClient\Model\Crop|null $crop crop + * + * @return self + */ + public function setCrop($crop) + { + if (is_null($crop)) { + throw new \InvalidArgumentException('non-nullable crop cannot be null'); + } + $this->container['crop'] = $crop; + + return $this; + } + + /** + * Gets transcode + * + * @return bool|null + */ + public function getTranscode() + { + return $this->container['transcode']; + } + + /** + * Sets transcode + * + * @param bool|null $transcode Set to `true` to force re-encoding of the video during preprocessing. This can help resolve compatibility issues, fix rotation problems, synchronize audio, or convert formats. The video will be processed to ensure optimal compatibility with the rendering engine. + * + * @return self + */ + public function setTranscode($transcode) + { + if (is_null($transcode)) { + throw new \InvalidArgumentException('non-nullable transcode cannot be null'); + } + $this->container['transcode'] = $transcode; + + return $this; + } + + /** + * Gets trim + * + * @return float|null + */ + public function getTrim() + { + return $this->container['trim']; + } + + /** + * Sets trim + * + * @param float|null $trim The start trim point of the audio clip, in seconds (defaults to 0). Audio will start from the in trim point. The audio will play until the file ends or the Clip length is reached. + * + * @return self + */ + public function setTrim($trim) + { + if (is_null($trim)) { + throw new \InvalidArgumentException('non-nullable trim cannot be null'); + } + $this->container['trim'] = $trim; + + return $this; + } + + /** + * Gets volume + * + * @return \ShotstackClient\Model\AudioAssetVolume|null + */ + public function getVolume() + { + return $this->container['volume']; + } + + /** + * Sets volume + * + * @param \ShotstackClient\Model\AudioAssetVolume|null $volume volume + * + * @return self + */ + public function setVolume($volume) + { + if (is_null($volume)) { + throw new \InvalidArgumentException('non-nullable volume cannot be null'); + } + $this->container['volume'] = $volume; + + return $this; + } + + /** + * Gets volume_effect + * + * @return string|null + */ + public function getVolumeEffect() + { + return $this->container['volume_effect']; + } + + /** + * Sets volume_effect + * + * @param string|null $volume_effect Preset volume effects to apply to the video asset
  • `fadeIn` - fade volume in only
  • `fadeOut` - fade volume out only
  • `fadeInFadeOut` - fade volume in and out
+ * + * @return self + */ + public function setVolumeEffect($volume_effect) + { + if (is_null($volume_effect)) { + throw new \InvalidArgumentException('non-nullable volume_effect cannot be null'); + } + $allowedValues = $this->getVolumeEffectAllowableValues(); + if (!in_array($volume_effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'volume_effect', must be one of '%s'", + $volume_effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['volume_effect'] = $volume_effect; + + return $this; + } + + /** + * Gets speed + * + * @return float|null + */ + public function getSpeed() + { + return $this->container['speed']; + } + + /** + * Sets speed + * + * @param float|null $speed Adjust the playback speed of the audio clip between 0 (paused) and 10 (10x normal speed), where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire audio (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire audio (i.e. original length / 2). + * + * @return self + */ + public function setSpeed($speed) + { + if (is_null($speed)) { + throw new \InvalidArgumentException('non-nullable speed cannot be null'); + } + + if (($speed > 10)) { + throw new \InvalidArgumentException('invalid value for $speed when calling PostGenerateRequestAsset., must be smaller than or equal to 10.'); + } + if (($speed < 0)) { + throw new \InvalidArgumentException('invalid value for $speed when calling PostGenerateRequestAsset., must be bigger than or equal to 0.'); + } + + $this->container['speed'] = $speed; + + return $this; + } + + /** + * Gets chroma_key + * + * @return \ShotstackClient\Model\ChromaKey|null + */ + public function getChromaKey() + { + return $this->container['chroma_key']; + } + + /** + * Sets chroma_key + * + * @param \ShotstackClient\Model\ChromaKey|null $chroma_key chroma_key + * + * @return self + */ + public function setChromaKey($chroma_key) + { + if (is_null($chroma_key)) { + throw new \InvalidArgumentException('non-nullable chroma_key cannot be null'); + } + $this->container['chroma_key'] = $chroma_key; + + return $this; + } + + /** + * Gets effect + * + * @return string|null + */ + public function getEffect() + { + return $this->container['effect']; + } + + /** + * Sets effect + * + * @param string|null $effect The effect to apply to the audio asset
  • `fadeIn` - fade volume in only
  • `fadeOut` - fade volume out only
  • `fadeInFadeOut` - fade volume in and out
+ * + * @return self + */ + public function setEffect($effect) + { + if (is_null($effect)) { + throw new \InvalidArgumentException('non-nullable effect cannot be null'); + } + $allowedValues = $this->getEffectAllowableValues(); + if (!in_array($effect, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'effect', must be one of '%s'", + $effect, + implode("', '", $allowedValues) + ) + ); + } + $this->container['effect'] = $effect; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/RichCaptionAsset.php b/src/Model/RichCaptionAsset.php index 07ef861..c650376 100644 --- a/src/Model/RichCaptionAsset.php +++ b/src/Model/RichCaptionAsset.php @@ -35,7 +35,7 @@ * RichCaptionAsset Class Doc Comment * * @category Class - * @description The RichCaptionAsset provides word-level caption animations with rich-text styling. It supports karaoke-style highlighting, word-by-word animations, and advanced typography. Use with SRT/VTT files or auto-transcription via aliases. + * @description The RichCaptionAsset provides word-level caption animations with rich-text styling. It supports karaoke-style highlighting, word-by-word animations, and advanced typography. Captions can be sourced from SRT/VTT/TTML subtitle files, from audio/video media URLs (auto-transcribed), or from alias references to other clips in the same timeline. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -449,7 +449,7 @@ public function getSrc() /** * Sets src * - * @param string $src The URL to an SRT or VTT subtitles file, or an alias reference to auto-generate captions from an audio or video clip. For file URLs, the URL must be publicly accessible or include credentials. For auto-captioning, use the format `alias://clip-name` where clip-name is the alias of an audio, video, or text-to-speech clip. + * @param string $src Source for the caption words. Accepts three formats: (1) the URL to a subtitle file (`.srt`, `.vtt`, `.ttml`, or `.dfxp`) which is parsed directly; (2) the URL to an audio or video media file (`.mp4`, `.mov`, `.webm`, `.mp3`, `.wav`, `.m4a`, `.flac`, `.aac`, `.ogg`, and related formats) which is auto-transcribed; (3) an alias reference in the form `alias://clip-name` where `clip-name` is the alias of another audio, video, or text-to-speech clip in the same timeline — the referenced clip's source is auto-transcribed. For file URLs, the URL must be publicly accessible or include credentials. Content is classified at runtime and unsupported content types (HTML, PDF, images, archives) are rejected with a structured error. * * @return self */ diff --git a/src/Model/RichTextBackground.php b/src/Model/RichTextBackground.php index 0e23aae..f8769bc 100644 --- a/src/Model/RichTextBackground.php +++ b/src/Model/RichTextBackground.php @@ -60,7 +60,9 @@ class RichTextBackground implements ModelInterface, ArrayAccess, \JsonSerializab protected static $openAPITypes = [ 'color' => 'string', 'opacity' => 'float', - 'border_radius' => 'float' + 'border_radius' => 'float', + 'wrap' => 'bool', + 'padding' => 'int' ]; /** @@ -73,7 +75,9 @@ class RichTextBackground implements ModelInterface, ArrayAccess, \JsonSerializab protected static $openAPIFormats = [ 'color' => null, 'opacity' => null, - 'border_radius' => null + 'border_radius' => null, + 'wrap' => null, + 'padding' => null ]; /** @@ -84,7 +88,9 @@ class RichTextBackground implements ModelInterface, ArrayAccess, \JsonSerializab protected static array $openAPINullables = [ 'color' => false, 'opacity' => false, - 'border_radius' => false + 'border_radius' => false, + 'wrap' => false, + 'padding' => false ]; /** @@ -175,7 +181,9 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'color' => 'color', 'opacity' => 'opacity', - 'border_radius' => 'borderRadius' + 'border_radius' => 'borderRadius', + 'wrap' => 'wrap', + 'padding' => 'padding' ]; /** @@ -186,7 +194,9 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'color' => 'setColor', 'opacity' => 'setOpacity', - 'border_radius' => 'setBorderRadius' + 'border_radius' => 'setBorderRadius', + 'wrap' => 'setWrap', + 'padding' => 'setPadding' ]; /** @@ -197,7 +207,9 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'color' => 'getColor', 'opacity' => 'getOpacity', - 'border_radius' => 'getBorderRadius' + 'border_radius' => 'getBorderRadius', + 'wrap' => 'getWrap', + 'padding' => 'getPadding' ]; /** @@ -260,6 +272,8 @@ public function __construct(array $data = null) $this->setIfExists('color', $data ?? [], null); $this->setIfExists('opacity', $data ?? [], 1); $this->setIfExists('border_radius', $data ?? [], 0); + $this->setIfExists('wrap', $data ?? [], false); + $this->setIfExists('padding', $data ?? [], null); } /** @@ -305,6 +319,14 @@ public function listInvalidProperties() $invalidProperties[] = "invalid value for 'border_radius', must be bigger than or equal to 0."; } + if (!is_null($this->container['padding']) && ($this->container['padding'] > 200)) { + $invalidProperties[] = "invalid value for 'padding', must be smaller than or equal to 200."; + } + + if (!is_null($this->container['padding']) && ($this->container['padding'] < 0)) { + $invalidProperties[] = "invalid value for 'padding', must be bigger than or equal to 0."; + } + return $invalidProperties; } @@ -418,6 +440,68 @@ public function setBorderRadius($border_radius) return $this; } + + /** + * Gets wrap + * + * @return bool|null + */ + public function getWrap() + { + return $this->container['wrap']; + } + + /** + * Sets wrap + * + * @param bool|null $wrap When true, the background pill shrinks to fit the rendered text bounding box plus the asset's padding (and stroke width, if present), producing a pill or badge effect. When false (default), the background fills the full asset content area. Available on rich-text and rich-caption assets only; not supported on legacy `type: text`. + * + * @return self + */ + public function setWrap($wrap) + { + if (is_null($wrap)) { + throw new \InvalidArgumentException('non-nullable wrap cannot be null'); + } + $this->container['wrap'] = $wrap; + + return $this; + } + + /** + * Gets padding + * + * @return int|null + */ + public function getPadding() + { + return $this->container['padding']; + } + + /** + * Sets padding + * + * @param int|null $padding Inner padding in pixels between the wrap pill edge and the rendered text. Only takes effect when `wrap: true`. When omitted, the renderer applies a sensible default proportional to the font size (approximately 12% of the active page font size on rich-caption assets). Set to 0 for a pill that hugs the text exactly. Available on rich-text and rich-caption assets only. + * + * @return self + */ + public function setPadding($padding) + { + if (is_null($padding)) { + throw new \InvalidArgumentException('non-nullable padding cannot be null'); + } + + if (($padding > 200)) { + throw new \InvalidArgumentException('invalid value for $padding when calling RichTextBackground., must be smaller than or equal to 200.'); + } + if (($padding < 0)) { + throw new \InvalidArgumentException('invalid value for $padding when calling RichTextBackground., must be bigger than or equal to 0.'); + } + + $this->container['padding'] = $padding; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Model/Soundtrack.php b/src/Model/Soundtrack.php index 3605ce2..0fc6635 100644 --- a/src/Model/Soundtrack.php +++ b/src/Model/Soundtrack.php @@ -35,7 +35,7 @@ * Soundtrack Class Doc Comment * * @category Class - * @description A music or audio file in mp3 format that plays for the duration of the rendered video or the length of the audio file, which ever is shortest. + * @description **Notice: The Soundtrack is deprecated, use an [AudioAsset](#tocs_audioasset) clip on its own track instead.** This type continues to function; no behaviour change for existing integrations. A music or audio file in mp3 format that plays for the duration of the rendered video or the length of the audio file, which ever is shortest. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/src/Model/TextAsset.php b/src/Model/TextAsset.php index e7e955a..bd75ee4 100644 --- a/src/Model/TextAsset.php +++ b/src/Model/TextAsset.php @@ -35,7 +35,7 @@ * TextAsset Class Doc Comment * * @category Class - * @description The TextAsset is used to add text and titles to a video. The text can be styled with built in and custom [Fonts](#tocs_font). You can also add a background bounding box used to control wrapping and overflow. Emoticons are also supported. + * @description **Notice: The TextAsset is deprecated, use the [RichTextAsset](#tocs_richtextasset) instead.** This type continues to function; no behaviour change for existing integrations. The TextAsset is used to add text and titles to a video. The text can be styled with built in and custom [Fonts](#tocs_font). You can also add a background bounding box used to control wrapping and overflow. Emoticons are also supported. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/src/Model/TextBackground.php b/src/Model/TextBackground.php index ea31b91..68092ff 100644 --- a/src/Model/TextBackground.php +++ b/src/Model/TextBackground.php @@ -61,7 +61,8 @@ class TextBackground implements ModelInterface, ArrayAccess, \JsonSerializable 'color' => 'string', 'opacity' => 'float', 'padding' => 'float', - 'border_radius' => 'float' + 'border_radius' => 'float', + 'wrap' => 'bool' ]; /** @@ -75,7 +76,8 @@ class TextBackground implements ModelInterface, ArrayAccess, \JsonSerializable 'color' => null, 'opacity' => null, 'padding' => null, - 'border_radius' => null + 'border_radius' => null, + 'wrap' => null ]; /** @@ -87,7 +89,8 @@ class TextBackground implements ModelInterface, ArrayAccess, \JsonSerializable 'color' => false, 'opacity' => false, 'padding' => false, - 'border_radius' => false + 'border_radius' => false, + 'wrap' => false ]; /** @@ -179,7 +182,8 @@ public function isNullableSetToNull(string $property): bool 'color' => 'color', 'opacity' => 'opacity', 'padding' => 'padding', - 'border_radius' => 'borderRadius' + 'border_radius' => 'borderRadius', + 'wrap' => 'wrap' ]; /** @@ -191,7 +195,8 @@ public function isNullableSetToNull(string $property): bool 'color' => 'setColor', 'opacity' => 'setOpacity', 'padding' => 'setPadding', - 'border_radius' => 'setBorderRadius' + 'border_radius' => 'setBorderRadius', + 'wrap' => 'setWrap' ]; /** @@ -203,7 +208,8 @@ public function isNullableSetToNull(string $property): bool 'color' => 'getColor', 'opacity' => 'getOpacity', 'padding' => 'getPadding', - 'border_radius' => 'getBorderRadius' + 'border_radius' => 'getBorderRadius', + 'wrap' => 'getWrap' ]; /** @@ -267,6 +273,7 @@ public function __construct(array $data = null) $this->setIfExists('opacity', $data ?? [], null); $this->setIfExists('padding', $data ?? [], null); $this->setIfExists('border_radius', $data ?? [], null); + $this->setIfExists('wrap', $data ?? [], null); } /** @@ -468,6 +475,33 @@ public function setBorderRadius($border_radius) return $this; } + + /** + * Gets wrap + * + * @return bool|null + */ + public function getWrap() + { + return $this->container['wrap']; + } + + /** + * Sets wrap + * + * @param bool|null $wrap Not supported on legacy `text` assets. Accepted here only so validators can emit a clear migration error pointing users to `rich-text` or `rich-caption`, which support background wrapping natively. + * + * @return self + */ + public function setWrap($wrap) + { + if (is_null($wrap)) { + throw new \InvalidArgumentException('non-nullable wrap cannot be null'); + } + $this->container['wrap'] = $wrap; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Model/TextToImageAsset.php b/src/Model/TextToImageAsset.php index 7b25d44..94a47f1 100644 --- a/src/Model/TextToImageAsset.php +++ b/src/Model/TextToImageAsset.php @@ -35,7 +35,7 @@ * TextToImageAsset Class Doc Comment * * @category Class - * @description The TextToImageAsset lets you create a dynamic image from a text prompt. + * @description **Notice: TextToImageAsset is deprecated. Use [ImageAsset](#tocs_imageasset) with `prompt` instead.** This type continues to function and is internally rewritten to ImageAsset; no behaviour change for existing integrations. The TextToImageAsset lets you create a dynamic image from a text prompt. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/src/Model/TextToSpeechAsset.php b/src/Model/TextToSpeechAsset.php index 2611591..852c374 100644 --- a/src/Model/TextToSpeechAsset.php +++ b/src/Model/TextToSpeechAsset.php @@ -35,7 +35,7 @@ * TextToSpeechAsset Class Doc Comment * * @category Class - * @description The TextToSpeechAsset lets you generate a voice over from text using a text-to-speech service. The generated audio can be trimmed, faded and have its volume and speed adjusted using the same properties available on the AudioAsset. + * @description **Notice: TextToSpeechAsset is deprecated. Use [AudioAsset](#tocs_audioasset) with `prompt` (the spoken text) and `voice` instead.** This type continues to function and is internally rewritten to AudioAsset; no behaviour change for existing integrations. The TextToSpeechAsset lets you generate a voice over from text using a text-to-speech service. The generated audio can be trimmed, faded and have its volume and speed adjusted using the same properties available on the AudioAsset. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/src/Model/Timeline.php b/src/Model/Timeline.php index 77392db..3c934e8 100644 --- a/src/Model/Timeline.php +++ b/src/Model/Timeline.php @@ -329,6 +329,7 @@ public function valid() * Gets soundtrack * * @return \ShotstackClient\Model\Soundtrack|null + * @deprecated */ public function getSoundtrack() { @@ -341,6 +342,7 @@ public function getSoundtrack() * @param \ShotstackClient\Model\Soundtrack|null $soundtrack soundtrack * * @return self + * @deprecated */ public function setSoundtrack($soundtrack) { diff --git a/src/Model/TitleAsset.php b/src/Model/TitleAsset.php index 1d65252..ec75a6c 100644 --- a/src/Model/TitleAsset.php +++ b/src/Model/TitleAsset.php @@ -35,7 +35,7 @@ * TitleAsset Class Doc Comment * * @category Class - * @description **Notice: The TitleAsset is deprecated, use the [TextAsset](#tocs_textasset) instead.** The TitleAsset clip type lets you create video titles from a text string and apply styling and positioning. + * @description **Notice: The TitleAsset is deprecated, use the [RichTextAsset](#tocs_richtextasset) instead.** The TitleAsset clip type lets you create video titles from a text string and apply styling and positioning. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech diff --git a/src/Model/VideoAsset.php b/src/Model/VideoAsset.php index b643b62..9032715 100644 --- a/src/Model/VideoAsset.php +++ b/src/Model/VideoAsset.php @@ -35,7 +35,7 @@ * VideoAsset Class Doc Comment * * @category Class - * @description The VideoAsset is used to create video sequences from video files. The src must be a publicly accessible URL to a video resource such as an mp4 file. + * @description The VideoAsset adds a video to a Clip. The video can be sourced from a URL (`src`), generated from a text prompt (`prompt`), or both. At least one of `src` or `prompt` must be provided. - **Source URL:** set `src` to the URL of an mp4 (or compatible) video file. - **Generated:** set `prompt` to describe the motion. Choose a generator with `model` and configure it with model-specific `options` (including a starting image for image-to-video). The generated `src` is filled in automatically. - **Both:** `src` acts as a preview placeholder while `prompt` drives generation — the video is regenerated from the prompt at render time. Unchanged prompts and options resolve from the generation cache. * @package ShotstackClient * @author OpenAPI Generator team * @link https://openapi-generator.tech @@ -60,6 +60,9 @@ class VideoAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'type' => 'string', 'src' => 'string', + 'prompt' => 'string', + 'model' => 'string', + 'options' => 'array', 'transcode' => 'bool', 'trim' => 'float', 'volume' => '\ShotstackClient\Model\VideoAssetVolume', @@ -79,6 +82,9 @@ class VideoAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'type' => null, 'src' => null, + 'prompt' => null, + 'model' => null, + 'options' => null, 'transcode' => null, 'trim' => null, 'volume' => null, @@ -96,6 +102,9 @@ class VideoAsset implements ModelInterface, ArrayAccess, \JsonSerializable protected static array $openAPINullables = [ 'type' => false, 'src' => false, + 'prompt' => false, + 'model' => false, + 'options' => false, 'transcode' => false, 'trim' => false, 'volume' => false, @@ -193,6 +202,9 @@ public function isNullableSetToNull(string $property): bool protected static $attributeMap = [ 'type' => 'type', 'src' => 'src', + 'prompt' => 'prompt', + 'model' => 'model', + 'options' => 'options', 'transcode' => 'transcode', 'trim' => 'trim', 'volume' => 'volume', @@ -210,6 +222,9 @@ public function isNullableSetToNull(string $property): bool protected static $setters = [ 'type' => 'setType', 'src' => 'setSrc', + 'prompt' => 'setPrompt', + 'model' => 'setModel', + 'options' => 'setOptions', 'transcode' => 'setTranscode', 'trim' => 'setTrim', 'volume' => 'setVolume', @@ -227,6 +242,9 @@ public function isNullableSetToNull(string $property): bool protected static $getters = [ 'type' => 'getType', 'src' => 'getSrc', + 'prompt' => 'getPrompt', + 'model' => 'getModel', + 'options' => 'getOptions', 'transcode' => 'getTranscode', 'trim' => 'getTrim', 'volume' => 'getVolume', @@ -327,6 +345,9 @@ public function __construct(array $data = null) { $this->setIfExists('type', $data ?? [], 'video'); $this->setIfExists('src', $data ?? [], null); + $this->setIfExists('prompt', $data ?? [], null); + $this->setIfExists('model', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); $this->setIfExists('transcode', $data ?? [], null); $this->setIfExists('trim', $data ?? [], null); $this->setIfExists('volume', $data ?? [], null); @@ -375,17 +396,18 @@ public function listInvalidProperties() ); } - if ($this->container['src'] === null) { - $invalidProperties[] = "'src' can't be null"; - } - if ((mb_strlen($this->container['src']) < 1)) { + if (!is_null($this->container['src']) && (mb_strlen($this->container['src']) < 1)) { $invalidProperties[] = "invalid value for 'src', the character length must be bigger than or equal to 1."; } - if (!preg_match("/\\S/", $this->container['src'])) { + if (!is_null($this->container['src']) && !preg_match("/\\S/", $this->container['src'])) { $invalidProperties[] = "invalid value for 'src', must be conform to the pattern /\\S/."; } + if (!is_null($this->container['prompt']) && (mb_strlen($this->container['prompt']) > 4000)) { + $invalidProperties[] = "invalid value for 'prompt', the character length must be smaller than or equal to 4000."; + } + $allowedValues = $this->getVolumeEffectAllowableValues(); if (!is_null($this->container['volume_effect']) && !in_array($this->container['volume_effect'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -458,7 +480,7 @@ public function setType($type) /** * Gets src * - * @return string + * @return string|null */ public function getSrc() { @@ -468,7 +490,7 @@ public function getSrc() /** * Sets src * - * @param string $src The video source URL. The URL must be publicly accessible or include credentials. + * @param string|null $src The video source URL. The URL must be publicly accessible or include credentials. When `prompt` is also set, `src` serves as a preview placeholder and the video is regenerated from the prompt at render time. * * @return self */ @@ -490,6 +512,91 @@ public function setSrc($src) return $this; } + /** + * Gets prompt + * + * @return string|null + */ + public function getPrompt() + { + return $this->container['prompt']; + } + + /** + * Sets prompt + * + * @param string|null $prompt A text prompt to generate the video from. The engine generates a video at render time and fills `src` automatically; an existing `src` is treated as a preview placeholder and replaced. Use `model` to choose the generator and `options` to configure it (including a starting image for image-to-video). + * + * @return self + */ + public function setPrompt($prompt) + { + if (is_null($prompt)) { + throw new \InvalidArgumentException('non-nullable prompt cannot be null'); + } + if ((mb_strlen($prompt) > 4000)) { + throw new \InvalidArgumentException('invalid length for $prompt when calling VideoAsset., must be smaller than or equal to 4000.'); + } + + $this->container['prompt'] = $prompt; + + return $this; + } + + /** + * Gets model + * + * @return string|null + */ + public function getModel() + { + return $this->container['model']; + } + + /** + * Sets model + * + * @param string|null $model The generation model to use when `prompt` is set (e.g. `shotstack-itv-mini`, `ray-flash-2`, `seedance-2.0`). Defaults to `seedance-2.0` if omitted. Each model's available options are defined by the model registry. + * + * @return self + */ + public function setModel($model) + { + if (is_null($model)) { + throw new \InvalidArgumentException('non-nullable model cannot be null'); + } + $this->container['model'] = $model; + + return $this; + } + + /** + * Gets options + * + * @return array|null + */ + public function getOptions() + { + return $this->container['options']; + } + + /** + * Sets options + * + * @param array|null $options Model-specific generation settings. Valid keys and values depend on the chosen `model` and are defined by the model registry. Omitted options use the model's defaults. Unknown or invalid options are rejected. + * + * @return self + */ + public function setOptions($options) + { + if (is_null($options)) { + throw new \InvalidArgumentException('non-nullable options cannot be null'); + } + $this->container['options'] = $options; + + return $this; + } + /** * Gets transcode * @@ -621,7 +728,7 @@ public function getSpeed() /** * Sets speed * - * @param float|null $speed Adjust the playback speed of the video clip between 0 (paused) and 10 (10x normal speed) where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire video (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire video (i.e. original length / 2). + * @param float|null $speed Adjust the playback speed of the video clip between 0 (paused) and 10 (10x normal speed) where 1 is normal speed (defaults to 1). Adjusting the speed will also adjust the duration of the clip and may require you to adjust the Clip length. For example, if you set speed to 0.5, the clip will need to be 2x as long to play the entire video (i.e. original length / 0.5). If you set speed to 2, the clip will need to be half as long to play the entire video (i.e. original length / 2). * * @return self */