Skip to content

Commit baf79e4

Browse files
authored
Merge pull request #1272 from php-api-clients/GitHub/from-1.1.4-a937c40b238be216f274ad4de79f6216-from-1.1.4-a937c40b238be216f274ad4de79f6216
2 parents e9fb83b + f7a1268 commit baf79e4

Some content is hidden

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

46 files changed

+47017
-159
lines changed

clients/GitHub/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ $client->call('GET /advisories', [
7070
'published' => 'generated',
7171
'updated' => 'generated',
7272
'modified' => 'generated',
73+
'epss_percentage' => 'generated',
74+
'epss_percentile' => 'generated',
7375
'before' => 'generated',
7476
'after' => 'generated',
7577
'type' => 'generated',
@@ -91,6 +93,8 @@ $client->operations()->securityAdvisories()->listGlobalAdvisories( ghsa_i
9193
published: 'generated',
9294
updated: 'generated',
9395
modified: 'generated',
96+
epss_percentage: 'generated',
97+
epss_percentile: 'generated',
9498
before: 'generated',
9599
after: 'generated',
96100
type: 'generated',

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

+68-36
Large diffs are not rendered by default.

clients/GitHub/src/Internal/Hydrator/Operation/Advisories/GhsaId.php

+97
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use ApiClients\Client\GitHub\Schema\BasicError;
88
use ApiClients\Client\GitHub\Schema\GlobalAdvisory;
99
use ApiClients\Client\GitHub\Schema\GlobalAdvisory\Cvss;
10+
use ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss;
1011
use EventSauce\ObjectHydrator\IterableList;
1112
use EventSauce\ObjectHydrator\ObjectMapper;
1213
use EventSauce\ObjectHydrator\PropertySerializers\SerializeArrayItems;
@@ -44,6 +45,7 @@ public function hydrateObject(string $className, array $payload): object
4445
return match ($className) {
4546
'ApiClients\Client\GitHub\Schema\GlobalAdvisory' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory($payload),
4647
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Cvss' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Cvss($payload),
48+
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($payload),
4749
'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload),
4850
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
4951
};
@@ -283,6 +285,26 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Glob
283285

284286
after_cwes:
285287

288+
$value = $payload['epss'] ?? null;
289+
290+
if ($value === null) {
291+
$properties['epss'] = null;
292+
goto after_epss;
293+
}
294+
295+
if (is_array($value)) {
296+
try {
297+
$this->hydrationStack[] = 'epss';
298+
$value = $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($value);
299+
} finally {
300+
array_pop($this->hydrationStack);
301+
}
302+
}
303+
304+
$properties['epss'] = $value;
305+
306+
after_epss:
307+
286308
$value = $payload['credits'] ?? null;
287309

288310
if ($value === null) {
@@ -349,6 +371,47 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Glob
349371
}
350372
}
351373

374+
private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss(array $payload): Epss
375+
{
376+
$properties = [];
377+
$missingFields = [];
378+
try {
379+
$value = $payload['percentage'] ?? null;
380+
381+
if ($value === null) {
382+
$properties['percentage'] = null;
383+
goto after_percentage;
384+
}
385+
386+
$properties['percentage'] = $value;
387+
388+
after_percentage:
389+
390+
$value = $payload['percentile'] ?? null;
391+
392+
if ($value === null) {
393+
$properties['percentile'] = null;
394+
goto after_percentile;
395+
}
396+
397+
$properties['percentile'] = $value;
398+
399+
after_percentile:
400+
} catch (Throwable $exception) {
401+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss', $exception, stack: $this->hydrationStack);
402+
}
403+
404+
if (count($missingFields) > 0) {
405+
throw UnableToHydrateObject::dueToMissingFields(Epss::class, $missingFields, stack: $this->hydrationStack);
406+
}
407+
408+
try {
409+
return new Epss(...$properties);
410+
} catch (Throwable $exception) {
411+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss', $exception, stack: $this->hydrationStack);
412+
}
413+
}
414+
352415
private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError
353416
{
354417
$properties = [];
@@ -445,6 +508,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
445508
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
446509
'ApiClients\Client\GitHub\Schema\GlobalAdvisory' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory($object),
447510
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Cvss' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Cvss($object),
511+
'ApiClients\Client\GitHub\Schema\GlobalAdvisory\Epss' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($object),
448512
'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object),
449513
default => throw new LogicException("No serialization defined for $className"),
450514
};
@@ -662,6 +726,15 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
662726
$cwes = $cwesSerializer0->serialize($cwes, $this);
663727
after_cwes: $result['cwes'] = $cwes;
664728

729+
$epss = $object->epss;
730+
731+
if ($epss === null) {
732+
goto after_epss;
733+
}
734+
735+
$epss = $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss($epss);
736+
after_epss: $result['epss'] = $epss;
737+
665738
$credits = $object->credits;
666739

667740
if ($credits === null) {
@@ -704,6 +777,30 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
704777
return $result;
705778
}
706779

780+
private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️GlobalAdvisory⚡️Epss(mixed $object): mixed
781+
{
782+
assert($object instanceof Epss);
783+
$result = [];
784+
785+
$percentage = $object->percentage;
786+
787+
if ($percentage === null) {
788+
goto after_percentage;
789+
}
790+
791+
after_percentage: $result['percentage'] = $percentage;
792+
793+
$percentile = $object->percentile;
794+
795+
if ($percentile === null) {
796+
goto after_percentile;
797+
}
798+
799+
after_percentile: $result['percentile'] = $percentile;
800+
801+
return $result;
802+
}
803+
707804
private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed
708805
{
709806
assert($object instanceof BasicError);

clients/GitHub/src/Internal/Hydrator/Operation/Meta.php

+104
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use ApiClients\Client\GitHub\Schema\ApiOverview;
88
use ApiClients\Client\GitHub\Schema\ApiOverview\Domains;
9+
use ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations;
910
use ApiClients\Client\GitHub\Schema\ApiOverview\SshKeyFingerprints;
1011
use EventSauce\ObjectHydrator\IterableList;
1112
use EventSauce\ObjectHydrator\ObjectMapper;
@@ -45,6 +46,7 @@ public function hydrateObject(string $className, array $payload): object
4546
'ApiClients\Client\GitHub\Schema\ApiOverview' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview($payload),
4647
'ApiClients\Client\GitHub\Schema\ApiOverview\SshKeyFingerprints' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️SshKeyFingerprints($payload),
4748
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains($payload),
49+
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($payload),
4850
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
4951
};
5052
}
@@ -384,6 +386,26 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiO
384386
$properties['actions'] = $value;
385387

386388
after_actions:
389+
390+
$value = $payload['artifact_attestations'] ?? null;
391+
392+
if ($value === null) {
393+
$properties['artifactAttestations'] = null;
394+
goto after_artifactAttestations;
395+
}
396+
397+
if (is_array($value)) {
398+
try {
399+
$this->hydrationStack[] = 'artifactAttestations';
400+
$value = $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($value);
401+
} finally {
402+
array_pop($this->hydrationStack);
403+
}
404+
}
405+
406+
$properties['artifactAttestations'] = $value;
407+
408+
after_artifactAttestations:
387409
} catch (Throwable $exception) {
388410
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ApiOverview\Domains', $exception, stack: $this->hydrationStack);
389411
}
@@ -399,6 +421,47 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiO
399421
}
400422
}
401423

