Skip to content

Commit 5f1fc87

Browse files
committed
Introduce list for paging calls
1 parent 242c909 commit 5f1fc87

File tree

2,494 files changed

+688141
-746884
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,494 files changed

+688141
-746884
lines changed

src/Client.php

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

src/Hydrator/Operation/App.php

Lines changed: 288 additions & 286 deletions
Large diffs are not rendered by default.

src/Hydrator/Operation/App/Hook/Config.php

Lines changed: 81 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -29,83 +29,102 @@ public function hydrateObject(string $className, array $payload): object
2929
}
3030

3131

32-
private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️WebhookConfig(array $payload): \ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig
33-
{
34-
$properties = [];
35-
$missingFields = [];
36-
try {
37-
38-
$value = $payload['url'] ?? null;
39-
40-
if ($value === null) {
41-
$properties['url'] = null;
42-
goto after_url;
43-
}
32+
private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️WebhookConfig(array $payload): \ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig
33+
{
34+
$properties = [];
35+
$missingFields = [];
36+
try {
37+
$value = $payload['url'] ?? null;
4438

45-
$properties['url'] = $value;
46-
47-
after_url:
39+
if ($value === null) {
40+
$properties['url'] = null;
41+
goto after_url;
42+
}
4843

49-
$value = $payload['content_type'] ?? null;
50-
51-
if ($value === null) {
52-
$properties['content_type'] = null;
53-
goto after_content_type;
54-
}
44+
$properties['url'] = $value;
5545

56-
$properties['content_type'] = $value;
57-
58-
after_content_type:
46+
after_url:
5947

60-
$value = $payload['secret'] ?? null;
61-
62-
if ($value === null) {
63-
$properties['secret'] = null;
64-
goto after_secret;
65-
}
48+
$value = $payload['content_type'] ?? null;
6649

67-
$properties['secret'] = $value;
68-
69-
after_secret:
50+
if ($value === null) {
51+
$properties['content_type'] = null;
52+
goto after_content_type;
53+
}
7054

71-
$value = $payload['insecure_ssl'] ?? null;
72-
73-
if ($value === null) {
74-
$properties['insecure_ssl'] = null;
75-
goto after_insecure_ssl;
76-
}
55+
$properties['content_type'] = $value;
7756

78-
$properties['insecure_ssl'] = $value;
79-
80-
after_insecure_ssl:
57+
after_content_type:
8158

82-
} catch (\Throwable $exception) {
83-
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
84-
}
85-
86-
if (count($missingFields) > 0) {
87-
throw UnableToHydrateObject::dueToMissingFields(\ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig::class, $missingFields, stack: $this->hydrationStack);
59+
$value = $payload['secret'] ?? null;
60+
61+
if ($value === null) {
62+
$properties['secret'] = null;
63+
goto after_secret;
8864
}
89-
90-
try {
91-
return new \ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig(...$properties);
92-
} catch (\Throwable $exception) {
93-
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
65+
66+
$properties['secret'] = $value;
67+
68+
after_secret:
69+
70+
$value = $payload['insecure_ssl'] ?? null;
71+
72+
if ($value === null) {
73+
$properties['insecure_ssl'] = null;
74+
goto after_insecure_ssl;
9475
}
76+
77+
$properties['insecure_ssl'] = $value;
78+
79+
after_insecure_ssl:
80+
81+
} catch (\Throwable $exception) {
82+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
83+
}
84+
85+
if (count($missingFields) > 0) {
86+
throw UnableToHydrateObject::dueToMissingFields(\ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig::class, $missingFields, stack: $this->hydrationStack);
9587
}
88+
89+
try {
90+
return new \ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig(...$properties);
91+
} catch (\Throwable $exception) {
92+
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
93+
}
94+
}
9695

96+
private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array
97+
{
98+
foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) {
99+
if (is_a($object, $valueType)) {
100+
return [$accessor => $payloadType] + $this->{$method}($object);
101+
}
102+
}
103+
104+
throw new \LogicException('No type mapped for object of class: ' . get_class($object));
105+
}
106+
97107
public function serializeObject(object $object): mixed
98108
{
99-
try {
100-
$className = get_class($object);
109+
return $this->serializeObjectOfType($object, get_class($object));
110+
}
101111

112+
/**
113+
* @template T
114+
*
115+
* @param T $object
116+
* @param class-string<T> $className
117+
*/
118+
public function serializeObjectOfType(object $object, string $className): mixed
119+
{
120+
try {
102121
return match($className) {
103122
'array' => $this->serializeValuearray($object),
104-
'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object),
105-
'DateTime' => $this->serializeValueDateTime($object),
106-
'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object),
107-
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
108-
'ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️WebhookConfig($object),
123+
'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object),
124+
'DateTime' => $this->serializeValueDateTime($object),
125+
'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object),
126+
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
127+
'ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️WebhookConfig($object),
109128
default => throw new \LogicException('No serialization defined for $className'),
110129
};
111130
} catch (\Throwable $exception) {
@@ -178,12 +197,12 @@ private function serializeValueDateTimeInterface(mixed $value): mixed
178197
return $serializer->serialize($value, $this);
179198
}
180199

181-
200+
182201
private function serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️WebhookConfig(mixed $object): mixed
183202
{
184203
\assert($object instanceof \ApiClients\Client\GitHubEnterpriseCloud\Schema\WebhookConfig);
185204
$result = [];
186-
205+
187206
$url = $object->url;
188207

189208
if ($url === null) {

0 commit comments

Comments
 (0)