11<?php
22/**
33 * EndpointsApi
4- * PHP version 5
4+ * PHP version 7.2
55 *
66 * @category Class
77 * @package Shotstack\Client
1717 * The version of the OpenAPI document: v1
1818 *
1919 * Generated by: https://openapi-generator.tech
20- * OpenAPI Generator version: 4.2.1
20+ * OpenAPI Generator version: 5.0.0
2121 */
2222
2323/**
@@ -73,34 +73,34 @@ class EndpointsApi
7373 * @param ClientInterface $client
7474 * @param Configuration $config
7575 * @param HeaderSelector $selector
76- * @param int $host_index (Optional) host index to select the list of hosts if defined in the OpenAPI spec
76+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
7777 */
7878 public function __construct (
7979 ClientInterface $ client = null ,
8080 Configuration $ config = null ,
8181 HeaderSelector $ selector = null ,
82- $ host_index = 0
82+ $ hostIndex = 0
8383 ) {
8484 $ this ->client = $ client ?: new Client ();
8585 $ this ->config = $ config ?: new Configuration ();
8686 $ this ->headerSelector = $ selector ?: new HeaderSelector ();
87- $ this ->hostIndex = $ host_index ;
87+ $ this ->hostIndex = $ hostIndex ;
8888 }
8989
9090 /**
9191 * Set the host index
9292 *
93- * @param int Host index (required)
93+ * @param int $hostIndex Host index (required)
9494 */
95- public function setHostIndex ($ host_index )
95+ public function setHostIndex ($ hostIndex )
9696 {
97- $ this ->hostIndex = $ host_index ;
97+ $ this ->hostIndex = $ hostIndex ;
9898 }
9999
100100 /**
101101 * Get the host index
102102 *
103- * @return Host index
103+ * @return int Host index
104104 */
105105 public function getHostIndex ()
106106 {
@@ -156,7 +156,7 @@ public function getRenderWithHttpInfo($id)
156156 "[ {$ e ->getCode ()}] {$ e ->getMessage ()}" ,
157157 $ e ->getCode (),
158158 $ e ->getResponse () ? $ e ->getResponse ()->getHeaders () : null ,
159- $ e ->getResponse () ? $ e ->getResponse ()->getBody ()-> getContents () : null
159+ $ e ->getResponse () ? ( string ) $ e ->getResponse ()->getBody () : null
160160 );
161161 }
162162
@@ -181,7 +181,7 @@ public function getRenderWithHttpInfo($id)
181181 if ('\Shotstack\Client\Model\RenderResponse ' === '\SplFileObject ' ) {
182182 $ content = $ responseBody ; //stream goes to serializer
183183 } else {
184- $ content = $ responseBody -> getContents () ;
184+ $ content = ( string ) $ responseBody ;
185185 }
186186
187187 return [
@@ -196,7 +196,7 @@ public function getRenderWithHttpInfo($id)
196196 if ($ returnType === '\SplFileObject ' ) {
197197 $ content = $ responseBody ; //stream goes to serializer
198198 } else {
199- $ content = $ responseBody -> getContents () ;
199+ $ content = ( string ) $ responseBody ;
200200 }
201201
202202 return [
@@ -263,7 +263,7 @@ function ($response) use ($returnType) {
263263 if ($ returnType === '\SplFileObject ' ) {
264264 $ content = $ responseBody ; //stream goes to serializer
265265 } else {
266- $ content = $ responseBody -> getContents () ;
266+ $ content = ( string ) $ responseBody ;
267267 }
268268
269269 return [
@@ -297,7 +297,7 @@ function ($exception) {
297297 * @throws \InvalidArgumentException
298298 * @return \GuzzleHttp\Psr7\Request
299299 */
300- protected function getRenderRequest ($ id )
300+ public function getRenderRequest ($ id )
301301 {
302302 // verify the required parameter 'id' is set
303303 if ($ id === null || (is_array ($ id ) && count ($ id ) === 0 )) {
@@ -318,6 +318,7 @@ protected function getRenderRequest($id)
318318 $ multipart = false ;
319319
320320
321+
321322 // path params
322323 if ($ id !== null ) {
323324 $ resourcePath = str_replace (
@@ -327,8 +328,6 @@ protected function getRenderRequest($id)
327328 );
328329 }
329330
330- // body params
331- $ _tempBody = null ;
332331
333332 if ($ multipart ) {
334333 $ headers = $ this ->headerSelector ->selectHeadersForMultipart (
@@ -342,21 +341,17 @@ protected function getRenderRequest($id)
342341 }
343342
344343 // for model (json/xml)
345- if (isset ($ _tempBody )) {
346- // $_tempBody is the method argument, if present
347- if ($ headers ['Content-Type ' ] === 'application/json ' ) {
348- $ httpBody = \GuzzleHttp \json_encode (ObjectSerializer::sanitizeForSerialization ($ _tempBody ));
349- } else {
350- $ httpBody = $ _tempBody ;
351- }
352- } elseif (count ($ formParams ) > 0 ) {
344+ if (count ($ formParams ) > 0 ) {
353345 if ($ multipart ) {
354346 $ multipartContents = [];
355347 foreach ($ formParams as $ formParamName => $ formParamValue ) {
356- $ multipartContents [] = [
357- 'name ' => $ formParamName ,
358- 'contents ' => $ formParamValue
359- ];
348+ $ formParamValueItems = is_array ($ formParamValue ) ? $ formParamValue : [$ formParamValue ];
349+ foreach ($ formParamValueItems as $ formParamValueItem ) {
350+ $ multipartContents [] = [
351+ 'name ' => $ formParamName ,
352+ 'contents ' => $ formParamValueItem
353+ ];
354+ }
360355 }
361356 // for HTTP post (form)
362357 $ httpBody = new MultipartStream ($ multipartContents );
@@ -439,7 +434,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
439434 "[ {$ e ->getCode ()}] {$ e ->getMessage ()}" ,
440435 $ e ->getCode (),
441436 $ e ->getResponse () ? $ e ->getResponse ()->getHeaders () : null ,
442- $ e ->getResponse () ? $ e ->getResponse ()->getBody ()-> getContents () : null
437+ $ e ->getResponse () ? ( string ) $ e ->getResponse ()->getBody () : null
443438 );
444439 }
445440
@@ -464,7 +459,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
464459 if ('\Shotstack\Client\Model\QueuedResponse ' === '\SplFileObject ' ) {
465460 $ content = $ responseBody ; //stream goes to serializer
466461 } else {
467- $ content = $ responseBody -> getContents () ;
462+ $ content = ( string ) $ responseBody ;
468463 }
469464
470465 return [
@@ -479,7 +474,7 @@ public function postRenderWithHttpInfo($edit, $x_api_queue_id = null)
479474 if ($ returnType === '\SplFileObject ' ) {
480475 $ content = $ responseBody ; //stream goes to serializer
481476 } else {
482- $ content = $ responseBody -> getContents () ;
477+ $ content = ( string ) $ responseBody ;
483478 }
484479
485480 return [
@@ -548,7 +543,7 @@ function ($response) use ($returnType) {
548543 if ($ returnType === '\SplFileObject ' ) {
549544 $ content = $ responseBody ; //stream goes to serializer
550545 } else {
551- $ content = $ responseBody -> getContents () ;
546+ $ content = ( string ) $ responseBody ;
552547 }
553548
554549 return [
@@ -583,7 +578,7 @@ function ($exception) {
583578 * @throws \InvalidArgumentException
584579 * @return \GuzzleHttp\Psr7\Request
585580 */
586- protected function postRenderRequest ($ edit , $ x_api_queue_id = null )
581+ public function postRenderRequest ($ edit , $ x_api_queue_id = null )
587582 {
588583 // verify the required parameter 'edit' is set
589584 if ($ edit === null || (is_array ($ edit ) && count ($ edit ) === 0 )) {
@@ -599,17 +594,13 @@ protected function postRenderRequest($edit, $x_api_queue_id = null)
599594 $ httpBody = '' ;
600595 $ multipart = false ;
601596
597+
602598 // header params
603599 if ($ x_api_queue_id !== null ) {
604600 $ headerParams ['x-api-queue-id ' ] = ObjectSerializer::toHeaderValue ($ x_api_queue_id );
605601 }
606602
607603
608- // body params
609- $ _tempBody = null ;
610- if (isset ($ edit )) {
611- $ _tempBody = $ edit ;
612- }
613604
614605 if ($ multipart ) {
615606 $ headers = $ this ->headerSelector ->selectHeadersForMultipart (
@@ -623,21 +614,23 @@ protected function postRenderRequest($edit, $x_api_queue_id = null)
623614 }
624615
625616 // for model (json/xml)
626- if (isset ($ _tempBody )) {
627- // $_tempBody is the method argument, if present
617+ if (isset ($ edit )) {
628618 if ($ headers ['Content-Type ' ] === 'application/json ' ) {
629- $ httpBody = \GuzzleHttp \json_encode (ObjectSerializer::sanitizeForSerialization ($ _tempBody ));
619+ $ httpBody = \GuzzleHttp \json_encode (ObjectSerializer::sanitizeForSerialization ($ edit ));
630620 } else {
631- $ httpBody = $ _tempBody ;
621+ $ httpBody = $ edit ;
632622 }
633623 } elseif (count ($ formParams ) > 0 ) {
634624 if ($ multipart ) {
635625 $ multipartContents = [];
636626 foreach ($ formParams as $ formParamName => $ formParamValue ) {
637- $ multipartContents [] = [
638- 'name ' => $ formParamName ,
639- 'contents ' => $ formParamValue
640- ];
627+ $ formParamValueItems = is_array ($ formParamValue ) ? $ formParamValue : [$ formParamValue ];
628+ foreach ($ formParamValueItems as $ formParamValueItem ) {
629+ $ multipartContents [] = [
630+ 'name ' => $ formParamName ,
631+ 'contents ' => $ formParamValueItem
632+ ];
633+ }
641634 }
642635 // for HTTP post (form)
643636 $ httpBody = new MultipartStream ($ multipartContents );
0 commit comments