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
446 changes: 446 additions & 0 deletions clients/GitHubEnterpriseCloud/README.md

Large diffs are not rendered by default.

756 changes: 608 additions & 148 deletions clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions clients/GitHubEnterpriseCloud/src/Client.php

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

declare(strict_types=1);

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

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 Owner 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 === 'avatar_url|email|events_url|followers_url|following_url|gists_url|gravatar_id|html_url|id|login|name|node_id|organizations_url|received_events_url|repos_url|site_admin|starred_at|starred_url|subscriptions_url|type|url|user_view_type') {
try {
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
} catch (Throwable) {
}
}

if ($signature === 'avatar_url|created_at|description|html_url|id|name|node_id|slug|updated_at|website_url') {
try {
return $hydrator->hydrateObject(Schema\Enterprise::class, $value);
} catch (Throwable) {
}
}
}

return $value;
}
}
Loading
Loading