Skip to content

Commit e5ff224

Browse files
authored
Merge pull request #1122 from php-api-clients/GitHub/from-1.1.4-9e7e2e65e12422c057cdc580ad81b2d1-from-1.1.4-9e7e2e65e12422c057cdc580ad81b2d1
2 parents 3ea1c50 + 17a2cb2 commit e5ff224

File tree

17 files changed

+183
-28
lines changed

17 files changed

+183
-28
lines changed

clients/GitHub/etc/openapi-client-generator.state

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"specHash": "dc607aeb3d02712c4deb944729095b7c",
2+
"specHash": "9e7e2e65e12422c057cdc580ad81b2d1",
33
"generatedFiles": {
44
"files": [
55
{
@@ -5768,7 +5768,7 @@
57685768
},
57695769
{
57705770
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Actions.php",
5771-
"hash": "de5bf092179379bd37ab5822aa57d427"
5771+
"hash": "1e378efc1a7e42ccf36c7fc474dcc68d"
57725772
},
57735773
{
57745774
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Oidc.php",
@@ -5800,7 +5800,7 @@
58005800
},
58015801
{
58025802
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Repos.php",
5803-
"hash": "83236f1e7b6e667c238b9ee90f4f0eb3"
5803+
"hash": "e47c376a147571cf59df4d012070321c"
58045804
},
58055805
{
58065806
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Billing.php",
@@ -18420,7 +18420,7 @@
1842018420
},
1842118421
{
1842218422
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Actions\/ListWorkflowRunsForRepo.php",
18423-
"hash": "120f4eb32bf62c92440c9371e760975c"
18423+
"hash": "c5be0cde0a23ae289ed3d1c4943d5c50"
1842418424
},
1842518425
{
1842618426
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Actions\/ListWorkflowRunsForRepoTest.php",
@@ -18804,7 +18804,7 @@
1880418804
},
1880518805
{
1880618806
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Actions\/ListWorkflowRuns.php",
18807-
"hash": "f38819d8dbb4746a718427cbb8545d90"
18807+
"hash": "2045bc3b4f291724809d19fff6128280"
1880818808
},
1880918809
{
1881018810
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Actions\/ListWorkflowRunsTest.php",
@@ -20508,15 +20508,15 @@
2050820508
},
2050920509
{
2051020510
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Repos\/CreateDispatchEvent.php",
20511-
"hash": "624485cee2b918bd12c33726cec649ed"
20511+
"hash": "11e44da623f8b907fcf62f598461a5e1"
2051220512
},
2051320513
{
2051420514
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Repos\/CreateDispatchEvent.php",
20515-
"hash": "f7a373df35321f19f5491a3a5b304b22"
20515+
"hash": "e086f2571757b950c4962083a9950678"
2051620516
},
2051720517
{
2051820518
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Repos\/CreateDispatchEventTest.php",
20519-
"hash": "749c385c7b5dc90aaf0c25d60a567ced"
20519+
"hash": "dd85423ac6c5adb06f3914fa36e321e7"
2052020520
},
2052120521
{
2052220522
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Repos\/GetAllEnvironments.php",
@@ -26404,7 +26404,7 @@
2640426404
},
2640526405
{
2640626406
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Actions.php",
26407-
"hash": "7ee52515f900099af150bc0f9c35b93d"
26407+
"hash": "4bfd8c4093fdf91b3df6588de460a12a"
2640826408
},
2640926409
{
2641026410
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/CodeScanning.php",
@@ -26464,7 +26464,7 @@
2646426464
},
2646526465
{
2646626466
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Repos.php",
26467-
"hash": "4d7d65332adeda6510ba08f915e44db4"
26467+
"hash": "4ea89d1a30c4fce239808bcd504e1d3d"
2646826468
},
2646926469
{
2647026470
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Teams.php",
@@ -26852,15 +26852,15 @@
2685226852
},
2685326853
{
2685426854
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php",
26855-
"hash": "2944786ba455b30f1a47ec85ca980184"
26855+
"hash": "147555754780b5408e6bdfb6561e2110"
2685626856
},
2685726857
{
2685826858
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php",
2685926859
"hash": "ef991455eed10a93b989f73a343925da"
2686026860
},
2686126861
{
2686226862
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Eight.php",
26863-
"hash": "77d95e1038bafab7f0fcb1832897a03f"
26863+
"hash": "9f5fce776efd3014eeb5e4a99fdbe233"
2686426864
},
2686526865
{
2686626866
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Nine.php",
@@ -26880,7 +26880,7 @@
2688026880
},
2688126881
{
2688226882
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Five.php",
26883-
"hash": "4d4aa638bc984e3ccf904011736dd0e5"
26883+
"hash": "a2c0ad344490b984666e4206f31dd7d5"
2688426884
},
2688526885
{
2688626886
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Two.php",
@@ -28176,7 +28176,7 @@
2817628176
},
2817728177
{
2817828178
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Dispatches.php",
28179-
"hash": "122b632bc8d1323e1bc0a03601b1dff9"
28179+
"hash": "3c51b6f41dc080ce289dd0acecefe7e1"
2818028180
},
2818128181
{
2818228182
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Environments.php",
@@ -29680,11 +29680,11 @@
2968029680
},
2968129681
{
2968229682
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php",
29683-
"hash": "20e7f30ce95fa464ecd3fbdf8e26decf"
29683+
"hash": "694653df53e7827c151062c70c385960"
2968429684
},
2968529685
{
2968629686
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php",
29687-
"hash": "7c361c1d9453b72de538f7e7fb34778a"
29687+
"hash": "a2755fdaf852b95ef51cc28449837af8"
2968829688
},
2968929689
{
2969029690
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon",

clients/GitHub/src/Internal/Hydrator/Operation/Repos/Owner/Repo/Dispatches.php

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace ApiClients\Client\GitHub\Internal\Hydrator\Operation\Repos\Owner\Repo;
66

7+
use ApiClients\Client\GitHub\Schema\BasicError;
78
use ApiClients\Client\GitHub\Schema\ValidationError;
89
use EventSauce\ObjectHydrator\IterableList;
910
use EventSauce\ObjectHydrator\ObjectMapper;
@@ -38,11 +39,75 @@ public function __construct()
3839
public function hydrateObject(string $className, array $payload): object
3940
{
4041
return match ($className) {
41-
'ApiClients\Client\GitHub\Schema\ValidationError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError($payload),
42+
'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload),
43+
'ApiClients\Client\GitHub\Schema\ValidationError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError($payload),
4244
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
4345
};
4446
}
4547

48+
private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError
49+
{
50+
$properties = [];
51+
$missingFields = [];
52+
try {
53+
$value = $payload['message'] ?? null;
54+
55+
if ($value === null) {
56+
$properties['message'] = null;
57+
goto after_message;
58+
}
59+
60+
$properties['message'] = $value;
61+
62+
after_message:
63+
64+
$value = $payload['documentation_url'] ?? null;
65+
66+
if ($value === null) {
67+
$properties['documentationUrl'] = null;
68+
goto after_documentationUrl;
69+
}
70+
71+
$properties['documentationUrl'] = $value;
72+
73+
after_documentationUrl:
74+
75+
$value = $payload['url'] ?? null;
76+
77+
if ($value === null) {
78+
$properties['url'] = null;
79+
goto after_url;
80+
}
81+
82+
$properties['url'] = $value;
83+
84+
after_url:
85+
86+
$value = $payload['status'] ?? null;
87+
88+
if ($value === null) {
89+
$properties['status'] = null;
90+
goto after_status;
91+
}
92+
93+
$properties['status'] = $value;
94+
95+
after_status:
96+
} catch (Throwable $exception) {
97+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack);
98+
}
99+
100+
if (count($missingFields) > 0) {
101+
throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack);
102+
}
103+
104+
try {
105+
return new BasicError(...$properties);
106+
} catch (Throwable $exception) {
107+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack);
108+
}
109+
}
110+
46111
private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError(array $payload): ValidationError
47112
{
48113
$properties = [];
@@ -126,6 +191,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
126191
'DateTime' => $this->serializeValueDateTime($object),
127192
'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object),
128193
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
194+
'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object),
129195
'ApiClients\Client\GitHub\Schema\ValidationError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError($object),
130196
default => throw new LogicException('No serialization defined for $className'),
131197
};
@@ -189,6 +255,46 @@ private function serializeValueDateTimeInterface(mixed $value): mixed
189255
return $serializer->serialize($value, $this);
190256
}
191257

