Skip to content
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
90 changes: 45 additions & 45 deletions clients/GitHub/etc/openapi-client-generator.state

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clients/GitHub/src/Client.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clients/GitHub/src/ClientInterface.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

namespace ApiClients\Client\GitHub\Internal\Attribute\CastUnionToType\Schema\CopilotSeatDetails;

use ApiClients\Client\GitHub\Schema;
use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;
use Throwable;

use function array_keys;
use function array_unique;
use function implode;
use function is_array;
use function sort;

#[Attribute(Attribute::TARGET_PARAMETER)]
final class Assignee implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): mixed
{
if (is_array($value)) {
$signatureChunks = array_unique(array_keys($value));
sort($signatureChunks);
$signature = implode('|', $signatureChunks);
if ($signature === 'name|email|login|id|node_id|avatar_url|gravatar_id|url|html_url|followers_url|following_url|gists_url|starred_url|subscriptions_url|organizations_url|repos_url|events_url|received_events_url|type|site_admin|starred_at') {
try {
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
} catch (Throwable) {
}
}

if ($signature === 'id|node_id|name|slug|description|privacy|notification_setting|permission|permissions|url|html_url|members_url|repositories_url|parent') {
try {
return $hydrator->hydrateObject(Schema\Team::class, $value);
} catch (Throwable) {
}
}

if ($signature === 'login|url|id|node_id|repos_url|events_url|hooks_url|issues_url|members_url|public_members_url|avatar_url|description|blog|html_url|name|company|location|email|has_organization_projects|has_repository_projects|is_verified|public_repos|public_gists|followers|following|type|created_at|updated_at|plan') {
try {
return $hydrator->hydrateObject(Schema\Organization::class, $value);
} catch (Throwable) {
}
}
}

return $value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace ApiClients\Client\GitHub\Internal\Hydrator\Operation\Orgs\Org\Members\Username;

use ApiClients\Client\GitHub\Internal\Attribute\CastUnionToType\Schema\CopilotSeatDetails\Assignee;
use ApiClients\Client\GitHub\Internal\Attribute\CastUnionToType\Schema\CopilotSeatDetails\AssigningTeam;
use ApiClients\Client\GitHub\Schema\BasicError;
use ApiClients\Client\GitHub\Schema\CopilotSeatDetails;
use ApiClients\Client\GitHub\Schema\CopilotSeatDetails\Assignee;
use ApiClients\Client\GitHub\Schema\Team;
use ApiClients\Client\GitHub\Schema\Team\Permissions;
use ApiClients\Client\GitHub\Schema\TeamSimple;
Expand Down Expand Up @@ -48,7 +48,6 @@ public function hydrateObject(string $className, array $payload): object
return match ($className) {
'ApiClients\Client\GitHub\Schema\CopilotSeatDetails' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️CopilotSeatDetails($payload),
'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload),
'ApiClients\Client\GitHub\Schema\CopilotSeatDetails\Assignee' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️CopilotSeatDetails⚡️Assignee($payload),
'ApiClients\Client\GitHub\Schema\Team' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Team($payload),
'ApiClients\Client\GitHub\Schema\Team\Permissions' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Team⚡️Permissions($payload),
'ApiClients\Client\GitHub\Schema\TeamSimple' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️TeamSimple($payload),
Expand All @@ -68,13 +67,17 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Copi
goto after_assignee;
}

if (is_array($value)) {
try {
$this->hydrationStack[] = 'assignee';
$value = $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️CopilotSeatDetails⚡️Assignee($value);
} finally {
array_pop($this->hydrationStack);
}
static $assigneeCaster1;

if ($assigneeCaster1 === null) {
$assigneeCaster1 = new Assignee(...[]);
}

$value = $assigneeCaster1->cast($value, $this);

if ($value === null) {
$missingFields[] = 'assignee';
goto after_assignee;
}

$properties['assignee'] = $value;
Expand Down Expand Up @@ -246,26 +249,6 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Basi
}
}

