You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -161,43 +160,24 @@ public function getInfoWithHttpInfo($id = null, $sr_name = null, string $content
161
160
162
161
$statusCode = $response->getStatusCode();
163
162
164
-
if ($statusCode < 200 || $statusCode > 299) {
165
-
thrownewApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
166
-
}
167
-
168
163
switch ($statusCode) {
169
164
case200:
170
-
if ('\Sigwin\RedditClient\Model\ListingEnvelope' === '\SplFileObject') {
171
-
$content = $response->getBody(); // stream goes to serializer
172
-
} else {
173
-
$content = (string) $response->getBody();
174
-
if ('\Sigwin\RedditClient\Model\ListingEnvelope' !== 'string') {
$content = $response->getBody(); // stream goes to serializer
189
-
} else {
190
-
$content = (string) $response->getBody();
191
-
if ($returnType !== 'string') {
192
-
$content = json_decode($content);
193
-
}
172
+
if ($statusCode < 200 || $statusCode > 299) {
173
+
thrownewApiException(\sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
@@ -207,8 +187,9 @@ public function getInfoWithHttpInfo($id = null, $sr_name = null, string $content
207
187
$e->getResponseHeaders()
208
188
);
209
189
$e->setResponseObject($data);
210
-
break;
190
+
throw$e;
211
191
}
192
+
212
193
throw$e;
213
194
}
214
195
}
@@ -218,9 +199,9 @@ public function getInfoWithHttpInfo($id = null, $sr_name = null, string $content
218
199
*
219
200
* Get thing info
220
201
*
221
-
* @param string $id (optional)
222
-
* @param string $sr_name (optional)
223
-
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation
202
+
* @param null|string $id (optional)
203
+
* @param null|string $sr_name (optional)
204
+
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation
224
205
*
225
206
* @throws \InvalidArgumentException
226
207
*/
@@ -240,9 +221,9 @@ static function ($response) {
240
221
*
241
222
* Get thing info
242
223
*
243
-
* @param string $id (optional)
244
-
* @param string $sr_name (optional)
245
-
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation
224
+
* @param null|string $id (optional)
225
+
* @param null|string $sr_name (optional)
226
+
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation
246
227
*
247
228
* @throws \InvalidArgumentException
248
229
*/
@@ -273,7 +254,7 @@ static function ($response) use ($returnType) {
273
254
staticfunction ($exception): void {
274
255
$response = $exception->getResponse();
275
256
$statusCode = $response->getStatusCode();
276
-
thrownewApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
257
+
thrownewApiException(\sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
277
258
}
278
259
)
279
260
;
@@ -282,9 +263,9 @@ static function ($exception): void {
282
263
/**
283
264
* Create request for operation 'getInfo'.
284
265
*
285
-
* @param string $id (optional)
286
-
* @param string $sr_name (optional)
287
-
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation
266
+
* @param null|string $id (optional)
267
+
* @param null|string $sr_name (optional)
268
+
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getInfo'] to see the possible values for this operation
288
269
*
289
270
* @throws \InvalidArgumentException
290
271
*/
@@ -392,4 +373,39 @@ private function createHttpClientOption(): array
392
373
393
374
return$options;
394
375
}
376
+
377
+
privatefunctionhandleResponseWithDataType(
378
+
string$dataType,
379
+
RequestInterface$request,
380
+
ResponseInterface$response,
381
+
): array {
382
+
if ($dataType === '\SplFileObject') {
383
+
$content = $response->getBody(); // stream goes to serializer
0 commit comments