11<?php
22/**
33 * CallbacksApi
4- * PHP version 7.4
4+ * PHP version 8.1
55 *
66 * @category Class
77 * @package HubSpot\Client\Automation\Actions
1616 *
1717 * The version of the OpenAPI document: v4
1818 * Generated by: https://openapi-generator.tech
19- * Generator version: 7.12 .0
19+ * Generator version: 7.17 .0
2020 */
2121
2222/**
3434use GuzzleHttp \Psr7 \MultipartStream ;
3535use GuzzleHttp \Psr7 \Request ;
3636use GuzzleHttp \RequestOptions ;
37+ use Psr \Http \Message \RequestInterface ;
38+ use Psr \Http \Message \ResponseInterface ;
3739use HubSpot \Client \Automation \Actions \ApiException ;
3840use HubSpot \Client \Automation \Actions \Configuration ;
41+ use HubSpot \Client \Automation \Actions \FormDataProcessor ;
3942use HubSpot \Client \Automation \Actions \HeaderSelector ;
4043use HubSpot \Client \Automation \Actions \ObjectSerializer ;
4144
@@ -184,7 +187,6 @@ public function completeWithHttpInfo($callback_id, $callback_completion_request,
184187
185188
186189 return [null , $ statusCode , $ response ->getHeaders ()];
187-
188190 } catch (ApiException $ e ) {
189191 switch ($ e ->getCode ()) {
190192 default :
@@ -194,8 +196,10 @@ public function completeWithHttpInfo($callback_id, $callback_completion_request,
194196 $ e ->getResponseHeaders ()
195197 );
196198 $ e ->setResponseObject ($ data );
197- break ;
199+ throw $ e ;
198200 }
201+
202+
199203 throw $ e ;
200204 }
201205 }
@@ -430,7 +434,6 @@ public function completeBatchWithHttpInfo($batch_input_callback_completion_batch
430434
431435
432436 return [null , $ statusCode , $ response ->getHeaders ()];
433-
434437 } catch (ApiException $ e ) {
435438 switch ($ e ->getCode ()) {
436439 default :
@@ -440,8 +443,10 @@ public function completeBatchWithHttpInfo($batch_input_callback_completion_batch
440443 $ e ->getResponseHeaders ()
441444 );
442445 $ e ->setResponseObject ($ data );
443- break ;
446+ throw $ e ;
444447 }
448+
449+
445450 throw $ e ;
446451 }
447452 }
@@ -617,6 +622,57 @@ protected function createHttpClientOption()
617622 }
618623 }
619624
625+ if ($ this ->config ->getCertFile ()) {
626+ $ options [RequestOptions::CERT ] = $ this ->config ->getCertFile ();
627+ }
628+
629+ if ($ this ->config ->getKeyFile ()) {
630+ $ options [RequestOptions::SSL_KEY ] = $ this ->config ->getKeyFile ();
631+ }
632+
620633 return $ options ;
621634 }
635+
636+ private function handleResponseWithDataType (
637+ string $ dataType ,
638+ RequestInterface $ request ,
639+ ResponseInterface $ response
640+ ): array {
641+ if ($ dataType === '\SplFileObject ' ) {
642+ $ content = $ response ->getBody (); //stream goes to serializer
643+ } else {
644+ $ content = (string ) $ response ->getBody ();
645+ if ($ dataType !== 'string ' ) {
646+ try {
647+ $ content = json_decode ($ content , false , 512 , JSON_THROW_ON_ERROR );
648+ } catch (\JsonException $ exception ) {
649+ throw new ApiException (
650+ sprintf (
651+ 'Error JSON decoding server response (%s) ' ,
652+ $ request ->getUri ()
653+ ),
654+ $ response ->getStatusCode (),
655+ $ response ->getHeaders (),
656+ $ content
657+ );
658+ }
659+ }
660+ }
661+
662+ return [
663+ ObjectSerializer::deserialize ($ content , $ dataType , []),
664+ $ response ->getStatusCode (),
665+ $ response ->getHeaders ()
666+ ];
667+ }
668+
669+ private function responseWithinRangeCode (
670+ string $ rangeCode ,
671+ int $ statusCode
672+ ): bool {
673+ $ left = (int ) ($ rangeCode [0 ].'00 ' );
674+ $ right = (int ) ($ rangeCode [0 ].'99 ' );
675+
676+ return $ statusCode >= $ left && $ statusCode <= $ right ;
677+ }
622678}
0 commit comments