diff --git a/clients/GitHub/README.md b/clients/GitHub/README.md index 35c977d831a..92fc3fb829a 100644 --- a/clients/GitHub/README.md +++ b/clients/GitHub/README.md @@ -990,6 +990,66 @@ $client->operations()->secretScanning()->listAlertsForEnterprise( enterpr You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise). +### copilot/usage-metrics-for-enterprise-team + +Get a summary of Copilot usage for an enterprise team + +Using the `call` method: +```php +$client->call('GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage', [ + 'enterprise' => 'generated', + 'team_slug' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->usageMetricsForEnterpriseTeam( enterprise: 'generated', + team_slug: 'generated', + since: 'generated', + until: 'generated', + page: 1, + per_page: 8, +); +``` + +You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-an-enterprise-team). + + +### copilot/usage-metrics-for-enterprise-team + +Get a summary of Copilot usage for an enterprise team + +Using the `call` method: +```php +$client->call('LIST /enterprises/{enterprise}/team/{team_slug}/copilot/usage', [ + 'enterprise' => 'generated', + 'team_slug' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->usageMetricsForEnterpriseTeamListing( enterprise: 'generated', + team_slug: 'generated', + since: 'generated', + until: 'generated', + page: 1, + per_page: 8, +); +``` + +You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-an-enterprise-team). + + ### activity/list-public-events List public events diff --git a/clients/GitHub/etc/openapi-client-generator.state b/clients/GitHub/etc/openapi-client-generator.state index 539928a0a60..2ded0a6e8c3 100644 --- a/clients/GitHub/etc/openapi-client-generator.state +++ b/clients/GitHub/etc/openapi-client-generator.state @@ -1,5 +1,5 @@ { - "specHash": "258d33610c11c1d10d29617d894e1ce8", + "specHash": "b5681abce03354e41943d59e8d8bc4a6", "generatedFiles": { "files": [ { @@ -256,7 +256,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/ApiOverview.php", - "hash": "6c6374d14557787602804bd2f302d374" + "hash": "5f7b17c0f0bb6b1d3af818db9f1faabb" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/SecurityAndAnalysis.php", @@ -4624,7 +4624,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Repos\/CreateInOrg\/Request\/ApplicationJson.php", - "hash": "fb07366e9a5a257d4bf4e8098cda9621" + "hash": "a6ada34a205d87d7a69adf1649cea29b" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Repos\/CreateOrgRuleset\/Request\/ApplicationJson.php", @@ -4736,7 +4736,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Repos\/Update\/Request\/ApplicationJson.php", - "hash": "c9203441c1bac6f7b5d2f53f690af6f9" + "hash": "6b28384df87302af409903a97ec0a8f5" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Repos\/Update\/Request\/ApplicationJson\/SecurityAndAnalysis.php", @@ -5492,7 +5492,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Repos\/CreateForAuthenticatedUser\/Request\/ApplicationJson.php", - "hash": "51bfe6a044dec4b097a97a79e35ea130" + "hash": "be4c75e517681ac4a3eeed7d924701cd" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Users\/AddSocialAccountForAuthenticatedUser\/Request\/ApplicationJson.php", @@ -5520,7 +5520,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Client.php", - "hash": "2fa79ff4a10c8c47be90d9f0f0526dae" + "hash": "65d2596dd07160059ecefb8b316d05cd" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/OperationsInterface.php", @@ -11678,21 +11678,13 @@ "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotOrganizationDetails.php", "hash": "0609c00665283fb0720f16bc99656890" }, - { - "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Organization.php", - "hash": "eaeafd474fcd86fcab5734de58de1039" - }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotSeatDetails.php", - "hash": "92e2a1ef84e4c3e5b25451da72311a94" - }, - { - "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Organization\/Plan.php", - "hash": "2c844af6f534301f4c76567e51769f88" + "hash": "45ea17da364c6d93645ba99ff27df1d8" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Operations\/Copilot\/ListCopilotSeats\/Response\/ApplicationJson\/Ok.php", - "hash": "24daee07f3e46d924018ae9cc0c0c94d" + "hash": "e79f2f53fbd57620603ac59c891eb4b2" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/AliasAbstract\/TietF5944C0A\/TietAA99D7D8\/Tiet9AE1F544\/TietA28F869C.php", @@ -11724,7 +11716,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Copilot.php", - "hash": "a0b9fc7025d2ed3c01515fc3f4285499" + "hash": "eae816e0c48c6fa4021b89839b99e0e3" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CheckAutomatedSecurityFixes.php", @@ -24532,7 +24524,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Copilot.php", - "hash": "b168d44133dfb1a578f90bd0efddc7d6" + "hash": "8b936b37b66653bfe68e7d5c9e903dbe" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Pulls.php", @@ -24736,7 +24728,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Issues.php", - "hash": "7af98c768f317bdd2add781ec3b1df69" + "hash": "68177dac6998d98b39d7a64e6e5fe1e7" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Migrations.php", @@ -24748,11 +24740,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Packages.php", - "hash": "4ab93017e3894ec5748c61024d8a46d7" + "hash": "c1e365780b7caff87f52fba60b0d3d38" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Repos.php", - "hash": "8afd666358a93bb89c0ae944fe11a6a2" + "hash": "58feacbb3f5aceff6543f0db3e7d382f" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Activity.php", @@ -24780,7 +24772,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Pulls.php", - "hash": "4d5b0ded5e8b8499670796a1044ee65e" + "hash": "9351b184edbadf5a3e74cf6bbbd2691e" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Dependabot.php", @@ -24788,7 +24780,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Reactions.php", - "hash": "c18fb98765e15fb2f499c11e2a6ab538" + "hash": "205b5fc6cc89470698b5f79a6c551928" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Checks.php", @@ -24976,7 +24968,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php", - "hash": "004122fbb6a1f96d6a0c2801a632c588" + "hash": "d6f9d7d9cf0b5127d80c1b292b76a01b" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Eight.php", @@ -25080,7 +25072,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Seven.php", - "hash": "f15289e9f2df163f19fb9f360950c959" + "hash": "0d048e7679a28ebc3cbaab5f44636b07" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Eight.php", @@ -25172,11 +25164,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Routers.php", - "hash": "da13c6ba2c5c877b7303e9e941265954" + "hash": "f98fef4178bc1cb79f6b89386de8e0ea" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operators.php", - "hash": "948d837a16c9556164aba7711b2020c2" + "hash": "622af053a71a71b62a3ba4651ff536db" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Root.php", @@ -25352,7 +25344,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Meta.php", - "hash": "3e215e4d43c9a354a82970e26246657b" + "hash": "c6f0c50324b9d3abdb985ff4d78ca00b" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Networks\/Owner\/Repo\/Events.php", @@ -25620,7 +25612,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Members\/Username\/Copilot.php", - "hash": "f8ac03c8d91928df010947fd46f09c52" + "hash": "2f0b8a8969eeb68cfbf80e93827c9db3" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Memberships\/Username.php", @@ -27168,7 +27160,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrators.php", - "hash": "11381cbdcb181eb75fe005455ce94cce" + "hash": "ab092ae2227ed736d11434cf17d36773" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/OrganizationSimpleWebhooks.php", @@ -27388,7 +27380,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/CopilotSeatDetails\/Assignee.php", - "hash": "cb674d6a95a110d5eab87192005b0d43" + "hash": "97bb887016552fb64fd21ab77e81a916" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/DeploymentBranchPolicyNamePatternWithType.php", @@ -27788,11 +27780,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php", - "hash": "c06de68a2d5065e055a7200b0f4e2b5d" + "hash": "2dac8d6824cdb9a032de120fac8e5b75" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php", - "hash": "1b3588a342742c08a3fe943b1886b3c4" + "hash": "9161ea27ab511d49e7c518b43f27d4b8" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon", @@ -28832,7 +28824,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Copilot.php", - "hash": "a4bc9908dbe0029801e8ca022969c2d3" + "hash": "d6fd0fdf4414bbaf810ab2c00e35b6e5" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Usage.php", @@ -29632,7 +29624,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Operations\/Copilot\/ListCopilotSeatsForEnterprise\/Response\/ApplicationJson\/Ok.php", - "hash": "e56860ef1e46c65d051b19c5e30e6480" + "hash": "6157f73720a2d7f0dd4f983cc6d487e5" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Billing\/Seats.php", @@ -30269,6 +30261,34 @@ { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/RepositoryRuleset\/Rules\/Eighteen\/Parameters.php", "hash": "e1f28caa9eb8cadf96ff706a4ea2b302" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/UsageMetricsForEnterpriseTeam.php", + "hash": "247600d098773436d2eae0d452697e68" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/UsageMetricsForEnterpriseTeam.php", + "hash": "93c5ff91ebc5037b265c25b2d5a761e0" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/UsageMetricsForEnterpriseTeamTest.php", + "hash": "acfa68749f56be7d8c0a9849d0d4a3bc" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/UsageMetricsForEnterpriseTeamListing.php", + "hash": "93d052d3e6f94d203e9c83af555189fc" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/UsageMetricsForEnterpriseTeamListing.php", + "hash": "cc44d2af63389bf87432f1584ebb22ed" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/UsageMetricsForEnterpriseTeamListingTest.php", + "hash": "3eba1d23274dd9d7c7ef7ff8e3d04268" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Team\/TeamSlug\/Copilot\/Usage.php", + "hash": "3f202db72777733607abe67c7ebe47f0" } ] }, diff --git a/clients/GitHub/src/Client.php b/clients/GitHub/src/Client.php index fd3276f4599..899f4d28a98 100644 --- a/clients/GitHub/src/Client.php +++ b/clients/GitHub/src/Client.php @@ -231,18 +231,18 @@ public function call(string $call, array $params = []): \ApiClients\Client\GitHu } return $this->router[Internal\Router\List\Five::class]->call($call, $params, $pathChunks); - } elseif ($pathChunksCount === 6) { - if (\array_key_exists(Internal\Router\List\Six::class, $this->router) === false) { - $this->router[Internal\Router\List\Six::class] = new Internal\Router\List\Six(routers: $this->routers); - } - - return $this->router[Internal\Router\List\Six::class]->call($call, $params, $pathChunks); } elseif ($pathChunksCount === 7) { if (\array_key_exists(Internal\Router\List\Seven::class, $this->router) === false) { $this->router[Internal\Router\List\Seven::class] = new Internal\Router\List\Seven(routers: $this->routers); } return $this->router[Internal\Router\List\Seven::class]->call($call, $params, $pathChunks); + } elseif ($pathChunksCount === 6) { + if (\array_key_exists(Internal\Router\List\Six::class, $this->router) === false) { + $this->router[Internal\Router\List\Six::class] = new Internal\Router\List\Six(routers: $this->routers); + } + + return $this->router[Internal\Router\List\Six::class]->call($call, $params, $pathChunks); } elseif ($pathChunksCount === 8) { if (\array_key_exists(Internal\Router\List\Eight::class, $this->router) === false) { $this->router[Internal\Router\List\Eight::class] = new Internal\Router\List\Eight(routers: $this->routers); diff --git a/clients/GitHub/src/Internal/Attribute/CastUnionToType/Schema/CopilotSeatDetails/Assignee.php b/clients/GitHub/src/Internal/Attribute/CastUnionToType/Schema/CopilotSeatDetails/Assignee.php index b81a9a8b87d..fcfa6a71a2a 100644 --- a/clients/GitHub/src/Internal/Attribute/CastUnionToType/Schema/CopilotSeatDetails/Assignee.php +++ b/clients/GitHub/src/Internal/Attribute/CastUnionToType/Schema/CopilotSeatDetails/Assignee.php @@ -31,20 +31,6 @@ public function cast(mixed $value, ObjectMapper $hydrator): mixed } catch (Throwable) { } } - - if ($signature === 'description|html_url|id|members_url|name|node_id|notification_setting|parent|permission|permissions|privacy|repositories_url|slug|url') { - try { - return $hydrator->hydrateObject(Schema\Team::class, $value); - } catch (Throwable) { - } - } - - if ($signature === 'avatar_url|blog|company|created_at|description|email|events_url|followers|following|has_organization_projects|has_repository_projects|hooks_url|html_url|id|is_verified|issues_url|location|login|members_url|name|node_id|plan|public_gists|public_members_url|public_repos|repos_url|type|updated_at|url') { - try { - return $hydrator->hydrateObject(Schema\Organization::class, $value); - } catch (Throwable) { - } - } } return $value; diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Usage.php b/clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Usage.php new file mode 100644 index 00000000000..6ebc9b97dac --- /dev/null +++ b/clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Usage.php @@ -0,0 +1,286 @@ + $className + * + * @return T + * + * @template T of object + */ + public function hydrateObject(string $className, array $payload): object + { + return match ($className) { + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError + { + $properties = []; + $missingFields = []; + try { + $value = $payload['message'] ?? null; + + if ($value === null) { + $properties['message'] = null; + goto after_message; + } + + $properties['message'] = $value; + + after_message: + + $value = $payload['documentation_url'] ?? null; + + if ($value === null) { + $properties['documentationUrl'] = null; + goto after_documentationUrl; + } + + $properties['documentationUrl'] = $value; + + after_documentationUrl: + + $value = $payload['url'] ?? null; + + if ($value === null) { + $properties['url'] = null; + goto after_url; + } + + $properties['url'] = $value; + + after_url: + + $value = $payload['status'] ?? null; + + if ($value === null) { + $properties['status'] = null; + goto after_status; + } + + $properties['status'] = $value; + + after_status: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new BasicError(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + } + + private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array + { + foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) { + if (is_a($object, $valueType)) { + return [$accessor => $payloadType] + $this->{$method}($object); + } + } + + throw new LogicException('No type mapped for object of class: ' . $object::class); + } + + public function serializeObject(object $object): mixed + { + return $this->serializeObjectOfType($object, $object::class); + } + + /** + * @param T $object + * @param class-string $className + * + * @template T + */ + public function serializeObjectOfType(object $object, string $className): mixed + { + try { + return match ($className) { + 'array' => $this->serializeValuearray($object), + 'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object), + 'DateTime' => $this->serializeValueDateTime($object), + 'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object), + 'DateTimeInterface' => $this->serializeValueDateTimeInterface($object), + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object), + default => throw new LogicException('No serialization defined for $className'), + }; + } catch (Throwable $exception) { + throw UnableToSerializeObject::dueToError($className, $exception); + } + } + + private function serializeValuearray(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeArrayItems(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueRamsey⚡️Uuid⚡️UuidInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeUuidToString(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTime(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeImmutable(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed + { + assert($object instanceof BasicError); + $result = []; + + $message = $object->message; + + if ($message === null) { + goto after_message; + } + + after_message: $result['message'] = $message; + + $documentationUrl = $object->documentationUrl; + + if ($documentationUrl === null) { + goto after_documentationUrl; + } + + after_documentationUrl: $result['documentation_url'] = $documentationUrl; + + $url = $object->url; + + if ($url === null) { + goto after_url; + } + + after_url: $result['url'] = $url; + + $status = $object->status; + + if ($status === null) { + goto after_status; + } + + after_status: $result['status'] = $status; + + return $result; + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToHydrateObject + * + * @template T + */ + public function hydrateObjects(string $className, iterable $payloads): IterableList + { + return new IterableList($this->doHydrateObjects($className, $payloads)); + } + + private function doHydrateObjects(string $className, iterable $payloads): Generator + { + foreach ($payloads as $index => $payload) { + yield $index => $this->hydrateObject($className, $payload); + } + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToSerializeObject + * + * @template T + */ + public function serializeObjects(iterable $payloads): IterableList + { + return new IterableList($this->doSerializeObjects($payloads)); + } + + private function doSerializeObjects(iterable $objects): Generator + { + foreach ($objects as $index => $object) { + yield $index => $this->serializeObject($object); + } + } +} diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Meta.php b/clients/GitHub/src/Internal/Hydrator/Operation/Meta.php index b06e7ace4eb..eec295ec88a 100644 --- a/clients/GitHub/src/Internal/Hydrator/Operation/Meta.php +++ b/clients/GitHub/src/Internal/Hydrator/Operation/Meta.php @@ -217,6 +217,17 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ApiO after_dependabot: + $value = $payload['copilot'] ?? null; + + if ($value === null) { + $properties['copilot'] = null; + goto after_copilot; + } + + $properties['copilot'] = $value; + + after_copilot: + $value = $payload['domains'] ?? null; if ($value === null) { @@ -681,6 +692,21 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema $dependabot = $dependabotSerializer0->serialize($dependabot, $this); after_dependabot: $result['dependabot'] = $dependabot; + $copilot = $object->copilot; + + if ($copilot === null) { + goto after_copilot; + } + + static $copilotSerializer0; + + if ($copilotSerializer0 === null) { + $copilotSerializer0 = new SerializeArrayItems(...[]); + } + + $copilot = $copilotSerializer0->serialize($copilot, $this); + after_copilot: $result['copilot'] = $copilot; + $domains = $object->domains; if ($domains === null) { diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Members/Username/Copilot.php b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Members/Username/Copilot.php index f55d23b7036..6666d52fb43 100644 --- a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Members/Username/Copilot.php +++ b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Members/Username/Copilot.php @@ -10,6 +10,7 @@ use ApiClients\Client\GitHub\Schema\BasicError; use ApiClients\Client\GitHub\Schema\CopilotSeatDetails; use ApiClients\Client\GitHub\Schema\OrganizationSimple; +use ApiClients\Client\GitHub\Schema\SimpleUser; use EventSauce\ObjectHydrator\IterableList; use EventSauce\ObjectHydrator\ObjectMapper; use EventSauce\ObjectHydrator\PropertySerializers\SerializeArrayItems; @@ -48,6 +49,7 @@ 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\SimpleUser' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️SimpleUser($payload), 'ApiClients\Client\GitHub\Schema\OrganizationSimple' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️OrganizationSimple($payload), default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), }; @@ -78,6 +80,15 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Copi goto after_assignee; } + if (is_array($value)) { + try { + $this->hydrationStack[] = 'assignee'; + $value = $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️SimpleUser($value); + } finally { + array_pop($this->hydrationStack); + } + } + $properties['assignee'] = $value; after_assignee: @@ -271,6 +282,256 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Basi } } + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️SimpleUser(array $payload): SimpleUser + { + $properties = []; + $missingFields = []; + try { + $value = $payload['name'] ?? null; + + if ($value === null) { + $properties['name'] = null; + goto after_name; + } + + $properties['name'] = $value; + + after_name: + + $value = $payload['email'] ?? null; + + if ($value === null) { + $properties['email'] = null; + goto after_email; + } + + $properties['email'] = $value; + + after_email: + + $value = $payload['login'] ?? null; + + if ($value === null) { + $missingFields[] = 'login'; + goto after_login; + } + + $properties['login'] = $value; + + after_login: + + $value = $payload['id'] ?? null; + + if ($value === null) { + $missingFields[] = 'id'; + goto after_id; + } + + $properties['id'] = $value; + + after_id: + + $value = $payload['node_id'] ?? null; + + if ($value === null) { + $missingFields[] = 'node_id'; + goto after_nodeId; + } + + $properties['nodeId'] = $value; + + after_nodeId: + + $value = $payload['avatar_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'avatar_url'; + goto after_avatarUrl; + } + + $properties['avatarUrl'] = $value; + + after_avatarUrl: + + $value = $payload['gravatar_id'] ?? null; + + if ($value === null) { + $properties['gravatarId'] = null; + goto after_gravatarId; + } + + $properties['gravatarId'] = $value; + + after_gravatarId: + + $value = $payload['url'] ?? null; + + if ($value === null) { + $missingFields[] = 'url'; + goto after_url; + } + + $properties['url'] = $value; + + after_url: + + $value = $payload['html_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'html_url'; + goto after_htmlUrl; + } + + $properties['htmlUrl'] = $value; + + after_htmlUrl: + + $value = $payload['followers_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'followers_url'; + goto after_followersUrl; + } + + $properties['followersUrl'] = $value; + + after_followersUrl: + + $value = $payload['following_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'following_url'; + goto after_followingUrl; + } + + $properties['followingUrl'] = $value; + + after_followingUrl: + + $value = $payload['gists_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'gists_url'; + goto after_gistsUrl; + } + + $properties['gistsUrl'] = $value; + + after_gistsUrl: + + $value = $payload['starred_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'starred_url'; + goto after_starredUrl; + } + + $properties['starredUrl'] = $value; + + after_starredUrl: + + $value = $payload['subscriptions_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'subscriptions_url'; + goto after_subscriptionsUrl; + } + + $properties['subscriptionsUrl'] = $value; + + after_subscriptionsUrl: + + $value = $payload['organizations_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'organizations_url'; + goto after_organizationsUrl; + } + + $properties['organizationsUrl'] = $value; + + after_organizationsUrl: + + $value = $payload['repos_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'repos_url'; + goto after_reposUrl; + } + + $properties['reposUrl'] = $value; + + after_reposUrl: + + $value = $payload['events_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'events_url'; + goto after_eventsUrl; + } + + $properties['eventsUrl'] = $value; + + after_eventsUrl: + + $value = $payload['received_events_url'] ?? null; + + if ($value === null) { + $missingFields[] = 'received_events_url'; + goto after_receivedEventsUrl; + } + + $properties['receivedEventsUrl'] = $value; + + after_receivedEventsUrl: + + $value = $payload['type'] ?? null; + + if ($value === null) { + $missingFields[] = 'type'; + goto after_type; + } + + $properties['type'] = $value; + + after_type: + + $value = $payload['site_admin'] ?? null; + + if ($value === null) { + $missingFields[] = 'site_admin'; + goto after_siteAdmin; + } + + $properties['siteAdmin'] = $value; + + after_siteAdmin: + + $value = $payload['starred_at'] ?? null; + + if ($value === null) { + $properties['starredAt'] = null; + goto after_starredAt; + } + + $properties['starredAt'] = $value; + + after_starredAt: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\SimpleUser', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(SimpleUser::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new SimpleUser(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\SimpleUser', $exception, stack: $this->hydrationStack); + } + } + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️OrganizationSimple(array $payload): OrganizationSimple { $properties = []; @@ -522,12 +783,8 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema assert($object instanceof CopilotSeatDetails); $result = []; - $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), - }; + $assignee = $object->assignee; + $assignee = $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️SimpleUser($assignee); after_assignee: $result['assignee'] = $assignee; $organization = $object->organization; diff --git a/clients/GitHub/src/Internal/Hydrators.php b/clients/GitHub/src/Internal/Hydrators.php index 860e803710a..05afd6284ad 100644 --- a/clients/GitHub/src/Internal/Hydrators.php +++ b/clients/GitHub/src/Internal/Hydrators.php @@ -42,6 +42,7 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Usage|null $operation🌀Enterprises🌀Enterprise🌀Copilot🌀Usage = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\Dependabot\Alerts|null $operation🌀Enterprises🌀Enterprise🌀Dependabot🌀Alerts = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\SecretScanning\Alerts|null $operation🌀Enterprises🌀Enterprise🌀SecretScanning🌀Alerts = null; + private Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Usage|null $operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage = null; private Internal\Hydrator\Operation\Events|null $operation🌀Events = null; private Internal\Hydrator\Operation\Feeds|null $operation🌀Feeds = null; private Internal\Hydrator\Operation\Gists|null $operation🌀Gists = null; @@ -1690,6 +1691,15 @@ public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀SecretS return $this->operation🌀Enterprises🌀Enterprise🌀SecretScanning🌀Alerts; } + public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage(): Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Usage + { + if ($this->operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage instanceof Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Usage === false) { + $this->operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage = new Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Usage(); + } + + return $this->operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage; + } + public function getObjectMapperOperation🌀Events(): Internal\Hydrator\Operation\Events { if ($this->operation🌀Events instanceof Internal\Hydrator\Operation\Events === false) { diff --git a/clients/GitHub/src/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeam.php b/clients/GitHub/src/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeam.php new file mode 100644 index 00000000000..b9c2e94dde5 --- /dev/null +++ b/clients/GitHub/src/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeam.php @@ -0,0 +1,121 @@ +enterprise = $enterprise; + $this->teamSlug = $teamSlug; + $this->since = $since; + $this->until = $until; + $this->page = $page; + $this->perPage = $perPage; + } + + public function createRequest(): RequestInterface + { + return new Request('GET', str_replace(['{enterprise}', '{team_slug}', '{since}', '{until}', '{page}', '{per_page}'], [$this->enterprise, $this->teamSlug, $this->since, $this->until, $this->page, $this->perPage], '/enterprises/{enterprise}/team/{team_slug}/copilot/usage' . '?since={since}&until={until}&page={page}&per_page={per_page}')); + } + + /** @return Observable */ + public function createResponse(ResponseInterface $response): Observable + { + $code = $response->getStatusCode(); + [$contentType] = explode(';', $response->getHeaderLine('Content-Type')); + switch ($contentType) { + case 'application/json': + $body = json_decode($response->getBody()->getContents(), true); + switch ($code) { + /** + * Response + **/ + case 200: + return Observable::fromArray($body, new ImmediateScheduler())->map(function (array $body): Schema\CopilotUsageMetrics { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetrics::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetrics::class, $body); + } catch (Throwable $error) { + goto items_application_json_two_hundred_aaaaa; + } + + items_application_json_two_hundred_aaaaa: + throw $error; + }); + /** + * Internal Error + **/ + + case 500: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(500, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + /** + * Requires authentication + **/ + + case 401: + $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)); + /** + * Forbidden + **/ + + case 403: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(403, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + /** + * Resource not found + **/ + + case 404: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHub/src/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeamListing.php b/clients/GitHub/src/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeamListing.php new file mode 100644 index 00000000000..719b1c7620f --- /dev/null +++ b/clients/GitHub/src/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeamListing.php @@ -0,0 +1,121 @@ +enterprise = $enterprise; + $this->teamSlug = $teamSlug; + $this->since = $since; + $this->until = $until; + $this->page = $page; + $this->perPage = $perPage; + } + + public function createRequest(): RequestInterface + { + return new Request('GET', str_replace(['{enterprise}', '{team_slug}', '{since}', '{until}', '{page}', '{per_page}'], [$this->enterprise, $this->teamSlug, $this->since, $this->until, $this->page, $this->perPage], '/enterprises/{enterprise}/team/{team_slug}/copilot/usage' . '?since={since}&until={until}&page={page}&per_page={per_page}')); + } + + /** @return Observable */ + public function createResponse(ResponseInterface $response): Observable + { + $code = $response->getStatusCode(); + [$contentType] = explode(';', $response->getHeaderLine('Content-Type')); + switch ($contentType) { + case 'application/json': + $body = json_decode($response->getBody()->getContents(), true); + switch ($code) { + /** + * Response + **/ + case 200: + return Observable::fromArray($body, new ImmediateScheduler())->map(function (array $body): Schema\CopilotUsageMetrics { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetrics::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetrics::class, $body); + } catch (Throwable $error) { + goto items_application_json_two_hundred_aaaaa; + } + + items_application_json_two_hundred_aaaaa: + throw $error; + }); + /** + * Internal Error + **/ + + case 500: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(500, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + /** + * Requires authentication + **/ + + case 401: + $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)); + /** + * Forbidden + **/ + + case 403: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(403, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + /** + * Resource not found + **/ + + case 404: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHub/src/Internal/Operator/Copilot/UsageMetricsForEnterpriseTeam.php b/clients/GitHub/src/Internal/Operator/Copilot/UsageMetricsForEnterpriseTeam.php new file mode 100644 index 00000000000..5ae07a3a37f --- /dev/null +++ b/clients/GitHub/src/Internal/Operator/Copilot/UsageMetricsForEnterpriseTeam.php @@ -0,0 +1,41 @@ + */ + public function call(string $enterprise, string $teamSlug, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHub\Internal\Operation\Copilot\UsageMetricsForEnterpriseTeam($this->responseSchemaValidator, $this->hydrator, $enterprise, $teamSlug, $since, $until, $page, $perPage); + $request = $operation->createRequest(); + $result = await($this->browser->request($request->getMethod(), (string) $request->getUri(), $request->withHeader('Authorization', $this->authentication->authHeader())->getHeaders(), (string) $request->getBody())->then(static function (ResponseInterface $response) use ($operation): Observable { + return $operation->createResponse($response); + })); + if ($result instanceof Observable) { + $result = awaitObservable($result); + } + + return $result; + } +} diff --git a/clients/GitHub/src/Internal/Operator/Copilot/UsageMetricsForEnterpriseTeamListing.php b/clients/GitHub/src/Internal/Operator/Copilot/UsageMetricsForEnterpriseTeamListing.php new file mode 100644 index 00000000000..0ae9ccc3a19 --- /dev/null +++ b/clients/GitHub/src/Internal/Operator/Copilot/UsageMetricsForEnterpriseTeamListing.php @@ -0,0 +1,41 @@ + */ + public function call(string $enterprise, string $teamSlug, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHub\Internal\Operation\Copilot\UsageMetricsForEnterpriseTeamListing($this->responseSchemaValidator, $this->hydrator, $enterprise, $teamSlug, $since, $until, $page, $perPage); + $request = $operation->createRequest(); + $result = await($this->browser->request($request->getMethod(), (string) $request->getUri(), $request->withHeader('Authorization', $this->authentication->authHeader())->getHeaders(), (string) $request->getBody())->then(static function (ResponseInterface $response) use ($operation): Observable { + return $operation->createResponse($response); + })); + if ($result instanceof Observable) { + $result = awaitObservable($result); + } + + return $result; + } +} diff --git a/clients/GitHub/src/Internal/Operators.php b/clients/GitHub/src/Internal/Operators.php index 9f6b2246def..7e25f79a105 100644 --- a/clients/GitHub/src/Internal/Operators.php +++ b/clients/GitHub/src/Internal/Operators.php @@ -53,6 +53,8 @@ final class Operators private Internal\Operator\Copilot\UsageMetricsForEnterpriseListing|null $copilot👷UsageMetricsForEnterpriseListing = null; private Internal\Operator\Dependabot\ListAlertsForEnterprise|null $dependabot👷ListAlertsForEnterprise = null; private Internal\Operator\SecretScanning\ListAlertsForEnterprise|null $secretScanning👷ListAlertsForEnterprise = null; + private Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam|null $copilot👷UsageMetricsForEnterpriseTeam = null; + private Internal\Operator\Copilot\UsageMetricsForEnterpriseTeamListing|null $copilot👷UsageMetricsForEnterpriseTeamListing = null; private Internal\Operator\Activity\ListPublicEvents|null $activity👷ListPublicEvents = null; private Internal\Operator\Activity\ListPublicEventsListing|null $activity👷ListPublicEventsListing = null; private Internal\Operator\Activity\GetFeeds|null $activity👷GetFeeds = null; @@ -1516,6 +1518,24 @@ public function secretScanning👷ListAlertsForEnterprise(): Internal\Operator\S return $this->secretScanning👷ListAlertsForEnterprise; } + public function copilot👷UsageMetricsForEnterpriseTeam(): Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam + { + if ($this->copilot👷UsageMetricsForEnterpriseTeam instanceof Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam === false) { + $this->copilot👷UsageMetricsForEnterpriseTeam = new Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage()); + } + + return $this->copilot👷UsageMetricsForEnterpriseTeam; + } + + public function copilot👷UsageMetricsForEnterpriseTeamListing(): Internal\Operator\Copilot\UsageMetricsForEnterpriseTeamListing + { + if ($this->copilot👷UsageMetricsForEnterpriseTeamListing instanceof Internal\Operator\Copilot\UsageMetricsForEnterpriseTeamListing === false) { + $this->copilot👷UsageMetricsForEnterpriseTeamListing = new Internal\Operator\Copilot\UsageMetricsForEnterpriseTeamListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage()); + } + + return $this->copilot👷UsageMetricsForEnterpriseTeamListing; + } + public function activity👷ListPublicEvents(): Internal\Operator\Activity\ListPublicEvents { if ($this->activity👷ListPublicEvents instanceof Internal\Operator\Activity\ListPublicEvents === false) { diff --git a/clients/GitHub/src/Internal/Router/Get/Copilot.php b/clients/GitHub/src/Internal/Router/Get/Copilot.php index a60fea643b4..c53e98c1917 100644 --- a/clients/GitHub/src/Internal/Router/Get/Copilot.php +++ b/clients/GitHub/src/Internal/Router/Get/Copilot.php @@ -190,4 +190,49 @@ public function getCopilotSeatDetailsForUser(array $params): CopilotSeatDetails| return $operator->call($arguments['org'], $arguments['username']); } + + /** @return iterable */ + public function usageMetricsForEnterpriseTeam(array $params): iterable + { + $arguments = []; + if (array_key_exists('enterprise', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: enterprise'); + } + + $arguments['enterprise'] = $params['enterprise']; + unset($params['enterprise']); + if (array_key_exists('team_slug', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: team_slug'); + } + + $arguments['team_slug'] = $params['team_slug']; + unset($params['team_slug']); + if (array_key_exists('since', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: since'); + } + + $arguments['since'] = $params['since']; + unset($params['since']); + if (array_key_exists('until', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: until'); + } + + $arguments['until'] = $params['until']; + unset($params['until']); + if (array_key_exists('page', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: page'); + } + + $arguments['page'] = $params['page']; + unset($params['page']); + if (array_key_exists('per_page', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: per_page'); + } + + $arguments['per_page'] = $params['per_page']; + unset($params['per_page']); + $operator = new Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage()); + + return $operator->call($arguments['enterprise'], $arguments['team_slug'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page']); + } } diff --git a/clients/GitHub/src/Internal/Router/Get/Seven.php b/clients/GitHub/src/Internal/Router/Get/Seven.php index 1d2d5cf01b4..5ed2d0c3469 100644 --- a/clients/GitHub/src/Internal/Router/Get/Seven.php +++ b/clients/GitHub/src/Internal/Router/Get/Seven.php @@ -63,11 +63,25 @@ public function __construct(private Routers $routers) { } - /** @return |Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Schema\ConvertedNoteToIssueIssueEvent|Schema\TimelineCommentEvent|Schema\TimelineCrossReferencedEvent|Schema\TimelineCommittedEvent|Schema\TimelineReviewedEvent|Schema\TimelineLineCommentedEvent|Schema\TimelineCommitCommentedEvent|Schema\TimelineAssignedIssueEvent|Schema\TimelineUnassignedIssueEvent|Schema\StateChangeIssueEvent>|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ - public function call(string $call, array $params, array $pathChunks): OidcCustomSub|Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok|Json|WithoutBody|iterable|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Dependabot\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|HookDelivery|TeamDiscussion|TeamMembership|TeamProject|Artifact|ActionsCacheUsageByRepository|Job|ActionsWorkflowAccessToRepository|SelectedActions|ActionsGetDefaultWorkflowPermissions|Runner|WorkflowRun|ActionsPublicKey|ActionsSecret|ActionsVariable|Workflow|BranchProtection|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListForSuite\Response\ApplicationJson\Ok|CodeScanningAlert|CodeScanningAnalysis|CodeScanningSarifsStatus|CodespacesPublicKey|RepoCodespacesSecret|RepositoryCollaboratorPermission|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListForRef\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListSuitesForRef\Response\ApplicationJson\Ok|CombinedCommitStatus|BasicError|DependabotAlert|DependabotPublicKey|DependabotSecret|\ApiClients\Client\GitHub\Schema\Operations\Repos\ListDeploymentBranchPolicies\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetAllDeploymentProtectionRules\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListEnvironmentSecrets\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListEnvironmentVariables\Response\ApplicationJson\Ok\Application\Json|Blob|GitCommit|GitRef|GitTag|GitTree|WebhookConfig|IssueComment|IssueEvent|PageBuild|PagesDeploymentStatus|PullRequestReviewComment|PullRequestReviewRequest|ReleaseAsset|Release|RuleSuite|SecretScanningAlert|TeamDiscussionComment|PackageVersion + /** @return iterable||Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Schema\ConvertedNoteToIssueIssueEvent|Schema\TimelineCommentEvent|Schema\TimelineCrossReferencedEvent|Schema\TimelineCommittedEvent|Schema\TimelineReviewedEvent|Schema\TimelineLineCommentedEvent|Schema\TimelineCommitCommentedEvent|Schema\TimelineAssignedIssueEvent|Schema\TimelineUnassignedIssueEvent|Schema\StateChangeIssueEvent>|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ + public function call(string $call, array $params, array $pathChunks): iterable|OidcCustomSub|Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok|Json|WithoutBody|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Dependabot\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|HookDelivery|TeamDiscussion|TeamMembership|TeamProject|Artifact|ActionsCacheUsageByRepository|Job|ActionsWorkflowAccessToRepository|SelectedActions|ActionsGetDefaultWorkflowPermissions|Runner|WorkflowRun|ActionsPublicKey|ActionsSecret|ActionsVariable|Workflow|BranchProtection|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListForSuite\Response\ApplicationJson\Ok|CodeScanningAlert|CodeScanningAnalysis|CodeScanningSarifsStatus|CodespacesPublicKey|RepoCodespacesSecret|RepositoryCollaboratorPermission|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListForRef\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListSuitesForRef\Response\ApplicationJson\Ok|CombinedCommitStatus|BasicError|DependabotAlert|DependabotPublicKey|DependabotSecret|\ApiClients\Client\GitHub\Schema\Operations\Repos\ListDeploymentBranchPolicies\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetAllDeploymentProtectionRules\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListEnvironmentSecrets\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListEnvironmentVariables\Response\ApplicationJson\Ok\Application\Json|Blob|GitCommit|GitRef|GitTag|GitTree|WebhookConfig|IssueComment|IssueEvent|PageBuild|PagesDeploymentStatus|PullRequestReviewComment|PullRequestReviewRequest|ReleaseAsset|Release|RuleSuite|SecretScanningAlert|TeamDiscussionComment|PackageVersion { if ($pathChunks[0] === '') { - if ($pathChunks[1] === 'orgs') { + if ($pathChunks[1] === 'enterprises') { + if ($pathChunks[2] === '{enterprise}') { + if ($pathChunks[3] === 'team') { + if ($pathChunks[4] === '{team_slug}') { + if ($pathChunks[5] === 'copilot') { + if ($pathChunks[6] === 'usage') { + if ($call === 'GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage') { + return $this->routers->internal🔀Router🔀Get🔀Copilot()->usageMetricsForEnterpriseTeam($params); + } + } + } + } + } + } + } elseif ($pathChunks[1] === 'orgs') { if ($pathChunks[2] === '{org}') { if ($pathChunks[3] === 'actions') { if ($pathChunks[4] === 'oidc') { diff --git a/clients/GitHub/src/Internal/Router/List/Copilot.php b/clients/GitHub/src/Internal/Router/List/Copilot.php index bf1ed2fd538..f13a76250a8 100644 --- a/clients/GitHub/src/Internal/Router/List/Copilot.php +++ b/clients/GitHub/src/Internal/Router/List/Copilot.php @@ -109,4 +109,55 @@ public function usageMetricsForOrgListing(array $params): iterable $arguments['page']++; } while (count($items) > 0); } + + /** @return iterable */ + public function usageMetricsForEnterpriseTeamListing(array $params): iterable + { + $arguments = []; + if (array_key_exists('enterprise', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: enterprise'); + } + + $arguments['enterprise'] = $params['enterprise']; + unset($params['enterprise']); + if (array_key_exists('team_slug', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: team_slug'); + } + + $arguments['team_slug'] = $params['team_slug']; + unset($params['team_slug']); + if (array_key_exists('since', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: since'); + } + + $arguments['since'] = $params['since']; + unset($params['since']); + if (array_key_exists('until', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: until'); + } + + $arguments['until'] = $params['until']; + unset($params['until']); + if (array_key_exists('page', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: page'); + } + + $arguments['page'] = $params['page']; + unset($params['page']); + if (array_key_exists('per_page', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: per_page'); + } + + $arguments['per_page'] = $params['per_page']; + unset($params['per_page']); + $arguments['page'] = 1; + do { + $operator = new Internal\Operator\Copilot\UsageMetricsForEnterpriseTeamListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage()); + $items = [...$operator->call($arguments['enterprise'], $arguments['team_slug'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page'])]; + + yield from $items; + + $arguments['page']++; + } while (count($items) > 0); + } } diff --git a/clients/GitHub/src/Internal/Router/List/Issues.php b/clients/GitHub/src/Internal/Router/List/Issues.php index b07a110ec28..198d4575047 100644 --- a/clients/GitHub/src/Internal/Router/List/Issues.php +++ b/clients/GitHub/src/Internal/Router/List/Issues.php @@ -470,7 +470,7 @@ public function listMilestonesListing(array $params): iterable } /** @return Observable */ - public function listCommentsForRepoListing(array $params): iterable + public function listCommentsListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -485,24 +485,18 @@ public function listCommentsForRepoListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('direction', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: direction'); + if (array_key_exists('issue_number', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: issue_number'); } - $arguments['direction'] = $params['direction']; - unset($params['direction']); + $arguments['issue_number'] = $params['issue_number']; + unset($params['issue_number']); if (array_key_exists('since', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: since'); } $arguments['since'] = $params['since']; unset($params['since']); - if (array_key_exists('sort', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: sort'); - } - - $arguments['sort'] = $params['sort']; - unset($params['sort']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -517,8 +511,8 @@ public function listCommentsForRepoListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Issues\ListCommentsForRepoListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀Comments()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['direction'], $arguments['since'], $arguments['sort'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Issues\ListCommentsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Comments()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['since'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -526,8 +520,8 @@ public function listCommentsForRepoListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listEventsForRepoListing(array $params): iterable + /** @return Observable */ + public function listEventsListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -542,6 +536,12 @@ public function listEventsForRepoListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); + if (array_key_exists('issue_number', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: issue_number'); + } + + $arguments['issue_number'] = $params['issue_number']; + unset($params['issue_number']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -556,8 +556,8 @@ public function listEventsForRepoListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Issues\ListEventsForRepoListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀Events()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Issues\ListEventsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Events()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -565,8 +565,8 @@ public function listEventsForRepoListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listCommentsListing(array $params): iterable + /** @return Observable|Schema\BasicError */ + public function listLabelsOnIssueListing(array $params): iterable|BasicError { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -587,12 +587,6 @@ public function listCommentsListing(array $params): iterable $arguments['issue_number'] = $params['issue_number']; unset($params['issue_number']); - if (array_key_exists('since', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: since'); - } - - $arguments['since'] = $params['since']; - unset($params['since']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -607,8 +601,8 @@ public function listCommentsListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Issues\ListCommentsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Comments()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['since'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Issues\ListLabelsOnIssueListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Labels()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -616,8 +610,8 @@ public function listCommentsListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listEventsListing(array $params): iterable + /** @return Observable */ + public function listEventsForTimelineListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -652,7 +646,7 @@ public function listEventsListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Issues\ListEventsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Events()); + $operator = new Internal\Operator\Issues\ListEventsForTimelineListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Timeline()); $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -661,8 +655,8 @@ public function listEventsListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable|Schema\BasicError */ - public function listLabelsOnIssueListing(array $params): iterable|BasicError + /** @return Observable */ + public function listLabelsForMilestoneListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -677,12 +671,12 @@ public function listLabelsOnIssueListing(array $params): iterable|BasicError $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('issue_number', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: issue_number'); + if (array_key_exists('milestone_number', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: milestone_number'); } - $arguments['issue_number'] = $params['issue_number']; - unset($params['issue_number']); + $arguments['milestone_number'] = $params['milestone_number']; + unset($params['milestone_number']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -697,8 +691,8 @@ public function listLabelsOnIssueListing(array $params): iterable|BasicError unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Issues\ListLabelsOnIssueListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Labels()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Issues\ListLabelsForMilestoneListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Milestones🌀MilestoneNumber🌀Labels()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['milestone_number'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -706,8 +700,8 @@ public function listLabelsOnIssueListing(array $params): iterable|BasicError } while (count($items) > 0); } - /** @return Observable */ - public function listEventsForTimelineListing(array $params): iterable + /** @return Observable */ + public function listCommentsForRepoListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -722,12 +716,24 @@ public function listEventsForTimelineListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('issue_number', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: issue_number'); + if (array_key_exists('direction', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: direction'); } - $arguments['issue_number'] = $params['issue_number']; - unset($params['issue_number']); + $arguments['direction'] = $params['direction']; + unset($params['direction']); + if (array_key_exists('since', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: since'); + } + + $arguments['since'] = $params['since']; + unset($params['since']); + if (array_key_exists('sort', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: sort'); + } + + $arguments['sort'] = $params['sort']; + unset($params['sort']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -742,8 +748,8 @@ public function listEventsForTimelineListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Issues\ListEventsForTimelineListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Timeline()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Issues\ListCommentsForRepoListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀Comments()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['direction'], $arguments['since'], $arguments['sort'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -751,8 +757,8 @@ public function listEventsForTimelineListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listLabelsForMilestoneListing(array $params): iterable + /** @return Observable */ + public function listEventsForRepoListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -767,12 +773,6 @@ public function listLabelsForMilestoneListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('milestone_number', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: milestone_number'); - } - - $arguments['milestone_number'] = $params['milestone_number']; - unset($params['milestone_number']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -787,8 +787,8 @@ public function listLabelsForMilestoneListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Issues\ListLabelsForMilestoneListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Milestones🌀MilestoneNumber🌀Labels()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['milestone_number'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Issues\ListEventsForRepoListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀Events()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['per_page'], $arguments['page'])]; yield from $items; diff --git a/clients/GitHub/src/Internal/Router/List/Packages.php b/clients/GitHub/src/Internal/Router/List/Packages.php index 2c95e7d207a..efcc8c97c28 100644 --- a/clients/GitHub/src/Internal/Router/List/Packages.php +++ b/clients/GitHub/src/Internal/Router/List/Packages.php @@ -151,7 +151,7 @@ public function listPackagesForUserListing(array $params): iterable|WithoutBody } /** @return Observable */ - public function getAllPackageVersionsForPackageOwnedByAuthenticatedUserListing(array $params): iterable + public function getAllPackageVersionsForPackageOwnedByOrgListing(array $params): iterable { $arguments = []; if (array_key_exists('package_type', $params) === false) { @@ -166,6 +166,12 @@ public function getAllPackageVersionsForPackageOwnedByAuthenticatedUserListing(a $arguments['package_name'] = $params['package_name']; unset($params['package_name']); + if (array_key_exists('org', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: org'); + } + + $arguments['org'] = $params['org']; + unset($params['org']); if (array_key_exists('page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: page'); } @@ -186,8 +192,8 @@ public function getAllPackageVersionsForPackageOwnedByAuthenticatedUserListing(a unset($params['state']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Packages\GetAllPackageVersionsForPackageOwnedByAuthenticatedUserListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀User🌀Packages🌀PackageType🌀PackageName🌀Versions()); - $items = [...$operator->call($arguments['package_type'], $arguments['package_name'], $arguments['page'], $arguments['per_page'], $arguments['state'])]; + $operator = new Internal\Operator\Packages\GetAllPackageVersionsForPackageOwnedByOrgListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Packages🌀PackageType🌀PackageName🌀Versions()); + $items = [...$operator->call($arguments['package_type'], $arguments['package_name'], $arguments['org'], $arguments['page'], $arguments['per_page'], $arguments['state'])]; yield from $items; @@ -196,7 +202,7 @@ public function getAllPackageVersionsForPackageOwnedByAuthenticatedUserListing(a } /** @return Observable */ - public function getAllPackageVersionsForPackageOwnedByOrgListing(array $params): iterable + public function getAllPackageVersionsForPackageOwnedByAuthenticatedUserListing(array $params): iterable { $arguments = []; if (array_key_exists('package_type', $params) === false) { @@ -211,12 +217,6 @@ public function getAllPackageVersionsForPackageOwnedByOrgListing(array $params): $arguments['package_name'] = $params['package_name']; unset($params['package_name']); - if (array_key_exists('org', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: org'); - } - - $arguments['org'] = $params['org']; - unset($params['org']); if (array_key_exists('page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: page'); } @@ -237,8 +237,8 @@ public function getAllPackageVersionsForPackageOwnedByOrgListing(array $params): unset($params['state']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Packages\GetAllPackageVersionsForPackageOwnedByOrgListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Packages🌀PackageType🌀PackageName🌀Versions()); - $items = [...$operator->call($arguments['package_type'], $arguments['package_name'], $arguments['org'], $arguments['page'], $arguments['per_page'], $arguments['state'])]; + $operator = new Internal\Operator\Packages\GetAllPackageVersionsForPackageOwnedByAuthenticatedUserListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀User🌀Packages🌀PackageType🌀PackageName🌀Versions()); + $items = [...$operator->call($arguments['package_type'], $arguments['package_name'], $arguments['page'], $arguments['per_page'], $arguments['state'])]; yield from $items; diff --git a/clients/GitHub/src/Internal/Router/List/Pulls.php b/clients/GitHub/src/Internal/Router/List/Pulls.php index 7cfe88c2d03..bbbf8e93a09 100644 --- a/clients/GitHub/src/Internal/Router/List/Pulls.php +++ b/clients/GitHub/src/Internal/Router/List/Pulls.php @@ -91,7 +91,7 @@ public function listListing(array $params): iterable|WithoutBody } /** @return Observable */ - public function listReviewCommentsForRepoListing(array $params): iterable + public function listReviewCommentsListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -106,12 +106,12 @@ public function listReviewCommentsForRepoListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('sort', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: sort'); + if (array_key_exists('pull_number', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: pull_number'); } - $arguments['sort'] = $params['sort']; - unset($params['sort']); + $arguments['pull_number'] = $params['pull_number']; + unset($params['pull_number']); if (array_key_exists('direction', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: direction'); } @@ -124,6 +124,12 @@ public function listReviewCommentsForRepoListing(array $params): iterable $arguments['since'] = $params['since']; unset($params['since']); + if (array_key_exists('sort', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: sort'); + } + + $arguments['sort'] = $params['sort']; + unset($params['sort']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -138,8 +144,8 @@ public function listReviewCommentsForRepoListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Pulls\ListReviewCommentsForRepoListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀Comments()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['sort'], $arguments['direction'], $arguments['since'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Pulls\ListReviewCommentsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Comments()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['pull_number'], $arguments['direction'], $arguments['since'], $arguments['sort'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -147,8 +153,8 @@ public function listReviewCommentsForRepoListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listReviewCommentsListing(array $params): iterable + /** @return Observable */ + public function listCommitsListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -169,24 +175,6 @@ public function listReviewCommentsListing(array $params): iterable $arguments['pull_number'] = $params['pull_number']; unset($params['pull_number']); - if (array_key_exists('direction', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: direction'); - } - - $arguments['direction'] = $params['direction']; - unset($params['direction']); - if (array_key_exists('since', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: since'); - } - - $arguments['since'] = $params['since']; - unset($params['since']); - if (array_key_exists('sort', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: sort'); - } - - $arguments['sort'] = $params['sort']; - unset($params['sort']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -201,8 +189,8 @@ public function listReviewCommentsListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Pulls\ListReviewCommentsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Comments()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['pull_number'], $arguments['direction'], $arguments['since'], $arguments['sort'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Pulls\ListCommitsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Commits()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['pull_number'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -210,8 +198,8 @@ public function listReviewCommentsListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listCommitsListing(array $params): iterable + /** @return Observable */ + public function listFilesListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -246,7 +234,7 @@ public function listCommitsListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Pulls\ListCommitsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Commits()); + $operator = new Internal\Operator\Pulls\ListFilesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Files()); $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['pull_number'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -255,8 +243,8 @@ public function listCommitsListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listFilesListing(array $params): iterable + /** @return Observable */ + public function listReviewsListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -291,7 +279,7 @@ public function listFilesListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Pulls\ListFilesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Files()); + $operator = new Internal\Operator\Pulls\ListReviewsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Reviews()); $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['pull_number'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -300,8 +288,8 @@ public function listFilesListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listReviewsListing(array $params): iterable + /** @return Observable */ + public function listReviewCommentsForRepoListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -316,12 +304,24 @@ public function listReviewsListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('pull_number', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: pull_number'); + if (array_key_exists('sort', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: sort'); } - $arguments['pull_number'] = $params['pull_number']; - unset($params['pull_number']); + $arguments['sort'] = $params['sort']; + unset($params['sort']); + if (array_key_exists('direction', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: direction'); + } + + $arguments['direction'] = $params['direction']; + unset($params['direction']); + if (array_key_exists('since', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: since'); + } + + $arguments['since'] = $params['since']; + unset($params['since']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -336,8 +336,8 @@ public function listReviewsListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Pulls\ListReviewsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀PullNumber🌀Reviews()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['pull_number'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Pulls\ListReviewCommentsForRepoListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pulls🌀Comments()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['sort'], $arguments['direction'], $arguments['since'], $arguments['per_page'], $arguments['page'])]; yield from $items; diff --git a/clients/GitHub/src/Internal/Router/List/Reactions.php b/clients/GitHub/src/Internal/Router/List/Reactions.php index fc86c6c114b..cb6a326c326 100644 --- a/clients/GitHub/src/Internal/Router/List/Reactions.php +++ b/clients/GitHub/src/Internal/Router/List/Reactions.php @@ -21,21 +21,27 @@ public function __construct(private SchemaValidator $requestSchemaValidator, pri } /** @return Observable */ - public function listForTeamDiscussionLegacyListing(array $params): iterable + public function listForCommitCommentListing(array $params): iterable { $arguments = []; - if (array_key_exists('team_id', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: team_id'); + if (array_key_exists('owner', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: owner'); } - $arguments['team_id'] = $params['team_id']; - unset($params['team_id']); - if (array_key_exists('discussion_number', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: discussion_number'); + $arguments['owner'] = $params['owner']; + unset($params['owner']); + if (array_key_exists('repo', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: repo'); } - $arguments['discussion_number'] = $params['discussion_number']; - unset($params['discussion_number']); + $arguments['repo'] = $params['repo']; + unset($params['repo']); + if (array_key_exists('comment_id', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: comment_id'); + } + + $arguments['comment_id'] = $params['comment_id']; + unset($params['comment_id']); if (array_key_exists('content', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: content'); } @@ -56,8 +62,8 @@ public function listForTeamDiscussionLegacyListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Reactions\ListForTeamDiscussionLegacyListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Teams🌀TeamId🌀Discussions🌀DiscussionNumber🌀Reactions()); - $items = [...$operator->call($arguments['team_id'], $arguments['discussion_number'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Reactions\ListForCommitCommentListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Comments🌀CommentId🌀Reactions()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['comment_id'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -66,7 +72,7 @@ public function listForTeamDiscussionLegacyListing(array $params): iterable } /** @return Observable */ - public function listForCommitCommentListing(array $params): iterable + public function listForIssueListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -81,12 +87,12 @@ public function listForCommitCommentListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('comment_id', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: comment_id'); + if (array_key_exists('issue_number', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: issue_number'); } - $arguments['comment_id'] = $params['comment_id']; - unset($params['comment_id']); + $arguments['issue_number'] = $params['issue_number']; + unset($params['issue_number']); if (array_key_exists('content', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: content'); } @@ -107,8 +113,8 @@ public function listForCommitCommentListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Reactions\ListForCommitCommentListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Comments🌀CommentId🌀Reactions()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['comment_id'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Reactions\ListForIssueListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Reactions()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -117,7 +123,7 @@ public function listForCommitCommentListing(array $params): iterable } /** @return Observable */ - public function listForIssueListing(array $params): iterable + public function listForReleaseListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -132,12 +138,12 @@ public function listForIssueListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('issue_number', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: issue_number'); + if (array_key_exists('release_id', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: release_id'); } - $arguments['issue_number'] = $params['issue_number']; - unset($params['issue_number']); + $arguments['release_id'] = $params['release_id']; + unset($params['release_id']); if (array_key_exists('content', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: content'); } @@ -158,8 +164,8 @@ public function listForIssueListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Reactions\ListForIssueListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Issues🌀IssueNumber🌀Reactions()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['issue_number'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Reactions\ListForReleaseListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Releases🌀ReleaseId🌀Reactions()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['release_id'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -168,27 +174,21 @@ public function listForIssueListing(array $params): iterable } /** @return Observable */ - public function listForReleaseListing(array $params): iterable + public function listForTeamDiscussionLegacyListing(array $params): iterable { $arguments = []; - if (array_key_exists('owner', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: owner'); - } - - $arguments['owner'] = $params['owner']; - unset($params['owner']); - if (array_key_exists('repo', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: repo'); + if (array_key_exists('team_id', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: team_id'); } - $arguments['repo'] = $params['repo']; - unset($params['repo']); - if (array_key_exists('release_id', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: release_id'); + $arguments['team_id'] = $params['team_id']; + unset($params['team_id']); + if (array_key_exists('discussion_number', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: discussion_number'); } - $arguments['release_id'] = $params['release_id']; - unset($params['release_id']); + $arguments['discussion_number'] = $params['discussion_number']; + unset($params['discussion_number']); if (array_key_exists('content', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: content'); } @@ -209,8 +209,8 @@ public function listForReleaseListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Reactions\ListForReleaseListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Releases🌀ReleaseId🌀Reactions()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['release_id'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Reactions\ListForTeamDiscussionLegacyListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Teams🌀TeamId🌀Discussions🌀DiscussionNumber🌀Reactions()); + $items = [...$operator->call($arguments['team_id'], $arguments['discussion_number'], $arguments['content'], $arguments['per_page'], $arguments['page'])]; yield from $items; diff --git a/clients/GitHub/src/Internal/Router/List/Repos.php b/clients/GitHub/src/Internal/Router/List/Repos.php index 947d8f0c648..01e0d9c68f5 100644 --- a/clients/GitHub/src/Internal/Router/List/Repos.php +++ b/clients/GitHub/src/Internal/Router/List/Repos.php @@ -958,8 +958,8 @@ public function listTeamsListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listPagesBuildsListing(array $params): iterable + /** @return Observable */ + public function listCommentsForCommitListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -974,6 +974,12 @@ public function listPagesBuildsListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); + if (array_key_exists('commit_sha', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: commit_sha'); + } + + $arguments['commit_sha'] = $params['commit_sha']; + unset($params['commit_sha']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -988,8 +994,8 @@ public function listPagesBuildsListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\ListPagesBuildsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pages🌀Builds()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\ListCommentsForCommitListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Commits🌀CommitSha🌀Comments()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['commit_sha'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -997,8 +1003,8 @@ public function listPagesBuildsListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function getRepoRuleSuitesListing(array $params): iterable + /** @return Observable */ + public function listPullRequestsAssociatedWithCommitListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -1013,30 +1019,12 @@ public function getRepoRuleSuitesListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('ref', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: ref'); - } - - $arguments['ref'] = $params['ref']; - unset($params['ref']); - if (array_key_exists('actor_name', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: actor_name'); - } - - $arguments['actor_name'] = $params['actor_name']; - unset($params['actor_name']); - if (array_key_exists('time_period', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: time_period'); - } - - $arguments['time_period'] = $params['time_period']; - unset($params['time_period']); - if (array_key_exists('rule_suite_result', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: rule_suite_result'); + if (array_key_exists('commit_sha', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: commit_sha'); } - $arguments['rule_suite_result'] = $params['rule_suite_result']; - unset($params['rule_suite_result']); + $arguments['commit_sha'] = $params['commit_sha']; + unset($params['commit_sha']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -1051,8 +1039,8 @@ public function getRepoRuleSuitesListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\GetRepoRuleSuitesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Rulesets🌀RuleSuites()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['ref'], $arguments['actor_name'], $arguments['time_period'], $arguments['rule_suite_result'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\ListPullRequestsAssociatedWithCommitListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Commits🌀CommitSha🌀Pulls()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['commit_sha'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -1060,8 +1048,8 @@ public function getRepoRuleSuitesListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listCommentsForCommitListing(array $params): iterable + /** @return Observable|Schema\BasicError */ + public function listCommitStatusesForRefListing(array $params): iterable|BasicError { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -1076,12 +1064,12 @@ public function listCommentsForCommitListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('commit_sha', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: commit_sha'); + if (array_key_exists('ref', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: ref'); } - $arguments['commit_sha'] = $params['commit_sha']; - unset($params['commit_sha']); + $arguments['ref'] = $params['ref']; + unset($params['ref']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -1096,8 +1084,8 @@ public function listCommentsForCommitListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\ListCommentsForCommitListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Commits🌀CommitSha🌀Comments()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['commit_sha'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\ListCommitStatusesForRefListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Commits🌀Ref🌀Statuses()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['ref'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -1105,8 +1093,8 @@ public function listCommentsForCommitListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listPullRequestsAssociatedWithCommitListing(array $params): iterable + /** @return Observable */ + public function listDeploymentStatusesListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -1121,12 +1109,12 @@ public function listPullRequestsAssociatedWithCommitListing(array $params): iter $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('commit_sha', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: commit_sha'); + if (array_key_exists('deployment_id', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: deployment_id'); } - $arguments['commit_sha'] = $params['commit_sha']; - unset($params['commit_sha']); + $arguments['deployment_id'] = $params['deployment_id']; + unset($params['deployment_id']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -1141,8 +1129,8 @@ public function listPullRequestsAssociatedWithCommitListing(array $params): iter unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\ListPullRequestsAssociatedWithCommitListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Commits🌀CommitSha🌀Pulls()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['commit_sha'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\ListDeploymentStatusesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Deployments🌀DeploymentId🌀Statuses()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['deployment_id'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -1150,8 +1138,8 @@ public function listPullRequestsAssociatedWithCommitListing(array $params): iter } while (count($items) > 0); } - /** @return Observable|Schema\BasicError */ - public function listCommitStatusesForRefListing(array $params): iterable|BasicError + /** @return Observable */ + public function listReleaseAssetsListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -1166,12 +1154,12 @@ public function listCommitStatusesForRefListing(array $params): iterable|BasicEr $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('ref', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: ref'); + if (array_key_exists('release_id', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: release_id'); } - $arguments['ref'] = $params['ref']; - unset($params['ref']); + $arguments['release_id'] = $params['release_id']; + unset($params['release_id']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -1186,8 +1174,8 @@ public function listCommitStatusesForRefListing(array $params): iterable|BasicEr unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\ListCommitStatusesForRefListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Commits🌀Ref🌀Statuses()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['ref'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\ListReleaseAssetsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Releases🌀ReleaseId🌀Assets()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['release_id'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -1195,8 +1183,8 @@ public function listCommitStatusesForRefListing(array $params): iterable|BasicEr } while (count($items) > 0); } - /** @return Observable */ - public function listDeploymentStatusesListing(array $params): iterable + /** @return Observable */ + public function getBranchRulesListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -1211,12 +1199,12 @@ public function listDeploymentStatusesListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('deployment_id', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: deployment_id'); + if (array_key_exists('branch', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: branch'); } - $arguments['deployment_id'] = $params['deployment_id']; - unset($params['deployment_id']); + $arguments['branch'] = $params['branch']; + unset($params['branch']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -1231,8 +1219,8 @@ public function listDeploymentStatusesListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\ListDeploymentStatusesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Deployments🌀DeploymentId🌀Statuses()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['deployment_id'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\GetBranchRulesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Rules🌀Branches🌀Branch()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['branch'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -1240,8 +1228,8 @@ public function listDeploymentStatusesListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function listReleaseAssetsListing(array $params): iterable + /** @return Observable */ + public function listPagesBuildsListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -1256,12 +1244,6 @@ public function listReleaseAssetsListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('release_id', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: release_id'); - } - - $arguments['release_id'] = $params['release_id']; - unset($params['release_id']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -1276,8 +1258,8 @@ public function listReleaseAssetsListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\ListReleaseAssetsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Releases🌀ReleaseId🌀Assets()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['release_id'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\ListPagesBuildsListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Pages🌀Builds()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['per_page'], $arguments['page'])]; yield from $items; @@ -1285,8 +1267,8 @@ public function listReleaseAssetsListing(array $params): iterable } while (count($items) > 0); } - /** @return Observable */ - public function getBranchRulesListing(array $params): iterable + /** @return Observable */ + public function getRepoRuleSuitesListing(array $params): iterable { $arguments = []; if (array_key_exists('owner', $params) === false) { @@ -1301,12 +1283,30 @@ public function getBranchRulesListing(array $params): iterable $arguments['repo'] = $params['repo']; unset($params['repo']); - if (array_key_exists('branch', $params) === false) { - throw new InvalidArgumentException('Missing mandatory field: branch'); + if (array_key_exists('ref', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: ref'); } - $arguments['branch'] = $params['branch']; - unset($params['branch']); + $arguments['ref'] = $params['ref']; + unset($params['ref']); + if (array_key_exists('actor_name', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: actor_name'); + } + + $arguments['actor_name'] = $params['actor_name']; + unset($params['actor_name']); + if (array_key_exists('time_period', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: time_period'); + } + + $arguments['time_period'] = $params['time_period']; + unset($params['time_period']); + if (array_key_exists('rule_suite_result', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: rule_suite_result'); + } + + $arguments['rule_suite_result'] = $params['rule_suite_result']; + unset($params['rule_suite_result']); if (array_key_exists('per_page', $params) === false) { throw new InvalidArgumentException('Missing mandatory field: per_page'); } @@ -1321,8 +1321,8 @@ public function getBranchRulesListing(array $params): iterable unset($params['page']); $arguments['page'] = 1; do { - $operator = new Internal\Operator\Repos\GetBranchRulesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Rules🌀Branches🌀Branch()); - $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['branch'], $arguments['per_page'], $arguments['page'])]; + $operator = new Internal\Operator\Repos\GetRepoRuleSuitesListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Repos🌀Owner🌀Repo🌀Rulesets🌀RuleSuites()); + $items = [...$operator->call($arguments['owner'], $arguments['repo'], $arguments['ref'], $arguments['actor_name'], $arguments['time_period'], $arguments['rule_suite_result'], $arguments['per_page'], $arguments['page'])]; yield from $items; diff --git a/clients/GitHub/src/Internal/Router/List/Seven.php b/clients/GitHub/src/Internal/Router/List/Seven.php index f2da1325c61..9dfce88ae3b 100644 --- a/clients/GitHub/src/Internal/Router/List/Seven.php +++ b/clients/GitHub/src/Internal/Router/List/Seven.php @@ -14,11 +14,25 @@ public function __construct(private Routers $routers) { } - /** @return Observable|Observable|Observable|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Schema\ConvertedNoteToIssueIssueEvent|Schema\TimelineCommentEvent|Schema\TimelineCrossReferencedEvent|Schema\TimelineCommittedEvent|Schema\TimelineReviewedEvent|Schema\TimelineLineCommentedEvent|Schema\TimelineCommitCommentedEvent|Schema\TimelineAssignedIssueEvent|Schema\TimelineUnassignedIssueEvent|Schema\StateChangeIssueEvent>|Observable|Observable|Observable|Observable|Observable|Observable */ + /** @return iterable|Observable|Observable|Observable|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Schema\ConvertedNoteToIssueIssueEvent|Schema\TimelineCommentEvent|Schema\TimelineCrossReferencedEvent|Schema\TimelineCommittedEvent|Schema\TimelineReviewedEvent|Schema\TimelineLineCommentedEvent|Schema\TimelineCommitCommentedEvent|Schema\TimelineAssignedIssueEvent|Schema\TimelineUnassignedIssueEvent|Schema\StateChangeIssueEvent>|Observable|Observable|Observable|Observable|Observable|Observable */ public function call(string $call, array $params, array $pathChunks): iterable|BasicError { if ($pathChunks[0] === '') { - if ($pathChunks[1] === 'orgs') { + if ($pathChunks[1] === 'enterprises') { + if ($pathChunks[2] === '{enterprise}') { + if ($pathChunks[3] === 'team') { + if ($pathChunks[4] === '{team_slug}') { + if ($pathChunks[5] === 'copilot') { + if ($pathChunks[6] === 'usage') { + if ($call === 'LIST /enterprises/{enterprise}/team/{team_slug}/copilot/usage') { + return $this->routers->internal🔀Router🔀List🔀Copilot()->usageMetricsForEnterpriseTeamListing($params); + } + } + } + } + } + } + } elseif ($pathChunks[1] === 'orgs') { if ($pathChunks[2] === '{org}') { if ($pathChunks[3] === 'packages') { if ($pathChunks[4] === '{package_type}') { diff --git a/clients/GitHub/src/Internal/Routers.php b/clients/GitHub/src/Internal/Routers.php index 04edcd56220..a280646929b 100644 --- a/clients/GitHub/src/Internal/Routers.php +++ b/clients/GitHub/src/Internal/Routers.php @@ -105,9 +105,9 @@ final class Routers private Internal\Router\List\CodeScanning|null $internal🔀Router🔀List🔀CodeScanning = null; private Internal\Router\List\SecretScanning|null $internal🔀Router🔀List🔀SecretScanning = null; private Internal\Router\List\Pulls|null $internal🔀Router🔀List🔀Pulls = null; - private Internal\Router\List\Dependabot|null $internal🔀Router🔀List🔀Dependabot = null; - private Internal\Router\List\Reactions|null $internal🔀Router🔀List🔀Reactions = null; private Internal\Router\List\Checks|null $internal🔀Router🔀List🔀Checks = null; + private Internal\Router\List\Reactions|null $internal🔀Router🔀List🔀Reactions = null; + private Internal\Router\List\Dependabot|null $internal🔀Router🔀List🔀Dependabot = null; private Internal\Router\Delete\Apps|null $internal🔀Router🔀Delete🔀Apps = null; private Internal\Router\Delete\Gists|null $internal🔀Router🔀Delete🔀Gists = null; private Internal\Router\Delete\Activity|null $internal🔀Router🔀Delete🔀Activity = null; @@ -1000,13 +1000,13 @@ public function internal🔀Router🔀List🔀Pulls(): Internal\Router\List\Pull return $this->internal🔀Router🔀List🔀Pulls; } - public function internal🔀Router🔀List🔀Dependabot(): Internal\Router\List\Dependabot + public function internal🔀Router🔀List🔀Checks(): Internal\Router\List\Checks { - if ($this->internal🔀Router🔀List🔀Dependabot instanceof Internal\Router\List\Dependabot === false) { - $this->internal🔀Router🔀List🔀Dependabot = new Internal\Router\List\Dependabot(browser: $this->browser, authentication: $this->authentication, requestSchemaValidator: $this->requestSchemaValidator, responseSchemaValidator: $this->responseSchemaValidator, hydrators: $this->hydrators); + if ($this->internal🔀Router🔀List🔀Checks instanceof Internal\Router\List\Checks === false) { + $this->internal🔀Router🔀List🔀Checks = new Internal\Router\List\Checks(browser: $this->browser, authentication: $this->authentication, requestSchemaValidator: $this->requestSchemaValidator, responseSchemaValidator: $this->responseSchemaValidator, hydrators: $this->hydrators); } - return $this->internal🔀Router🔀List🔀Dependabot; + return $this->internal🔀Router🔀List🔀Checks; } public function internal🔀Router🔀List🔀Reactions(): Internal\Router\List\Reactions @@ -1018,13 +1018,13 @@ public function internal🔀Router🔀List🔀Reactions(): Internal\Router\List\ return $this->internal🔀Router🔀List🔀Reactions; } - public function internal🔀Router🔀List🔀Checks(): Internal\Router\List\Checks + public function internal🔀Router🔀List🔀Dependabot(): Internal\Router\List\Dependabot { - if ($this->internal🔀Router🔀List🔀Checks instanceof Internal\Router\List\Checks === false) { - $this->internal🔀Router🔀List🔀Checks = new Internal\Router\List\Checks(browser: $this->browser, authentication: $this->authentication, requestSchemaValidator: $this->requestSchemaValidator, responseSchemaValidator: $this->responseSchemaValidator, hydrators: $this->hydrators); + if ($this->internal🔀Router🔀List🔀Dependabot instanceof Internal\Router\List\Dependabot === false) { + $this->internal🔀Router🔀List🔀Dependabot = new Internal\Router\List\Dependabot(browser: $this->browser, authentication: $this->authentication, requestSchemaValidator: $this->requestSchemaValidator, responseSchemaValidator: $this->responseSchemaValidator, hydrators: $this->hydrators); } - return $this->internal🔀Router🔀List🔀Checks; + return $this->internal🔀Router🔀List🔀Dependabot; } public function internal🔀Router🔀Delete🔀Apps(): Internal\Router\Delete\Apps diff --git a/clients/GitHub/src/Operation/Copilot.php b/clients/GitHub/src/Operation/Copilot.php index af601c645a8..fdfb6539d9a 100644 --- a/clients/GitHub/src/Operation/Copilot.php +++ b/clients/GitHub/src/Operation/Copilot.php @@ -37,6 +37,18 @@ public function usageMetricsForEnterpriseListing(string $enterprise, string $sin return $this->operators->copilot👷UsageMetricsForEnterpriseListing()->call($enterprise, $since, $until, $page, $perPage); } + /** @return iterable */ + public function usageMetricsForEnterpriseTeam(string $enterprise, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷UsageMetricsForEnterpriseTeam()->call($enterprise, $teamSlug, $since, $until, $page, $perPage); + } + + /** @return iterable */ + public function usageMetricsForEnterpriseTeamListing(string $enterprise, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷UsageMetricsForEnterpriseTeamListing()->call($enterprise, $teamSlug, $since, $until, $page, $perPage); + } + /** @return */ public function getCopilotOrganizationDetails(string $org): CopilotOrganizationDetails|WithoutBody { diff --git a/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php b/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php index 38b2eef6053..30555c13c6f 100644 --- a/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php +++ b/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php @@ -211,6 +211,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method return $this->typeResolver->resolve('Observable'); } + if ($call === 'GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage') { + return $this->typeResolver->resolve('iterable'); + } + + if ($call === 'LIST /enterprises/{enterprise}/team/{team_slug}/copilot/usage') { + return $this->typeResolver->resolve('iterable'); + } + if ($call === 'GET /events') { return $this->typeResolver->resolve('Observable|WithoutBody'); } diff --git a/clients/GitHub/src/Schema/ApiOverview.php b/clients/GitHub/src/Schema/ApiOverview.php index 40c0cab42b1..57d251dbb40 100644 --- a/clients/GitHub/src/Schema/ApiOverview.php +++ b/clients/GitHub/src/Schema/ApiOverview.php @@ -147,6 +147,15 @@ "192.0.2.1" ] }, + "copilot": { + "type": "array", + "items": { + "type": "string" + }, + "examples": [ + "192.0.2.1" + ] + }, "domains": { "type": "object", "properties": { @@ -258,6 +267,10 @@ "192.0.2.1", "192.0.2.1" ], + "copilot": [ + "192.0.2.1", + "192.0.2.1" + ], "domains": { "website": [ "generated", @@ -287,7 +300,7 @@ public function __construct(#[MapFrom('verifiable_password_authentication')] public Schema\ApiOverview\SshKeyFingerprints|null $sshKeyFingerprints, #[MapFrom('ssh_keys')] public array|null $sshKeys, public array|null $hooks, #[MapFrom('github_enterprise_importer')] public array|null $githubEnterpriseImporter, public array|null $web, public array|null $api, public array|null $git, public array|null $packages, public array|null $pages, public array|null $importer, public array|null $actions, #[MapFrom('actions_macos')] - public array|null $actionsMacos, public array|null $dependabot, public Schema\ApiOverview\Domains|null $domains,) + public array|null $actionsMacos, public array|null $dependabot, public array|null $copilot, public Schema\ApiOverview\Domains|null $domains,) { } } diff --git a/clients/GitHub/src/Schema/CopilotSeatDetails.php b/clients/GitHub/src/Schema/CopilotSeatDetails.php index 87f7d2137ed..8ca2d5e9c7d 100644 --- a/clients/GitHub/src/Schema/CopilotSeatDetails.php +++ b/clients/GitHub/src/Schema/CopilotSeatDetails.php @@ -184,392 +184,6 @@ } }, "description": "A GitHub user." - }, - { - "title": "Team", - "required": [ - "id", - "node_id", - "url", - "members_url", - "name", - "description", - "permission", - "html_url", - "repositories_url", - "slug", - "parent" - ], - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "node_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "privacy": { - "type": "string" - }, - "notification_setting": { - "type": "string" - }, - "permission": { - "type": "string" - }, - "permissions": { - "required": [ - "pull", - "triage", - "push", - "maintain", - "admin" - ], - "type": "object", - "properties": { - "pull": { - "type": "boolean" - }, - "triage": { - "type": "boolean" - }, - "push": { - "type": "boolean" - }, - "maintain": { - "type": "boolean" - }, - "admin": { - "type": "boolean" - } - } - }, - "url": { - "type": "string", - "format": "uri" - }, - "html_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/github.com\\/orgs\\/rails\\/teams\\/core" - ] - }, - "members_url": { - "type": "string" - }, - "repositories_url": { - "type": "string", - "format": "uri" - }, - "parent": { - "anyOf": [ - { - "type": "null" - }, - { - "title": "Team Simple", - "required": [ - "id", - "node_id", - "url", - "members_url", - "name", - "description", - "permission", - "html_url", - "repositories_url", - "slug" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "description": "Unique identifier of the team", - "examples": [ - 1 - ] - }, - "node_id": { - "type": "string", - "examples": [ - "MDQ6VGVhbTE=" - ] - }, - "url": { - "type": "string", - "description": "URL for the team", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1" - ] - }, - "members_url": { - "type": "string", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1\\/members{\\/member}" - ] - }, - "name": { - "type": "string", - "description": "Name of the team", - "examples": [ - "Justice League" - ] - }, - "description": { - "type": [ - "string", - "null" - ], - "description": "Description of the team", - "examples": [ - "A great team." - ] - }, - "permission": { - "type": "string", - "description": "Permission that the team will have for its repositories", - "examples": [ - "admin" - ] - }, - "privacy": { - "type": "string", - "description": "The level of privacy this team should have", - "examples": [ - "closed" - ] - }, - "notification_setting": { - "type": "string", - "description": "The notification setting the team has set", - "examples": [ - "notifications_enabled" - ] - }, - "html_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/github.com\\/orgs\\/rails\\/teams\\/core" - ] - }, - "repositories_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1\\/repos" - ] - }, - "slug": { - "type": "string", - "examples": [ - "justice-league" - ] - }, - "ldap_dn": { - "type": "string", - "description": "Distinguished Name (DN) that team maps to within LDAP environment", - "examples": [ - "uid=example,ou=users,dc=github,dc=com" - ] - } - }, - "description": "Groups of organization members that gives permissions on specified repositories." - } - ] - } - }, - "description": "Groups of organization members that gives permissions on specified repositories." - }, - { - "title": "Organization", - "required": [ - "login", - "url", - "id", - "node_id", - "repos_url", - "events_url", - "hooks_url", - "issues_url", - "members_url", - "public_members_url", - "avatar_url", - "description", - "html_url", - "has_organization_projects", - "has_repository_projects", - "public_repos", - "public_gists", - "followers", - "following", - "type", - "created_at", - "updated_at" - ], - "type": "object", - "properties": { - "login": { - "type": "string", - "description": "Unique login name of the organization", - "examples": [ - "new-org" - ] - }, - "url": { - "type": "string", - "description": "URL for the organization", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/orgs\\/github" - ] - }, - "id": { - "type": "integer" - }, - "node_id": { - "type": "string" - }, - "repos_url": { - "type": "string", - "format": "uri" - }, - "events_url": { - "type": "string", - "format": "uri" - }, - "hooks_url": { - "type": "string" - }, - "issues_url": { - "type": "string" - }, - "members_url": { - "type": "string" - }, - "public_members_url": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "blog": { - "type": "string", - "description": "Display blog url for the organization", - "format": "uri", - "examples": [ - "blog.example-org.com" - ] - }, - "html_url": { - "type": "string", - "format": "uri" - }, - "name": { - "type": "string", - "description": "Display name for the organization", - "examples": [ - "New Org" - ] - }, - "company": { - "type": "string", - "description": "Display company name for the organization", - "examples": [ - "Acme corporation" - ] - }, - "location": { - "type": "string", - "description": "Display location for the organization", - "examples": [ - "Berlin, Germany" - ] - }, - "email": { - "type": "string", - "description": "Display email for the organization", - "format": "email", - "examples": [ - "org@example.com" - ] - }, - "has_organization_projects": { - "type": "boolean", - "description": "Specifies if organization projects are enabled for this org" - }, - "has_repository_projects": { - "type": "boolean", - "description": "Specifies if repository projects are enabled for repositories that belong to this org" - }, - "is_verified": { - "type": "boolean" - }, - "public_repos": { - "type": "integer" - }, - "public_gists": { - "type": "integer" - }, - "followers": { - "type": "integer" - }, - "following": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "plan": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "space": { - "type": "integer" - }, - "private_repos": { - "type": "integer" - }, - "filled_seats": { - "type": "integer" - }, - "seats": { - "type": "integer" - } - } - } - }, - "description": "GitHub account for managing multiple users, teams, and repositories" } ], "description": "The assignee that has been granted access to GitHub Copilot.", @@ -1028,7 +642,7 @@ * updatedAt: Timestamp of when the assignee's GitHub Copilot access was last updated, in ISO 8601 format. */ public function __construct(#[Assignee] - public Schema\SimpleUser|Schema\Team|Schema\Organization $assignee, #[Organization] + public Schema\SimpleUser $assignee, #[Organization] public Schema\OrganizationSimple|null $organization, #[MapFrom('assigning_team')] #[AssigningTeam] public Schema\Team|Schema\EnterpriseTeam|null $assigningTeam, #[MapFrom('pending_cancellation_date')] diff --git a/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeats/Response/ApplicationJson/Ok.php b/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeats/Response/ApplicationJson/Ok.php index 7416f62d5da..58d9220fbbc 100644 --- a/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeats/Response/ApplicationJson/Ok.php +++ b/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeats/Response/ApplicationJson/Ok.php @@ -189,392 +189,6 @@ } }, "description": "A GitHub user." - }, - { - "title": "Team", - "required": [ - "id", - "node_id", - "url", - "members_url", - "name", - "description", - "permission", - "html_url", - "repositories_url", - "slug", - "parent" - ], - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "node_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "privacy": { - "type": "string" - }, - "notification_setting": { - "type": "string" - }, - "permission": { - "type": "string" - }, - "permissions": { - "required": [ - "pull", - "triage", - "push", - "maintain", - "admin" - ], - "type": "object", - "properties": { - "pull": { - "type": "boolean" - }, - "triage": { - "type": "boolean" - }, - "push": { - "type": "boolean" - }, - "maintain": { - "type": "boolean" - }, - "admin": { - "type": "boolean" - } - } - }, - "url": { - "type": "string", - "format": "uri" - }, - "html_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/github.com\\/orgs\\/rails\\/teams\\/core" - ] - }, - "members_url": { - "type": "string" - }, - "repositories_url": { - "type": "string", - "format": "uri" - }, - "parent": { - "anyOf": [ - { - "type": "null" - }, - { - "title": "Team Simple", - "required": [ - "id", - "node_id", - "url", - "members_url", - "name", - "description", - "permission", - "html_url", - "repositories_url", - "slug" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "description": "Unique identifier of the team", - "examples": [ - 1 - ] - }, - "node_id": { - "type": "string", - "examples": [ - "MDQ6VGVhbTE=" - ] - }, - "url": { - "type": "string", - "description": "URL for the team", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1" - ] - }, - "members_url": { - "type": "string", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1\\/members{\\/member}" - ] - }, - "name": { - "type": "string", - "description": "Name of the team", - "examples": [ - "Justice League" - ] - }, - "description": { - "type": [ - "string", - "null" - ], - "description": "Description of the team", - "examples": [ - "A great team." - ] - }, - "permission": { - "type": "string", - "description": "Permission that the team will have for its repositories", - "examples": [ - "admin" - ] - }, - "privacy": { - "type": "string", - "description": "The level of privacy this team should have", - "examples": [ - "closed" - ] - }, - "notification_setting": { - "type": "string", - "description": "The notification setting the team has set", - "examples": [ - "notifications_enabled" - ] - }, - "html_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/github.com\\/orgs\\/rails\\/teams\\/core" - ] - }, - "repositories_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1\\/repos" - ] - }, - "slug": { - "type": "string", - "examples": [ - "justice-league" - ] - }, - "ldap_dn": { - "type": "string", - "description": "Distinguished Name (DN) that team maps to within LDAP environment", - "examples": [ - "uid=example,ou=users,dc=github,dc=com" - ] - } - }, - "description": "Groups of organization members that gives permissions on specified repositories." - } - ] - } - }, - "description": "Groups of organization members that gives permissions on specified repositories." - }, - { - "title": "Organization", - "required": [ - "login", - "url", - "id", - "node_id", - "repos_url", - "events_url", - "hooks_url", - "issues_url", - "members_url", - "public_members_url", - "avatar_url", - "description", - "html_url", - "has_organization_projects", - "has_repository_projects", - "public_repos", - "public_gists", - "followers", - "following", - "type", - "created_at", - "updated_at" - ], - "type": "object", - "properties": { - "login": { - "type": "string", - "description": "Unique login name of the organization", - "examples": [ - "new-org" - ] - }, - "url": { - "type": "string", - "description": "URL for the organization", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/orgs\\/github" - ] - }, - "id": { - "type": "integer" - }, - "node_id": { - "type": "string" - }, - "repos_url": { - "type": "string", - "format": "uri" - }, - "events_url": { - "type": "string", - "format": "uri" - }, - "hooks_url": { - "type": "string" - }, - "issues_url": { - "type": "string" - }, - "members_url": { - "type": "string" - }, - "public_members_url": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "blog": { - "type": "string", - "description": "Display blog url for the organization", - "format": "uri", - "examples": [ - "blog.example-org.com" - ] - }, - "html_url": { - "type": "string", - "format": "uri" - }, - "name": { - "type": "string", - "description": "Display name for the organization", - "examples": [ - "New Org" - ] - }, - "company": { - "type": "string", - "description": "Display company name for the organization", - "examples": [ - "Acme corporation" - ] - }, - "location": { - "type": "string", - "description": "Display location for the organization", - "examples": [ - "Berlin, Germany" - ] - }, - "email": { - "type": "string", - "description": "Display email for the organization", - "format": "email", - "examples": [ - "org@example.com" - ] - }, - "has_organization_projects": { - "type": "boolean", - "description": "Specifies if organization projects are enabled for this org" - }, - "has_repository_projects": { - "type": "boolean", - "description": "Specifies if repository projects are enabled for repositories that belong to this org" - }, - "is_verified": { - "type": "boolean" - }, - "public_repos": { - "type": "integer" - }, - "public_gists": { - "type": "integer" - }, - "followers": { - "type": "integer" - }, - "following": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "plan": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "space": { - "type": "integer" - }, - "private_repos": { - "type": "integer" - }, - "filled_seats": { - "type": "integer" - }, - "seats": { - "type": "integer" - } - } - } - }, - "description": "GitHub account for managing multiple users, teams, and repositories" } ], "description": "The assignee that has been granted access to GitHub Copilot.", diff --git a/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeatsForEnterprise/Response/ApplicationJson/Ok.php b/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeatsForEnterprise/Response/ApplicationJson/Ok.php index 7ddfb3eb6a2..d29a653a49d 100644 --- a/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeatsForEnterprise/Response/ApplicationJson/Ok.php +++ b/clients/GitHub/src/Schema/Operations/Copilot/ListCopilotSeatsForEnterprise/Response/ApplicationJson/Ok.php @@ -189,392 +189,6 @@ } }, "description": "A GitHub user." - }, - { - "title": "Team", - "required": [ - "id", - "node_id", - "url", - "members_url", - "name", - "description", - "permission", - "html_url", - "repositories_url", - "slug", - "parent" - ], - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "node_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "privacy": { - "type": "string" - }, - "notification_setting": { - "type": "string" - }, - "permission": { - "type": "string" - }, - "permissions": { - "required": [ - "pull", - "triage", - "push", - "maintain", - "admin" - ], - "type": "object", - "properties": { - "pull": { - "type": "boolean" - }, - "triage": { - "type": "boolean" - }, - "push": { - "type": "boolean" - }, - "maintain": { - "type": "boolean" - }, - "admin": { - "type": "boolean" - } - } - }, - "url": { - "type": "string", - "format": "uri" - }, - "html_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/github.com\\/orgs\\/rails\\/teams\\/core" - ] - }, - "members_url": { - "type": "string" - }, - "repositories_url": { - "type": "string", - "format": "uri" - }, - "parent": { - "anyOf": [ - { - "type": "null" - }, - { - "title": "Team Simple", - "required": [ - "id", - "node_id", - "url", - "members_url", - "name", - "description", - "permission", - "html_url", - "repositories_url", - "slug" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "description": "Unique identifier of the team", - "examples": [ - 1 - ] - }, - "node_id": { - "type": "string", - "examples": [ - "MDQ6VGVhbTE=" - ] - }, - "url": { - "type": "string", - "description": "URL for the team", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1" - ] - }, - "members_url": { - "type": "string", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1\\/members{\\/member}" - ] - }, - "name": { - "type": "string", - "description": "Name of the team", - "examples": [ - "Justice League" - ] - }, - "description": { - "type": [ - "string", - "null" - ], - "description": "Description of the team", - "examples": [ - "A great team." - ] - }, - "permission": { - "type": "string", - "description": "Permission that the team will have for its repositories", - "examples": [ - "admin" - ] - }, - "privacy": { - "type": "string", - "description": "The level of privacy this team should have", - "examples": [ - "closed" - ] - }, - "notification_setting": { - "type": "string", - "description": "The notification setting the team has set", - "examples": [ - "notifications_enabled" - ] - }, - "html_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/github.com\\/orgs\\/rails\\/teams\\/core" - ] - }, - "repositories_url": { - "type": "string", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/organizations\\/1\\/team\\/1\\/repos" - ] - }, - "slug": { - "type": "string", - "examples": [ - "justice-league" - ] - }, - "ldap_dn": { - "type": "string", - "description": "Distinguished Name (DN) that team maps to within LDAP environment", - "examples": [ - "uid=example,ou=users,dc=github,dc=com" - ] - } - }, - "description": "Groups of organization members that gives permissions on specified repositories." - } - ] - } - }, - "description": "Groups of organization members that gives permissions on specified repositories." - }, - { - "title": "Organization", - "required": [ - "login", - "url", - "id", - "node_id", - "repos_url", - "events_url", - "hooks_url", - "issues_url", - "members_url", - "public_members_url", - "avatar_url", - "description", - "html_url", - "has_organization_projects", - "has_repository_projects", - "public_repos", - "public_gists", - "followers", - "following", - "type", - "created_at", - "updated_at" - ], - "type": "object", - "properties": { - "login": { - "type": "string", - "description": "Unique login name of the organization", - "examples": [ - "new-org" - ] - }, - "url": { - "type": "string", - "description": "URL for the organization", - "format": "uri", - "examples": [ - "https:\\/\\/api.github.com\\/orgs\\/github" - ] - }, - "id": { - "type": "integer" - }, - "node_id": { - "type": "string" - }, - "repos_url": { - "type": "string", - "format": "uri" - }, - "events_url": { - "type": "string", - "format": "uri" - }, - "hooks_url": { - "type": "string" - }, - "issues_url": { - "type": "string" - }, - "members_url": { - "type": "string" - }, - "public_members_url": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "blog": { - "type": "string", - "description": "Display blog url for the organization", - "format": "uri", - "examples": [ - "blog.example-org.com" - ] - }, - "html_url": { - "type": "string", - "format": "uri" - }, - "name": { - "type": "string", - "description": "Display name for the organization", - "examples": [ - "New Org" - ] - }, - "company": { - "type": "string", - "description": "Display company name for the organization", - "examples": [ - "Acme corporation" - ] - }, - "location": { - "type": "string", - "description": "Display location for the organization", - "examples": [ - "Berlin, Germany" - ] - }, - "email": { - "type": "string", - "description": "Display email for the organization", - "format": "email", - "examples": [ - "org@example.com" - ] - }, - "has_organization_projects": { - "type": "boolean", - "description": "Specifies if organization projects are enabled for this org" - }, - "has_repository_projects": { - "type": "boolean", - "description": "Specifies if repository projects are enabled for repositories that belong to this org" - }, - "is_verified": { - "type": "boolean" - }, - "public_repos": { - "type": "integer" - }, - "public_gists": { - "type": "integer" - }, - "followers": { - "type": "integer" - }, - "following": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "plan": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "space": { - "type": "integer" - }, - "private_repos": { - "type": "integer" - }, - "filled_seats": { - "type": "integer" - }, - "seats": { - "type": "integer" - } - } - } - }, - "description": "GitHub account for managing multiple users, teams, and repositories" } ], "description": "The assignee that has been granted access to GitHub Copilot.", diff --git a/clients/GitHub/src/Schema/Organization.php b/clients/GitHub/src/Schema/Organization.php deleted file mode 100644 index a96a9c8bb2e..00000000000 --- a/clients/GitHub/src/Schema/Organization.php +++ /dev/null @@ -1,258 +0,0 @@ - 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + foreach ($result as $item) { + } + } + + /** @test */ + public function operations_httpCode_500_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(500, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } + + /** @test */ + public function call_httpCode_401_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(401, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + foreach ($result as $item) { + } + } + + /** @test */ + public function operations_httpCode_401_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(401, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } + + /** @test */ + public function call_httpCode_403_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(403, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + foreach ($result as $item) { + } + } + + /** @test */ + public function operations_httpCode_403_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(403, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } + + /** @test */ + public function call_httpCode_404_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(404, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + foreach ($result as $item) { + } + } + + /** @test */ + public function operations_httpCode_404_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(404, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } +} diff --git a/clients/GitHub/tests/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeamTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeamTest.php new file mode 100644 index 00000000000..baaa80fda79 --- /dev/null +++ b/clients/GitHub/tests/Internal/Operation/Copilot/UsageMetricsForEnterpriseTeamTest.php @@ -0,0 +1,179 @@ + 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeam::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + } + + /** @test */ + public function operations_httpCode_500_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(500, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } + + /** @test */ + public function call_httpCode_401_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(401, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeam::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + } + + /** @test */ + public function operations_httpCode_401_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(401, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } + + /** @test */ + public function call_httpCode_403_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(403, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeam::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + } + + /** @test */ + public function operations_httpCode_403_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(403, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } + + /** @test */ + public function call_httpCode_404_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(404, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\Copilot\UsageMetricsForEnterpriseTeam::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['team_slug'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + } + + /** @test */ + public function operations_httpCode_404_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(404, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true))); + $auth = $this->prophesize(AuthenticationInterface::class); + $auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled(); + $browser = $this->prophesize(Browser::class); + $browser->withBase(Argument::any())->willReturn($browser->reveal()); + $browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal()); + $browser->request('GET', '/enterprises/generated/team/generated/copilot/usage?since=generated&until=generated&page=1&per_page=8', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->copilot()->usageMetricsForEnterpriseTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } +} diff --git a/clients/GitHub/tests/Types/ClientCallReturnTypes.php b/clients/GitHub/tests/Types/ClientCallReturnTypes.php index df9838d1a7b..596aa661d82 100644 --- a/clients/GitHub/tests/Types/ClientCallReturnTypes.php +++ b/clients/GitHub/tests/Types/ClientCallReturnTypes.php @@ -59,6 +59,8 @@ function authHeader(): string assertType('Observable', $client->call('LIST /enterprises/{enterprise}/copilot/usage')); assertType('Observable|WithoutBody', $client->call('GET /enterprises/{enterprise}/dependabot/alerts')); assertType('Observable', $client->call('GET /enterprises/{enterprise}/secret-scanning/alerts')); +assertType('iterable', $client->call('GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage')); +assertType('iterable', $client->call('LIST /enterprises/{enterprise}/team/{team_slug}/copilot/usage')); assertType('Observable|WithoutBody', $client->call('GET /events')); assertType('Observable|WithoutBody', $client->call('LIST /events')); assertType('', $client->call('GET /feeds')); diff --git a/etc/specs/GitHub/current.spec.yaml b/etc/specs/GitHub/current.spec.yaml index 5ce9cafb163..52f4354bcc3 100644 --- a/etc/specs/GitHub/current.spec.yaml +++ b/etc/specs/GitHub/current.spec.yaml @@ -1501,7 +1501,7 @@ paths: for all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions. - The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day, + The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day, and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics, they must have telemetry enabled in their IDE. @@ -1674,6 +1674,85 @@ paths: enabledForGitHubApps: false category: secret-scanning subcategory: secret-scanning + "/enterprises/{enterprise}/team/{team_slug}/copilot/usage": + get: + summary: Get a summary of Copilot usage for an enterprise team + description: |- + > [!NOTE] + > This endpoint is in beta and is subject to change. + + You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDE + for users within an enterprise team, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day. + See the response schema tab for detailed metrics definitions. + + The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day, + and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics, + they must have telemetry enabled in their IDE. + + > [!NOTE] + > This endpoint will only return results for a given day if the enterprise team had five or more members with active Copilot licenses, as evaluated at the end of that day. + + Owners and billing managers for the enterprise that contains the enterprise team can view Copilot usage metrics for the enterprise team. + + OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint. + tags: + - copilot + operationId: copilot/usage-metrics-for-enterprise-team + externalDocs: + description: API method documentation + url: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-an-enterprise-team + parameters: + - "$ref": "#/components/parameters/enterprise" + - "$ref": "#/components/parameters/team-slug" + - name: since + description: Show usage metrics since this date. This is a timestamp in [ISO + 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`). + Maximum value is 28 days ago. + in: query + required: false + schema: + type: string + - name: until + description: Show usage metrics until this date. This is a timestamp in [ISO + 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`) + and should not preceed the `since` date if it is passed. + in: query + required: false + schema: + type: string + - "$ref": "#/components/parameters/page" + - name: per_page + description: The number of days of metrics to display per page (max 28). For + more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + in: query + schema: + type: integer + default: 28 + responses: + '200': + description: Response + content: + application/json: + schema: + type: array + items: + "$ref": "#/components/schemas/copilot-usage-metrics" + examples: + default: + "$ref": "#/components/examples/copilot-usage-metrics-org" + '500': + "$ref": "#/components/responses/internal_error" + '401': + "$ref": "#/components/responses/requires_authentication" + '403': + "$ref": "#/components/responses/forbidden" + '404': + "$ref": "#/components/responses/not_found" + x-github: + githubCloudOnly: false + enabledForGitHubApps: true + category: copilot + subcategory: copilot-usage "/events": get: summary: List public events @@ -7892,7 +7971,7 @@ paths: across an organization, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions. - The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day, + The response contains metrics for up to 28 days prior. Usage metrics are processed once per day for the previous day, and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics, they must have telemetry enabled in their IDE. @@ -12322,6 +12401,8 @@ paths: - PR_TITLE - COMMIT_OR_PR_TITLE description: |- + Required when using `squash_merge_commit_message`. + The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. @@ -12344,6 +12425,8 @@ paths: - PR_TITLE - MERGE_MESSAGE description: |- + Required when using `merge_commit_message`. + The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. @@ -12612,7 +12695,11 @@ paths: "/orgs/{org}/rulesets/{ruleset_id}": get: summary: Get an organization repository ruleset - description: Get a repository ruleset for an organization. + description: |- + Get a repository ruleset for an organization. + + **Note:** To prevent leaking sensitive information, the `bypass_actors` property is only returned if the user + making the API request has write access to the ruleset. tags: - repos operationId: repos/get-org-ruleset @@ -16078,6 +16165,8 @@ paths: - PR_TITLE - COMMIT_OR_PR_TITLE description: |- + Required when using `squash_merge_commit_message`. + The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. @@ -16100,6 +16189,8 @@ paths: - PR_TITLE - MERGE_MESSAGE description: |- + Required when using `merge_commit_message`. + The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. @@ -37165,7 +37256,11 @@ paths: "/repos/{owner}/{repo}/rulesets/{ruleset_id}": get: summary: Get a repository ruleset - description: Get a ruleset for a repository. + description: |- + Get a ruleset for a repository. + + **Note:** To prevent leaking sensitive information, the `bypass_actors` property is only returned if the user + making the API request has write access to the ruleset. tags: - repos operationId: repos/get-repo-ruleset @@ -45070,6 +45165,8 @@ paths: - PR_TITLE - COMMIT_OR_PR_TITLE description: |- + Required when using `squash_merge_commit_message`. + The default value for a squash merge commit title: - `PR_TITLE` - default to the pull request's title. @@ -45092,6 +45189,8 @@ paths: - PR_TITLE - MERGE_MESSAGE description: |- + Required when using `merge_commit_message`. + The default value for a merge commit title. - `PR_TITLE` - default to the pull request's title. @@ -66580,6 +66679,77 @@ components: - html_url - key - name + organization-simple: + title: Organization Simple + description: A GitHub organization. + type: object + properties: + login: + type: string + examples: + - github + id: + type: integer + examples: + - 1 + node_id: + type: string + examples: + - MDEyOk9yZ2FuaXphdGlvbjE= + url: + type: string + format: uri + examples: + - https://api.github.com/orgs/github + repos_url: + type: string + format: uri + examples: + - https://api.github.com/orgs/github/repos + events_url: + type: string + format: uri + examples: + - https://api.github.com/orgs/github/events + hooks_url: + type: string + examples: + - https://api.github.com/orgs/github/hooks + issues_url: + type: string + examples: + - https://api.github.com/orgs/github/issues + members_url: + type: string + examples: + - https://api.github.com/orgs/github/members{/member} + public_members_url: + type: string + examples: + - https://api.github.com/orgs/github/public_members{/member} + avatar_url: + type: string + examples: + - https://github.com/images/error/octocat_happy.gif + description: + type: + - string + - 'null' + examples: + - A great organization + required: + - login + - url + - id + - node_id + - repos_url + - events_url + - hooks_url + - issues_url + - members_url + - public_members_url + - avatar_url + - description team-simple: title: Team Simple description: Groups of organization members that gives permissions on specified @@ -66734,208 +66904,6 @@ components: - repositories_url - slug - parent - organization: - title: Organization - description: GitHub account for managing multiple users, teams, and repositories - type: object - properties: - login: - description: Unique login name of the organization - type: string - examples: - - new-org - url: - description: URL for the organization - type: string - format: uri - examples: - - https://api.github.com/orgs/github - id: - type: integer - node_id: - type: string - repos_url: - type: string - format: uri - events_url: - type: string - format: uri - hooks_url: - type: string - issues_url: - type: string - members_url: - type: string - public_members_url: - type: string - avatar_url: - type: string - description: - type: - - string - - 'null' - blog: - description: Display blog url for the organization - type: string - format: uri - examples: - - blog.example-org.com - html_url: - type: string - format: uri - name: - description: Display name for the organization - type: string - examples: - - New Org - company: - description: Display company name for the organization - type: string - examples: - - Acme corporation - location: - description: Display location for the organization - type: string - examples: - - Berlin, Germany - email: - description: Display email for the organization - type: string - format: email - examples: - - org@example.com - has_organization_projects: - description: Specifies if organization projects are enabled for this org - type: boolean - has_repository_projects: - description: Specifies if repository projects are enabled for repositories - that belong to this org - type: boolean - is_verified: - type: boolean - public_repos: - type: integer - public_gists: - type: integer - followers: - type: integer - following: - type: integer - type: - type: string - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - plan: - type: object - properties: - name: - type: string - space: - type: integer - private_repos: - type: integer - filled_seats: - type: integer - seats: - type: integer - required: - - login - - url - - id - - node_id - - repos_url - - events_url - - hooks_url - - issues_url - - members_url - - public_members_url - - avatar_url - - description - - html_url - - has_organization_projects - - has_repository_projects - - public_repos - - public_gists - - followers - - following - - type - - created_at - - updated_at - organization-simple: - title: Organization Simple - description: A GitHub organization. - type: object - properties: - login: - type: string - examples: - - github - id: - type: integer - examples: - - 1 - node_id: - type: string - examples: - - MDEyOk9yZ2FuaXphdGlvbjE= - url: - type: string - format: uri - examples: - - https://api.github.com/orgs/github - repos_url: - type: string - format: uri - examples: - - https://api.github.com/orgs/github/repos - events_url: - type: string - format: uri - examples: - - https://api.github.com/orgs/github/events - hooks_url: - type: string - examples: - - https://api.github.com/orgs/github/hooks - issues_url: - type: string - examples: - - https://api.github.com/orgs/github/issues - members_url: - type: string - examples: - - https://api.github.com/orgs/github/members{/member} - public_members_url: - type: string - examples: - - https://api.github.com/orgs/github/public_members{/member} - avatar_url: - type: string - examples: - - https://github.com/images/error/octocat_happy.gif - description: - type: - - string - - 'null' - examples: - - A great organization - required: - - login - - url - - id - - node_id - - repos_url - - events_url - - hooks_url - - issues_url - - members_url - - public_members_url - - avatar_url - - description enterprise-team: title: Enterprise Team description: Group of enterprise owners and/or members @@ -66996,8 +66964,6 @@ components: additionalProperties: true oneOf: - "$ref": "#/components/schemas/simple-user" - - "$ref": "#/components/schemas/team" - - "$ref": "#/components/schemas/organization" organization: type: - object @@ -69489,6 +69455,12 @@ components: type: string examples: - 192.0.2.1 + copilot: + type: array + items: + type: string + examples: + - 192.0.2.1 domains: type: object properties: @@ -199237,6 +199209,70 @@ components: push_protection_bypassed_at: resolution_comment: validity: unknown + copilot-usage-metrics-org: + value: + - day: '2023-10-15' + total_suggestions_count: 1000 + total_acceptances_count: 800 + total_lines_suggested: 1800 + total_lines_accepted: 1200 + total_active_users: 10 + total_chat_acceptances: 32 + total_chat_turns: 200 + total_active_chat_users: 4 + breakdown: + - language: python + editor: vscode + suggestions_count: 300 + acceptances_count: 250 + lines_suggested: 900 + lines_accepted: 700 + active_users: 5 + - language: python + editor: jetbrains + suggestions_count: 300 + acceptances_count: 200 + lines_suggested: 400 + lines_accepted: 300 + active_users: 2 + - language: ruby + editor: vscode + suggestions_count: 400 + acceptances_count: 350 + lines_suggested: 500 + lines_accepted: 200 + active_users: 3 + - day: '2023-10-16' + total_suggestions_count: 800 + total_acceptances_count: 600 + total_lines_suggested: 1100 + total_lines_accepted: 700 + total_active_users: 12 + total_chat_acceptances: 57 + total_chat_turns: 426 + total_active_chat_users: 8 + breakdown: + - language: python + editor: vscode + suggestions_count: 300 + acceptances_count: 200 + lines_suggested: 600 + lines_accepted: 300 + active_users: 2 + - language: python + editor: jetbrains + suggestions_count: 300 + acceptances_count: 150 + lines_suggested: 300 + lines_accepted: 250 + active_users: 6 + - language: ruby + editor: vscode + suggestions_count: 200 + acceptances_count: 150 + lines_suggested: 200 + lines_accepted: 150 + active_users: 3 public-events-items: value: - id: '22249084947' @@ -200371,6 +200407,8 @@ components: - 192.0.2.1 dependabot: - 192.0.2.1 + copilot: + - 192.0.2.1 domains: website: - "*.example.com" @@ -201479,6 +201517,7 @@ components: secret_scanning_push_protection: enabled secret_scanning_validity_checks: enabled private_vulnerability_reporting: enabled + enforcement: enforced url: https://api.github.com/orgs/octo-org/code-security/configurations/17 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/view created_at: '2023-12-04T15:58:07Z' @@ -201497,6 +201536,7 @@ components: secret_scanning_push_protection: enabled secret_scanning_validity_checks: disabled private_vulnerability_reporting: enabled + enforcement: enforced url: https://api.github.com/orgs/octo-org/code-security/configurations/1326 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/edit/1326 created_at: '2024-05-10T00:00:00Z' @@ -201538,6 +201578,7 @@ components: secret_scanning_push_protection: enabled secret_scanning_validity_checks: enabled private_vulnerability_reporting: enabled + enforcement: enforced url: https://api.github.com/orgs/octo-org/code-security/configurations/1325 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/edit/1325 created_at: '2024-05-01T00:00:00Z' @@ -201558,6 +201599,7 @@ components: secret_scanning_push_protection: enabled secret_scanning_validity_checks: disabled private_vulnerability_reporting: enabled + enforcement: enforced url: https://api.github.com/orgs/octo-org/code-security/configurations/17 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/view created_at: '2023-12-04T15:58:07Z' @@ -201577,6 +201619,7 @@ components: secret_scanning_push_protection: disabled secret_scanning_validity_checks: disabled private_vulnerability_reporting: disabled + enforcement: enforced url: https://api.github.com/orgs/octo-org/code-security/configurations/1325 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/edit/1325 created_at: '2024-05-01T00:00:00Z' @@ -202091,70 +202134,6 @@ components: inactive_this_cycle: 11 seat_management_setting: assign_selected public_code_suggestions: block - copilot-usage-metrics-org: - value: - - day: '2023-10-15' - total_suggestions_count: 1000 - total_acceptances_count: 800 - total_lines_suggested: 1800 - total_lines_accepted: 1200 - total_active_users: 10 - total_chat_acceptances: 32 - total_chat_turns: 200 - total_active_chat_users: 4 - breakdown: - - language: python - editor: vscode - suggestions_count: 300 - acceptances_count: 250 - lines_suggested: 900 - lines_accepted: 700 - active_users: 5 - - language: python - editor: jetbrains - suggestions_count: 300 - acceptances_count: 200 - lines_suggested: 400 - lines_accepted: 300 - active_users: 2 - - language: ruby - editor: vscode - suggestions_count: 400 - acceptances_count: 350 - lines_suggested: 500 - lines_accepted: 200 - active_users: 3 - - day: '2023-10-16' - total_suggestions_count: 800 - total_acceptances_count: 600 - total_lines_suggested: 1100 - total_lines_accepted: 700 - total_active_users: 12 - total_chat_acceptances: 57 - total_chat_turns: 426 - total_active_chat_users: 8 - breakdown: - - language: python - editor: vscode - suggestions_count: 300 - acceptances_count: 200 - lines_suggested: 600 - lines_accepted: 300 - active_users: 2 - - language: python - editor: jetbrains - suggestions_count: 300 - acceptances_count: 150 - lines_suggested: 300 - lines_accepted: 250 - active_users: 6 - - language: ruby - editor: vscode - suggestions_count: 200 - acceptances_count: 150 - lines_suggested: 200 - lines_accepted: 150 - active_users: 3 organization-dependabot-secret-paginated: value: total_count: 3 @@ -222542,6 +222521,13 @@ components: required: false schema: type: string + team-slug: + name: team_slug + description: The slug of the team name. + in: path + required: true + schema: + type: string gist-id: name: gist_id description: The unique identifier of the gist. @@ -222766,13 +222752,6 @@ components: required: true schema: type: string - team-slug: - name: team_slug - description: The slug of the team name. - in: path - required: true - schema: - type: string role-id: name: role_id description: The unique identifier of the role.