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
24 changes: 12 additions & 12 deletions clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"specHash": "b091080a69743dee86f2fe208c7f1f91",
"specHash": "64807339d76b70126531bad7791aa05d",
"generatedFiles": {
"files": [
{
Expand Down Expand Up @@ -6108,7 +6108,7 @@
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Actions.php",
"hash": "c65e85a2b6dcbd28bd791f4fe592a225"
"hash": "c1d419c64b6f133d64141d359067907f"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/AnnouncementBanners.php",
Expand Down Expand Up @@ -6156,7 +6156,7 @@
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Orgs.php",
"hash": "a4381768ac529d75c4560fb1a13309b1"
"hash": "0be8a48857c6ebc56dde6b136d0a42bd"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Oidc.php",
Expand Down Expand Up @@ -6188,7 +6188,7 @@
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Repos.php",
"hash": "f1e7b7824b97c730c9552a1138f33019"
"hash": "19f82f6d3644bb2d40e239b4320f5a9f"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Reactions.php",
Expand Down Expand Up @@ -14004,19 +14004,15 @@
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotSeatDetails.php",
"hash": "4280606f5f22c09da75eb683a662ee80"
"hash": "fce07c4b35302f45fa5885cf9994c7b2"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/Organization\/Plan.php",
"hash": "b144158b8c6c23d002714b602059581c"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotSeatDetails\/Assignee.php",
"hash": "0f11e0f87cfe34ebdaa4c0b92f506e6a"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/Operations\/Copilot\/ListCopilotSeats\/Response\/ApplicationJson\/Ok.php",
"hash": "0fd9e2bb65915a6b09ddb53fb3e732c4"
"hash": "ba2dc87545d15504c7354c94c9e43780"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/Copilot\/AddCopilotForBusinessSeatsForTeams\/Request\/ApplicationJson.php",
Expand Down Expand Up @@ -29444,7 +29440,7 @@
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Members\/Username\/Copilot.php",
"hash": "8e07375bab60fbb07c8340851bc9484f"
"hash": "05fa33a84cb20743b3fe7de59b7b0ddf"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Memberships\/Username.php",
Expand Down Expand Up @@ -31048,7 +31044,7 @@
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrators.php",
"hash": "3251a2b1b63af971494636ae41f881bf"
"hash": "de8d1ca133b9c7aa79f8aa7776a1cccb"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/EnterpriseAdmin\/ListProvisionedGroupsEnterprise.php",
Expand Down Expand Up @@ -31509,6 +31505,10 @@
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/Actions\/Runs\/RunId\/ForceCancel.php",
"hash": "56f3feab7e2688ad0dab07b5f7de468a"
},
{
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/CopilotSeatDetails\/Assignee.php",
"hash": "23a28307668db2b48df10922e4d7d665"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

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

use ApiClients\Client\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\Internal\Hydrator\Operation\Orgs\Org\Members\Username;

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

if (is_array($value)) {
try {
$this->hydrationStack[] = 'assignee';
$value = $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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⚡️GitHubEnterpriseCloud⚡️S
}
}

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

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

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

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

namespace ApiClients\Client\GitHubEnterpriseCloud\Schema;

use ApiClients\Client\GitHubEnterpriseCloud\Internal\Attribute\CastUnionToType\Schema\CopilotSeatDetails\Assignee;
use ApiClients\Client\GitHubEnterpriseCloud\Internal\Attribute\CastUnionToType\Schema\CopilotSeatDetails\AssigningTeam;
use ApiClients\Client\GitHubEnterpriseCloud\Schema;
use EventSauce\ObjectHydrator\MapFrom;
Expand All @@ -19,7 +20,8 @@
"type": "object",
"properties": {
"assignee": {
"enum": [
"type": "object",
"oneOf": [
{
"title": "Simple User",
"required": [
Expand Down Expand Up @@ -568,7 +570,6 @@
"description": "GitHub account for managing multiple users, teams, and repositories"
}
],
"type": "object",
"description": "The assignee that has been granted access to GitHub Copilot.",
"additionalProperties": true
},
Expand Down Expand Up @@ -831,7 +832,7 @@
public const SCHEMA_TITLE = 'Copilot for Business Seat Detail';
public const SCHEMA_DESCRIPTION = 'Information about a Copilot for Business seat assignment for a user, team, or organization.';
public const SCHEMA_EXAMPLE_DATA = '{
"assignee": [],
"assignee": null,
"assigning_team": null,
"pending_cancellation_date": "generated",
"last_activity_at": "1970-01-01T00:00:00+00:00",
Expand All @@ -849,7 +850,8 @@
* createdAt: Timestamp of when the assignee was last granted access to GitHub Copilot, in ISO 8601 format.
* updatedAt: Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format.
*/
public function __construct(public Schema\CopilotSeatDetails\Assignee $assignee, #[MapFrom('assigning_team')]
public function __construct(#[Assignee]
public Schema\SimpleUser|Schema\Team|Schema\Organization $assignee, #[MapFrom('assigning_team')]
#[AssigningTeam]
public Schema\Team|null $assigningTeam, #[MapFrom('pending_cancellation_date')]
public string|null $pendingCancellationDate, #[MapFrom('last_activity_at')]
Expand Down
Loading