Skip to content

Commit f171357

Browse files
committed
Spec 1.2.0
1 parent d62df6e commit f171357

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ For more information, please visit [https://ssl.reddit.com/dev/api](https://ssl.
88

99
### Requirements
1010

11-
PHP 7.2 and later.
11+
PHP 7.3 and later.
12+
Should also work with PHP 8.0 but has not been tested.
1213

1314
### Composer
1415

@@ -116,5 +117,5 @@ [email protected]
116117

117118
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
118119

119-
- API version: `1.1.0`
120+
- API version: `1.2.0`
120121
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`

src/Api/UserApi.php

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,21 @@ public function getSavedWithHttpInfo($username, $after = null, $before = null, $
133133
try {
134134
$response = $this->client->send($request, $options);
135135
} catch (RequestException $e) {
136-
throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null);
136+
throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null);
137137
}
138138

139139
$statusCode = $response->getStatusCode();
140140

141141
if ($statusCode < 200 || $statusCode > 299) {
142-
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $request->getUri()), $statusCode, $response->getHeaders(), $response->getBody());
142+
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
143143
}
144144

145-
$responseBody = $response->getBody();
146145
switch ($statusCode) {
147146
case 200:
148147
if ('\Sigwin\RedditClient\Model\ListingEnvelope' === '\SplFileObject') {
149-
$content = $responseBody; //stream goes to serializer
148+
$content = $response->getBody(); //stream goes to serializer
150149
} else {
151-
$content = (string) $responseBody;
150+
$content = (string) $response->getBody();
152151
}
153152

154153
return [
@@ -159,11 +158,10 @@ public function getSavedWithHttpInfo($username, $after = null, $before = null, $
159158
}
160159

161160
$returnType = '\Sigwin\RedditClient\Model\ListingEnvelope';
162-
$responseBody = $response->getBody();
163161
if ($returnType === '\SplFileObject') {
164-
$content = $responseBody; //stream goes to serializer
162+
$content = $response->getBody(); //stream goes to serializer
165163
} else {
166-
$content = (string) $responseBody;
164+
$content = (string) $response->getBody();
167165
}
168166

169167
return [
@@ -229,11 +227,10 @@ public function getSavedAsyncWithHttpInfo($username, $after = null, $before = nu
229227
->sendAsync($request, $this->createHttpClientOption())
230228
->then(
231229
static function ($response) use ($returnType) {
232-
$responseBody = $response->getBody();
233230
if ($returnType === '\SplFileObject') {
234-
$content = $responseBody; //stream goes to serializer
231+
$content = $response->getBody(); //stream goes to serializer
235232
} else {
236-
$content = (string) $responseBody;
233+
$content = (string) $response->getBody();
237234
}
238235

239236
return [
@@ -245,7 +242,7 @@ static function ($response) use ($returnType) {
245242
static function ($exception): void {
246243
$response = $exception->getResponse();
247244
$statusCode = $response->getStatusCode();
248-
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), $response->getBody());
245+
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
249246
}
250247
);
251248
}
@@ -411,22 +408,21 @@ public function meWithHttpInfo(): array
411408
try {
412409
$response = $this->client->send($request, $options);
413410
} catch (RequestException $e) {
414-
throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null);
411+
throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", (int) $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? (string) $e->getResponse()->getBody() : null);
415412
}
416413

417414
$statusCode = $response->getStatusCode();
418415

419416
if ($statusCode < 200 || $statusCode > 299) {
420-
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $request->getUri()), $statusCode, $response->getHeaders(), $response->getBody());
417+
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, (string) $request->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
421418
}
422419

423-
$responseBody = $response->getBody();
424420
switch ($statusCode) {
425421
case 200:
426422
if ('\Sigwin\RedditClient\Model\Me' === '\SplFileObject') {
427-
$content = $responseBody; //stream goes to serializer
423+
$content = $response->getBody(); //stream goes to serializer
428424
} else {
429-
$content = (string) $responseBody;
425+
$content = (string) $response->getBody();
430426
}
431427

432428
return [
@@ -437,11 +433,10 @@ public function meWithHttpInfo(): array
437433
}
438434

439435
$returnType = '\Sigwin\RedditClient\Model\Me';
440-
$responseBody = $response->getBody();
441436
if ($returnType === '\SplFileObject') {
442-
$content = $responseBody; //stream goes to serializer
437+
$content = $response->getBody(); //stream goes to serializer
443438
} else {
444-
$content = (string) $responseBody;
439+
$content = (string) $response->getBody();
445440
}
446441

447442
return [
@@ -503,11 +498,10 @@ public function meAsyncWithHttpInfo(): \GuzzleHttp\Promise\PromiseInterface
503498
->sendAsync($request, $this->createHttpClientOption())
504499
->then(
505500
static function ($response) use ($returnType) {
506-
$responseBody = $response->getBody();
507501
if ($returnType === '\SplFileObject') {
508-
$content = $responseBody; //stream goes to serializer
502+
$content = $response->getBody(); //stream goes to serializer
509503
} else {
510-
$content = (string) $responseBody;
504+
$content = (string) $response->getBody();
511505
}
512506

513507
return [
@@ -519,7 +513,7 @@ static function ($response) use ($returnType) {
519513
static function ($exception): void {
520514
$response = $exception->getResponse();
521515
$statusCode = $response->getStatusCode();
522-
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), $response->getBody());
516+
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), (string) $response->getBody());
523517
}
524518
);
525519
}

src/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* Configuration Class Doc Comment
9-
* PHP version 7.2.
9+
* PHP version 7.3.
1010
*
1111
* @category Class
1212
*
@@ -376,7 +376,7 @@ public static function toDebugReport(): string
376376
$report = 'PHP SDK (Sigwin\RedditClient) Debug Report:'.\PHP_EOL;
377377
$report .= ' OS: '.php_uname().\PHP_EOL;
378378
$report .= ' PHP Version: '.\PHP_VERSION.\PHP_EOL;
379-
$report .= ' The version of the OpenAPI document: 1.1.0'.\PHP_EOL;
379+
$report .= ' The version of the OpenAPI document: 1.2.0'.\PHP_EOL;
380380
$report .= ' Temp Folder Path: '.self::getDefaultConfiguration()->getTempFolderPath().\PHP_EOL;
381381

382382
return $report;

src/Model/Thing.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class Thing implements \JsonSerializable, ArrayAccess, ModelInterface
2525

2626
const KIND_T1 = 't1';
2727
const KIND_T3 = 't3';
28+
const KIND_MORE = 'more';
2829

2930
/**
3031
* The original name of the model.
@@ -175,6 +176,7 @@ public function getKindAllowableValues(): array
175176
return [
176177
self::KIND_T1,
177178
self::KIND_T3,
179+
self::KIND_MORE,
178180
];
179181
}
180182

0 commit comments

Comments
 (0)