424+
private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations(array $payload): ArtifactAttestations
425+
{
426+
$properties = [];
427+
$missingFields = [];
428+
try {
429+
$value = $payload['trust_domain'] ?? null;
430+
431+
if ($value === null) {
432+
$properties['trustDomain'] = null;
433+
goto after_trustDomain;
434+
}
435+
436+
$properties['trustDomain'] = $value;
437+
438+
after_trustDomain:
439+
440+
$value = $payload['services'] ?? null;
441+
442+
if ($value === null) {
443+
$properties['services'] = null;
444+
goto after_services;
445+
}
446+
447+
$properties['services'] = $value;
448+
449+
after_services:
450+
} catch (Throwable $exception) {
451+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations', $exception, stack: $this->hydrationStack);
452+
}
453+
454+
if (count($missingFields) > 0) {
455+
throw UnableToHydrateObject::dueToMissingFields(ArtifactAttestations::class, $missingFields, stack: $this->hydrationStack);
456+
}
457+
458+
try {
459+
return new ArtifactAttestations(...$properties);
460+
} catch (Throwable $exception) {
461+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations', $exception, stack: $this->hydrationStack);
462+
}
463+
}
464+
402465
private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array
403466
{
404467
foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) {
@@ -433,6 +496,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
433496
'ApiClients\Client\GitHub\Schema\ApiOverview' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview($object),
434497
'ApiClients\Client\GitHub\Schema\ApiOverview\SshKeyFingerprints' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️SshKeyFingerprints($object),
435498
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains($object),
499+
'ApiClients\Client\GitHub\Schema\ApiOverview\Domains\ArtifactAttestations' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($object),
436500
default => throw new LogicException("No serialization defined for $className"),
437501
};
438502
} catch (Throwable $exception) {
@@ -839,6 +903,46 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
839903
$actions = $actionsSerializer0->serialize($actions, $this);
840904
after_actions: $result['actions'] = $actions;
841905

906+
$artifactAttestations = $object->artifactAttestations;
907+
908+
if ($artifactAttestations === null) {
909+
goto after_artifactAttestations;
910+
}
911+
912+
$artifactAttestations = $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations($artifactAttestations);
913+
after_artifactAttestations: $result['artifact_attestations'] = $artifactAttestations;
914+
915+
return $result;
916+
}
917+
918+
private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiOverview⚡️Domains⚡️ArtifactAttestations(mixed $object): mixed
919+
{
920+
assert($object instanceof ArtifactAttestations);
921+
$result = [];
922+
923+
$trustDomain = $object->trustDomain;
924+
925+
if ($trustDomain === null) {
926+
goto after_trustDomain;
927+
}
928+
929+
after_trustDomain: $result['trust_domain'] = $trustDomain;
930+
931+
$services = $object->services;
932+
933+
if ($services === null) {
934+
goto after_services;
935+
}
936+
937+
static $servicesSerializer0;
938+
939+
if ($servicesSerializer0 === null) {
940+
$servicesSerializer0 = new SerializeArrayItems(...[]);
941+
}
942+
943+
$services = $servicesSerializer0->serialize($services, $this);
944+
after_services: $result['services'] = $services;
945+
842946
return $result;
843947
}
844948

0 commit comments

Comments
 (0)