11
11
* @author Infobip Support
12
12
* @link https://www.infobip.com
13
13
*/
14
-
15
14
declare (strict_types=1 );
16
15
17
16
/**
33
32
use GuzzleHttp \Exception \GuzzleException ;
34
33
use GuzzleHttp \Exception \RequestException ;
35
34
use GuzzleHttp \Promise \PromiseInterface ;
36
- use GuzzleHttp \Psr7 \MultipartStream ;
37
35
use GuzzleHttp \Psr7 \Query ;
38
36
use GuzzleHttp \Psr7 \Request ;
39
37
use Infobip \ApiException ;
@@ -174,7 +172,6 @@ private function createCallRouteRequest(\Infobip\Model\CallRoutingRouteRequest $
174
172
175
173
$ this ->validateParams ($ allData , $ validationConstraints );
176
174
$ resourcePath = '/callrouting/1/routes ' ;
177
- $ formParams = [];
178
175
$ queryParams = [];
179
176
$ headerParams = [];
180
177
$ httpBody = '' ;
@@ -184,36 +181,10 @@ private function createCallRouteRequest(\Infobip\Model\CallRoutingRouteRequest $
184
181
'Content-Type ' => 'application/json ' ,
185
182
];
186
183
187
- // for model (json/xml)
188
184
if (isset ($ callRoutingRouteRequest )) {
189
185
$ httpBody = ($ headers ['Content-Type ' ] === 'application/json ' )
190
186
? $ this ->objectSerializer ->serialize ($ callRoutingRouteRequest )
191
187
: $ callRoutingRouteRequest ;
192
- } elseif (count ($ formParams ) > 0 ) {
193
- if ($ headers ['Content-Type ' ] === 'multipart/form-data ' ) {
194
- $ boundary = '---- ' . hash ('sha256 ' , uniqid ('' , true ));
195
- $ headers ['Content-Type ' ] .= '; boundary= ' . $ boundary ;
196
- $ multipartContents = [];
197
-
198
- foreach ($ formParams as $ formParamName => $ formParamValue ) {
199
- $ formParamValueItems = (\is_array ($ formParamValue )) ? $ formParamValue : [$ formParamValue ];
200
-
201
- foreach ($ formParamValueItems as $ formParamValueItem ) {
202
- $ multipartContents [] = [
203
- 'name ' => $ formParamName ,
204
- 'contents ' => $ formParamValueItem
205
- ];
206
- }
207
- }
208
-
209
- // for HTTP post (form)
210
- $ httpBody = new MultipartStream ($ multipartContents , $ boundary );
211
- } elseif ($ headers ['Content-Type ' ] === 'application/json ' ) {
212
- $ httpBody = $ this ->objectSerializer ->serialize ($ formParams );
213
- } else {
214
- // for HTTP post (form)
215
- $ httpBody = Query::build ($ formParams );
216
- }
217
188
}
218
189
219
190
$ apiKey = $ this ->config ->getApiKey ();
@@ -442,7 +413,6 @@ private function deleteCallRouteRequest(string $routeId): Request
442
413
443
414
$ this ->validateParams ($ allData , $ validationConstraints );
444
415
$ resourcePath = '/callrouting/1/routes/{routeId} ' ;
445
- $ formParams = [];
446
416
$ queryParams = [];
447
417
$ headerParams = [];
448
418
$ httpBody = '' ;
@@ -460,33 +430,6 @@ private function deleteCallRouteRequest(string $routeId): Request
460
430
'Accept ' => 'application/json ' ,
461
431
];
462
432
463
- // for model (json/xml)
464
- if (count ($ formParams ) > 0 ) {
465
- if ($ headers ['Content-Type ' ] === 'multipart/form-data ' ) {
466
- $ boundary = '---- ' . hash ('sha256 ' , uniqid ('' , true ));
467
- $ headers ['Content-Type ' ] .= '; boundary= ' . $ boundary ;
468
- $ multipartContents = [];
469
-
470
- foreach ($ formParams as $ formParamName => $ formParamValue ) {
471
- $ formParamValueItems = (\is_array ($ formParamValue )) ? $ formParamValue : [$ formParamValue ];
472
-
473
- foreach ($ formParamValueItems as $ formParamValueItem ) {
474
- $ multipartContents [] = [
475
- 'name ' => $ formParamName ,
476
- 'contents ' => $ formParamValueItem
477
- ];
478
- }
479
- }
480
-
481
- // for HTTP post (form)
482
- $ httpBody = new MultipartStream ($ multipartContents , $ boundary );
483
- } elseif ($ headers ['Content-Type ' ] === 'application/json ' ) {
484
- $ httpBody = $ this ->objectSerializer ->serialize ($ formParams );
485
- } else {
486
- // for HTTP post (form)
487
- $ httpBody = Query::build ($ formParams );
488
- }
489
- }
490
433
491
434
$ apiKey = $ this ->config ->getApiKey ();
492
435
@@ -714,7 +657,6 @@ private function getCallRouteRequest(string $routeId): Request
714
657
715
658
$ this ->validateParams ($ allData , $ validationConstraints );
716
659
$ resourcePath = '/callrouting/1/routes/{routeId} ' ;
717
- $ formParams = [];
718
660
$ queryParams = [];
719
661
$ headerParams = [];
720
662
$ httpBody = '' ;
@@ -732,33 +674,6 @@ private function getCallRouteRequest(string $routeId): Request
732
674
'Accept ' => 'application/json ' ,
733
675
];
734
676
735
- // for model (json/xml)
736
- if (count ($ formParams ) > 0 ) {
737
- if ($ headers ['Content-Type ' ] === 'multipart/form-data ' ) {
738
- $ boundary = '---- ' . hash ('sha256 ' , uniqid ('' , true ));
739
- $ headers ['Content-Type ' ] .= '; boundary= ' . $ boundary ;
740
- $ multipartContents = [];
741
-
742
- foreach ($ formParams as $ formParamName => $ formParamValue ) {
743
- $ formParamValueItems = (\is_array ($ formParamValue )) ? $ formParamValue : [$ formParamValue ];
744
-
745
- foreach ($ formParamValueItems as $ formParamValueItem ) {
746
- $ multipartContents [] = [
747
- 'name ' => $ formParamName ,
748
- 'contents ' => $ formParamValueItem
749
- ];
750
- }
751
- }
752
-
753
- // for HTTP post (form)
754
- $ httpBody = new MultipartStream ($ multipartContents , $ boundary );
755
- } elseif ($ headers ['Content-Type ' ] === 'application/json ' ) {
756
- $ httpBody = $ this ->objectSerializer ->serialize ($ formParams );
757
- } else {
758
- // for HTTP post (form)
759
- $ httpBody = Query::build ($ formParams );
760
- }
761
- }
762
677
763
678
$ apiKey = $ this ->config ->getApiKey ();
764
679
@@ -994,7 +909,6 @@ private function getCallRoutesRequest(int $page = 0, int $size = 20): Request
994
909
995
910
$ this ->validateParams ($ allData , $ validationConstraints );
996
911
$ resourcePath = '/callrouting/1/routes ' ;
997
- $ formParams = [];
998
912
$ queryParams = [];
999
913
$ headerParams = [];
1000
914
$ httpBody = '' ;
@@ -1013,33 +927,6 @@ private function getCallRoutesRequest(int $page = 0, int $size = 20): Request
1013
927
'Accept ' => 'application/json ' ,
1014
928
];
1015
929
1016
- // for model (json/xml)
1017
- if (count ($ formParams ) > 0 ) {
1018
- if ($ headers ['Content-Type ' ] === 'multipart/form-data ' ) {
1019
- $ boundary = '---- ' . hash ('sha256 ' , uniqid ('' , true ));
1020
- $ headers ['Content-Type ' ] .= '; boundary= ' . $ boundary ;
1021
- $ multipartContents = [];
1022
-
1023
- foreach ($ formParams as $ formParamName => $ formParamValue ) {
1024
- $ formParamValueItems = (\is_array ($ formParamValue )) ? $ formParamValue : [$ formParamValue ];
1025
-
1026
- foreach ($ formParamValueItems as $ formParamValueItem ) {
1027
- $ multipartContents [] = [
1028
- 'name ' => $ formParamName ,
1029
- 'contents ' => $ formParamValueItem
1030
- ];
1031
- }
1032
- }
1033
-
1034
- // for HTTP post (form)
1035
- $ httpBody = new MultipartStream ($ multipartContents , $ boundary );
1036
- } elseif ($ headers ['Content-Type ' ] === 'application/json ' ) {
1037
- $ httpBody = $ this ->objectSerializer ->serialize ($ formParams );
1038
- } else {
1039
- // for HTTP post (form)
1040
- $ httpBody = Query::build ($ formParams );
1041
- }
1042
- }
1043
930
1044
931
$ apiKey = $ this ->config ->getApiKey ();
1045
932
@@ -1274,7 +1161,6 @@ private function updateCallRouteRequest(string $routeId, \Infobip\Model\CallRout
1274
1161
1275
1162
$ this ->validateParams ($ allData , $ validationConstraints );
1276
1163
$ resourcePath = '/callrouting/1/routes/{routeId} ' ;
1277
- $ formParams = [];
1278
1164
$ queryParams = [];
1279
1165
$ headerParams = [];
1280
1166
$ httpBody = '' ;
@@ -1293,36 +1179,10 @@ private function updateCallRouteRequest(string $routeId, \Infobip\Model\CallRout
1293
1179
'Content-Type ' => 'application/json ' ,
1294
1180
];
1295
1181
1296
- // for model (json/xml)
1297
1182
if (isset ($ callRoutingRouteRequest )) {
1298
1183
$ httpBody = ($ headers ['Content-Type ' ] === 'application/json ' )
1299
1184
? $ this ->objectSerializer ->serialize ($ callRoutingRouteRequest )
1300
1185
: $ callRoutingRouteRequest ;
1301
- } elseif (count ($ formParams ) > 0 ) {
1302
- if ($ headers ['Content-Type ' ] === 'multipart/form-data ' ) {
1303
- $ boundary = '---- ' . hash ('sha256 ' , uniqid ('' , true ));
1304
- $ headers ['Content-Type ' ] .= '; boundary= ' . $ boundary ;
1305
- $ multipartContents = [];
1306
-
1307
- foreach ($ formParams as $ formParamName => $ formParamValue ) {
1308
- $ formParamValueItems = (\is_array ($ formParamValue )) ? $ formParamValue : [$ formParamValue ];
1309
-
1310
- foreach ($ formParamValueItems as $ formParamValueItem ) {
1311
- $ multipartContents [] = [
1312
- 'name ' => $ formParamName ,
1313
- 'contents ' => $ formParamValueItem
1314
- ];
1315
- }
1316
- }
1317
-
1318
- // for HTTP post (form)
1319
- $ httpBody = new MultipartStream ($ multipartContents , $ boundary );
1320
- } elseif ($ headers ['Content-Type ' ] === 'application/json ' ) {
1321
- $ httpBody = $ this ->objectSerializer ->serialize ($ formParams );
1322
- } else {
1323
- // for HTTP post (form)
1324
- $ httpBody = Query::build ($ formParams );
1325
- }
1326
1186
}
1327
1187
1328
1188
$ apiKey = $ this ->config ->getApiKey ();
0 commit comments