diff --git a/clients/GitHubEnterpriseCloud/README.md b/clients/GitHubEnterpriseCloud/README.md index fdd785178f7..c37d966a5e6 100644 --- a/clients/GitHubEnterpriseCloud/README.md +++ b/clients/GitHubEnterpriseCloud/README.md @@ -1962,6 +1962,62 @@ $client->operations()->copilot()->listCopilotSeatsForEnterprise( enterpri You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-enterprise). +### copilot/copilot-metrics-for-enterprise + +Get Copilot metrics for an enterprise + +Using the `call` method: +```php +$client->call('GET /enterprises/{enterprise}/copilot/metrics', [ + 'enterprise' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForEnterprise( enterprise: '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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise). + + +### copilot/copilot-metrics-for-enterprise + +Get Copilot metrics for an enterprise + +Using the `call` method: +```php +$client->call('LIST /enterprises/{enterprise}/copilot/metrics', [ + 'enterprise' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForEnterpriseListing( enterprise: '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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise). + + ### copilot/usage-metrics-for-enterprise Get a summary of Copilot usage for enterprise members @@ -2302,6 +2358,66 @@ $client->operations()->billing()->getGithubBillingUsageReportGhe( enterpr You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-billing-usage-report-for-an-enterprise). +### copilot/copilot-metrics-for-enterprise-team + +Get Copilot metrics for an enterprise team + +Using the `call` method: +```php +$client->call('GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics', [ + 'enterprise' => 'generated', + 'team_slug' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForEnterpriseTeam( 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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise-team). + + +### copilot/copilot-metrics-for-enterprise-team + +Get Copilot metrics for an enterprise team + +Using the `call` method: +```php +$client->call('LIST /enterprises/{enterprise}/team/{team_slug}/copilot/metrics', [ + 'enterprise' => 'generated', + 'team_slug' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForEnterpriseTeamListing( 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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise-team). + + ### copilot/usage-metrics-for-enterprise-team Get a summary of Copilot usage for an enterprise team @@ -6116,6 +6232,62 @@ $client->operations()->copilot()->cancelCopilotSeatAssignmentForUsers( or You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/copilot/copilot-user-management#remove-users-from-the-copilot-subscription-for-an-organization). +### copilot/copilot-metrics-for-organization + +Get Copilot metrics for an organization + +Using the `call` method: +```php +$client->call('GET /orgs/{org}/copilot/metrics', [ + 'org' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForOrganization( org: '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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-organization). + + +### copilot/copilot-metrics-for-organization + +Get Copilot metrics for an organization + +Using the `call` method: +```php +$client->call('LIST /orgs/{org}/copilot/metrics', [ + 'org' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForOrganizationListing( org: '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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-organization). + + ### copilot/usage-metrics-for-org Get a summary of Copilot usage for organization members @@ -10038,6 +10210,66 @@ $client->operations()->teams()->listIdpGroupsForOrg( org: 'generated', You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-an-organization). +### copilot/copilot-metrics-for-team + +Get Copilot metrics for a team + +Using the `call` method: +```php +$client->call('GET /orgs/{org}/team/{team_slug}/copilot/metrics', [ + 'org' => 'generated', + 'team_slug' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForTeam( org: '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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-a-team). + + +### copilot/copilot-metrics-for-team + +Get Copilot metrics for a team + +Using the `call` method: +```php +$client->call('LIST /orgs/{org}/team/{team_slug}/copilot/metrics', [ + 'org' => 'generated', + 'team_slug' => 'generated', + 'since' => 'generated', + 'until' => 'generated', + 'page' => 1, + 'per_page' => 8, +]); +``` + +Operations method: +```php +$client->operations()->copilot()->copilotMetricsForTeamListing( org: '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/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-a-team). + + ### copilot/usage-metrics-for-team Get a summary of Copilot usage for a team diff --git a/clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state b/clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state index 6ffe8b9e830..01664858008 100644 --- a/clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state +++ b/clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state @@ -1,5 +1,5 @@ { - "specHash": "25c84342b0a57e02594127b0dd21daae", + "specHash": "fedf0d71c08f1b559e2c2e12a07bcb84", "generatedFiles": { "files": [ { @@ -12104,7 +12104,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Copilot.php", - "hash": "0fc0bd2dc489e4803f565e36424c27a1" + "hash": "aed1e41f26356ebb08a5216efc0238fa" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CheckAutomatedSecurityFixes.php", @@ -26072,7 +26072,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Copilot.php", - "hash": "fcaf2f21886cb67eae3d55149733c3a3" + "hash": "460d6fd9d96b86c5d5b9b4741898de53" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Pulls.php", @@ -26560,7 +26560,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Five.php", - "hash": "cb7d826c43fe180e6b9f6268536b74bc" + "hash": "185301118cc1712e30f1edfee14db654" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php", @@ -26568,7 +26568,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php", - "hash": "026f7e42d9e4e59874c87c4939cc12a7" + "hash": "1a7c8bb261e194035b3b6c279452b4e2" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Eight.php", @@ -26660,7 +26660,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Five.php", - "hash": "dc880ef38a537e30963c81bc90d8075f" + "hash": "1de17086c95a8637b744bd2e2fee3db5" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Two.php", @@ -26672,7 +26672,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Seven.php", - "hash": "44f1af0ca1124a15d9af1f39d023ca78" + "hash": "ce83f84d79bef7edb2a68862bc4f812d" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Eight.php", @@ -26768,7 +26768,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operators.php", - "hash": "114d2afb53dc54c1b327e200ac058350" + "hash": "78ce0b46035a1e1871adaaa7f4600b1e" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Root.php", @@ -28940,7 +28940,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrators.php", - "hash": "c8fa9a38d3127018425cf92e62b8a407" + "hash": "c65937245be52df4c5714c8593d4cfc5" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/EnterpriseAdmin\/ListProvisionedGroupsEnterprise.php", @@ -29740,11 +29740,11 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php", - "hash": "d4327cff15ed6791470ae0084e08653d" + "hash": "6bbcf54e3374f3804ad8abc42f0a303f" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php", - "hash": "8b24c3d0b4051f8068328f06fbbc0f44" + "hash": "638af93e91b1611aaad95aee48a38294" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon", @@ -30860,7 +30860,7 @@ }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Copilot.php", - "hash": "268f8666e9c58ca47173b409ad0d444b" + "hash": "1afb0f463ab213b53f2b0c04f44fcf3a" }, { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Usage.php", @@ -32821,6 +32821,174 @@ { "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/AliasAbstract\/TietF9118D54\/Tiet0348F141\/Tiet9D635D6C\/TietE7315EF1.php", "hash": "ec5620cd0ddd8fd35d3f720fd62de8fb" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterprise.php", + "hash": "b6b634efbb03867b5b620c1c9aecb91b" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterprise.php", + "hash": "cebcf4e7ae4df2dddd6180ab175a4dc4" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTest.php", + "hash": "68d48fae426944284cbdef12e080548e" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseListing.php", + "hash": "b4e2f03760ef581b43baffa9203fd54b" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseListing.php", + "hash": "f94d06f5a4e35edd820e98e7aefbff49" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseListingTest.php", + "hash": "02a964d7216c03be1fd62c410128fe9d" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeam.php", + "hash": "add7c5b2f6c7c1cd02bb9045fa06bb0a" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeam.php", + "hash": "8eef6e54734c220ad24a82da07b5ba66" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamTest.php", + "hash": "b8d6e881f5f4ebf75150808732d46e74" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamListing.php", + "hash": "f5755ce639a5b740212a9e05cf476b26" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeamListing.php", + "hash": "dc8742055a09ba8eb7ab1f7e3e7b5bd5" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamListingTest.php", + "hash": "e4bbd2674e1b8f83d80d189973175f48" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganization.php", + "hash": "5fe1370e510104bb2526c92b398e9991" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganization.php", + "hash": "6aad600b542d0c1205369ebd803fe80e" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationTest.php", + "hash": "c939a6d58e11263ebf4258caa8d51795" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationListing.php", + "hash": "3c4526e1f3c814e8ef459eb83314361d" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganizationListing.php", + "hash": "d489d84b0e1cb734c4f86614bd52596e" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationListingTest.php", + "hash": "622b43b927baa7ad9970f88807da276d" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeam.php", + "hash": "a8b7ad59b0238f78be515e47677530bd" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeam.php", + "hash": "f54a280beafca10361540b4375428870" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamTest.php", + "hash": "7e08f26afa8b2b9f06dbfc0e1c39dc14" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamListing.php", + "hash": "eb8d0ffc46757d2259fa40453a28730d" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeamListing.php", + "hash": "a93e85a960eecee24066d7df98972918" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamListingTest.php", + "hash": "08b87f3576f6ed75c96a765245cbff4b" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions.php", + "hash": "1382cff84516824a6c9fb60081c94c2c" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeChat.php", + "hash": "f12f4f1f09543eeb20d6f2c951666e6c" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotDotcomChat.php", + "hash": "f9043b3ac15640e1eb62c3d40e33bbca" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotDotcomPullRequests.php", + "hash": "b6aed412b882b1c45e54fb1f66ae5407" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotUsageMetricsDay.php", + "hash": "d181f754551f8adcec069c84a4940947" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Languages.php", + "hash": "b66022abaea8fc648b8b2213bacf1ce6" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Editors.php", + "hash": "0b61aaa16f53bdbd59d02eb2811f92f4" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Editors\/Models.php", + "hash": "0b0f142bc8280c8de4780fbd36be7b38" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Editors\/Models\/Languages.php", + "hash": "a641dfc553c9f2cd7acbff8532aa67a8" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeChat\/Editors.php", + "hash": "c776c612b4978e3e332682058963d829" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotIdeChat\/Editors\/Models.php", + "hash": "5eeea478515978a3fc0ba8293a81a91c" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotDotcomChat\/Models.php", + "hash": "277504a47aa8d64eb72a075e496b6b27" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotDotcomPullRequests\/Repositories.php", + "hash": "edbe3ab2a610a334a0b02091590c7ef6" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CopilotDotcomPullRequests\/Repositories\/Models.php", + "hash": "173350447fe4875a5f1ee00ac5b2bb4b" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Metrics.php", + "hash": "6c9b199ff693737383405bf1e0d04e11" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Team\/TeamSlug\/Copilot\/Metrics.php", + "hash": "24115a46696038521520779a4f2ec57d" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Copilot\/Metrics.php", + "hash": "72e47b179baf01b34856d8e2213137e2" + }, + { + "name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Team\/TeamSlug\/Copilot\/Metrics.php", + "hash": "4ee33e9f889360c744665482b9bd1dcd" } ] }, diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Copilot/Metrics.php b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Copilot/Metrics.php new file mode 100644 index 00000000000..90c3ba38c5e --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Copilot/Metrics.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\GitHubEnterpriseCloud\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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⚡️GitHubEnterpriseCloud⚡️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/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Metrics.php b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Metrics.php new file mode 100644 index 00000000000..8038c2d48b0 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Metrics.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\GitHubEnterpriseCloud\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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⚡️GitHubEnterpriseCloud⚡️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/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Orgs/Org/Copilot/Metrics.php b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Orgs/Org/Copilot/Metrics.php new file mode 100644 index 00000000000..f88ab36799c --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Orgs/Org/Copilot/Metrics.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\GitHubEnterpriseCloud\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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⚡️GitHubEnterpriseCloud⚡️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/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Orgs/Org/Team/TeamSlug/Copilot/Metrics.php b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Orgs/Org/Team/TeamSlug/Copilot/Metrics.php new file mode 100644 index 00000000000..3b8ca8a5611 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Hydrator/Operation/Orgs/Org/Team/TeamSlug/Copilot/Metrics.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\GitHubEnterpriseCloud\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\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\GitHubEnterpriseCloud\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterpriseCloud⚡️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⚡️GitHubEnterpriseCloud⚡️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/GitHubEnterpriseCloud/src/Internal/Hydrators.php b/clients/GitHubEnterpriseCloud/src/Internal/Hydrators.php index c43395e6d29..61bf0ec55ef 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Hydrators.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Hydrators.php @@ -66,6 +66,7 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\Enterprises\Enterprise\CodeSecurityAndAnalysis|null $operation🌀Enterprises🌀Enterprise🌀CodeSecurityAndAnalysis = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\ConsumedLicenses|null $operation🌀Enterprises🌀Enterprise🌀ConsumedLicenses = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Billing\Seats|null $operation🌀Enterprises🌀Enterprise🌀Copilot🌀Billing🌀Seats = null; + private Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Metrics|null $operation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics = null; 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\LicenseSyncStatus|null $operation🌀Enterprises🌀Enterprise🌀LicenseSyncStatus = null; @@ -77,6 +78,7 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\Enterprises\Enterprise\Settings\Billing\Packages|null $operation🌀Enterprises🌀Enterprise🌀Settings🌀Billing🌀Packages = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\Settings\Billing\SharedStorage|null $operation🌀Enterprises🌀Enterprise🌀Settings🌀Billing🌀SharedStorage = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\Settings\Billing\Usage|null $operation🌀Enterprises🌀Enterprise🌀Settings🌀Billing🌀Usage = null; + private Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Metrics|null $operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Usage|null $operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Usage = null; private Internal\Hydrator\Operation\Enterprises\Enterprise\SecurityProduct\Enablement|null $operation🌀Enterprises🌀Enterprise🌀SecurityProduct🌀Enablement = null; private Internal\Hydrator\Operation\Events|null $operation🌀Events = null; @@ -171,6 +173,7 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\Orgs\Org\Copilot\Billing\Seats|null $operation🌀Orgs🌀Org🌀Copilot🌀Billing🌀Seats = null; private Internal\Hydrator\Operation\Orgs\Org\Copilot\Billing\SelectedTeams|null $operation🌀Orgs🌀Org🌀Copilot🌀Billing🌀SelectedTeams = null; private Internal\Hydrator\Operation\Orgs\Org\Copilot\Billing\SelectedUsers|null $operation🌀Orgs🌀Org🌀Copilot🌀Billing🌀SelectedUsers = null; + private Internal\Hydrator\Operation\Orgs\Org\Copilot\Metrics|null $operation🌀Orgs🌀Org🌀Copilot🌀Metrics = null; private Internal\Hydrator\Operation\Orgs\Org\Copilot\Usage|null $operation🌀Orgs🌀Org🌀Copilot🌀Usage = null; private Internal\Hydrator\Operation\Orgs\Org\CredentialAuthorizations|null $operation🌀Orgs🌀Org🌀CredentialAuthorizations = null; private Internal\Hydrator\Operation\Orgs\Org\CredentialAuthorizations\CredentialId|null $operation🌀Orgs🌀Org🌀CredentialAuthorizations🌀CredentialId = null; @@ -260,6 +263,7 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\Orgs\Org\Settings\Billing\Packages|null $operation🌀Orgs🌀Org🌀Settings🌀Billing🌀Packages = null; private Internal\Hydrator\Operation\Orgs\Org\Settings\Billing\SharedStorage|null $operation🌀Orgs🌀Org🌀Settings🌀Billing🌀SharedStorage = null; private Internal\Hydrator\Operation\Orgs\Org\TeamSync\Groups|null $operation🌀Orgs🌀Org🌀TeamSync🌀Groups = null; + private Internal\Hydrator\Operation\Orgs\Org\Team\TeamSlug\Copilot\Metrics|null $operation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics = null; private Internal\Hydrator\Operation\Orgs\Org\Team\TeamSlug\Copilot\Usage|null $operation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Usage = null; private Internal\Hydrator\Operation\Orgs\Org\Teams|null $operation🌀Orgs🌀Org🌀Teams = null; private Internal\Hydrator\Operation\Orgs\Org\Teams\TeamSlug|null $operation🌀Orgs🌀Org🌀Teams🌀TeamSlug = null; @@ -2037,6 +2041,15 @@ public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Copilot return $this->operation🌀Enterprises🌀Enterprise🌀Copilot🌀Billing🌀Seats; } + public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics(): Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Metrics + { + if ($this->operation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics instanceof Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Metrics === false) { + $this->operation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics = new Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Metrics(); + } + + return $this->operation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics; + } + public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Copilot🌀Usage(): Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Usage { if ($this->operation🌀Enterprises🌀Enterprise🌀Copilot🌀Usage instanceof Internal\Hydrator\Operation\Enterprises\Enterprise\Copilot\Usage === false) { @@ -2136,6 +2149,15 @@ public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Setting return $this->operation🌀Enterprises🌀Enterprise🌀Settings🌀Billing🌀Usage; } + public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics(): Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Metrics + { + if ($this->operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics instanceof Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Metrics === false) { + $this->operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics = new Internal\Hydrator\Operation\Enterprises\Enterprise\Team\TeamSlug\Copilot\Metrics(); + } + + return $this->operation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics; + } + 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) { @@ -2982,6 +3004,15 @@ public function getObjectMapperOperation🌀Orgs🌀Org🌀Copilot🌀Billing return $this->operation🌀Orgs🌀Org🌀Copilot🌀Billing🌀SelectedUsers; } + public function getObjectMapperOperation🌀Orgs🌀Org🌀Copilot🌀Metrics(): Internal\Hydrator\Operation\Orgs\Org\Copilot\Metrics + { + if ($this->operation🌀Orgs🌀Org🌀Copilot🌀Metrics instanceof Internal\Hydrator\Operation\Orgs\Org\Copilot\Metrics === false) { + $this->operation🌀Orgs🌀Org🌀Copilot🌀Metrics = new Internal\Hydrator\Operation\Orgs\Org\Copilot\Metrics(); + } + + return $this->operation🌀Orgs🌀Org🌀Copilot🌀Metrics; + } + public function getObjectMapperOperation🌀Orgs🌀Org🌀Copilot🌀Usage(): Internal\Hydrator\Operation\Orgs\Org\Copilot\Usage { if ($this->operation🌀Orgs🌀Org🌀Copilot🌀Usage instanceof Internal\Hydrator\Operation\Orgs\Org\Copilot\Usage === false) { @@ -3783,6 +3814,15 @@ public function getObjectMapperOperation🌀Orgs🌀Org🌀TeamSync🌀Groups(): return $this->operation🌀Orgs🌀Org🌀TeamSync🌀Groups; } + public function getObjectMapperOperation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics(): Internal\Hydrator\Operation\Orgs\Org\Team\TeamSlug\Copilot\Metrics + { + if ($this->operation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics instanceof Internal\Hydrator\Operation\Orgs\Org\Team\TeamSlug\Copilot\Metrics === false) { + $this->operation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics = new Internal\Hydrator\Operation\Orgs\Org\Team\TeamSlug\Copilot\Metrics(); + } + + return $this->operation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics; + } + public function getObjectMapperOperation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Usage(): Internal\Hydrator\Operation\Orgs\Org\Team\TeamSlug\Copilot\Usage { if ($this->operation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Usage instanceof Internal\Hydrator\Operation\Orgs\Org\Team\TeamSlug\Copilot\Usage === false) { diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterprise.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterprise.php new file mode 100644 index 00000000000..5a3aeed59cb --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterprise.php @@ -0,0 +1,118 @@ +enterprise = $enterprise; + $this->since = $since; + $this->until = $until; + $this->page = $page; + $this->perPage = $perPage; + } + + public function createRequest(): RequestInterface + { + return new Request('GET', str_replace(['{enterprise}', '{since}', '{until}', '{page}', '{per_page}'], [$this->enterprise, $this->since, $this->until, $this->page, $this->perPage], '/enterprises/{enterprise}/copilot/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseListing.php new file mode 100644 index 00000000000..b87f83d661a --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseListing.php @@ -0,0 +1,118 @@ +enterprise = $enterprise; + $this->since = $since; + $this->until = $until; + $this->page = $page; + $this->perPage = $perPage; + } + + public function createRequest(): RequestInterface + { + return new Request('GET', str_replace(['{enterprise}', '{since}', '{until}', '{page}', '{per_page}'], [$this->enterprise, $this->since, $this->until, $this->page, $this->perPage], '/enterprises/{enterprise}/copilot/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeam.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeam.php new file mode 100644 index 00000000000..e4a9e5f3eda --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeam.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/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListing.php new file mode 100644 index 00000000000..6881ed73199 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListing.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/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForOrganization.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForOrganization.php new file mode 100644 index 00000000000..adc19ae84ac --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForOrganization.php @@ -0,0 +1,118 @@ +org = $org; + $this->since = $since; + $this->until = $until; + $this->page = $page; + $this->perPage = $perPage; + } + + public function createRequest(): RequestInterface + { + return new Request('GET', str_replace(['{org}', '{since}', '{until}', '{page}', '{per_page}'], [$this->org, $this->since, $this->until, $this->page, $this->perPage], '/orgs/{org}/copilot/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForOrganizationListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForOrganizationListing.php new file mode 100644 index 00000000000..a90d986a783 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForOrganizationListing.php @@ -0,0 +1,118 @@ +org = $org; + $this->since = $since; + $this->until = $until; + $this->page = $page; + $this->perPage = $perPage; + } + + public function createRequest(): RequestInterface + { + return new Request('GET', str_replace(['{org}', '{since}', '{until}', '{page}', '{per_page}'], [$this->org, $this->since, $this->until, $this->page, $this->perPage], '/orgs/{org}/copilot/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForTeam.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForTeam.php new file mode 100644 index 00000000000..bffcbc6b6bb --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForTeam.php @@ -0,0 +1,121 @@ +org = $org; + $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(['{org}', '{team_slug}', '{since}', '{until}', '{page}', '{per_page}'], [$this->org, $this->teamSlug, $this->since, $this->until, $this->page, $this->perPage], '/orgs/{org}/team/{team_slug}/copilot/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForTeamListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForTeamListing.php new file mode 100644 index 00000000000..166cb8e45c0 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operation/Copilot/CopilotMetricsForTeamListing.php @@ -0,0 +1,121 @@ +org = $org; + $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(['{org}', '{team_slug}', '{since}', '{until}', '{page}', '{per_page}'], [$this->org, $this->teamSlug, $this->since, $this->until, $this->page, $this->perPage], '/orgs/{org}/team/{team_slug}/copilot/metrics' . '?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\CopilotUsageMetricsDay { + $error = new RuntimeException(); + try { + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CopilotUsageMetricsDay::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema')); + + return $this->hydrator->hydrateObject(Schema\CopilotUsageMetricsDay::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)); + /** + * 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)); + /** + * Copilot Usage Merics API setting is disabled at the organization or enterprise level. + **/ + + case 422: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(422, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + } + + break; + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php new file mode 100644 index 00000000000..d4ef1df3e5e --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php @@ -0,0 +1,41 @@ + */ + public function call(string $enterprise, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForEnterprise($this->responseSchemaValidator, $this->hydrator, $enterprise, $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/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseListing.php new file mode 100644 index 00000000000..ecb91173ec6 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseListing.php @@ -0,0 +1,41 @@ + */ + public function call(string $enterprise, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForEnterpriseListing($this->responseSchemaValidator, $this->hydrator, $enterprise, $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/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeam.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeam.php new file mode 100644 index 00000000000..15c7c67b36e --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeam.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\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForEnterpriseTeam($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/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeamListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeamListing.php new file mode 100644 index 00000000000..d122d82d8d5 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeamListing.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\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForEnterpriseTeamListing($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/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForOrganization.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForOrganization.php new file mode 100644 index 00000000000..b77708f600c --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForOrganization.php @@ -0,0 +1,41 @@ + */ + public function call(string $org, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForOrganization($this->responseSchemaValidator, $this->hydrator, $org, $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/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForOrganizationListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForOrganizationListing.php new file mode 100644 index 00000000000..96dfb50f3b3 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForOrganizationListing.php @@ -0,0 +1,41 @@ + */ + public function call(string $org, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForOrganizationListing($this->responseSchemaValidator, $this->hydrator, $org, $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/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForTeam.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForTeam.php new file mode 100644 index 00000000000..b272748eaf8 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForTeam.php @@ -0,0 +1,41 @@ + */ + public function call(string $org, string $teamSlug, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForTeam($this->responseSchemaValidator, $this->hydrator, $org, $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/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForTeamListing.php b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForTeamListing.php new file mode 100644 index 00000000000..08da2465e95 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForTeamListing.php @@ -0,0 +1,41 @@ + */ + public function call(string $org, string $teamSlug, string $since, string $until, int $page = 1, int $perPage = 28): iterable + { + $operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForTeamListing($this->responseSchemaValidator, $this->hydrator, $org, $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/GitHubEnterpriseCloud/src/Internal/Operators.php b/clients/GitHubEnterpriseCloud/src/Internal/Operators.php index de4eeed30e3..e73e7b0fec4 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Operators.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Operators.php @@ -97,6 +97,8 @@ final class Operators private Internal\Operator\SecretScanning\PatchSecurityAnalysisSettingsForEnterprise|null $secretScanning👷PatchSecurityAnalysisSettingsForEnterprise = null; private Internal\Operator\EnterpriseAdmin\GetConsumedLicenses|null $enterpriseAdmin👷GetConsumedLicenses = null; private Internal\Operator\Copilot\ListCopilotSeatsForEnterprise|null $copilot👷ListCopilotSeatsForEnterprise = null; + private Internal\Operator\Copilot\CopilotMetricsForEnterprise|null $copilot👷CopilotMetricsForEnterprise = null; + private Internal\Operator\Copilot\CopilotMetricsForEnterpriseListing|null $copilot👷CopilotMetricsForEnterpriseListing = null; private Internal\Operator\Copilot\UsageMetricsForEnterprise|null $copilot👷UsageMetricsForEnterprise = null; private Internal\Operator\Copilot\UsageMetricsForEnterpriseListing|null $copilot👷UsageMetricsForEnterpriseListing = null; private Internal\Operator\Dependabot\ListAlertsForEnterprise|null $dependabot👷ListAlertsForEnterprise = null; @@ -110,6 +112,8 @@ final class Operators private Internal\Operator\Billing\GetGithubPackagesBillingGhe|null $billing👷GetGithubPackagesBillingGhe = null; private Internal\Operator\Billing\GetSharedStorageBillingGhe|null $billing👷GetSharedStorageBillingGhe = null; private Internal\Operator\Billing\GetGithubBillingUsageReportGhe|null $billing👷GetGithubBillingUsageReportGhe = null; + private Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeam|null $copilot👷CopilotMetricsForEnterpriseTeam = null; + private Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeamListing|null $copilot👷CopilotMetricsForEnterpriseTeamListing = null; private Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam|null $copilot👷UsageMetricsForEnterpriseTeam = null; private Internal\Operator\Copilot\UsageMetricsForEnterpriseTeamListing|null $copilot👷UsageMetricsForEnterpriseTeamListing = null; private Internal\Operator\SecretScanning\PostSecurityProductEnablementForEnterprise|null $secretScanning👷PostSecurityProductEnablementForEnterprise = null; @@ -278,6 +282,8 @@ final class Operators private Internal\Operator\Copilot\CancelCopilotSeatAssignmentForTeams|null $copilot👷CancelCopilotSeatAssignmentForTeams = null; private Internal\Operator\Copilot\AddCopilotSeatsForUsers|null $copilot👷AddCopilotSeatsForUsers = null; private Internal\Operator\Copilot\CancelCopilotSeatAssignmentForUsers|null $copilot👷CancelCopilotSeatAssignmentForUsers = null; + private Internal\Operator\Copilot\CopilotMetricsForOrganization|null $copilot👷CopilotMetricsForOrganization = null; + private Internal\Operator\Copilot\CopilotMetricsForOrganizationListing|null $copilot👷CopilotMetricsForOrganizationListing = null; private Internal\Operator\Copilot\UsageMetricsForOrg|null $copilot👷UsageMetricsForOrg = null; private Internal\Operator\Copilot\UsageMetricsForOrgListing|null $copilot👷UsageMetricsForOrgListing = null; private Internal\Operator\Orgs\ListSamlSsoAuthorizations|null $orgs👷ListSamlSsoAuthorizations = null; @@ -438,6 +444,8 @@ final class Operators private Internal\Operator\Billing\GetGithubPackagesBillingOrg|null $billing👷GetGithubPackagesBillingOrg = null; private Internal\Operator\Billing\GetSharedStorageBillingOrg|null $billing👷GetSharedStorageBillingOrg = null; private Internal\Operator\Teams\ListIdpGroupsForOrg|null $teams👷ListIdpGroupsForOrg = null; + private Internal\Operator\Copilot\CopilotMetricsForTeam|null $copilot👷CopilotMetricsForTeam = null; + private Internal\Operator\Copilot\CopilotMetricsForTeamListing|null $copilot👷CopilotMetricsForTeamListing = null; private Internal\Operator\Copilot\UsageMetricsForTeam|null $copilot👷UsageMetricsForTeam = null; private Internal\Operator\Copilot\UsageMetricsForTeamListing|null $copilot👷UsageMetricsForTeamListing = null; private Internal\Operator\Teams\List_|null $teams👷List_ = null; @@ -2043,6 +2051,24 @@ public function copilot👷ListCopilotSeatsForEnterprise(): Internal\Operator\Co return $this->copilot👷ListCopilotSeatsForEnterprise; } + public function copilot👷CopilotMetricsForEnterprise(): Internal\Operator\Copilot\CopilotMetricsForEnterprise + { + if ($this->copilot👷CopilotMetricsForEnterprise instanceof Internal\Operator\Copilot\CopilotMetricsForEnterprise === false) { + $this->copilot👷CopilotMetricsForEnterprise = new Internal\Operator\Copilot\CopilotMetricsForEnterprise($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForEnterprise; + } + + public function copilot👷CopilotMetricsForEnterpriseListing(): Internal\Operator\Copilot\CopilotMetricsForEnterpriseListing + { + if ($this->copilot👷CopilotMetricsForEnterpriseListing instanceof Internal\Operator\Copilot\CopilotMetricsForEnterpriseListing === false) { + $this->copilot👷CopilotMetricsForEnterpriseListing = new Internal\Operator\Copilot\CopilotMetricsForEnterpriseListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForEnterpriseListing; + } + public function copilot👷UsageMetricsForEnterprise(): Internal\Operator\Copilot\UsageMetricsForEnterprise { if ($this->copilot👷UsageMetricsForEnterprise instanceof Internal\Operator\Copilot\UsageMetricsForEnterprise === false) { @@ -2160,6 +2186,24 @@ public function billing👷GetGithubBillingUsageReportGhe(): Internal\Operator\B return $this->billing👷GetGithubBillingUsageReportGhe; } + public function copilot👷CopilotMetricsForEnterpriseTeam(): Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeam + { + if ($this->copilot👷CopilotMetricsForEnterpriseTeam instanceof Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeam === false) { + $this->copilot👷CopilotMetricsForEnterpriseTeam = new Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeam($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForEnterpriseTeam; + } + + public function copilot👷CopilotMetricsForEnterpriseTeamListing(): Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeamListing + { + if ($this->copilot👷CopilotMetricsForEnterpriseTeamListing instanceof Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeamListing === false) { + $this->copilot👷CopilotMetricsForEnterpriseTeamListing = new Internal\Operator\Copilot\CopilotMetricsForEnterpriseTeamListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForEnterpriseTeamListing; + } + public function copilot👷UsageMetricsForEnterpriseTeam(): Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam { if ($this->copilot👷UsageMetricsForEnterpriseTeam instanceof Internal\Operator\Copilot\UsageMetricsForEnterpriseTeam === false) { @@ -3672,6 +3716,24 @@ public function copilot👷CancelCopilotSeatAssignmentForUsers(): Internal\Opera return $this->copilot👷CancelCopilotSeatAssignmentForUsers; } + public function copilot👷CopilotMetricsForOrganization(): Internal\Operator\Copilot\CopilotMetricsForOrganization + { + if ($this->copilot👷CopilotMetricsForOrganization instanceof Internal\Operator\Copilot\CopilotMetricsForOrganization === false) { + $this->copilot👷CopilotMetricsForOrganization = new Internal\Operator\Copilot\CopilotMetricsForOrganization($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForOrganization; + } + + public function copilot👷CopilotMetricsForOrganizationListing(): Internal\Operator\Copilot\CopilotMetricsForOrganizationListing + { + if ($this->copilot👷CopilotMetricsForOrganizationListing instanceof Internal\Operator\Copilot\CopilotMetricsForOrganizationListing === false) { + $this->copilot👷CopilotMetricsForOrganizationListing = new Internal\Operator\Copilot\CopilotMetricsForOrganizationListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForOrganizationListing; + } + public function copilot👷UsageMetricsForOrg(): Internal\Operator\Copilot\UsageMetricsForOrg { if ($this->copilot👷UsageMetricsForOrg instanceof Internal\Operator\Copilot\UsageMetricsForOrg === false) { @@ -5112,6 +5174,24 @@ public function teams👷ListIdpGroupsForOrg(): Internal\Operator\Teams\ListIdpG return $this->teams👷ListIdpGroupsForOrg; } + public function copilot👷CopilotMetricsForTeam(): Internal\Operator\Copilot\CopilotMetricsForTeam + { + if ($this->copilot👷CopilotMetricsForTeam instanceof Internal\Operator\Copilot\CopilotMetricsForTeam === false) { + $this->copilot👷CopilotMetricsForTeam = new Internal\Operator\Copilot\CopilotMetricsForTeam($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForTeam; + } + + public function copilot👷CopilotMetricsForTeamListing(): Internal\Operator\Copilot\CopilotMetricsForTeamListing + { + if ($this->copilot👷CopilotMetricsForTeamListing instanceof Internal\Operator\Copilot\CopilotMetricsForTeamListing === false) { + $this->copilot👷CopilotMetricsForTeamListing = new Internal\Operator\Copilot\CopilotMetricsForTeamListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + } + + return $this->copilot👷CopilotMetricsForTeamListing; + } + public function copilot👷UsageMetricsForTeam(): Internal\Operator\Copilot\UsageMetricsForTeam { if ($this->copilot👷UsageMetricsForTeam instanceof Internal\Operator\Copilot\UsageMetricsForTeam === false) { diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Copilot.php b/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Copilot.php index 0c38e404b57..f5dd6c7bf1a 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Copilot.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Copilot.php @@ -23,6 +23,45 @@ public function __construct(private SchemaValidator $requestSchemaValidator, pri { } + /** @return iterable */ + public function copilotMetricsForEnterprise(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('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\CopilotMetricsForEnterprise($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics()); + + return $operator->call($arguments['enterprise'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page']); + } + /** @return Observable */ public function usageMetricsForEnterprise(array $params): iterable { @@ -77,6 +116,45 @@ public function getCopilotOrganizationDetails(array $params): CopilotOrganizatio return $operator->call($arguments['org']); } + /** @return iterable */ + public function copilotMetricsForOrganization(array $params): iterable + { + $arguments = []; + 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('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\CopilotMetricsForOrganization($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Copilot🌀Metrics()); + + return $operator->call($arguments['org'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page']); + } + /** @return Observable */ public function usageMetricsForOrg(array $params): iterable { @@ -191,6 +269,51 @@ public function getCopilotSeatDetailsForUser(array $params): CopilotSeatDetails| return $operator->call($arguments['org'], $arguments['username']); } + /** @return iterable */ + public function copilotMetricsForEnterpriseTeam(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\CopilotMetricsForEnterpriseTeam($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + + return $operator->call($arguments['enterprise'], $arguments['team_slug'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page']); + } + /** @return Observable */ public function usageMetricsForEnterpriseTeam(array $params): iterable { @@ -236,6 +359,51 @@ public function usageMetricsForEnterpriseTeam(array $params): iterable return $operator->call($arguments['enterprise'], $arguments['team_slug'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page']); } + /** @return iterable */ + public function copilotMetricsForTeam(array $params): iterable + { + $arguments = []; + 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('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\CopilotMetricsForTeam($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + + return $operator->call($arguments['org'], $arguments['team_slug'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page']); + } + /** @return Observable */ public function usageMetricsForTeam(array $params): iterable { diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Five.php b/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Five.php index 9868f7d6c94..7c7557df8e9 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Five.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Five.php @@ -55,7 +55,7 @@ public function __construct(private Routers $routers) { } - /** @return |Observable|Observable|Observable|WithoutBody|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ + /** @return |Observable|iterable|Observable|Observable|WithoutBody|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ public function call(string $call, array $params, array $pathChunks): HookDelivery|ActionsEnterprisePermissions|Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\EnterpriseAdmin\ListSelfHostedRunnersForEnterprise\Response\ApplicationJson\Ok|iterable|WithoutBody|GistComment|MarketplacePurchase|BasicError|ThreadSubscription|ActionsOrganizationPermissions|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListSelfHostedRunnerGroupsForOrg\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListSelfHostedRunnersForOrg\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListOrgSecrets\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListOrgVariables\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Orgs\ListAttestations\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Codespaces\ListOrgSecrets\Response\ApplicationJson\Ok|CopilotOrganizationDetails|OrganizationCustomRepositoryRole|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Dependabot\ListOrgSecrets\Response\ApplicationJson\Ok|ExternalGroup|OrgHook|OrgMembership|Migration|OrganizationRole|RepositoryRuleset|GroupMapping|TeamFull|ProjectCard|CheckAutomatedSecurityFixes|CodeSecurityConfigurationForRepository|Json|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Repos\GetAllEnvironments\Response\ApplicationJson\Ok|Import|Installation|InteractionLimitResponse|One|Language|LicenseContent|Page|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Repos\CheckPrivateVulnerabilityReporting\Response\ApplicationJson\Ok|ContentFile|SimpleUser|Stargazer|RepositorySubscription|Topic|TeamDiscussion|TeamMembership|TeamProject|CodespacesUserPublicKey|CodespacesSecret|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Codespaces\CodespaceMachinesForAuthenticatedUser\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Apps\ListInstallationReposForAuthenticatedUser\Response\ApplicationJson\Ok|Package|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Users\ListAttestations\Response\ApplicationJson\Ok|EmptyObject { if ($pathChunks[0] === '') { @@ -92,7 +92,11 @@ public function call(string $call, array $params, array $pathChunks): HookDelive } } } elseif ($pathChunks[3] === 'copilot') { - if ($pathChunks[4] === 'usage') { + if ($pathChunks[4] === 'metrics') { + if ($call === 'GET /enterprises/{enterprise}/copilot/metrics') { + return $this->routers->internal🔀Router🔀Get🔀Copilot()->copilotMetricsForEnterprise($params); + } + } elseif ($pathChunks[4] === 'usage') { if ($call === 'GET /enterprises/{enterprise}/copilot/usage') { return $this->routers->internal🔀Router🔀Get🔀Copilot()->usageMetricsForEnterprise($params); } @@ -218,6 +222,10 @@ public function call(string $call, array $params, array $pathChunks): HookDelive if ($call === 'GET /orgs/{org}/copilot/billing') { return $this->routers->internal🔀Router🔀Get🔀Copilot()->getCopilotOrganizationDetails($params); } + } elseif ($pathChunks[4] === 'metrics') { + if ($call === 'GET /orgs/{org}/copilot/metrics') { + return $this->routers->internal🔀Router🔀Get🔀Copilot()->copilotMetricsForOrganization($params); + } } elseif ($pathChunks[4] === 'usage') { if ($call === 'GET /orgs/{org}/copilot/usage') { return $this->routers->internal🔀Router🔀Get🔀Copilot()->usageMetricsForOrg($params); diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Seven.php b/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Seven.php index d77e7443755..4df41800bb8 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Seven.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Seven.php @@ -67,7 +67,7 @@ public function __construct(private Routers $routers) { } - /** @return |Observable|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 */ + /** @return |iterable|Observable|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): Json|Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\EnterpriseAdmin\ListLabelsForSelfHostedRunnerForEnterprise\Response\ApplicationJson\Ok|iterable|OidcCustomSub|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListRepoAccessToSelfHostedRunnerGroupInOrg\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListSelfHostedRunnersInGroupForOrg\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListSelectedReposForOrgVariable\Response\ApplicationJson\Ok\Application\Json|WithoutBody|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Codespaces\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Dependabot\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|HookDelivery|TeamDiscussion|TeamMembership|TeamProject|GroupMapping|Artifact|ActionsCacheUsageByRepository|Job|ActionsWorkflowAccessToRepository|SelectedActions|ActionsGetDefaultWorkflowPermissions|Runner|WorkflowRun|ActionsPublicKey|ActionsSecret|ActionsVariable|Workflow|BranchProtection|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Checks\ListForSuite\Response\ApplicationJson\Ok|CodeScanningAlert|CodeScanningAnalysis|CodeScanningSarifsStatus|CodespacesPublicKey|RepoCodespacesSecret|RepositoryCollaboratorPermission|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Checks\ListForRef\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Checks\ListSuitesForRef\Response\ApplicationJson\Ok|CombinedCommitStatus|BasicError|DependabotAlert|DependabotPublicKey|DependabotSecret|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Repos\ListDeploymentBranchPolicies\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Repos\GetAllDeploymentProtectionRules\Response\ApplicationJson\Ok|\ApiClients\Client\GitHubEnterpriseCloud\Schema\Operations\Actions\ListEnvironmentSecrets\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHubEnterpriseCloud\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|GroupResponse|UserResponse|ScimUser|TeamDiscussionComment|PackageVersion { if ($pathChunks[0] === '') { @@ -98,7 +98,11 @@ public function call(string $call, array $params, array $pathChunks): Json|Ok|\A } elseif ($pathChunks[3] === 'team') { if ($pathChunks[4] === '{team_slug}') { if ($pathChunks[5] === 'copilot') { - if ($pathChunks[6] === 'usage') { + if ($pathChunks[6] === 'metrics') { + if ($call === 'GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics') { + return $this->routers->internal🔀Router🔀Get🔀Copilot()->copilotMetricsForEnterpriseTeam($params); + } + } elseif ($pathChunks[6] === 'usage') { if ($call === 'GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage') { return $this->routers->internal🔀Router🔀Get🔀Copilot()->usageMetricsForEnterpriseTeam($params); } @@ -208,7 +212,11 @@ public function call(string $call, array $params, array $pathChunks): Json|Ok|\A } elseif ($pathChunks[3] === 'team') { if ($pathChunks[4] === '{team_slug}') { if ($pathChunks[5] === 'copilot') { - if ($pathChunks[6] === 'usage') { + if ($pathChunks[6] === 'metrics') { + if ($call === 'GET /orgs/{org}/team/{team_slug}/copilot/metrics') { + return $this->routers->internal🔀Router🔀Get🔀Copilot()->copilotMetricsForTeam($params); + } + } elseif ($pathChunks[6] === 'usage') { if ($call === 'GET /orgs/{org}/team/{team_slug}/copilot/usage') { return $this->routers->internal🔀Router🔀Get🔀Copilot()->usageMetricsForTeam($params); } diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Copilot.php b/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Copilot.php index 394af6919a1..89286b8b4ba 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Copilot.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Copilot.php @@ -20,6 +20,51 @@ public function __construct(private SchemaValidator $requestSchemaValidator, pri { } + /** @return iterable */ + public function copilotMetricsForEnterpriseListing(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('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\CopilotMetricsForEnterpriseListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Copilot🌀Metrics()); + $items = [...$operator->call($arguments['enterprise'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page'])]; + + yield from $items; + + $arguments['page']++; + } while (count($items) > 0); + } + /** @return Observable */ public function usageMetricsForEnterpriseListing(array $params): iterable { @@ -65,6 +110,51 @@ public function usageMetricsForEnterpriseListing(array $params): iterable } while (count($items) > 0); } + /** @return iterable */ + public function copilotMetricsForOrganizationListing(array $params): iterable + { + $arguments = []; + 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('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\CopilotMetricsForOrganizationListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Copilot🌀Metrics()); + $items = [...$operator->call($arguments['org'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page'])]; + + yield from $items; + + $arguments['page']++; + } while (count($items) > 0); + } + /** @return Observable */ public function usageMetricsForOrgListing(array $params): iterable { @@ -110,6 +200,57 @@ public function usageMetricsForOrgListing(array $params): iterable } while (count($items) > 0); } + /** @return iterable */ + public function copilotMetricsForEnterpriseTeamListing(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\CopilotMetricsForEnterpriseTeamListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Enterprises🌀Enterprise🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + $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); + } + /** @return Observable */ public function usageMetricsForEnterpriseTeamListing(array $params): iterable { @@ -161,6 +302,57 @@ public function usageMetricsForEnterpriseTeamListing(array $params): iterable } while (count($items) > 0); } + /** @return iterable */ + public function copilotMetricsForTeamListing(array $params): iterable + { + $arguments = []; + 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('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\CopilotMetricsForTeamListing($this->browser, $this->authentication, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀Team🌀TeamSlug🌀Copilot🌀Metrics()); + $items = [...$operator->call($arguments['org'], $arguments['team_slug'], $arguments['since'], $arguments['until'], $arguments['page'], $arguments['per_page'])]; + + yield from $items; + + $arguments['page']++; + } while (count($items) > 0); + } + /** @return Observable */ public function usageMetricsForTeamListing(array $params): iterable { diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Five.php b/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Five.php index 386aefc3d36..af6fc356b2d 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Five.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Five.php @@ -16,7 +16,7 @@ public function __construct(private Routers $routers) { } - /** @return Observable|Observable|Observable|Observable|Schema\BasicError|WithoutBody|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ + /** @return Observable|iterable|Observable|Observable|Observable|Schema\BasicError|WithoutBody|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ public function call(string $call, array $params, array $pathChunks): iterable|BasicError|WithoutBody { if ($pathChunks[0] === '') { @@ -29,7 +29,11 @@ public function call(string $call, array $params, array $pathChunks): iterable|B } } } elseif ($pathChunks[3] === 'copilot') { - if ($pathChunks[4] === 'usage') { + if ($pathChunks[4] === 'metrics') { + if ($call === 'LIST /enterprises/{enterprise}/copilot/metrics') { + return $this->routers->internal🔀Router🔀List🔀Copilot()->copilotMetricsForEnterpriseListing($params); + } + } elseif ($pathChunks[4] === 'usage') { if ($call === 'LIST /enterprises/{enterprise}/copilot/usage') { return $this->routers->internal🔀Router🔀List🔀Copilot()->usageMetricsForEnterpriseListing($params); } @@ -65,7 +69,11 @@ public function call(string $call, array $params, array $pathChunks): iterable|B } } } elseif ($pathChunks[3] === 'copilot') { - if ($pathChunks[4] === 'usage') { + if ($pathChunks[4] === 'metrics') { + if ($call === 'LIST /orgs/{org}/copilot/metrics') { + return $this->routers->internal🔀Router🔀List🔀Copilot()->copilotMetricsForOrganizationListing($params); + } + } elseif ($pathChunks[4] === 'usage') { if ($call === 'LIST /orgs/{org}/copilot/usage') { return $this->routers->internal🔀Router🔀List🔀Copilot()->usageMetricsForOrgListing($params); } diff --git a/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Seven.php b/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Seven.php index 656da5beab9..980c20f3d1c 100644 --- a/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Seven.php +++ b/clients/GitHubEnterpriseCloud/src/Internal/Router/List/Seven.php @@ -14,7 +14,7 @@ public function __construct(private Routers $routers) { } - /** @return Observable|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|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] === '') { @@ -23,7 +23,11 @@ public function call(string $call, array $params, array $pathChunks): iterable|B if ($pathChunks[3] === 'team') { if ($pathChunks[4] === '{team_slug}') { if ($pathChunks[5] === 'copilot') { - if ($pathChunks[6] === 'usage') { + if ($pathChunks[6] === 'metrics') { + if ($call === 'LIST /enterprises/{enterprise}/team/{team_slug}/copilot/metrics') { + return $this->routers->internal🔀Router🔀List🔀Copilot()->copilotMetricsForEnterpriseTeamListing($params); + } + } elseif ($pathChunks[6] === 'usage') { if ($call === 'LIST /enterprises/{enterprise}/team/{team_slug}/copilot/usage') { return $this->routers->internal🔀Router🔀List🔀Copilot()->usageMetricsForEnterpriseTeamListing($params); } @@ -47,7 +51,11 @@ public function call(string $call, array $params, array $pathChunks): iterable|B } elseif ($pathChunks[3] === 'team') { if ($pathChunks[4] === '{team_slug}') { if ($pathChunks[5] === 'copilot') { - if ($pathChunks[6] === 'usage') { + if ($pathChunks[6] === 'metrics') { + if ($call === 'LIST /orgs/{org}/team/{team_slug}/copilot/metrics') { + return $this->routers->internal🔀Router🔀List🔀Copilot()->copilotMetricsForTeamListing($params); + } + } elseif ($pathChunks[6] === 'usage') { if ($call === 'LIST /orgs/{org}/team/{team_slug}/copilot/usage') { return $this->routers->internal🔀Router🔀List🔀Copilot()->usageMetricsForTeamListing($params); } diff --git a/clients/GitHubEnterpriseCloud/src/Operation/Copilot.php b/clients/GitHubEnterpriseCloud/src/Operation/Copilot.php index 3e2a8300689..6d8199019e5 100644 --- a/clients/GitHubEnterpriseCloud/src/Operation/Copilot.php +++ b/clients/GitHubEnterpriseCloud/src/Operation/Copilot.php @@ -25,6 +25,18 @@ public function listCopilotSeatsForEnterprise(string $enterprise, int $page, int return $this->operators->copilot👷ListCopilotSeatsForEnterprise()->call($enterprise, $page, $perPage); } + /** @return iterable */ + public function copilotMetricsForEnterprise(string $enterprise, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForEnterprise()->call($enterprise, $since, $until, $page, $perPage); + } + + /** @return iterable */ + public function copilotMetricsForEnterpriseListing(string $enterprise, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForEnterpriseListing()->call($enterprise, $since, $until, $page, $perPage); + } + /** @return Observable */ public function usageMetricsForEnterprise(string $enterprise, string $since, string $until, int $page, int $perPage): iterable { @@ -37,6 +49,18 @@ public function usageMetricsForEnterpriseListing(string $enterprise, string $sin return $this->operators->copilot👷UsageMetricsForEnterpriseListing()->call($enterprise, $since, $until, $page, $perPage); } + /** @return iterable */ + public function copilotMetricsForEnterpriseTeam(string $enterprise, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForEnterpriseTeam()->call($enterprise, $teamSlug, $since, $until, $page, $perPage); + } + + /** @return iterable */ + public function copilotMetricsForEnterpriseTeamListing(string $enterprise, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForEnterpriseTeamListing()->call($enterprise, $teamSlug, $since, $until, $page, $perPage); + } + /** @return Observable */ public function usageMetricsForEnterpriseTeam(string $enterprise, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable { @@ -85,6 +109,18 @@ public function cancelCopilotSeatAssignmentForUsers(string $org, array $params): return $this->operators->copilot👷CancelCopilotSeatAssignmentForUsers()->call($org, $params); } + /** @return iterable */ + public function copilotMetricsForOrganization(string $org, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForOrganization()->call($org, $since, $until, $page, $perPage); + } + + /** @return iterable */ + public function copilotMetricsForOrganizationListing(string $org, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForOrganizationListing()->call($org, $since, $until, $page, $perPage); + } + /** @return Observable */ public function usageMetricsForOrg(string $org, string $since, string $until, int $page, int $perPage): iterable { @@ -103,6 +139,18 @@ public function getCopilotSeatDetailsForUser(string $org, string $username): Cop return $this->operators->copilot👷GetCopilotSeatDetailsForUser()->call($org, $username); } + /** @return iterable */ + public function copilotMetricsForTeam(string $org, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForTeam()->call($org, $teamSlug, $since, $until, $page, $perPage); + } + + /** @return iterable */ + public function copilotMetricsForTeamListing(string $org, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable + { + return $this->operators->copilot👷CopilotMetricsForTeamListing()->call($org, $teamSlug, $since, $until, $page, $perPage); + } + /** @return Observable */ public function usageMetricsForTeam(string $org, string $teamSlug, string $since, string $until, int $page, int $perPage): iterable { diff --git a/clients/GitHubEnterpriseCloud/src/PHPStan/ClientCallReturnTypes.php b/clients/GitHubEnterpriseCloud/src/PHPStan/ClientCallReturnTypes.php index 8c7506efb4e..cbcd5d9c475 100644 --- a/clients/GitHubEnterpriseCloud/src/PHPStan/ClientCallReturnTypes.php +++ b/clients/GitHubEnterpriseCloud/src/PHPStan/ClientCallReturnTypes.php @@ -387,6 +387,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method return $this->typeResolver->resolve(''); } + if ($call === 'GET /enterprises/{enterprise}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + + if ($call === 'LIST /enterprises/{enterprise}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + if ($call === 'GET /enterprises/{enterprise}/copilot/usage') { return $this->typeResolver->resolve('Observable'); } @@ -439,6 +447,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method return $this->typeResolver->resolve(''); } + if ($call === 'GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + + if ($call === 'LIST /enterprises/{enterprise}/team/{team_slug}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + if ($call === 'GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage') { return $this->typeResolver->resolve('Observable'); } @@ -1111,6 +1127,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method return $this->typeResolver->resolve(''); } + if ($call === 'GET /orgs/{org}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + + if ($call === 'LIST /orgs/{org}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + if ($call === 'GET /orgs/{org}/copilot/usage') { return $this->typeResolver->resolve('Observable'); } @@ -1751,6 +1775,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method return $this->typeResolver->resolve(''); } + if ($call === 'GET /orgs/{org}/team/{team_slug}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + + if ($call === 'LIST /orgs/{org}/team/{team_slug}/copilot/metrics') { + return $this->typeResolver->resolve('iterable'); + } + if ($call === 'GET /orgs/{org}/team/{team_slug}/copilot/usage') { return $this->typeResolver->resolve('Observable'); } diff --git a/clients/GitHubEnterpriseCloud/src/Schema/CopilotDotcomChat.php b/clients/GitHubEnterpriseCloud/src/Schema/CopilotDotcomChat.php new file mode 100644 index 00000000000..1e05eb93e91 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/src/Schema/CopilotDotcomChat.php @@ -0,0 +1,87 @@ + '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/copilot/metrics?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\CopilotMetricsForEnterpriseListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = '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/copilot/metrics?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()->copilotMetricsForEnterpriseListing('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/copilot/metrics?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\CopilotMetricsForEnterpriseListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = '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/copilot/metrics?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()->copilotMetricsForEnterpriseListing('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/copilot/metrics?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\CopilotMetricsForEnterpriseListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = '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/copilot/metrics?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()->copilotMetricsForEnterpriseListing('generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/copilot/metrics?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\CopilotMetricsForEnterpriseListing::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = '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_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/copilot/metrics?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()->copilotMetricsForEnterpriseListing('generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListingTest.php b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListingTest.php new file mode 100644 index 00000000000..1f5b28fe538 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListingTest.php @@ -0,0 +1,195 @@ + '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/metrics?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\CopilotMetricsForEnterpriseTeamListing::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/metrics?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()->copilotMetricsForEnterpriseTeamListing('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/metrics?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\CopilotMetricsForEnterpriseTeamListing::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/metrics?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()->copilotMetricsForEnterpriseTeamListing('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/metrics?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\CopilotMetricsForEnterpriseTeamListing::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/metrics?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()->copilotMetricsForEnterpriseTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/metrics?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\CopilotMetricsForEnterpriseTeamListing::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_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/metrics?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()->copilotMetricsForEnterpriseTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamTest.php b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamTest.php new file mode 100644 index 00000000000..d4bfac9e0ff --- /dev/null +++ b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamTest.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/metrics?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\CopilotMetricsForEnterpriseTeam::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/metrics?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()->copilotMetricsForEnterpriseTeam('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/metrics?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\CopilotMetricsForEnterpriseTeam::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/metrics?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()->copilotMetricsForEnterpriseTeam('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/metrics?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\CopilotMetricsForEnterpriseTeam::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/metrics?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()->copilotMetricsForEnterpriseTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/metrics?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\CopilotMetricsForEnterpriseTeam::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_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/metrics?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()->copilotMetricsForEnterpriseTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTest.php b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTest.php new file mode 100644 index 00000000000..a28f49c2444 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTest.php @@ -0,0 +1,175 @@ + '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/copilot/metrics?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\CopilotMetricsForEnterprise::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = '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/copilot/metrics?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()->copilotMetricsForEnterprise('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/copilot/metrics?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\CopilotMetricsForEnterprise::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = '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/copilot/metrics?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()->copilotMetricsForEnterprise('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/copilot/metrics?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\CopilotMetricsForEnterprise::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = '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/copilot/metrics?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()->copilotMetricsForEnterprise('generated', 'generated', 'generated', 1, 8); + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/copilot/metrics?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\CopilotMetricsForEnterprise::OPERATION_MATCH, (static function (array $data): array { + $data['enterprise'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + } + + /** @test */ + public function operations_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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/copilot/metrics?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()->copilotMetricsForEnterprise('generated', 'generated', 'generated', 1, 8); + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationListingTest.php b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationListingTest.php new file mode 100644 index 00000000000..a470739b90f --- /dev/null +++ b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationListingTest.php @@ -0,0 +1,191 @@ + '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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganizationListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganizationListing('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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganizationListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganizationListing('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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganizationListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganizationListing('generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganizationListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganizationListing('generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationTest.php b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationTest.php new file mode 100644 index 00000000000..6e0ac981675 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationTest.php @@ -0,0 +1,175 @@ + '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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganization::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganization('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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganization::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganization('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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganization::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganization('generated', 'generated', 'generated', 1, 8); + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/copilot/metrics?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\CopilotMetricsForOrganization::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = 'generated'; + $data['since'] = 'generated'; + $data['until'] = 'generated'; + $data['page'] = 1; + $data['per_page'] = 8; + + return $data; + })([])); + } + + /** @test */ + public function operations_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/copilot/metrics?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()->copilotMetricsForOrganization('generated', 'generated', 'generated', 1, 8); + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForTeamListingTest.php b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForTeamListingTest.php new file mode 100644 index 00000000000..42901add372 --- /dev/null +++ b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForTeamListingTest.php @@ -0,0 +1,195 @@ + '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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeamListing('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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeamListing('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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeamListing::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeamListing('generated', 'generated', 'generated', 'generated', 1, 8); + foreach ($result as $item) { + } + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForTeamTest.php b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForTeamTest.php new file mode 100644 index 00000000000..601d74adb4f --- /dev/null +++ b/clients/GitHubEnterpriseCloud/tests/Internal/Operation/Copilot/CopilotMetricsForTeamTest.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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeam::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeam('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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeam::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeam('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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeam::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } + + /** @test */ + public function call_httpCode_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/team/generated/copilot/metrics?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\CopilotMetricsForTeam::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = '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_422_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(422, ['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', '/orgs/generated/team/generated/copilot/metrics?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()->copilotMetricsForTeam('generated', 'generated', 'generated', 'generated', 1, 8); + } +} diff --git a/clients/GitHubEnterpriseCloud/tests/Types/ClientCallReturnTypes.php b/clients/GitHubEnterpriseCloud/tests/Types/ClientCallReturnTypes.php index eb39ed77600..4a669d865a4 100644 --- a/clients/GitHubEnterpriseCloud/tests/Types/ClientCallReturnTypes.php +++ b/clients/GitHubEnterpriseCloud/tests/Types/ClientCallReturnTypes.php @@ -103,6 +103,8 @@ function authHeader(): string assertType('', $client->call('PATCH /enterprises/{enterprise}/code_security_and_analysis')); assertType('', $client->call('GET /enterprises/{enterprise}/consumed-licenses')); assertType('', $client->call('GET /enterprises/{enterprise}/copilot/billing/seats')); +assertType('iterable', $client->call('GET /enterprises/{enterprise}/copilot/metrics')); +assertType('iterable', $client->call('LIST /enterprises/{enterprise}/copilot/metrics')); assertType('Observable', $client->call('GET /enterprises/{enterprise}/copilot/usage')); assertType('Observable', $client->call('LIST /enterprises/{enterprise}/copilot/usage')); assertType('Observable|WithoutBody', $client->call('GET /enterprises/{enterprise}/dependabot/alerts')); @@ -116,6 +118,8 @@ function authHeader(): string assertType('', $client->call('GET /enterprises/{enterprise}/settings/billing/packages')); assertType('', $client->call('GET /enterprises/{enterprise}/settings/billing/shared-storage')); assertType('', $client->call('GET /enterprises/{enterprise}/settings/billing/usage')); +assertType('iterable', $client->call('GET /enterprises/{enterprise}/team/{team_slug}/copilot/metrics')); +assertType('iterable', $client->call('LIST /enterprises/{enterprise}/team/{team_slug}/copilot/metrics')); assertType('Observable', $client->call('GET /enterprises/{enterprise}/team/{team_slug}/copilot/usage')); assertType('Observable', $client->call('LIST /enterprises/{enterprise}/team/{team_slug}/copilot/usage')); assertType('', $client->call('POST /enterprises/{enterprise}/{security_product}/{enablement}')); @@ -284,6 +288,8 @@ function authHeader(): string assertType('', $client->call('DELETE /orgs/{org}/copilot/billing/selected_teams')); assertType('', $client->call('POST /orgs/{org}/copilot/billing/selected_users')); assertType('', $client->call('DELETE /orgs/{org}/copilot/billing/selected_users')); +assertType('iterable', $client->call('GET /orgs/{org}/copilot/metrics')); +assertType('iterable', $client->call('LIST /orgs/{org}/copilot/metrics')); assertType('Observable', $client->call('GET /orgs/{org}/copilot/usage')); assertType('Observable', $client->call('LIST /orgs/{org}/copilot/usage')); assertType('Observable', $client->call('GET /orgs/{org}/credential-authorizations')); @@ -444,6 +450,8 @@ function authHeader(): string assertType('', $client->call('GET /orgs/{org}/settings/billing/packages')); assertType('', $client->call('GET /orgs/{org}/settings/billing/shared-storage')); assertType('', $client->call('GET /orgs/{org}/team-sync/groups')); +assertType('iterable', $client->call('GET /orgs/{org}/team/{team_slug}/copilot/metrics')); +assertType('iterable', $client->call('LIST /orgs/{org}/team/{team_slug}/copilot/metrics')); assertType('Observable', $client->call('GET /orgs/{org}/team/{team_slug}/copilot/usage')); assertType('Observable', $client->call('LIST /orgs/{org}/team/{team_slug}/copilot/usage')); assertType('Observable', $client->call('GET /orgs/{org}/teams')); diff --git a/etc/specs/GitHubEnterpriseCloud/current.spec.yaml b/etc/specs/GitHubEnterpriseCloud/current.spec.yaml index 41258070366..ca58aab60db 100644 --- a/etc/specs/GitHubEnterpriseCloud/current.spec.yaml +++ b/etc/specs/GitHubEnterpriseCloud/current.spec.yaml @@ -3319,6 +3319,77 @@ paths: enabledForGitHubApps: true category: copilot subcategory: copilot-user-management + "/enterprises/{enterprise}/copilot/metrics": + get: + summary: Get Copilot metrics for an enterprise + description: |- + Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions. + + The response contains metrics for up to 28 days prior. 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. + + To access this endpoint, the Copilot Metrics API access policy must be enabled or set to "no policy" for the enterprise within GitHub settings. + Only enterprise owners and billing managers can view Copilot metrics for the enterprise. + + 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/copilot-metrics-for-enterprise + externalDocs: + description: API method documentation + url: https://docs.github.com/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise + parameters: + - "$ref": "#/components/parameters/enterprise" + - 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/enterprise-cloud@latest//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-day" + examples: + default: + "$ref": "#/components/examples/copilot-usage-metrics-for-day" + '500': + "$ref": "#/components/responses/internal_error" + '403': + "$ref": "#/components/responses/forbidden" + '404': + "$ref": "#/components/responses/not_found" + '422': + "$ref": "#/components/responses/usage_metrics_api_disabled" + x-github: + githubCloudOnly: false + enabledForGitHubApps: true + category: copilot + subcategory: copilot-metrics "/enterprises/{enterprise}/copilot/usage": get: summary: Get a summary of Copilot usage for enterprise members @@ -3836,6 +3907,81 @@ paths: enabledForGitHubApps: false category: enterprise-admin subcategory: billing + "/enterprises/{enterprise}/team/{team_slug}/copilot/metrics": + get: + summary: Get Copilot metrics for an enterprise team + description: |- + Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions. + + The response contains metrics for up to 28 days prior. 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** on that day, as evaluated at the end of that day. + + To access this endpoint, the Copilot Metrics API access policy must be enabled or set to "no policy" for the enterprise within GitHub settings. + Only owners and billing managers for the enterprise that contains the enterprise team can view Copilot 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/copilot-metrics-for-enterprise-team + externalDocs: + description: API method documentation + url: https://docs.github.com/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise-team + parameters: + - "$ref": "#/components/parameters/enterprise" + - "$ref": "#/components/parameters/enterprise-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/enterprise-cloud@latest//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-day" + examples: + default: + "$ref": "#/components/examples/copilot-usage-metrics-for-day" + '500': + "$ref": "#/components/responses/internal_error" + '403': + "$ref": "#/components/responses/forbidden" + '404': + "$ref": "#/components/responses/not_found" + '422': + "$ref": "#/components/responses/usage_metrics_api_disabled" + x-github: + githubCloudOnly: false + enabledForGitHubApps: true + category: copilot + subcategory: copilot-metrics "/enterprises/{enterprise}/team/{team_slug}/copilot/usage": get: summary: Get a summary of Copilot usage for an enterprise team @@ -11016,6 +11162,80 @@ paths: enabledForGitHubApps: true category: copilot subcategory: copilot-user-management + "/orgs/{org}/copilot/metrics": + get: + summary: Get Copilot metrics for an organization + description: |- + Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions. + + > [!NOTE] + > This endpoint will only return results for a given day if the organization contained **five or more members with active Copilot licenses** on that day, as evaluated at the end of that day. + + The response contains metrics for up to 28 days prior. 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. + + To access this endpoint, the Copilot Metrics API access policy must be enabled for the organization. + Only organization owners and owners and billing managers of the parent enterprise can view Copilot metrics. + + OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot`, `read:org`, or `read:enterprise` scopes to use this endpoint. + tags: + - copilot + operationId: copilot/copilot-metrics-for-organization + externalDocs: + description: API method documentation + url: https://docs.github.com/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-an-organization + parameters: + - "$ref": "#/components/parameters/org" + - 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/enterprise-cloud@latest//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-day" + examples: + default: + "$ref": "#/components/examples/copilot-usage-metrics-for-day" + '500': + "$ref": "#/components/responses/internal_error" + '403': + "$ref": "#/components/responses/forbidden" + '404': + "$ref": "#/components/responses/not_found" + '422': + "$ref": "#/components/responses/usage_metrics_api_disabled" + x-github: + githubCloudOnly: false + enabledForGitHubApps: true + category: copilot + subcategory: copilot-metrics "/orgs/{org}/copilot/usage": get: summary: Get a summary of Copilot usage for organization members @@ -17154,6 +17374,81 @@ paths: enabledForGitHubApps: true category: teams subcategory: team-sync + "/orgs/{org}/team/{team_slug}/copilot/metrics": + get: + summary: Get Copilot metrics for a team + description: |- + Use this endpoint to see a breakdown of aggregated metrics for various GitHub Copilot features. See the response schema tab for detailed metrics definitions. + + > [!NOTE] + > This endpoint will only return results for a given day if the team had **five or more members with active Copilot licenses** on that day, as evaluated at the end of that day. + + The response contains metrics for up to 28 days prior. 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. + + To access this endpoint, the Copilot Metrics API access policy must be enabled for the organization containing the team within GitHub settings. + Only organization owners for the organization that contains this team and owners and billing managers of the parent enterprise can view Copilot metrics for a team. + + OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot`, `read:org`, or `read:enterprise` scopes to use this endpoint. + tags: + - copilot + operationId: copilot/copilot-metrics-for-team + externalDocs: + description: API method documentation + url: https://docs.github.com/enterprise-cloud@latest//rest/copilot/copilot-metrics#get-copilot-metrics-for-a-team + parameters: + - "$ref": "#/components/parameters/org" + - "$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/enterprise-cloud@latest//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-day" + examples: + default: + "$ref": "#/components/examples/copilot-usage-metrics-for-day" + '500': + "$ref": "#/components/responses/internal_error" + '403': + "$ref": "#/components/responses/forbidden" + '404': + "$ref": "#/components/responses/not_found" + '422': + "$ref": "#/components/responses/usage_metrics_api_disabled" + x-github: + githubCloudOnly: false + enabledForGitHubApps: true + category: copilot + subcategory: copilot-metrics "/orgs/{org}/team/{team_slug}/copilot/usage": get: summary: Get a summary of Copilot usage for a team @@ -75368,6 +75663,295 @@ components: - assignee - created_at additionalProperties: false + copilot-ide-code-completions: + type: + - object + - 'null' + description: Usage metrics for Copilot editor code completions in the IDE. + additionalProperties: true + properties: + total_engaged_users: + type: integer + description: Number of users who accepted at least one Copilot code suggestion, + across all active editors. Includes both full and partial acceptances. + languages: + type: array + description: Code completion metrics for active languages. + items: + type: object + description: Usage metrics for a given language for the given editor for + Copilot code completions. + properties: + name: + type: string + description: Name of the language used for Copilot code completion + suggestions. + total_engaged_users: + type: integer + description: Number of users who accepted at least one Copilot code + completion suggestion for the given language. Includes both full + and partial acceptances. + editors: + type: array + items: + type: object + description: Copilot code completion metrics for active editors. + additionalProperties: true + properties: + name: + type: string + description: Name of the given editor. + total_engaged_users: + type: integer + description: Number of users who accepted at least one Copilot code + completion suggestion for the given editor. Includes both full and + partial acceptances. + models: + type: array + description: List of model metrics for custom models and the default + model. + items: + type: object + properties: + name: + type: string + description: Name of the language used for Copilot code completion + suggestions, for the given editor. + is_custom_model: + type: boolean + description: Indicates whether a model is custom or default. + custom_model_training_date: + type: + - string + - 'null' + description: The training date for the custom model. + total_engaged_users: + type: integer + description: Number of users who accepted at least one Copilot + code completion suggestion for the given editor, for the given + language and model. Includes both full and partial acceptances. + languages: + type: array + description: Code completion metrics for active languages, for + the given editor. + items: + type: object + description: Usage metrics for a given language for the given + editor for Copilot code completions. + properties: + name: + type: string + description: Name of the language used for Copilot code + completion suggestions, for the given editor. + total_engaged_users: + type: integer + description: Number of users who accepted at least one + Copilot code completion suggestion for the given editor, + for the given language. Includes both full and partial + acceptances. + total_code_suggestions: + type: integer + description: The number of Copilot code suggestions generated + for the given editor, for the given language. + total_code_acceptances: + type: integer + description: The number of Copilot code suggestions accepted + for the given editor, for the given language. Includes + both full and partial acceptances. + total_code_lines_suggested: + type: integer + description: The number of lines of code suggested by + Copilot code completions for the given editor, for the + given language. + total_code_lines_accepted: + type: integer + description: The number of lines of code accepted from + Copilot code suggestions for the given editor, for the + given language. + copilot-ide-chat: + type: + - object + - 'null' + description: Usage metrics for Copilot Chat in the IDE. + additionalProperties: true + properties: + total_engaged_users: + type: integer + description: Total number of users who prompted Copilot Chat in the IDE. + editors: + type: array + items: + type: object + description: Copilot Chat metrics, for active editors. + properties: + name: + type: string + description: Name of the given editor. + total_engaged_users: + type: integer + description: The number of users who prompted Copilot Chat in the + specified editor. + models: + type: array + description: List of model metrics for custom models and the default + model. + items: + type: object + properties: + name: + type: string + description: Name of the language used for Copilot code completion + suggestions, for the given editor. + is_custom_model: + type: boolean + description: Indicates whether a model is custom or default. + custom_model_training_date: + type: + - string + - 'null' + description: The training date for the custom model. + total_engaged_users: + type: integer + description: The number of users who prompted Copilot Chat in + the given editor and model. + total_chats: + type: integer + description: The total number of chats initiated by users in + the given editor and model. + total_chat_insertion_events: + type: integer + description: The number of times users accepted a code suggestion + from Copilot Chat using the 'Insert Code' UI element, for + the given editor. + total_chat_copy_events: + type: integer + description: The number of times users copied a code suggestion + from Copilot Chat using the keyboard, or the 'Copy' UI element, + for the given editor. + copilot-dotcom-chat: + type: + - object + - 'null' + description: Usage metrics for Copilot Chat in github.com + additionalProperties: true + properties: + total_engaged_users: + type: integer + description: Total number of users who prompted Copilot Chat on github.com + at least once. + models: + type: array + description: List of model metrics for a custom models and the default model. + items: + type: object + properties: + name: + type: string + description: Name of the language used for Copilot code completion + suggestions, for the given editor. + is_custom_model: + type: boolean + description: Indicates whether a model is custom or default. + custom_model_training_date: + type: + - string + - 'null' + description: The training date for the custom model (if applicable). + total_engaged_users: + type: integer + description: Total number of users who prompted Copilot Chat on github.com + at least once for each model. + total_chats: + type: integer + description: Total number of chats initiated by users on github.com. + copilot-dotcom-pull-requests: + type: + - object + - 'null' + description: Usage metrics for Copilot for pull requests. + additionalProperties: true + properties: + total_engaged_users: + type: integer + description: The number of users who used Copilot for Pull Requests on github.com + to generate a pull request summary at least once. + repositories: + type: array + description: Repositories in which users used Copilot for Pull Requests + to generate pull request summaries + items: + type: object + properties: + name: + type: string + description: Repository name + total_engaged_users: + type: integer + description: The number of users who generated pull request summaries + using Copilot for Pull Requests in the given repository. + models: + type: array + description: List of model metrics for custom models and the default + model. + items: + type: object + properties: + name: + type: string + description: Name of the language used for Copilot code completion + suggestions, for the given editor. + is_custom_model: + type: boolean + description: Indicates whether a model is custom or default. + custom_model_training_date: + type: + - string + - 'null' + description: The training date for the custom model. + total_pr_summaries_created: + type: integer + description: The number of pull request summaries generated + using Copilot for Pull Requests in the given repository. + total_engaged_users: + type: integer + description: The number of users who generated pull request + summaries using Copilot for Pull Requests in the given repository + and model. + copilot-usage-metrics-day: + title: Copilot Usage Metrics + description: Copilot usage metrics for a given day. + type: object + properties: + date: + type: string + format: date + description: The date for which the usage metrics are aggregated, in `YYYY-MM-DD` + format. + total_active_users: + type: integer + description: The total number of Copilot users with activity belonging to + any Copilot feature, globally, for the given day. Includes passive activity + such as receiving a code suggestion, as well as engagement activity such + as accepting a code suggestion or prompting chat. Does not include authentication + events. Is not limited to the individual features detailed on the endpoint. + total_engaged_users: + type: integer + description: The total number of Copilot users who engaged with any Copilot + feature, for the given day. Examples include but are not limited to accepting + a code suggestion, prompting Copilot chat, or triggering a PR Summary. + Does not include authentication events. Is not limited to the individual + features detailed on the endpoint. + copilot_ide_code_completions: + "$ref": "#/components/schemas/copilot-ide-code-completions" + copilot_ide_chat: + "$ref": "#/components/schemas/copilot-ide-chat" + copilot_dotcom_chat: + "$ref": "#/components/schemas/copilot-dotcom-chat" + copilot_dotcom_pull_requests: + "$ref": "#/components/schemas/copilot-dotcom-pull-requests" + required: + - date + additionalProperties: true copilot-usage-metrics: title: Copilot Usage Metrics description: Summary of Copilot usage. @@ -208803,6 +209387,105 @@ components: received_events_url: https://api.github.com/users/octokitten/received_events type: User site_admin: false + copilot-usage-metrics-for-day: + value: + - date: '2024-06-24' + total_active_users: 24 + total_engaged_users: 20 + copilot_ide_code_completions: + total_engaged_users: 20 + languages: + - name: python + total_engaged_users: 10 + - name: ruby + total_engaged_users: 10 + editors: + - name: vscode + total_engaged_users: 13 + models: + - name: default + is_custom_model: false + custom_model_training_date: + total_engaged_users: 13 + languages: + - name: python + total_engaged_users: 6 + total_code_suggestions: 249 + total_code_acceptances: 123 + total_code_lines_suggested: 225 + total_code_lines_accepted: 135 + - name: ruby + total_engaged_users: 7 + total_code_suggestions: 496 + total_code_acceptances: 253 + total_code_lines_suggested: 520 + total_code_lines_accepted: 270 + - name: neovim + total_engaged_users: 7 + models: + - name: a-custom-model + is_custom_model: true + custom_model_training_date: '2024-02-01' + languages: + - name: typescript + total_engaged_users: 3 + total_code_suggestions: 112 + total_code_acceptances: 56 + total_code_lines_suggested: 143 + total_code_lines_accepted: 61 + - name: go + total_engaged_users: 4 + total_code_suggestions: 132 + total_code_acceptances: 67 + total_code_lines_suggested: 154 + total_code_lines_accepted: 72 + copilot_ide_chat: + total_engaged_users: 13 + editors: + - name: vscode + total_engaged_users: 13 + models: + - name: default + is_custom_model: false + custom_model_training_date: + total_engaged_users: 12 + total_chats: 45 + total_chat_insertion_events: 12 + total_chat_copy_events: 16 + - name: a-custom-model + is_custom_model: true + custom_model_training_date: '2024-02-01' + total_engaged_users: 1 + total_chats: 10 + total_chat_insertion_events: 11 + total_chat_copy_events: 3 + copilot_dotcom_chat: + total_engaged_users: 14 + models: + - name: default + is_custom_model: false + custom_model_training_date: + total_engaged_users: 14 + total_chats: 38 + copilot_dotcom_pull_requests: + total_engaged_users: 12 + repositories: + - name: demo/repo1 + total_engaged_users: 8 + models: + - name: default + is_custom_model: false + custom_model_training_date: + total_pr_summaries_created: 6 + total_engaged_users: 8 + - name: demo/repo2 + total_engaged_users: 4 + models: + - name: a-custom-model + is_custom_model: true + custom_model_training_date: '2024-02-01' + total_pr_summaries_created: 10 + total_engaged_users: 4 copilot-usage-metrics-enterprise: value: - day: '2023-10-15' @@ -233175,6 +233858,13 @@ components: required: false schema: type: integer + enterprise-team-slug: + name: team_slug + description: The slug of the enterprise team name. + in: path + required: true + schema: + type: string team-slug: name: team_slug description: The slug of the team name. @@ -234407,6 +235097,13 @@ components: application/json: schema: "$ref": "#/components/schemas/basic-error" + usage_metrics_api_disabled: + description: Copilot Usage Merics API setting is disabled at the organization + or enterprise level. + content: + application/json: + schema: + "$ref": "#/components/schemas/basic-error" get_all_cost_centers: description: Response when getting cost centers content: