Skip to content

Commit b3e3621

Browse files
committed
Release v1.0.33
* Fixed **Error** schema
1 parent 5823480 commit b3e3621

12 files changed

+582
-112
lines changed

lib/Api/APINotificationCallbacksApi.php

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ protected function pullMultipleNotificationRequest($limit = null)
274274

275275
// query params
276276
if ($limit !== null) {
277-
$queryParams['limit'] = ObjectSerializer::toQueryValue($limit, null);
277+
$queryParams['limit'] = ObjectSerializer::toQueryValue($limit);
278278
}
279279

280280

@@ -317,7 +317,7 @@ protected function pullMultipleNotificationRequest($limit = null)
317317

318318
} else {
319319
// for HTTP post (form)
320-
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
320+
$httpBody = $this->buildQuery($formParams);
321321
}
322322
}
323323

@@ -337,7 +337,7 @@ protected function pullMultipleNotificationRequest($limit = null)
337337
$headers
338338
);
339339

340-
$query = \GuzzleHttp\Psr7\build_query($queryParams);
340+
$query = $this->buildQuery($queryParams);
341341
return new Request(
342342
'GET',
343343
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
@@ -568,7 +568,7 @@ protected function pullNotificationRequest()
568568

569569
} else {
570570
// for HTTP post (form)
571-
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
571+
$httpBody = $this->buildQuery($formParams);
572572
}
573573
}
574574

@@ -588,7 +588,7 @@ protected function pullNotificationRequest()
588588
$headers
589589
);
590590

591-
$query = \GuzzleHttp\Psr7\build_query($queryParams);
591+
$query = $this->buildQuery($queryParams);
592592
return new Request(
593593
'GET',
594594
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
@@ -774,7 +774,7 @@ protected function pushNotificationsRequest()
774774

775775
} else {
776776
// for HTTP post (form)
777-
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
777+
$httpBody = $this->buildQuery($formParams);
778778
}
779779
}
780780

@@ -790,7 +790,7 @@ protected function pushNotificationsRequest()
790790
$headers
791791
);
792792

793-
$query = \GuzzleHttp\Psr7\build_query($queryParams);
793+
$query = $this->buildQuery($queryParams);
794794
return new Request(
795795
'POST',
796796
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
@@ -984,7 +984,7 @@ protected function releaseNotificationsRequest()
984984

985985
} else {
986986
// for HTTP post (form)
987-
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
987+
$httpBody = $this->buildQuery($formParams);
988988
}
989989
}
990990

@@ -1004,7 +1004,7 @@ protected function releaseNotificationsRequest()
10041004
$headers
10051005
);
10061006

1007-
$query = \GuzzleHttp\Psr7\build_query($queryParams);
1007+
$query = $this->buildQuery($queryParams);
10081008
return new Request(
10091009
'POST',
10101010
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
@@ -1031,4 +1031,47 @@ protected function createHttpClientOption()
10311031

10321032
return $options;
10331033
}
1034+
1035+
protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986)
1036+
{
1037+
if (!$params) {
1038+
return '';
1039+
}
1040+
1041+
if ($encoding === false) {
1042+
$encoder = function ($str) {
1043+
return $str;
1044+
};
1045+
} elseif ($encoding === PHP_QUERY_RFC3986) {
1046+
$encoder = 'rawurlencode';
1047+
} elseif ($encoding === PHP_QUERY_RFC1738) {
1048+
$encoder = 'urlencode';
1049+
} else {
1050+
throw new \InvalidArgumentException('Invalid type');
1051+
}
1052+
1053+
$qs = '';
1054+
foreach ($params as $k => $v) {
1055+
$k = $encoder((string) $k);
1056+
if (!is_array($v)) {
1057+
$qs .= $k;
1058+
$v = is_bool($v) ? (int) $v : $v;
1059+
if ($v !== null) {
1060+
$qs .= '='.$encoder((string) $v);
1061+
}
1062+
$qs .= '&';
1063+
} else {
1064+
foreach ($v as $vv) {
1065+
$qs .= $k;
1066+
$vv = is_bool($vv) ? (int) $vv : $vv;
1067+
if ($vv !== null) {
1068+
$qs .= '='.$encoder((string) $vv);
1069+
}
1070+
$qs .= '&';
1071+
}
1072+
}
1073+
}
1074+
1075+
return $qs ? (string) substr($qs, 0, -1) : '';
1076+
}
10341077
}

