Skip to content

[GitHub] Update to 1.1.4-2b790a7412799c3a2996ba936824dd7d from 1.1.4-f1a89aa5fb6ef3d7a6d77044c06b8756 #1346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 42 additions & 42 deletions clients/GitHub/etc/openapi-client-generator.state

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace ApiClients\Client\GitHub\Internal\Hydrator\Operation\User\Following;

use ApiClients\Client\GitHub\Schema\BasicError;
use ApiClients\Client\GitHub\Schema\ValidationError;
use EventSauce\ObjectHydrator\IterableList;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertySerializers\SerializeArrayItems;
Expand Down Expand Up @@ -39,6 +40,7 @@ public function hydrateObject(string $className, array $payload): object
{
return match ($className) {
'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload),
'ApiClients\Client\GitHub\Schema\ValidationError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError($payload),
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
};
}
Expand Down Expand Up @@ -106,6 +108,58 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Basi
}
}

private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError(array $payload): ValidationError
{
$properties = [];
$missingFields = [];
try {
$value = $payload['message'] ?? null;

if ($value === null) {
$missingFields[] = 'message';
goto after_message;
}

$properties['message'] = $value;

after_message:

$value = $payload['documentation_url'] ?? null;

if ($value === null) {
$missingFields[] = 'documentation_url';
goto after_documentationUrl;
}

$properties['documentationUrl'] = $value;

after_documentationUrl:

$value = $payload['errors'] ?? null;

if ($value === null) {
$properties['errors'] = null;
goto after_errors;
}

$properties['errors'] = $value;

after_errors:
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ValidationError', $exception, stack: $this->hydrationStack);
}

if (count($missingFields) > 0) {
throw UnableToHydrateObject::dueToMissingFields(ValidationError::class, $missingFields, stack: $this->hydrationStack);
}

try {
return new ValidationError(...$properties);
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\ValidationError', $exception, stack: $this->hydrationStack);
}
}

private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array
{
foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) {
Expand Down Expand Up @@ -138,6 +192,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object),
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object),
'ApiClients\Client\GitHub\Schema\ValidationError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError($object),
default => throw new LogicException("No serialization defined for $className"),
};
} catch (Throwable $exception) {
Expand Down Expand Up @@ -240,6 +295,35 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
return $result;
}

private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ValidationError(mixed $object): mixed
{
assert($object instanceof ValidationError);
$result = [];

$message = $object->message;
after_message: $result['message'] = $message;

$documentationUrl = $object->documentationUrl;
after_documentationUrl: $result['documentation_url'] = $documentationUrl;

$errors = $object->errors;

if ($errors === null) {
goto after_errors;
}

static $errorsSerializer0;

if ($errorsSerializer0 === null) {
$errorsSerializer0 = new SerializeArrayItems(...[]);
}

$errors = $errorsSerializer0->serialize($errors, $this);
after_errors: $result['errors'] = $errors;

return $result;
}

/**
* @param class-string<T> $className
* @param iterable<array> $payloads;
Expand Down
8 changes: 8 additions & 0 deletions clients/GitHub/src/Internal/Operation/Users/Follow.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ public function createResponse(ResponseInterface $response): WithoutBody
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));

throw new ErrorSchemas\BasicError(401, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
/**
* Validation failed, or the endpoint has been spammed.
**/

case 422:
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\ValidationError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));

