Skip to content

Commit e8515c1

Browse files
authored
Merge pull request #1123 from php-api-clients/GitHubEnterpriseCloud/from-1.1.4-a7adbe76e1c25b7f4ce737f85d3021f1-from-1.1.4-a7adbe76e1c25b7f4ce737f85d3021f1
2 parents e5ff224 + 68e1052 commit e8515c1

File tree

17 files changed

+183
-28
lines changed

17 files changed

+183
-28
lines changed

clients/GitHubEnterpriseCloud/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": "4ad6b0308a7d8a918d4955dcdeb001cb",
2+
"specHash": "a7adbe76e1c25b7f4ce737f85d3021f1",
33
"generatedFiles": {
44
"files": [
55
{
@@ -6088,7 +6088,7 @@
60886088
},
60896089
{
60906090
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Actions.php",
6091-
"hash": "af386e2c2f61abb6f85deae9d42238f9"
6091+
"hash": "cb0c5fcc0e188ac40708ba85f91a5471"
60926092
},
60936093
{
60946094
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/AnnouncementBanners.php",
@@ -6168,7 +6168,7 @@
61686168
},
61696169
{
61706170
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Repos.php",
6171-
"hash": "70b8434c4d0615054eb9c4956fce9428"
6171+
"hash": "ba22e713eb46c51c4219d47eb577721d"
61726172
},
61736173
{
61746174
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Reactions.php",
@@ -19916,7 +19916,7 @@
1991619916
},
1991719917
{
1991819918
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Actions\/ListWorkflowRunsForRepo.php",
19919-
"hash": "ca7d4cc41b6db8c4f91623a75946d03a"
19919+
"hash": "0d7aebe8c47b76b131c35e49641927d4"
1992019920
},
1992119921
{
1992219922
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Actions\/ListWorkflowRunsForRepoTest.php",
@@ -20300,7 +20300,7 @@
2030020300
},
2030120301
{
2030220302
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Actions\/ListWorkflowRuns.php",
20303-
"hash": "459764f6dd6e1ead5a9959f3a19ad3db"
20303+
"hash": "5d2269f909e1150c528c2db3dbb87cdc"
2030420304
},
2030520305
{
2030620306
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Actions\/ListWorkflowRunsTest.php",
@@ -22004,15 +22004,15 @@
2200422004
},
2200522005
{
2200622006
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Repos\/CreateDispatchEvent.php",
22007-
"hash": "b666e5357384288e77f18b749950b5cc"
22007+
"hash": "a6dd501269a996c7e0b81adf352c04ff"
2200822008
},
2200922009
{
2201022010
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Repos\/CreateDispatchEvent.php",
22011-
"hash": "454300b97218079a6b01d1dbebdae734"
22011+
"hash": "b11e0af635b08c5b3b9e9def8e417b02"
2201222012
},
2201322013
{
2201422014
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Repos\/CreateDispatchEventTest.php",
22015-
"hash": "5057ff53b63960b844ff84c425b4ea26"
22015+
"hash": "b663825cc906345acfbae9b6ed334a79"
2201622016
},
2201722017
{
2201822018
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Repos\/GetAllEnvironments.php",
@@ -28044,7 +28044,7 @@
2804428044
},
2804528045
{
2804628046
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Actions.php",
28047-
"hash": "522541c317bcd74739056ac11b63aca2"
28047+
"hash": "60706d920bae3c9c73fc69c681b47142"
2804828048
},
2804928049
{
2805028050
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Copilot.php",
@@ -28104,7 +28104,7 @@
2810428104
},
2810528105
{
2810628106
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Repos.php",
28107-
"hash": "800127e79acbd6f06bbc9755d0c98a95"
28107+
"hash": "c846fad60677a5c415d217f658d8ef2d"
2810828108
},
2810928109
{
2811028110
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Teams.php",
@@ -28540,15 +28540,15 @@
2854028540
},
2854128541
{
2854228542
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php",
28543-
"hash": "db4f314f5f7f361be10ecb1704478f0d"
28543+
"hash": "28c7d64a38f9ae61536e5ff3af0ea112"
2854428544
},
2854528545
{
2854628546
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php",
2854728547
"hash": "35e6002e6d6ed95b3084ba5c554e2ba8"
2854828548
},
2854928549
{
2855028550
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Eight.php",
28551-
"hash": "ba67a53ab4ca4638892e8e72f5f2c3b3"
28551+
"hash": "df74ea1ae4bafb3cee06c38ccf8e821e"
2855228552
},
2855328553
{
2855428554
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Nine.php",
@@ -28568,7 +28568,7 @@
2856828568
},
2856928569
{
2857028570
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Five.php",
28571-
"hash": "e0dd9392090644b3b937fb490984a237"
28571+
"hash": "f3facaa17883a5c20b1219ae5558633c"
2857228572
},
2857328573
{
2857428574
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Post\/Seven.php",
@@ -30028,7 +30028,7 @@
3002830028
},
3002930029
{
3003030030
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Dispatches.php",
30031-
"hash": "c64b591c865b3cc8a9d82706566199f5"
30031+
"hash": "80510381e853bbe9596d0a397dc51951"
3003230032
},
3003330033
{
3003430034
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Environments.php",
@@ -31764,11 +31764,11 @@
3176431764
},
3176531765
{
3176631766
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php",
31767-
"hash": "236fd3e3a9ce056ad9eb7ec4078829c7"
31767+
"hash": "cba84edf0e3bd80f4ee50abe5b18a1cc"
3176831768
},
3176931769
{
3177031770
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php",
31771-
"hash": "5d7bd2784224fb0bbce25336582c1e26"
31771+
"hash": "c0e4e895958494d9ac01794a9547fda2"
3177231772
},
3177331773
{
3177431774
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon",

clients/GitHubEnterpriseCloud/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\GitHubEnterpriseCloud\Internal\Hydrator\Operation\Repos\Owner\Repo;
66

7+
use ApiClients\Client\GitHubEnterpriseCloud\Schema\BasicError;
78
use ApiClients\Client\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\Schema\ValidationError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️ValidationError($payload),
42+
'ApiClients\Client\GitHubEnterpriseCloud\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️BasicError($payload),
43+
'ApiClients\Client\GitHubEnterpriseCloud\Schema\ValidationError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️ValidationError($payload),
4244
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
4345
};
4446
}
4547

48+
private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\Schema\BasicError', $exception, stack: $this->hydrationStack);
108+
}
109+
}
110+
46111
private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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\GitHubEnterpriseCloud\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️BasicError($object),
129195
'ApiClients\Client\GitHubEnterpriseCloud\Schema\ValidationError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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⚡️GitHubEnterpriseCloud⚡️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⚡️GitHubEnterpriseCloud⚡️Schema⚡️ValidationError(mixed $object): mixed
193299
{
194300
assert($object instanceof ValidationError);

clients/GitHubEnterpriseCloud/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/GitHubEnterpriseCloud/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\GitHubEnterpriseCloud\Internal\Operation\Actions\ListWorkflowRuns($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $workflowId, $actor, $branch, $event, $status, $created, $checkSuiteId, $headSha, $perPage, $page, $excludePullRequests);

clients/GitHubEnterpriseCloud/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\GitHubEnterpriseCloud\Internal\Operation\Actions\ListWorkflowRunsForRepo($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $actor, $branch, $event, $status, $created, $checkSuiteId, $headSha, $perPage, $page, $excludePullRequests);

clients/GitHubEnterpriseCloud/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\GitHubEnterpriseCloud\Internal\Operation\Repos\CreateDispatchEvent($this->requestSchemaValidator, $this->responseSchemaValidator, $this->hydrator, $owner, $repo);

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

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

647+
/** @return */
647648
public function listWorkflowRunsForRepo(array $params): \ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListWorkflowRunsForRepo\Response\ApplicationJson\Ok
648649
{
649650
$arguments = [];
@@ -1681,6 +1682,7 @@ public function getWorkflowRunUsage(array $params): WorkflowRunUsage
16811682
return $operator->call($arguments['owner'], $arguments['repo'], $arguments['run_id']);
16821683
}
16831684

1685+
/** @return */
16841686
public function listWorkflowRuns(array $params): \ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListWorkflowRuns\Response\ApplicationJson\Ok\Application\Json
16851687
{
16861688
$arguments = [];

clients/GitHubEnterpriseCloud/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\GitHubEnterpriseCloud\Schema\Operations\Actions\ListJobsForWorkflowRun\Response\ApplicationJson\Ok\Application\Json|WorkflowRunUsage|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListWorkflowRuns\Response\ApplicationJson\Ok\Application\Json|WorkflowUsage|ProtectedBranchAdminEnforced|ProtectedBranchPullRequestReview|StatusCheckPolicy|BranchRestrictionPolicy|CodeScanningCodeqlDatabase|DeploymentStatus|DeploymentBranchPolicy|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Repos\ListCustomDeploymentRuleIntegrations\Response\ApplicationJson\Ok|DeploymentProtectionRule|ActionsPublicKey|ActionsSecret|ActionsVariable|HookDelivery|PullRequestReview
3939
{
4040
if ($pathChunks[0] === '') {

0 commit comments

Comments
 (0)