lib/Api/AddressesApi.php

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ protected function getAddressRequest($facility_id, $doctor_id, $address_id, $wit
315315

316316
// query params
317317
if ($with !== null) {
318-
$queryParams['with'] = ObjectSerializer::toQueryValue($with, null);
318+
$queryParams['with'] = ObjectSerializer::toQueryValue($with);
319319
}
320320

321321
// path params
@@ -382,7 +382,7 @@ protected function getAddressRequest($facility_id, $doctor_id, $address_id, $wit
382382

383383
} else {
384384
// for HTTP post (form)
385-
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
385+
$httpBody = $this->buildQuery($formParams);
386386
}
387387
}
388388

@@ -402,7 +402,7 @@ protected function getAddressRequest($facility_id, $doctor_id, $address_id, $wit
402402
$headers
403403
);
404404

405-
$query = \GuzzleHttp\Psr7\build_query($queryParams);
405+
$query = $this->buildQuery($queryParams);
406406
return new Request(
407407
'GET',
408408
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
@@ -629,7 +629,7 @@ protected function getAddressesRequest($facility_id, $doctor_id, $with = null)
629629

630630
// query params
631631
if ($with !== null) {
632-
$queryParams['with'] = ObjectSerializer::toQueryValue($with, null);
632+
$queryParams['with'] = ObjectSerializer::toQueryValue($with);
633633
}
634634

635635
// path params
@@ -688,7 +688,7 @@ protected function getAddressesRequest($facility_id, $doctor_id, $with = null)
688688

689689
} else {
690690
// for HTTP post (form)
691-
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
691+
$httpBody = $this->buildQuery($formParams);
692692
}
693693
}
694694

@@ -708,7 +708,7 @@ protected function getAddressesRequest($facility_id, $doctor_id, $with = null)
708708
$headers
709709
);
710710

711-
$query = \GuzzleHttp\Psr7\build_query($queryParams);
711+
$query = $this->buildQuery($queryParams);
712712
return new Request(
713713
'GET',
714714
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
@@ -1026,7 +1026,7 @@ protected function updateAddressRequest($body, $facility_id, $doctor_id, $addres
10261026

10271027
} else {
10281028
// for HTTP post (form)
1029-
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
1029+
$httpBody = $this->buildQuery($formParams);
10301030
}
10311031
}
10321032

@@ -1046,7 +1046,7 @@ protected function updateAddressRequest($body, $facility_id, $doctor_id, $addres
10461046
$headers
10471047
);
10481048

1049-
$query = \GuzzleHttp\Psr7\build_query($queryParams);
1049+
$query = $this->buildQuery($queryParams);
10501050
return new Request(
10511051
'PATCH',
10521052
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
@@ -1073,4 +1073,47 @@ protected function createHttpClientOption()
10731073

10741074
return $options;
10751075
}
1076+
1077+
protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986)
1078+
{
1079+
if (!$params) {
1080+
return '';
1081+
}
1082+
1083+
if ($encoding === false) {
1084+
$encoder = function ($str) {
1085+
return $str;
1086+
};
1087+
} elseif ($encoding === PHP_QUERY_RFC3986) {
1088+
$encoder = 'rawurlencode';
1089+
} elseif ($encoding === PHP_QUERY_RFC1738) {
1090+
$encoder = 'urlencode';
1091+
} else {
1092+
throw new \InvalidArgumentException('Invalid type');
1093+
}
1094+
1095+
$qs = '';
1096+
foreach ($params as $k => $v) {
1097+
$k = $encoder((string) $k);
1098+
if (!is_array($v)) {
1099+
$qs .= $k;
1100+
$v = is_bool($v) ? (int) $v : $v;
1101+
if ($v !== null) {
1102+
$qs .= '='.$encoder((string) $v);
1103+
}
1104+
$qs .= '&';
1105+
} else {
1106+
foreach ($v as $vv) {
1107+
$qs .= $k;
1108+
$vv = is_bool($vv) ? (int) $vv : $vv;
1109+
if ($vv !== null) {
1110+
$qs .= '='.$encoder((string) $vv);
1111+
}
1112+
$qs .= '&';
1113+
}
1114+
}
1115+
}
1116+
1117+
return $qs ? (string) substr($qs, 0, -1) : '';
1118+
}
10761119
}

0 commit comments

Comments
 (0)