diff --git a/lib/Api/APINotificationCallbacksApi.php b/lib/Api/APINotificationCallbacksApi.php index 9484c71..47df3dd 100644 --- a/lib/Api/APINotificationCallbacksApi.php +++ b/lib/Api/APINotificationCallbacksApi.php @@ -274,7 +274,7 @@ protected function pullMultipleNotificationRequest($limit = null) // query params if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit, null); } @@ -317,7 +317,7 @@ protected function pullMultipleNotificationRequest($limit = null) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -337,7 +337,7 @@ protected function pullMultipleNotificationRequest($limit = null) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -568,7 +568,7 @@ protected function pullNotificationRequest() } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -588,7 +588,7 @@ protected function pullNotificationRequest() $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -774,7 +774,7 @@ protected function pushNotificationsRequest() } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -790,7 +790,7 @@ protected function pushNotificationsRequest() $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -984,7 +984,7 @@ protected function releaseNotificationsRequest() } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1004,7 +1004,7 @@ protected function releaseNotificationsRequest() $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1031,47 +1031,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/AddressesApi.php b/lib/Api/AddressesApi.php index 19ce9d7..d7025f6 100644 --- a/lib/Api/AddressesApi.php +++ b/lib/Api/AddressesApi.php @@ -315,7 +315,7 @@ protected function getAddressRequest($facility_id, $doctor_id, $address_id, $wit // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } // path params @@ -382,7 +382,7 @@ protected function getAddressRequest($facility_id, $doctor_id, $address_id, $wit } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -402,7 +402,7 @@ protected function getAddressRequest($facility_id, $doctor_id, $address_id, $wit $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -629,7 +629,7 @@ protected function getAddressesRequest($facility_id, $doctor_id, $with = null) // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } // path params @@ -688,7 +688,7 @@ protected function getAddressesRequest($facility_id, $doctor_id, $with = null) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -708,7 +708,7 @@ protected function getAddressesRequest($facility_id, $doctor_id, $with = null) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1026,7 +1026,7 @@ protected function updateAddressRequest($body, $facility_id, $doctor_id, $addres } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1046,7 +1046,7 @@ protected function updateAddressRequest($body, $facility_id, $doctor_id, $addres $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1073,47 +1073,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/BookingsApi.php b/lib/Api/BookingsApi.php index 28bdbbc..144e419 100644 --- a/lib/Api/BookingsApi.php +++ b/lib/Api/BookingsApi.php @@ -371,7 +371,7 @@ protected function cancelBookingRequest($facility_id, $doctor_id, $address_id, $ } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -391,7 +391,7 @@ protected function cancelBookingRequest($facility_id, $doctor_id, $address_id, $ $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -706,7 +706,7 @@ protected function getBookingRequest($facility_id, $doctor_id, $address_id, $boo } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -726,7 +726,7 @@ protected function getBookingRequest($facility_id, $doctor_id, $address_id, $boo $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -996,23 +996,23 @@ protected function getBookingsRequest($facility_id, $doctor_id, $address_id, $st // query params if ($start !== null) { - $queryParams['start'] = ObjectSerializer::toQueryValue($start); + $queryParams['start'] = ObjectSerializer::toQueryValue($start, 'date-time'); } // query params if ($end !== null) { - $queryParams['end'] = ObjectSerializer::toQueryValue($end); + $queryParams['end'] = ObjectSerializer::toQueryValue($end, 'date-time'); } // query params if ($page !== null) { - $queryParams['page'] = ObjectSerializer::toQueryValue($page); + $queryParams['page'] = ObjectSerializer::toQueryValue($page, null); } // query params if ($limit !== null) { - $queryParams['limit'] = ObjectSerializer::toQueryValue($limit); + $queryParams['limit'] = ObjectSerializer::toQueryValue($limit, null); } // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } // path params @@ -1079,7 +1079,7 @@ protected function getBookingsRequest($facility_id, $doctor_id, $address_id, $st } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1099,7 +1099,7 @@ protected function getBookingsRequest($facility_id, $doctor_id, $address_id, $st $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1444,7 +1444,7 @@ protected function moveBookingRequest($body, $facility_id, $doctor_id, $address_ } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1464,7 +1464,7 @@ protected function moveBookingRequest($body, $facility_id, $doctor_id, $address_ $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1736,7 +1736,7 @@ protected function requestOpinionRequest($facility_id, $doctor_id, $body = null) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1756,7 +1756,7 @@ protected function requestOpinionRequest($facility_id, $doctor_id, $body = null) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1783,47 +1783,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/CalendarBreaksApi.php b/lib/Api/CalendarBreaksApi.php index 736b037..8fd7916 100644 --- a/lib/Api/CalendarBreaksApi.php +++ b/lib/Api/CalendarBreaksApi.php @@ -374,7 +374,7 @@ protected function addCalendarBreakRequest($body, $facility_id, $doctor_id, $add } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -394,7 +394,7 @@ protected function addCalendarBreakRequest($body, $facility_id, $doctor_id, $add $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -672,7 +672,7 @@ protected function deleteCalendarBreakRequest($facility_id, $doctor_id, $address } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -692,7 +692,7 @@ protected function deleteCalendarBreakRequest($facility_id, $doctor_id, $address $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1007,7 +1007,7 @@ protected function getCalendarBreakRequest($facility_id, $doctor_id, $address_id } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1027,7 +1027,7 @@ protected function getCalendarBreakRequest($facility_id, $doctor_id, $address_id $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1282,11 +1282,11 @@ protected function getCalendarBreaksRequest($facility_id, $doctor_id, $address_i // query params if ($since !== null) { - $queryParams['since'] = ObjectSerializer::toQueryValue($since); + $queryParams['since'] = ObjectSerializer::toQueryValue($since, 'date-time'); } // query params if ($till !== null) { - $queryParams['till'] = ObjectSerializer::toQueryValue($till); + $queryParams['till'] = ObjectSerializer::toQueryValue($till, 'date-time'); } // path params @@ -1353,7 +1353,7 @@ protected function getCalendarBreaksRequest($facility_id, $doctor_id, $address_i } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1373,7 +1373,7 @@ protected function getCalendarBreaksRequest($facility_id, $doctor_id, $address_i $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1681,7 +1681,7 @@ protected function moveCalendarBreakRequest($body, $facility_id, $doctor_id, $ad } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1701,7 +1701,7 @@ protected function moveCalendarBreakRequest($body, $facility_id, $doctor_id, $ad $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1728,47 +1728,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/CalendarsApi.php b/lib/Api/CalendarsApi.php index 24c6b02..7a4da9c 100644 --- a/lib/Api/CalendarsApi.php +++ b/lib/Api/CalendarsApi.php @@ -336,7 +336,7 @@ protected function disableCalendarRequest($facility_id, $doctor_id, $address_id) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -356,7 +356,7 @@ protected function disableCalendarRequest($facility_id, $doctor_id, $address_id) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -623,7 +623,7 @@ protected function enableCalendarRequest($facility_id, $doctor_id, $address_id) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -643,7 +643,7 @@ protected function enableCalendarRequest($facility_id, $doctor_id, $address_id) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -939,7 +939,7 @@ protected function getCalendarRequest($facility_id, $doctor_id, $address_id) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -959,7 +959,7 @@ protected function getCalendarRequest($facility_id, $doctor_id, $address_id) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -986,47 +986,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/DoctorsApi.php b/lib/Api/DoctorsApi.php index 1ae69c3..3353663 100644 --- a/lib/Api/DoctorsApi.php +++ b/lib/Api/DoctorsApi.php @@ -304,7 +304,7 @@ protected function getDoctorRequest($facility_id, $doctor_id, $with = null) // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } // path params @@ -363,7 +363,7 @@ protected function getDoctorRequest($facility_id, $doctor_id, $with = null) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -383,7 +383,7 @@ protected function getDoctorRequest($facility_id, $doctor_id, $with = null) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -599,7 +599,7 @@ protected function getDoctorsRequest($facility_id, $with = null) // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } // path params @@ -650,7 +650,7 @@ protected function getDoctorsRequest($facility_id, $with = null) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -670,7 +670,7 @@ protected function getDoctorsRequest($facility_id, $with = null) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -697,47 +697,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/FacilitiesApi.php b/lib/Api/FacilitiesApi.php index 8313e70..a184ed0 100644 --- a/lib/Api/FacilitiesApi.php +++ b/lib/Api/FacilitiesApi.php @@ -300,7 +300,7 @@ protected function getFacilitiesRequest() } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -320,7 +320,7 @@ protected function getFacilitiesRequest() $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -536,7 +536,7 @@ protected function getFacilityRequest($facility_id, $with = null) // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } // path params @@ -587,7 +587,7 @@ protected function getFacilityRequest($facility_id, $with = null) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -607,7 +607,7 @@ protected function getFacilityRequest($facility_id, $with = null) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -634,47 +634,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/InsurancesApi.php b/lib/Api/InsurancesApi.php index 81a04f7..6489653 100644 --- a/lib/Api/InsurancesApi.php +++ b/lib/Api/InsurancesApi.php @@ -358,7 +358,7 @@ protected function addAddressInsuranceProviderRequest($body, $facility_id, $doct } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -378,7 +378,7 @@ protected function addAddressInsuranceProviderRequest($body, $facility_id, $doct $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -664,7 +664,7 @@ protected function deleteAddressInsuranceProviderRequest($facility_id, $doctor_i } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -684,7 +684,7 @@ protected function deleteAddressInsuranceProviderRequest($facility_id, $doctor_i $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -980,7 +980,7 @@ protected function getAddressInsuranceProvidersRequest($facility_id, $doctor_id, } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1000,7 +1000,7 @@ protected function getAddressInsuranceProvidersRequest($facility_id, $doctor_id, $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1242,7 +1242,7 @@ protected function getInsurancePlansRequest($insurance_provider_id) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1262,7 +1262,7 @@ protected function getInsurancePlansRequest($insurance_provider_id) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1485,7 +1485,7 @@ protected function getInsuranceProvidersRequest() } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1505,7 +1505,7 @@ protected function getInsuranceProvidersRequest() $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1778,7 +1778,7 @@ protected function updateOrCreateAddressInsuranceProviderRequest($body, $facilit } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1798,7 +1798,7 @@ protected function updateOrCreateAddressInsuranceProviderRequest($body, $facilit $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1825,47 +1825,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/PatientPresenceApi.php b/lib/Api/PatientPresenceApi.php index c31ea45..3fd0fe5 100644 --- a/lib/Api/PatientPresenceApi.php +++ b/lib/Api/PatientPresenceApi.php @@ -363,7 +363,7 @@ protected function markPatientAbsenceRequest($facility_id, $doctor_id, $address_ } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -383,7 +383,7 @@ protected function markPatientAbsenceRequest($facility_id, $doctor_id, $address_ $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -669,7 +669,7 @@ protected function markPatientPresenceRequest($facility_id, $doctor_id, $address } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -689,7 +689,7 @@ protected function markPatientPresenceRequest($facility_id, $doctor_id, $address $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -716,47 +716,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/ServicesApi.php b/lib/Api/ServicesApi.php index d9c84ac..82943f4 100644 --- a/lib/Api/ServicesApi.php +++ b/lib/Api/ServicesApi.php @@ -366,7 +366,7 @@ protected function addAddressServiceRequest($body, $facility_id, $doctor_id, $ad } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -386,7 +386,7 @@ protected function addAddressServiceRequest($body, $facility_id, $doctor_id, $ad $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -664,7 +664,7 @@ protected function deleteAddressServiceRequest($facility_id, $doctor_id, $addres } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -684,7 +684,7 @@ protected function deleteAddressServiceRequest($facility_id, $doctor_id, $addres $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -999,7 +999,7 @@ protected function getAddressServiceRequest($facility_id, $doctor_id, $address_i } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1019,7 +1019,7 @@ protected function getAddressServiceRequest($facility_id, $doctor_id, $address_i $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1257,7 +1257,7 @@ protected function getAddressServicesRequest($facility_id, $doctor_id, $address_ // query params if ($start !== null) { - $queryParams['start'] = ObjectSerializer::toQueryValue($start); + $queryParams['start'] = ObjectSerializer::toQueryValue($start, 'date-time'); } // path params @@ -1324,7 +1324,7 @@ protected function getAddressServicesRequest($facility_id, $doctor_id, $address_ } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1344,7 +1344,7 @@ protected function getAddressServicesRequest($facility_id, $doctor_id, $address_ $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1533,7 +1533,7 @@ protected function getServicesRequest($with = null) // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } @@ -1576,7 +1576,7 @@ protected function getServicesRequest($with = null) } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1596,7 +1596,7 @@ protected function getServicesRequest($with = null) $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1933,7 +1933,7 @@ protected function updateAddressServiceRequest($body, $facility_id, $doctor_id, } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1953,7 +1953,7 @@ protected function updateAddressServiceRequest($body, $facility_id, $doctor_id, $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1980,47 +1980,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/Api/SlotsApi.php b/lib/Api/SlotsApi.php index ed1858a..18587ad 100644 --- a/lib/Api/SlotsApi.php +++ b/lib/Api/SlotsApi.php @@ -414,7 +414,7 @@ protected function bookSlotRequest($body, $facility_id, $doctor_id, $address_id, } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -434,7 +434,7 @@ protected function bookSlotRequest($body, $facility_id, $doctor_id, $address_id, $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -712,7 +712,7 @@ protected function deleteSlotsRequest($facility_id, $doctor_id, $address_id, $da } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -732,7 +732,7 @@ protected function deleteSlotsRequest($facility_id, $doctor_id, $address_id, $da $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -992,15 +992,15 @@ protected function getSlotsRequest($facility_id, $doctor_id, $address_id, $start // query params if ($start !== null) { - $queryParams['start'] = ObjectSerializer::toQueryValue($start); + $queryParams['start'] = ObjectSerializer::toQueryValue($start, 'date-time'); } // query params if ($end !== null) { - $queryParams['end'] = ObjectSerializer::toQueryValue($end); + $queryParams['end'] = ObjectSerializer::toQueryValue($end, 'date-time'); } // query params if ($with !== null) { - $queryParams['with'] = ObjectSerializer::toQueryValue($with); + $queryParams['with'] = ObjectSerializer::toQueryValue($with, null); } // path params @@ -1067,7 +1067,7 @@ protected function getSlotsRequest($facility_id, $doctor_id, $address_id, $start } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1087,7 +1087,7 @@ protected function getSlotsRequest($facility_id, $doctor_id, $address_id, $start $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1376,7 +1376,7 @@ protected function replaceSlotsRequest($body, $facility_id, $doctor_id, $address } else { // for HTTP post (form) - $httpBody = $this->buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1396,7 +1396,7 @@ protected function replaceSlotsRequest($body, $facility_id, $doctor_id, $address $headers ); - $query = $this->buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), @@ -1423,47 +1423,4 @@ protected function createHttpClientOption() return $options; } - - protected function buildQuery($params, $encoding = PHP_QUERY_RFC3986) - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function ($str) { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? (int) $v : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? (int) $vv : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index f9fc381..069eeaf 100644 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -117,15 +117,16 @@ public static function toPathValue($value) * later. * * @param string[]|string|\DateTime $object an object to be serialized to a string + * @param string|null $format the format of the parameter * * @return string the serialized object */ - public static function toQueryValue($object) + public static function toQueryValue($object, $format = null) { if (is_array($object)) { return implode(',', $object); } else { - return self::toString($object); + return self::toString($object, $format); } } @@ -164,16 +165,18 @@ public static function toFormValue($value) /** * Take value and turn it into a string suitable for inclusion in * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 + * If it's a datetime object, format it in RFC3339 + * If it's a date, format it in Y-m-d * * @param string|\DateTime $value the value of the parameter + * @param string|null $format the format of the parameter * * @return string the header string */ - public static function toString($value) + public static function toString($value, $format = null) { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(\DateTime::ATOM); + if ($value instanceof \DateTime) { + return ($format === 'date') ? $value->format('Y-m-d') : $value->format(\DateTime::ATOM); } else { return $value; } @@ -291,7 +294,7 @@ public static function deserialize($data, $class, $httpHeaders = null) // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { - $subclass = 'DocPlanner\Client\Model\\' . $data->{$discriminator}; + $subclass = '{{invokerPackage}}\Model\\' . $data->{$discriminator}; if (is_subclass_of($subclass, $class)) { $class = $subclass; }