258+
private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed
259+
{
260+
assert($object instanceof BasicError);
261+
$result = [];
262+
263+
$message = $object->message;
264+
265+
if ($message === null) {
266+
goto after_message;
267+
}
268+
269+
after_message: $result['message'] = $message;
270+
271+
$documentationUrl = $object->documentationUrl;
272+
273+
if ($documentationUrl === null) {
274+
goto after_documentationUrl;
275+
}
276+
277+
after_documentationUrl: $result['documentation_url'] = $documentationUrl;
278+
279+
$url = $object->url;
280+
281+
if ($url === null) {
282+
goto after_url;
283+
}
284+
285+
after_url: $result['url'] = $url;
286+
287+
$status = $object->status;
288+
289+
if ($status === null) {
290+
goto after_status;
291+
}
292+
293+
after_status: $result['status'] = $status;
294+
295+
return $result;
296+
}
297+
192298
private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError(mixed $object): mixed
193299
{
194300
assert($object instanceof ValidationError);

clients/GitHub/src/Internal/Operation/Repos/CreateDispatchEvent.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,17 @@ public function createResponse(ResponseInterface $response): WithoutBody
5050
case 'application/json':
5151
$body = json_decode($response->getBody()->getContents(), true);
5252
switch ($code) {
53+
/**
54+
* Resource not found
55+
**/
56+
case 404:
57+
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
58+
59+
throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
5360
/**
5461
* Validation failed, or the endpoint has been spammed.
5562
**/
63+
5664
case 422:
5765
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\ValidationError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
5866

clients/GitHub/src/Internal/Operator/Actions/ListWorkflowRuns.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
2424
{
2525
}
2626

27+
/** @return */
2728
public function call(string $owner, string $repo, $workflowId, string $actor, string $branch, string $event, string $status, string $created, int $checkSuiteId, string $headSha, int $perPage = 30, int $page = 1, bool $excludePullRequests = false): Json
2829
{
2930
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Actions\ListWorkflowRuns($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $workflowId, $actor, $branch, $event, $status, $created, $checkSuiteId, $headSha, $perPage, $page, $excludePullRequests);

clients/GitHub/src/Internal/Operator/Actions/ListWorkflowRunsForRepo.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
2424
{
2525
}
2626

27+
/** @return */
2728
public function call(string $owner, string $repo, string $actor, string $branch, string $event, string $status, string $created, int $checkSuiteId, string $headSha, int $perPage = 30, int $page = 1, bool $excludePullRequests = false): Ok
2829
{
2930
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Actions\ListWorkflowRunsForRepo($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $actor, $branch, $event, $status, $created, $checkSuiteId, $headSha, $perPage, $page, $excludePullRequests);

clients/GitHub/src/Internal/Operator/Repos/CreateDispatchEvent.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public function __construct(private Browser $browser, private AuthenticationInte
2424
{
2525
}
2626

27-
/** @return */
2827
public function call(string $owner, string $repo, array $params): WithoutBody
2928
{
3029
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Repos\CreateDispatchEvent($this->requestSchemaValidator, $this->responseSchemaValidator, $this->hydrator, $owner, $repo);

clients/GitHub/src/Internal/Router/Get/Actions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ public function listSelfHostedRunnersForRepo(array $params): Json
559559
return $operator->call($arguments['name'], $arguments['owner'], $arguments['repo'], $arguments['per_page'], $arguments['page']);
560560
}
561561

562+
/** @return */
562563
public function listWorkflowRunsForRepo(array $params): \ApiClients\Client\GitHub\Schema\Operations\Actions\ListWorkflowRunsForRepo\Response\ApplicationJson\Ok
563564
{
564565
$arguments = [];
@@ -1530,6 +1531,7 @@ public function getWorkflowRunUsage(array $params): WorkflowRunUsage
15301531
return $operator->call($arguments['owner'], $arguments['repo'], $arguments['run_id']);
15311532
}
15321533

1534+
/** @return */
15331535
public function listWorkflowRuns(array $params): \ApiClients\Client\GitHub\Schema\Operations\Actions\ListWorkflowRuns\Response\ApplicationJson\Ok\Application\Json
15341536
{
15351537
$arguments = [];

clients/GitHub/src/Internal/Router/Get/Eight.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(private Routers $routers)
3434
{
3535
}
3636

37-
/** @return |Observable<Schema\TeamDiscussionComment>|Observable<Schema\Reaction>|Observable<Schema\EnvironmentApprovals>|Observable<Schema\PendingDeployment>|Schema\Operations\Actions\ListWorkflowRuns\Response\ApplicationJson\Ok\Application\Json|Observable<Schema\CodeScanningAlertInstance>|Observable<Schema\SecretScanningLocation>|WithoutBody */
37+
/** @return |Observable<Schema\TeamDiscussionComment>|Observable<Schema\Reaction>|Observable<Schema\EnvironmentApprovals>|Observable<Schema\PendingDeployment>|Observable<Schema\CodeScanningAlertInstance>|Observable<Schema\SecretScanningLocation>|WithoutBody */
3838
public function call(string $call, array $params, array $pathChunks): PackageVersion|iterable|TeamRepository|WithoutBody|OidcCustomSubRepo|Ok|Json|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListJobsForWorkflowRun\Response\ApplicationJson\Ok\Application\Json|WorkflowRunUsage|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListWorkflowRuns\Response\ApplicationJson\Ok\Application\Json|WorkflowUsage|ProtectedBranchAdminEnforced|ProtectedBranchPullRequestReview|StatusCheckPolicy|BranchRestrictionPolicy|CodeScanningCodeqlDatabase|DeploymentStatus|DeploymentBranchPolicy|\ApiClients\Client\GitHub\Schema\Operations\Repos\ListCustomDeploymentRuleIntegrations\Response\ApplicationJson\Ok|DeploymentProtectionRule|ActionsPublicKey|ActionsSecret|ActionsVariable|HookDelivery|PullRequestReview
3939
{
4040
if ($pathChunks[0] === '') {

0 commit comments

Comments
 (0)