private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️CopilotSeatDetails⚡️Assignee(array $payload): Assignee
{
$properties = [];
$missingFields = [];
try {
} catch (Throwable $exception) {
throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\CopilotSeatDetails\Assignee', $exception, stack: $this->hydrationStack);
}

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

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

private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Team(array $payload): Team
{
$properties = [];
Expand Down Expand Up @@ -793,8 +776,12 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema
assert($object instanceof CopilotSeatDetails);
$result = [];

$assignee = $object->assignee;
$assignee = $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️CopilotSeatDetails⚡️Assignee($assignee);
$assignee = $object->assignee;
$assignee = match ($assignee::class) {
'ApiClients\Client\GitHub\Schema\SimpleUser' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️SimpleUser($assignee),
'ApiClients\Client\GitHub\Schema\Team' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Team($assignee),
'ApiClients\Client\GitHub\Schema\Organization' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Organization($assignee),
};
after_assignee: $result['assignee'] = $assignee;

$assigningTeam = $object->assigningTeam;
Expand Down
4 changes: 2 additions & 2 deletions clients/GitHub/src/Internal/Hydrators.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public function hydrateObject(string $className, array $payload): object
'\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Codespaces\\GetCodespacesForUserInOrg\\Response\\ApplicationJson\\Ok\\Application\\Json' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Codespaces()->hydrateObject($className, $payload),
'\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Codespaces\\DeleteFromOrganization\\Response\\ApplicationJson\\Accepted\\Application\\Json' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Codespaces🌀CodespaceName()->hydrateObject($className, $payload),
'\\ApiClients\\Client\\GitHub\\Schema\\Codespace', '\\ApiClients\\Client\\GitHub\\Schema\\CodespaceMachine', '\\ApiClients\\Client\\GitHub\\Schema\\Codespace\\GitStatus', '\\ApiClients\\Client\\GitHub\\Schema\\Codespace\\RuntimeConstraints' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Codespaces🌀CodespaceName🌀Stop()->hydrateObject($className, $payload),
'\\ApiClients\\Client\\GitHub\\Schema\\CopilotSeatDetails', '\\ApiClients\\Client\\GitHub\\Schema\\CopilotSeatDetails\\Assignee' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Copilot()->hydrateObject($className, $payload),
'\\ApiClients\\Client\\GitHub\\Schema\\CopilotSeatDetails' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Copilot()->hydrateObject($className, $payload),
'\\ApiClients\\Client\\GitHub\\Schema\\OrgMembership', '\\ApiClients\\Client\\GitHub\\Schema\\OrganizationSimple', '\\ApiClients\\Client\\GitHub\\Schema\\OrgMembership\\Permissions' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Memberships🌀Username()->hydrateObject($className, $payload),
'\\ApiClients\\Client\\GitHub\\Schema\\Migration' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Migrations()->hydrateObject($className, $payload),
'\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Orgs\\ConvertMemberToOutsideCollaborator\\Response\\ApplicationJson\\Accepted\\Application\\Json', '\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Orgs\\RemoveOutsideCollaborator\\Response\\ApplicationJson\\UnprocessableEntity' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀OutsideCollaborators🌀Username()->hydrateObject($className, $payload),
Expand Down Expand Up @@ -937,7 +937,7 @@ public function serializeObjectOfType(object $object, string $className): mixed
'\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Codespaces\\GetCodespacesForUserInOrg\\Response\\ApplicationJson\\Ok\\Application\\Json' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Codespaces()->serializeObject($object),
'\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Codespaces\\DeleteFromOrganization\\Response\\ApplicationJson\\Accepted\\Application\\Json' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Codespaces🌀CodespaceName()->serializeObject($object),
'\\ApiClients\\Client\\GitHub\\Schema\\Codespace', '\\ApiClients\\Client\\GitHub\\Schema\\CodespaceMachine', '\\ApiClients\\Client\\GitHub\\Schema\\Codespace\\GitStatus', '\\ApiClients\\Client\\GitHub\\Schema\\Codespace\\RuntimeConstraints' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Codespaces🌀CodespaceName🌀Stop()->serializeObject($object),
'\\ApiClients\\Client\\GitHub\\Schema\\CopilotSeatDetails', '\\ApiClients\\Client\\GitHub\\Schema\\CopilotSeatDetails\\Assignee' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Copilot()->serializeObject($object),
'\\ApiClients\\Client\\GitHub\\Schema\\CopilotSeatDetails' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Members🌀Username🌀Copilot()->serializeObject($object),
'\\ApiClients\\Client\\GitHub\\Schema\\OrgMembership', '\\ApiClients\\Client\\GitHub\\Schema\\OrganizationSimple', '\\ApiClients\\Client\\GitHub\\Schema\\OrgMembership\\Permissions' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Memberships🌀Username()->serializeObject($object),
'\\ApiClients\\Client\\GitHub\\Schema\\Migration' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀Migrations()->serializeObject($object),
'\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Orgs\\ConvertMemberToOutsideCollaborator\\Response\\ApplicationJson\\Accepted\\Application\\Json', '\\ApiClients\\Client\\GitHub\\Schema\\Operations\\Orgs\\RemoveOutsideCollaborator\\Response\\ApplicationJson\\UnprocessableEntity' => $this->getObjectMapperOperation🌀Orgs🌀Org🌀OutsideCollaborators🌀Username()->serializeObject($object),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Actions;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\EmptyObject;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\EmptyObject */
/** @return */
public function call(string $owner, string $repo, int $runId): EmptyObject|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Actions\ForceCancelWorkflowRun($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $runId);
Expand Down
3 changes: 1 addition & 2 deletions clients/GitHub/src/Internal/Operator/Orgs/GetWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Orgs;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\OrgHook;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\OrgHook */
/** @return */
public function call(string $org, int $hookId): OrgHook|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\GetWebhook($this->responseSchemaValidator, $this->hydrator, $org, $hookId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Orgs;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\WebhookConfig;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\WebhookConfig */
/** @return */
public function call(string $org, int $hookId): WebhookConfig|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\GetWebhookConfigForOrg($this->responseSchemaValidator, $this->hydrator, $org, $hookId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Orgs;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\HookDelivery;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\HookDelivery */
/** @return */
public function call(string $org, int $hookId, int $deliveryId): HookDelivery|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\GetWebhookDelivery($this->responseSchemaValidator, $this->hydrator, $org, $hookId, $deliveryId);
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<Schema\HookDeliveryItem> */
/** @return Observable<Schema\HookDeliveryItem> */
public function call(string $org, int $hookId, string $cursor, bool $redelivery, int $perPage = 30): iterable
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\ListWebhookDeliveries($this->responseSchemaValidator, $this->hydrator, $org, $hookId, $cursor, $redelivery, $perPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Orgs;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\Operations\Orgs\RedeliverWebhookDelivery\Response\ApplicationJson\Accepted\Application\Json;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\Operations\Orgs\RedeliverWebhookDelivery\Response\ApplicationJson\Accepted\Application\Json */
/** @return */
public function call(string $org, int $hookId, int $deliveryId): Json|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\RedeliverWebhookDelivery($this->responseSchemaValidator, $this->hydrator, $org, $hookId, $deliveryId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Orgs;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\OrgHook;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\OrgHook */
/** @return */
public function call(string $org, int $hookId, array $params): OrgHook|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\UpdateWebhook($this->requestSchemaValidator, $this->responseSchemaValidator, $this->hydrator, $org, $hookId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Orgs;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\WebhookConfig;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\WebhookConfig */
/** @return */
public function call(string $org, int $hookId, array $params): WebhookConfig|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Orgs\UpdateWebhookConfigForOrg($this->requestSchemaValidator, $this->responseSchemaValidator, $this->hydrator, $org, $hookId);
Expand Down
3 changes: 1 addition & 2 deletions clients/GitHub/src/Internal/Operator/Repos/GetWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Repos;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\Hook;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\Hook */
/** @return */
public function call(string $owner, string $repo, int $hookId): Hook|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Repos\GetWebhook($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $hookId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Repos;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\WebhookConfig;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\WebhookConfig */
/** @return */
public function call(string $owner, string $repo, int $hookId): WebhookConfig|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Repos\GetWebhookConfigForRepo($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $hookId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ApiClients\Client\GitHub\Internal\Operator\Repos;

use ApiClients\Client\GitHub\Internal;
use ApiClients\Client\GitHub\Schema;
use ApiClients\Client\GitHub\Schema\HookDelivery;
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
use League\OpenAPIValidation\Schema\SchemaValidator;
Expand All @@ -25,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
{
}

/** @return Schema\HookDelivery */
/** @return */
public function call(string $owner, string $repo, int $hookId, int $deliveryId): HookDelivery|array
{
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Repos\GetWebhookDelivery($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $hookId, $deliveryId);
Expand Down
Loading