throw new ErrorSchemas\ValidationError(422, $this->hydrator->hydrateObject(Schema\ValidationError::class, $body));
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsRouteStats> */
/** @return Observable<Schema\ApiInsightsRouteStats> */
public function call(string $org, string $actorType, int $actorId, string $minTimestamp, string $maxTimestamp, array $sort, int $page = 1, int $perPage = 30, string $direction = 'desc'): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetRouteStatsByActor($this->responseSchemaValidator, $this->hydrator, $org, $actorType, $actorId, $minTimestamp, $maxTimestamp, $sort, $page, $perPage, $direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsRouteStats> */
/** @return Observable<Schema\ApiInsightsRouteStats> */
public function call(string $org, string $actorType, int $actorId, string $minTimestamp, string $maxTimestamp, array $sort, int $page = 1, int $perPage = 30, string $direction = 'desc'): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetRouteStatsByActorListing($this->responseSchemaValidator, $this->hydrator, $org, $actorType, $actorId, $minTimestamp, $maxTimestamp, $sort, $page, $perPage, $direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsSubjectStats> */
/** @return Observable<Schema\ApiInsightsSubjectStats> */
public function call(string $org, string $minTimestamp, string $maxTimestamp, array $sort, int $page = 1, int $perPage = 30, string $direction = 'desc'): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetSubjectStats($this->responseSchemaValidator, $this->hydrator, $org, $minTimestamp, $maxTimestamp, $sort, $page, $perPage, $direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsSubjectStats> */
/** @return Observable<Schema\ApiInsightsSubjectStats> */
public function call(string $org, string $minTimestamp, string $maxTimestamp, array $sort, int $page = 1, int $perPage = 30, string $direction = 'desc'): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetSubjectStatsListing($this->responseSchemaValidator, $this->hydrator, $org, $minTimestamp, $maxTimestamp, $sort, $page, $perPage, $direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return */
public function call(string $org, string $minTimestamp, string $maxTimestamp): ApiInsightsSummaryStats
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetSummaryStats($this->responseSchemaValidator, $this->hydrator, $org, $minTimestamp, $maxTimestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return */
public function call(string $org, string $minTimestamp, string $maxTimestamp, string $actorType, int $actorId): ApiInsightsSummaryStats
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetSummaryStatsByActor($this->responseSchemaValidator, $this->hydrator, $org, $minTimestamp, $maxTimestamp, $actorType, $actorId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return */
public function call(string $org, string $userId, string $minTimestamp, string $maxTimestamp): ApiInsightsSummaryStats
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetSummaryStatsByUser($this->responseSchemaValidator, $this->hydrator, $org, $userId, $minTimestamp, $maxTimestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsTimeStats> */
/** @return Observable<Schema\ApiInsightsTimeStats> */
public function call(string $org, string $minTimestamp, string $maxTimestamp, string $timestampIncrement): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetTimeStats($this->responseSchemaValidator, $this->hydrator, $org, $minTimestamp, $maxTimestamp, $timestampIncrement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsTimeStats> */
/** @return Observable<Schema\ApiInsightsTimeStats> */
public function call(string $org, string $actorType, int $actorId, string $minTimestamp, string $maxTimestamp, string $timestampIncrement): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetTimeStatsByActor($this->responseSchemaValidator, $this->hydrator, $org, $actorType, $actorId, $minTimestamp, $maxTimestamp, $timestampIncrement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsTimeStats> */
/** @return Observable<Schema\ApiInsightsTimeStats> */
public function call(string $org, string $userId, string $minTimestamp, string $maxTimestamp, string $timestampIncrement): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetTimeStatsByUser($this->responseSchemaValidator, $this->hydrator, $org, $userId, $minTimestamp, $maxTimestamp, $timestampIncrement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsUserStats> */
/** @return Observable<Schema\ApiInsightsUserStats> */
public function call(string $org, string $userId, string $minTimestamp, string $maxTimestamp, array $sort, int $page = 1, int $perPage = 30, string $direction = 'desc'): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetUserStats($this->responseSchemaValidator, $this->hydrator, $org, $userId, $minTimestamp, $maxTimestamp, $sort, $page, $perPage, $direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\ApiInsightsUserStats> */
/** @return Observable<Schema\ApiInsightsUserStats> */
public function call(string $org, string $userId, string $minTimestamp, string $maxTimestamp, array $sort, int $page = 1, int $perPage = 30, string $direction = 'desc'): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\ApiInsights\GetUserStatsListing($this->responseSchemaValidator, $this->hydrator, $org, $userId, $minTimestamp, $maxTimestamp, $sort, $page, $perPage, $direction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\HookDeliveryItem> */
/** @return Observable<Schema\HookDeliveryItem> */
public function call(string $cursor, int $perPage = 30): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Apps\ListWebhookDeliveries($this->responseSchemaValidator, $this->hydrator, $cursor, $perPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\HookDeliveryItem> */
/** @return Observable<Schema\HookDeliveryItem> */
public function call(string $org, int $hookId, string $cursor, int $perPage = 30): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\ListWebhookDeliveries($this->responseSchemaValidator, $this->hydrator, $org, $hookId, $cursor, $perPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return iterable<int,Schema\HookDeliveryItem> */
/** @return Observable<Schema\HookDeliveryItem> */
public function call(string $owner, string $repo, int $hookId, string $cursor, int $perPage = 30): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Repos\ListWebhookDeliveries($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $hookId, $cursor, $perPage);
Expand Down
1 change: 0 additions & 1 deletion clients/GitHub/src/Internal/Operator/Users/Follow.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return */
public function call(string $username): WithoutBody
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Users\Follow($this->responseSchemaValidator, $this->hydrator, $username);
Expand Down
15 changes: 9 additions & 6 deletions clients/GitHub/src/Internal/Router/Get/ApiInsights.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(private SchemaValidator $requestSchemaValidator, pri
{
}

/** @return iterable<int,Schema\ApiInsightsSubjectStats> */
/** @return Observable<Schema\ApiInsightsSubjectStats> */
public function getSubjectStats(array $params): iterable
{
$arguments = [];
Expand Down Expand Up @@ -71,6 +71,7 @@ public function getSubjectStats(array $params): iterable
return $operator->call($arguments['org'], $arguments['min_timestamp'], $arguments['max_timestamp'], $arguments['sort'], $arguments['page'], $arguments['per_page'], $arguments['direction']);
}

/** @return */
public function getSummaryStats(array $params): ApiInsightsSummaryStats
{
$arguments = [];
Expand All @@ -97,7 +98,7 @@ public function getSummaryStats(array $params): ApiInsightsSummaryStats
return $operator->call($arguments['org'], $arguments['min_timestamp'], $arguments['max_timestamp']);
}

/** @return iterable<int,Schema\ApiInsightsTimeStats> */
/** @return Observable<Schema\ApiInsightsTimeStats> */
public function getTimeStats(array $params): iterable
{
$arguments = [];
Expand Down Expand Up @@ -130,7 +131,7 @@ public function getTimeStats(array $params): iterable
return $operator->call($arguments['org'], $arguments['min_timestamp'], $arguments['max_timestamp'], $arguments['timestamp_increment']);
}

/** @return iterable<int,Schema\ApiInsightsUserStats> */
/** @return Observable<Schema\ApiInsightsUserStats> */
public function getUserStats(array $params): iterable
{
$arguments = [];
Expand Down Expand Up @@ -187,7 +188,7 @@ public function getUserStats(array $params): iterable
return $operator->call($arguments['org'], $arguments['user_id'], $arguments['min_timestamp'], $arguments['max_timestamp'], $arguments['sort'], $arguments['page'], $arguments['per_page'], $arguments['direction']);
}

/** @return iterable<int,Schema\ApiInsightsRouteStats> */
/** @return Observable<Schema\ApiInsightsRouteStats> */
public function getRouteStatsByActor(array $params): iterable
{
$arguments = [];
Expand Down Expand Up @@ -250,6 +251,7 @@ public function getRouteStatsByActor(array $params): iterable
return $operator->call($arguments['org'], $arguments['actor_type'], $arguments['actor_id'], $arguments['min_timestamp'], $arguments['max_timestamp'], $arguments['sort'], $arguments['page'], $arguments['per_page'], $arguments['direction']);
}

/** @return */
public function getSummaryStatsByUser(array $params): ApiInsightsSummaryStats
{
$arguments = [];
Expand Down Expand Up @@ -282,6 +284,7 @@ public function getSummaryStatsByUser(array $params): ApiInsightsSummaryStats
return $operator->call($arguments['org'], $arguments['user_id'], $arguments['min_timestamp'], $arguments['max_timestamp']);
}

/** @return */
public function getSummaryStatsByActor(array $params): ApiInsightsSummaryStats
{
$arguments = [];
Expand Down Expand Up @@ -320,7 +323,7 @@ public function getSummaryStatsByActor(array $params): ApiInsightsSummaryStats
return $operator->call($arguments['org'], $arguments['min_timestamp'], $arguments['max_timestamp'], $arguments['actor_type'], $arguments['actor_id']);
}

/** @return iterable<int,Schema\ApiInsightsTimeStats> */
/** @return Observable<Schema\ApiInsightsTimeStats> */
public function getTimeStatsByUser(array $params): iterable
{
$arguments = [];
Expand Down Expand Up @@ -359,7 +362,7 @@ public function getTimeStatsByUser(array $params): iterable
return $operator->call($arguments['org'], $arguments['user_id'], $arguments['min_timestamp'], $arguments['max_timestamp'], $arguments['timestamp_increment']);
}

/** @return iterable<int,Schema\ApiInsightsTimeStats> */
/** @return Observable<Schema\ApiInsightsTimeStats> */
public function getTimeStatsByActor(array $params): iterable
{
$arguments = [];
Expand Down
2 changes: 1 addition & 1 deletion clients/GitHub/src/Internal/Router/Get/Apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function getWebhookConfigForApp(array $params): WebhookConfig
return $operator->call();
}

/** @return iterable<int,Schema\HookDeliveryItem> */
/** @return Observable<Schema\HookDeliveryItem> */
public function listWebhookDeliveries(array $params): iterable
{
$arguments = [];
Expand Down
Loading
Loading