Skip to content

Commit 626dc34

Browse files
authored
[GitHubAE] Update to 1.1.4-51868c0a30cf979b021c18dc01550582 from 1.1.4-3c30b4654b8763c53887fef2aad3304a
Detected Schema changes:
1 parent 7a0471d commit 626dc34

File tree

2,884 files changed

+1107358
-14427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,884 files changed

+1107358
-14427
lines changed

etc/openapi-client-generator.state

Lines changed: 21795 additions & 1 deletion
Large diffs are not rendered by default.

src/Client.php

Lines changed: 204 additions & 21 deletions
Large diffs are not rendered by default.

src/ClientInterface.php

Lines changed: 154 additions & 9 deletions
Large diffs are not rendered by default.

src/Operation/Actions.php

Lines changed: 79 additions & 78 deletions
Large diffs are not rendered by default.

src/Operation/Actions/ListRunnerApplicationsForOrg.php

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@
44

55
namespace ApiClients\Client\GitHubAE\Operation\Actions;
66

7+
use ApiClients\Client\GitHubAE\Hydrator;
8+
use ApiClients\Client\GitHubAE\Schema;
9+
use cebe\openapi\Reader;
10+
use League\OpenAPIValidation\Schema\SchemaValidator;
711
use Psr\Http\Message\RequestInterface;
812
use Psr\Http\Message\ResponseInterface;
913
use RingCentral\Psr7\Request;
14+
use RuntimeException;
15+
use Rx\Observable;
16+
use Rx\Scheduler\ImmediateScheduler;
17+
use Throwable;
1018

19+
use function explode;
20+
use function json_decode;
1121
use function str_replace;
1222

1323
final class ListRunnerApplicationsForOrg
@@ -19,7 +29,7 @@ final class ListRunnerApplicationsForOrg
1929
/**The organization name. The name is not case sensitive. **/
2030
private string $org;
2131

22-
public function __construct(string $org)
32+
public function __construct(private readonly SchemaValidator $responseSchemaValidator, private readonly Hydrator\Operation\Orgs\Org\Actions\Runners\Downloads $hydrator, string $org)
2333
{
2434
$this->org = $org;
2535
}
@@ -29,8 +39,37 @@ public function createRequest(): RequestInterface
2939
return new Request(self::METHOD, str_replace(['{org}'], [$this->org], self::PATH));
3040
}
3141

32-
public function createResponse(ResponseInterface $response): ResponseInterface
42+
/** @return Observable<Schema\RunnerApplication> */
43+
public function createResponse(ResponseInterface $response): Observable
3344
{
34-
return $response;
45+
$code = $response->getStatusCode();
46+
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
47+
switch ($contentType) {
48+
case 'application/json':
49+
$body = json_decode($response->getBody()->getContents(), true);
50+
switch ($code) {
51+
/**
52+
* Response
53+
**/
54+
case 200:
55+
return Observable::fromArray($body, new ImmediateScheduler())->map(function (array $body): Schema\RunnerApplication {
56+
$error = new RuntimeException();
57+
try {
58+
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\RunnerApplication::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
59+
60+
return $this->hydrator->hydrateObject(Schema\RunnerApplication::class, $body);
61+
} catch (Throwable $error) {
62+
goto items_application_json_two_hundred_aaaaa;
63+
}
64+
65+
items_application_json_two_hundred_aaaaa:
66+
throw $error;
67+
});
68+
}
69+
70+
break;
71+
}
72+
73+
throw new RuntimeException('Unable to find matching response code and content type');
3574
}
3675
}

src/Operation/Actions/ListRunnerApplicationsForRepo.php

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@
44

55
namespace ApiClients\Client\GitHubAE\Operation\Actions;
66

7+
use ApiClients\Client\GitHubAE\Hydrator;
8+
use ApiClients\Client\GitHubAE\Schema;
9+
use cebe\openapi\Reader;
10+
use League\OpenAPIValidation\Schema\SchemaValidator;
711
use Psr\Http\Message\RequestInterface;
812
use Psr\Http\Message\ResponseInterface;
913
use RingCentral\Psr7\Request;
14+
use RuntimeException;
15+
use Rx\Observable;
16+
use Rx\Scheduler\ImmediateScheduler;
17+
use Throwable;
1018

19+
use function explode;
20+
use function json_decode;
1121
use function str_replace;
1222

1323
final class ListRunnerApplicationsForRepo
@@ -21,7 +31,7 @@ final class ListRunnerApplicationsForRepo
2131
/**The name of the repository without the `.git` extension. The name is not case sensitive. **/
2232
private string $repo;
2333

24-
public function __construct(string $owner, string $repo)
34+
public function __construct(private readonly SchemaValidator $responseSchemaValidator, private readonly Hydrator\Operation\Repos\Owner\Repo\Actions\Runners\Downloads $hydrator, string $owner, string $repo)
2535
{
2636
$this->owner = $owner;
2737
$this->repo = $repo;
@@ -32,8 +42,37 @@ public function createRequest(): RequestInterface
3242
return new Request(self::METHOD, str_replace(['{owner}', '{repo}'], [$this->owner, $this->repo], self::PATH));
3343
}
3444

35-
public function createResponse(ResponseInterface $response): ResponseInterface
45+
/** @return Observable<Schema\RunnerApplication> */
46+
public function createResponse(ResponseInterface $response): Observable
3647
{
37-
return $response;
48+
$code = $response->getStatusCode();
49+
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
50+
switch ($contentType) {
51+
case 'application/json':
52+
$body = json_decode($response->getBody()->getContents(), true);
53+
switch ($code) {
54+
/**
55+
* Response
56+
**/
57+
case 200:
58+
return Observable::fromArray($body, new ImmediateScheduler())->map(function (array $body): Schema\RunnerApplication {
59+
$error = new RuntimeException();
60+
try {
61+
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\RunnerApplication::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
62+
63+
return $this->hydrator->hydrateObject(Schema\RunnerApplication::class, $body);
64+
} catch (Throwable $error) {
65+
goto items_application_json_two_hundred_aaaaa;
66+
}
67+
68+
items_application_json_two_hundred_aaaaa:
69+
throw $error;
70+
});
71+
}
72+
73+
break;
74+
}
75+
76+
throw new RuntimeException('Unable to find matching response code and content type');
3877
}
3978
}

0 commit comments

Comments
 (0)