From 8364f79ea761b5f178d4ea95f59e42e170b79615 Mon Sep 17 00:00:00 2001 From: WyriHaximus <147145+WyriHaximus@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:12:07 +0000 Subject: [PATCH] [GitHub] Update to 1.1.4-4befd63c20b175c975d8d0d17534c658 from 1.1.4-df0040fe321f9d8e0f0fb0a6e8e300a9 Detected Schema changes: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ├─┬Paths │ ├──[➖] path (1768:3)❌ │ ├──[➖] path (1511:3)❌ │ ├──[➖] path (14066:3)❌ │ └──[➖] path (8784:3)❌ └─┬Components ├──[➖] responses (226164:7)❌ ├──[➖] parameters (225062:7)❌ ├──[➖] examples (200840:7)❌ ├──[➖] schemas (68597:7)❌ ├──[➖] schemas (68851:7)❌ ├──[➖] schemas (68762:7)❌ ├──[➖] schemas (68702:7)❌ └──[➖] schemas (68798:7)❌ ``` | Document Element | Total Changes | Breaking Changes | |------------------|---------------|------------------| | paths | 4 | 4 | | components | 8 | 8 | Date: 10/30/24 | Commit: New: etc/specs/GitHub/previous.spec.yaml, Original: etc/specs/GitHub/current.spec.yaml - ❌ **BREAKING Changes**: _12_ out of _12_ - **Removals**: _12_ - **Breaking Removals**: _12_ ERROR: breaking changes discovered --- clients/GitHub/README.md | 232 ++++++ .../GitHub/etc/openapi-client-generator.state | 192 ++++- .../Enterprise/Copilot/Metrics.php | 286 +++++++ .../Team/TeamSlug/Copilot/Metrics.php | 286 +++++++ .../Operation/Orgs/Org/Copilot/Metrics.php | 286 +++++++ .../Org/Team/TeamSlug/Copilot/Metrics.php | 286 +++++++ clients/GitHub/src/Internal/Hydrators.php | 40 + .../Copilot/CopilotMetricsForEnterprise.php | 118 +++ .../CopilotMetricsForEnterpriseListing.php | 118 +++ .../CopilotMetricsForEnterpriseTeam.php | 121 +++ ...CopilotMetricsForEnterpriseTeamListing.php | 121 +++ .../Copilot/CopilotMetricsForOrganization.php | 118 +++ .../CopilotMetricsForOrganizationListing.php | 118 +++ .../Copilot/CopilotMetricsForTeam.php | 121 +++ .../Copilot/CopilotMetricsForTeamListing.php | 121 +++ .../Copilot/CopilotMetricsForEnterprise.php | 41 ++ .../CopilotMetricsForEnterpriseListing.php | 41 ++ .../CopilotMetricsForEnterpriseTeam.php | 41 ++ ...CopilotMetricsForEnterpriseTeamListing.php | 41 ++ .../Copilot/CopilotMetricsForOrganization.php | 41 ++ .../CopilotMetricsForOrganizationListing.php | 41 ++ .../Copilot/CopilotMetricsForTeam.php | 41 ++ .../Copilot/CopilotMetricsForTeamListing.php | 41 ++ clients/GitHub/src/Internal/Operators.php | 80 ++ .../src/Internal/Router/Get/Copilot.php | 168 +++++ .../GitHub/src/Internal/Router/Get/Five.php | 12 +- .../GitHub/src/Internal/Router/Get/Seven.php | 14 +- .../src/Internal/Router/List/Copilot.php | 192 +++++ .../GitHub/src/Internal/Router/List/Five.php | 14 +- .../GitHub/src/Internal/Router/List/Seven.php | 14 +- clients/GitHub/src/Operation/Copilot.php | 48 ++ .../src/PHPStan/ClientCallReturnTypes.php | 32 + .../GitHub/src/Schema/CopilotDotcomChat.php | 87 +++ .../src/Schema/CopilotDotcomChat/Models.php | 63 ++ .../src/Schema/CopilotDotcomPullRequests.php | 130 ++++ .../Repositories.php | 88 +++ .../Repositories/Models.php | 63 ++ clients/GitHub/src/Schema/CopilotIdeChat.php | 145 ++++ .../src/Schema/CopilotIdeChat/Editors.php | 101 +++ .../Schema/CopilotIdeChat/Editors/Models.php | 77 ++ .../src/Schema/CopilotIdeCodeCompletions.php | 257 +++++++ .../CopilotIdeCodeCompletions/Editors.php | 154 ++++ .../Editors/Models.php | 109 +++ .../Editors/Models/Languages.php | 68 ++ .../CopilotIdeCodeCompletions/Languages.php | 40 + .../src/Schema/CopilotUsageMetricsDay.php | 594 +++++++++++++++ ...CopilotMetricsForEnterpriseListingTest.php | 191 +++++ ...lotMetricsForEnterpriseTeamListingTest.php | 195 +++++ .../CopilotMetricsForEnterpriseTeamTest.php | 179 +++++ .../CopilotMetricsForEnterpriseTest.php | 175 +++++ ...pilotMetricsForOrganizationListingTest.php | 191 +++++ .../CopilotMetricsForOrganizationTest.php | 175 +++++ .../CopilotMetricsForTeamListingTest.php | 195 +++++ .../Copilot/CopilotMetricsForTeamTest.php | 179 +++++ .../tests/Types/ClientCallReturnTypes.php | 8 + etc/specs/GitHub/current.spec.yaml | 697 ++++++++++++++++++ 56 files changed, 7604 insertions(+), 23 deletions(-) create mode 100644 clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Copilot/Metrics.php create mode 100644 clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Metrics.php create mode 100644 clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Copilot/Metrics.php create mode 100644 clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Team/TeamSlug/Copilot/Metrics.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterprise.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseListing.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeam.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListing.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForOrganization.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForOrganizationListing.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForTeam.php create mode 100644 clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForTeamListing.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseListing.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeam.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeamListing.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForOrganization.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForOrganizationListing.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForTeam.php create mode 100644 clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForTeamListing.php create mode 100644 clients/GitHub/src/Schema/CopilotDotcomChat.php create mode 100644 clients/GitHub/src/Schema/CopilotDotcomChat/Models.php create mode 100644 clients/GitHub/src/Schema/CopilotDotcomPullRequests.php create mode 100644 clients/GitHub/src/Schema/CopilotDotcomPullRequests/Repositories.php create mode 100644 clients/GitHub/src/Schema/CopilotDotcomPullRequests/Repositories/Models.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeChat.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeChat/Editors.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeChat/Editors/Models.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeCodeCompletions.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeCodeCompletions/Editors.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeCodeCompletions/Editors/Models.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeCodeCompletions/Editors/Models/Languages.php create mode 100644 clients/GitHub/src/Schema/CopilotIdeCodeCompletions/Languages.php create mode 100644 clients/GitHub/src/Schema/CopilotUsageMetricsDay.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseListingTest.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListingTest.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamTest.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTest.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationListingTest.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationTest.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForTeamListingTest.php create mode 100644 clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForTeamTest.php diff --git a/clients/GitHub/README.md b/clients/GitHub/README.md index 0494f37d014..4c96524f35e 100644 --- a/clients/GitHub/README.md +++ b/clients/GitHub/README.md @@ -856,6 +856,62 @@ $client->operations()->copilot()->listCopilotSeatsForEnterprise( enterpri You can find more about this operation over at the [API method documentation](https://docs.github.com/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/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/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-enterprise). + + ### copilot/usage-metrics-for-enterprise Get a summary of Copilot usage for enterprise members @@ -998,6 +1054,66 @@ $client->operations()->secretScanning()->listAlertsForEnterprise( enterpr You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise). +### copilot/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/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/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 @@ -4676,6 +4792,62 @@ $client->operations()->copilot()->cancelCopilotSeatAssignmentForUsers( or You can find more about this operation over at the [API method documentation](https://docs.github.com/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/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/rest/copilot/copilot-metrics#get-copilot-metrics-for-an-organization). + + ### copilot/usage-metrics-for-org Get a summary of Copilot usage for organization members @@ -8106,6 +8278,66 @@ $client->operations()->billing()->getSharedStorageBillingOrg( org: 'gener You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/billing/billing#get-shared-storage-billing-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/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/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/GitHub/etc/openapi-client-generator.state b/clients/GitHub/etc/openapi-client-generator.state index 1fce406c920..7f9a0b6d89d 100644 --- a/clients/GitHub/etc/openapi-client-generator.state +++ b/clients/GitHub/etc/openapi-client-generator.state @@ -1,5 +1,5 @@ { - "specHash": "df0040fe321f9d8e0f0fb0a6e8e300a9", + "specHash": "4befd63c20b175c975d8d0d17534c658", "generatedFiles": { "files": [ { @@ -11632,7 +11632,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Copilot.php", - "hash": "a79dc3f0dcb2f1ffb46ad26530ad825c" + "hash": "6ade6b422ebb9bea2565934472391a0c" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CheckAutomatedSecurityFixes.php", @@ -24436,7 +24436,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Copilot.php", - "hash": "df4e323dcf743fccccafd577190f0e36" + "hash": "0659af6cea81d05da85721e8288a2f95" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Pulls.php", @@ -24872,7 +24872,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Five.php", - "hash": "79bca1614fb98a90b022bf82b70b4c16" + "hash": "a59507c14867ec757a540569fd6b2046" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php", @@ -24880,7 +24880,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php", - "hash": "8ae810dfd0cbd28b94429829ab2aef5d" + "hash": "7dcff0ea5a9034872b56f76ab8678ef0" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Eight.php", @@ -24976,7 +24976,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Five.php", - "hash": "847f3fb360c2b185cfe50d6fb2ad225b" + "hash": "37adf0b0c605ed4b34da57553d40612a" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Six.php", @@ -24984,7 +24984,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Seven.php", - "hash": "0f584cb34feab43604b13233fbb87a66" + "hash": "c955792e85ba9471e9a8eca2796c599b" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Eight.php", @@ -25080,7 +25080,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operators.php", - "hash": "02f0e8d80d1579a92222b772333b2ab5" + "hash": "73bddde1d49a446e360798671c62f0d1" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Root.php", @@ -27072,7 +27072,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrators.php", - "hash": "363bb9819bf820699d3018eb478c1271" + "hash": "153e70befe62b6935d238622606cbced" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/OrganizationSimpleWebhooks.php", @@ -27656,11 +27656,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php", - "hash": "3302362401a401605189ce99fd6b4c38" + "hash": "6d60fc896e49c812335d4df8359d7a6d" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php", - "hash": "0125b05333c46f6094096673d2a9fb7a" + "hash": "d509d66ebb56bf9cb33ba8f6415a27a3" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon", @@ -28700,7 +28700,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Copilot.php", - "hash": "3c5a85785078faff19611eba011b2adb" + "hash": "c481d55963d10b120edcfa7f38ce045c" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Usage.php", @@ -30645,6 +30645,174 @@ { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/AliasAbstract\/TietF9118D54\/Tiet0348F141\/Tiet9D635D6C\/TietE7315EF1.php", "hash": "3e4fdc80247873aa80d031284a7a4885" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterprise.php", + "hash": "25e6cec4db8a9aa99bcb1bee247b4055" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterprise.php", + "hash": "399a6aa023a04ea00bd3f67d476c1470" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTest.php", + "hash": "6e0d95ca72aa7908ba97c848f7e5f211" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseListing.php", + "hash": "ad390b48c79a4e79465dace9b2f1fe04" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseListing.php", + "hash": "2ce9f340b29fd008da29cc42965a0793" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseListingTest.php", + "hash": "6c5b9e4415fdca6fc99f65c4e6772c46" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeam.php", + "hash": "3b265ba8cc3809c501233168d460be90" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeam.php", + "hash": "079572f2c14ba2251377966d5cb0f495" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamTest.php", + "hash": "917d8afd41598239d6091db27595c530" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamListing.php", + "hash": "ecc72771936b45f2351fca926685e012" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeamListing.php", + "hash": "e27d1d3e0589130b81f0ffb0ff2ac456" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamListingTest.php", + "hash": "bca563c479577cd8a19f243a795a682d" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganization.php", + "hash": "486cb5cf0bd8f2c1d58260fffa38b41c" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganization.php", + "hash": "9dba5bb250e3b77d8a0ec7e8a126a2a6" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationTest.php", + "hash": "11db910f3255b9dae6a4af7959e24690" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationListing.php", + "hash": "93e4bb77fdd71f66f07ba5376732305b" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganizationListing.php", + "hash": "7a6ccd80e4b684213f121e7d9e8bf094" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationListingTest.php", + "hash": "74c802f1127d3cbf1033a7a165ba9988" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeam.php", + "hash": "6e85e6a0a644fa84748bb3735591d635" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeam.php", + "hash": "6bd86aa3e8852b527319d04049f2011c" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamTest.php", + "hash": "2312e3d07518725413cc13da57e974ff" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamListing.php", + "hash": "924050fe38f6e57f62dc2ec125f82fa0" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeamListing.php", + "hash": "40043b868a899e74f4f8e23427ba5ecb" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamListingTest.php", + "hash": "f4a2fdca8df7950b17cbc6ac51d833a7" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions.php", + "hash": "cbb356d737bf5e0900da19ae566b9401" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeChat.php", + "hash": "07eae63bdb39afff7422c8d9010e1ef8" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotDotcomChat.php", + "hash": "e58931f4bfabd1ae146c0f87871984a1" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotDotcomPullRequests.php", + "hash": "3bb2dbca3c4f63c37f1d96fdc918c4d9" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotUsageMetricsDay.php", + "hash": "e67f119e5f1587a1bc59a36f5f6909e8" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Languages.php", + "hash": "e11abfbba137d9bea6d64c68769a07db" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Editors.php", + "hash": "be6a98f5c5b59230fdc034d0360be4fd" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Editors\/Models.php", + "hash": "f7faf46d0e7dae726dc35247197af397" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeCodeCompletions\/Editors\/Models\/Languages.php", + "hash": "c59f7aaa800a0f1d7402438c24ec30b6" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeChat\/Editors.php", + "hash": "4923208c1c44e07ccbeed505aa864bfc" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotIdeChat\/Editors\/Models.php", + "hash": "4b4a355950e8f8a4ab22984faeb69d27" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotDotcomChat\/Models.php", + "hash": "a90b60695d9ef3a953f17e075c904a4a" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotDotcomPullRequests\/Repositories.php", + "hash": "7793cded23c157f9b2e584efa72ffbef" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CopilotDotcomPullRequests\/Repositories\/Models.php", + "hash": "382068e789c1d8685c7cd034ce61ff0c" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Metrics.php", + "hash": "713ba6790893820994349ed247cb6070" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Team\/TeamSlug\/Copilot\/Metrics.php", + "hash": "d17550790fe1693a09851f76966e6fd6" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Copilot\/Metrics.php", + "hash": "c1d4dd29d1ecffb6793b50fa1dfb2fbe" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Team\/TeamSlug\/Copilot\/Metrics.php", + "hash": "e86a62d972b96c0dfef1bb5449415923" } ] }, diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Copilot/Metrics.php b/clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Copilot/Metrics.php new file mode 100644 index 00000000000..4c6eaecbbfc --- /dev/null +++ b/clients/GitHub/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\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError + { + $properties = []; + $missingFields = []; + try { + $value = $payload['message'] ?? null; + + if ($value === null) { + $properties['message'] = null; + goto after_message; + } + + $properties['message'] = $value; + + after_message: + + $value = $payload['documentation_url'] ?? null; + + if ($value === null) { + $properties['documentationUrl'] = null; + goto after_documentationUrl; + } + + $properties['documentationUrl'] = $value; + + after_documentationUrl: + + $value = $payload['url'] ?? null; + + if ($value === null) { + $properties['url'] = null; + goto after_url; + } + + $properties['url'] = $value; + + after_url: + + $value = $payload['status'] ?? null; + + if ($value === null) { + $properties['status'] = null; + goto after_status; + } + + $properties['status'] = $value; + + after_status: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new BasicError(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + } + + private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array + { + foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) { + if (is_a($object, $valueType)) { + return [$accessor => $payloadType] + $this->{$method}($object); + } + } + + throw new LogicException('No type mapped for object of class: ' . $object::class); + } + + public function serializeObject(object $object): mixed + { + return $this->serializeObjectOfType($object, $object::class); + } + + /** + * @param T $object + * @param class-string $className + * + * @template T + */ + public function serializeObjectOfType(object $object, string $className): mixed + { + try { + return match ($className) { + 'array' => $this->serializeValuearray($object), + 'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object), + 'DateTime' => $this->serializeValueDateTime($object), + 'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object), + 'DateTimeInterface' => $this->serializeValueDateTimeInterface($object), + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object), + default => throw new LogicException("No serialization defined for $className"), + }; + } catch (Throwable $exception) { + throw UnableToSerializeObject::dueToError($className, $exception); + } + } + + private function serializeValuearray(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeArrayItems(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueRamsey⚡️Uuid⚡️UuidInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeUuidToString(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTime(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeImmutable(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed + { + assert($object instanceof BasicError); + $result = []; + + $message = $object->message; + + if ($message === null) { + goto after_message; + } + + after_message: $result['message'] = $message; + + $documentationUrl = $object->documentationUrl; + + if ($documentationUrl === null) { + goto after_documentationUrl; + } + + after_documentationUrl: $result['documentation_url'] = $documentationUrl; + + $url = $object->url; + + if ($url === null) { + goto after_url; + } + + after_url: $result['url'] = $url; + + $status = $object->status; + + if ($status === null) { + goto after_status; + } + + after_status: $result['status'] = $status; + + return $result; + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToHydrateObject + * + * @template T + */ + public function hydrateObjects(string $className, iterable $payloads): IterableList + { + return new IterableList($this->doHydrateObjects($className, $payloads)); + } + + private function doHydrateObjects(string $className, iterable $payloads): Generator + { + foreach ($payloads as $index => $payload) { + yield $index => $this->hydrateObject($className, $payload); + } + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToSerializeObject + * + * @template T + */ + public function serializeObjects(iterable $payloads): IterableList + { + return new IterableList($this->doSerializeObjects($payloads)); + } + + private function doSerializeObjects(iterable $objects): Generator + { + foreach ($objects as $index => $object) { + yield $index => $this->serializeObject($object); + } + } +} diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Metrics.php b/clients/GitHub/src/Internal/Hydrator/Operation/Enterprises/Enterprise/Team/TeamSlug/Copilot/Metrics.php new file mode 100644 index 00000000000..3ec18651851 --- /dev/null +++ b/clients/GitHub/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\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError + { + $properties = []; + $missingFields = []; + try { + $value = $payload['message'] ?? null; + + if ($value === null) { + $properties['message'] = null; + goto after_message; + } + + $properties['message'] = $value; + + after_message: + + $value = $payload['documentation_url'] ?? null; + + if ($value === null) { + $properties['documentationUrl'] = null; + goto after_documentationUrl; + } + + $properties['documentationUrl'] = $value; + + after_documentationUrl: + + $value = $payload['url'] ?? null; + + if ($value === null) { + $properties['url'] = null; + goto after_url; + } + + $properties['url'] = $value; + + after_url: + + $value = $payload['status'] ?? null; + + if ($value === null) { + $properties['status'] = null; + goto after_status; + } + + $properties['status'] = $value; + + after_status: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new BasicError(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + } + + private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array + { + foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) { + if (is_a($object, $valueType)) { + return [$accessor => $payloadType] + $this->{$method}($object); + } + } + + throw new LogicException('No type mapped for object of class: ' . $object::class); + } + + public function serializeObject(object $object): mixed + { + return $this->serializeObjectOfType($object, $object::class); + } + + /** + * @param T $object + * @param class-string $className + * + * @template T + */ + public function serializeObjectOfType(object $object, string $className): mixed + { + try { + return match ($className) { + 'array' => $this->serializeValuearray($object), + 'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object), + 'DateTime' => $this->serializeValueDateTime($object), + 'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object), + 'DateTimeInterface' => $this->serializeValueDateTimeInterface($object), + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object), + default => throw new LogicException("No serialization defined for $className"), + }; + } catch (Throwable $exception) { + throw UnableToSerializeObject::dueToError($className, $exception); + } + } + + private function serializeValuearray(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeArrayItems(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueRamsey⚡️Uuid⚡️UuidInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeUuidToString(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTime(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeImmutable(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed + { + assert($object instanceof BasicError); + $result = []; + + $message = $object->message; + + if ($message === null) { + goto after_message; + } + + after_message: $result['message'] = $message; + + $documentationUrl = $object->documentationUrl; + + if ($documentationUrl === null) { + goto after_documentationUrl; + } + + after_documentationUrl: $result['documentation_url'] = $documentationUrl; + + $url = $object->url; + + if ($url === null) { + goto after_url; + } + + after_url: $result['url'] = $url; + + $status = $object->status; + + if ($status === null) { + goto after_status; + } + + after_status: $result['status'] = $status; + + return $result; + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToHydrateObject + * + * @template T + */ + public function hydrateObjects(string $className, iterable $payloads): IterableList + { + return new IterableList($this->doHydrateObjects($className, $payloads)); + } + + private function doHydrateObjects(string $className, iterable $payloads): Generator + { + foreach ($payloads as $index => $payload) { + yield $index => $this->hydrateObject($className, $payload); + } + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToSerializeObject + * + * @template T + */ + public function serializeObjects(iterable $payloads): IterableList + { + return new IterableList($this->doSerializeObjects($payloads)); + } + + private function doSerializeObjects(iterable $objects): Generator + { + foreach ($objects as $index => $object) { + yield $index => $this->serializeObject($object); + } + } +} diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Copilot/Metrics.php b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Copilot/Metrics.php new file mode 100644 index 00000000000..75223c7f130 --- /dev/null +++ b/clients/GitHub/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\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError + { + $properties = []; + $missingFields = []; + try { + $value = $payload['message'] ?? null; + + if ($value === null) { + $properties['message'] = null; + goto after_message; + } + + $properties['message'] = $value; + + after_message: + + $value = $payload['documentation_url'] ?? null; + + if ($value === null) { + $properties['documentationUrl'] = null; + goto after_documentationUrl; + } + + $properties['documentationUrl'] = $value; + + after_documentationUrl: + + $value = $payload['url'] ?? null; + + if ($value === null) { + $properties['url'] = null; + goto after_url; + } + + $properties['url'] = $value; + + after_url: + + $value = $payload['status'] ?? null; + + if ($value === null) { + $properties['status'] = null; + goto after_status; + } + + $properties['status'] = $value; + + after_status: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new BasicError(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + } + + private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array + { + foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) { + if (is_a($object, $valueType)) { + return [$accessor => $payloadType] + $this->{$method}($object); + } + } + + throw new LogicException('No type mapped for object of class: ' . $object::class); + } + + public function serializeObject(object $object): mixed + { + return $this->serializeObjectOfType($object, $object::class); + } + + /** + * @param T $object + * @param class-string $className + * + * @template T + */ + public function serializeObjectOfType(object $object, string $className): mixed + { + try { + return match ($className) { + 'array' => $this->serializeValuearray($object), + 'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object), + 'DateTime' => $this->serializeValueDateTime($object), + 'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object), + 'DateTimeInterface' => $this->serializeValueDateTimeInterface($object), + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object), + default => throw new LogicException("No serialization defined for $className"), + }; + } catch (Throwable $exception) { + throw UnableToSerializeObject::dueToError($className, $exception); + } + } + + private function serializeValuearray(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeArrayItems(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueRamsey⚡️Uuid⚡️UuidInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeUuidToString(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTime(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeImmutable(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed + { + assert($object instanceof BasicError); + $result = []; + + $message = $object->message; + + if ($message === null) { + goto after_message; + } + + after_message: $result['message'] = $message; + + $documentationUrl = $object->documentationUrl; + + if ($documentationUrl === null) { + goto after_documentationUrl; + } + + after_documentationUrl: $result['documentation_url'] = $documentationUrl; + + $url = $object->url; + + if ($url === null) { + goto after_url; + } + + after_url: $result['url'] = $url; + + $status = $object->status; + + if ($status === null) { + goto after_status; + } + + after_status: $result['status'] = $status; + + return $result; + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToHydrateObject + * + * @template T + */ + public function hydrateObjects(string $className, iterable $payloads): IterableList + { + return new IterableList($this->doHydrateObjects($className, $payloads)); + } + + private function doHydrateObjects(string $className, iterable $payloads): Generator + { + foreach ($payloads as $index => $payload) { + yield $index => $this->hydrateObject($className, $payload); + } + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToSerializeObject + * + * @template T + */ + public function serializeObjects(iterable $payloads): IterableList + { + return new IterableList($this->doSerializeObjects($payloads)); + } + + private function doSerializeObjects(iterable $objects): Generator + { + foreach ($objects as $index => $object) { + yield $index => $this->serializeObject($object); + } + } +} diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Team/TeamSlug/Copilot/Metrics.php b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/Team/TeamSlug/Copilot/Metrics.php new file mode 100644 index 00000000000..673aff6061e --- /dev/null +++ b/clients/GitHub/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\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError + { + $properties = []; + $missingFields = []; + try { + $value = $payload['message'] ?? null; + + if ($value === null) { + $properties['message'] = null; + goto after_message; + } + + $properties['message'] = $value; + + after_message: + + $value = $payload['documentation_url'] ?? null; + + if ($value === null) { + $properties['documentationUrl'] = null; + goto after_documentationUrl; + } + + $properties['documentationUrl'] = $value; + + after_documentationUrl: + + $value = $payload['url'] ?? null; + + if ($value === null) { + $properties['url'] = null; + goto after_url; + } + + $properties['url'] = $value; + + after_url: + + $value = $payload['status'] ?? null; + + if ($value === null) { + $properties['status'] = null; + goto after_status; + } + + $properties['status'] = $value; + + after_status: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new BasicError(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + } + + private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array + { + foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) { + if (is_a($object, $valueType)) { + return [$accessor => $payloadType] + $this->{$method}($object); + } + } + + throw new LogicException('No type mapped for object of class: ' . $object::class); + } + + public function serializeObject(object $object): mixed + { + return $this->serializeObjectOfType($object, $object::class); + } + + /** + * @param T $object + * @param class-string $className + * + * @template T + */ + public function serializeObjectOfType(object $object, string $className): mixed + { + try { + return match ($className) { + 'array' => $this->serializeValuearray($object), + 'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object), + 'DateTime' => $this->serializeValueDateTime($object), + 'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object), + 'DateTimeInterface' => $this->serializeValueDateTimeInterface($object), + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object), + default => throw new LogicException("No serialization defined for $className"), + }; + } catch (Throwable $exception) { + throw UnableToSerializeObject::dueToError($className, $exception); + } + } + + private function serializeValuearray(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeArrayItems(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueRamsey⚡️Uuid⚡️UuidInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeUuidToString(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTime(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeImmutable(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed + { + assert($object instanceof BasicError); + $result = []; + + $message = $object->message; + + if ($message === null) { + goto after_message; + } + + after_message: $result['message'] = $message; + + $documentationUrl = $object->documentationUrl; + + if ($documentationUrl === null) { + goto after_documentationUrl; + } + + after_documentationUrl: $result['documentation_url'] = $documentationUrl; + + $url = $object->url; + + if ($url === null) { + goto after_url; + } + + after_url: $result['url'] = $url; + + $status = $object->status; + + if ($status === null) { + goto after_status; + } + + after_status: $result['status'] = $status; + + return $result; + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToHydrateObject + * + * @template T + */ + public function hydrateObjects(string $className, iterable $payloads): IterableList + { + return new IterableList($this->doHydrateObjects($className, $payloads)); + } + + private function doHydrateObjects(string $className, iterable $payloads): Generator + { + foreach ($payloads as $index => $payload) { + yield $index => $this->hydrateObject($className, $payload); + } + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToSerializeObject + * + * @template T + */ + public function serializeObjects(iterable $payloads): IterableList + { + return new IterableList($this->doSerializeObjects($payloads)); + } + + private function doSerializeObjects(iterable $objects): Generator + { + foreach ($objects as $index => $object) { + yield $index => $this->serializeObject($object); + } + } +} diff --git a/clients/GitHub/src/Internal/Hydrators.php b/clients/GitHub/src/Internal/Hydrators.php index cdbac00dfba..63ece4321df 100644 --- a/clients/GitHub/src/Internal/Hydrators.php +++ b/clients/GitHub/src/Internal/Hydrators.php @@ -39,9 +39,11 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\CodesOfConduct\Key|null $operation🌀CodesOfConduct🌀Key = null; private Internal\Hydrator\Operation\Emojis|null $operation🌀Emojis = 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\SecretScanning\Alerts|null $operation🌀Enterprises🌀Enterprise🌀SecretScanning🌀Alerts = 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\Events|null $operation🌀Events = null; private Internal\Hydrator\Operation\Feeds|null $operation🌀Feeds = null; @@ -132,6 +134,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\Dependabot\Alerts|null $operation🌀Orgs🌀Org🌀Dependabot🌀Alerts = null; private Internal\Hydrator\Operation\Orgs\Org\Dependabot\Secrets|null $operation🌀Orgs🌀Org🌀Dependabot🌀Secrets = null; @@ -208,6 +211,7 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\Orgs\Org\Settings\Billing\Actions|null $operation🌀Orgs🌀Org🌀Settings🌀Billing🌀Actions = null; 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\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; @@ -1686,6 +1690,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) { @@ -1713,6 +1726,15 @@ public function getObjectMapperOperation🌀Enterprises🌀Enterprise🌀SecretS return $this->operation🌀Enterprises🌀Enterprise🌀SecretScanning🌀Alerts; } + 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) { @@ -2523,6 +2545,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) { @@ -3207,6 +3238,15 @@ public function getObjectMapperOperation🌀Orgs🌀Org🌀Settings🌀Billing return $this->operation🌀Orgs🌀Org🌀Settings🌀Billing🌀SharedStorage; } + 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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterprise.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterprise.php new file mode 100644 index 00000000000..c2eac29592e --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseListing.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseListing.php new file mode 100644 index 00000000000..961cc57e8e8 --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeam.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeam.php new file mode 100644 index 00000000000..3dbafaf60bb --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListing.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListing.php new file mode 100644 index 00000000000..bc4e5419ce0 --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForOrganization.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForOrganization.php new file mode 100644 index 00000000000..006543b5b0f --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForOrganizationListing.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForOrganizationListing.php new file mode 100644 index 00000000000..f0ae6beacfe --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForTeam.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForTeam.php new file mode 100644 index 00000000000..9c1580be046 --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForTeamListing.php b/clients/GitHub/src/Internal/Operation/Copilot/CopilotMetricsForTeamListing.php new file mode 100644 index 00000000000..9fe9aa32a01 --- /dev/null +++ b/clients/GitHub/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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php new file mode 100644 index 00000000000..50f7a7c8d99 --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseListing.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseListing.php new file mode 100644 index 00000000000..ea8407d5b9e --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeam.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeam.php new file mode 100644 index 00000000000..4dbc76f12c5 --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeamListing.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterpriseTeamListing.php new file mode 100644 index 00000000000..e5614e4cd01 --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForOrganization.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForOrganization.php new file mode 100644 index 00000000000..37849872812 --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForOrganizationListing.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForOrganizationListing.php new file mode 100644 index 00000000000..8aa9ce3c799 --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForTeam.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForTeam.php new file mode 100644 index 00000000000..8ae24c12209 --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForTeamListing.php b/clients/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForTeamListing.php new file mode 100644 index 00000000000..ac6b15a35cc --- /dev/null +++ b/clients/GitHub/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\GitHub\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/GitHub/src/Internal/Operators.php b/clients/GitHub/src/Internal/Operators.php index 062740de0fa..3a4afe0f921 100644 --- a/clients/GitHub/src/Internal/Operators.php +++ b/clients/GitHub/src/Internal/Operators.php @@ -49,10 +49,14 @@ final class Operators private Internal\Operator\CodesOfConduct\GetConductCode|null $codesOfConduct👷GetConductCode = null; private Internal\Operator\Emojis\Get|null $emojis👷Get = 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; private Internal\Operator\SecretScanning\ListAlertsForEnterprise|null $secretScanning👷ListAlertsForEnterprise = 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\Activity\ListPublicEvents|null $activity👷ListPublicEvents = null; @@ -215,6 +219,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\Dependabot\ListAlertsForOrg|null $dependabot👷ListAlertsForOrg = null; @@ -353,6 +359,8 @@ final class Operators private Internal\Operator\Billing\GetGithubActionsBillingOrg|null $billing👷GetGithubActionsBillingOrg = null; private Internal\Operator\Billing\GetGithubPackagesBillingOrg|null $billing👷GetGithubPackagesBillingOrg = null; private Internal\Operator\Billing\GetSharedStorageBillingOrg|null $billing👷GetSharedStorageBillingOrg = 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; @@ -1499,6 +1507,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) { @@ -1535,6 +1561,24 @@ public function secretScanning👷ListAlertsForEnterprise(): Internal\Operator\S return $this->secretScanning👷ListAlertsForEnterprise; } + 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) { @@ -2993,6 +3037,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) { @@ -4235,6 +4297,24 @@ public function billing👷GetSharedStorageBillingOrg(): Internal\Operator\Billi return $this->billing👷GetSharedStorageBillingOrg; } + 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/GitHub/src/Internal/Router/Get/Copilot.php b/clients/GitHub/src/Internal/Router/Get/Copilot.php index e50fb00eee5..d71c4cb03b8 100644 --- a/clients/GitHub/src/Internal/Router/Get/Copilot.php +++ b/clients/GitHub/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/GitHub/src/Internal/Router/Get/Five.php b/clients/GitHub/src/Internal/Router/Get/Five.php index 53abe6bef87..8d2b0f1acab 100644 --- a/clients/GitHub/src/Internal/Router/Get/Five.php +++ b/clients/GitHub/src/Internal/Router/Get/Five.php @@ -51,7 +51,7 @@ public function __construct(private Routers $routers) { } - /** @return |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|Observable */ + /** @return |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|Observable */ public function call(string $call, array $params, array $pathChunks): HookDelivery|iterable|WithoutBody|GistComment|MarketplacePurchase|BasicError|ThreadSubscription|ActionsOrganizationPermissions|Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListSelfHostedRunnersForOrg\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListOrgSecrets\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListOrgVariables\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Orgs\ListAttestations\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListOrgSecrets\Response\ApplicationJson\Ok|CopilotOrganizationDetails|\ApiClients\Client\GitHub\Schema\Operations\Dependabot\ListOrgSecrets\Response\ApplicationJson\Ok|OrgHook|OrgMembership|Migration|OrganizationRole|RepositoryRuleset|TeamFull|ProjectCard|CheckAutomatedSecurityFixes|CodeSecurityConfigurationForRepository|Json|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetAllEnvironments\Response\ApplicationJson\Ok|Import|Installation|InteractionLimitResponse|One|Language|LicenseContent|Page|\ApiClients\Client\GitHub\Schema\Operations\Repos\CheckPrivateVulnerabilityReporting\Response\ApplicationJson\Ok|ContentFile|SimpleUser|Stargazer|RepositorySubscription|Topic|TeamDiscussion|TeamMembership|TeamProject|CodespacesUserPublicKey|CodespacesSecret|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\CodespaceMachinesForAuthenticatedUser\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Apps\ListInstallationReposForAuthenticatedUser\Response\ApplicationJson\Ok|Package|\ApiClients\Client\GitHub\Schema\Operations\Users\ListAttestations\Response\ApplicationJson\Ok|EmptyObject { if ($pathChunks[0] === '') { @@ -68,7 +68,11 @@ public function call(string $call, array $params, array $pathChunks): HookDelive } elseif ($pathChunks[1] === 'enterprises') { if ($pathChunks[2] === '{enterprise}') { if ($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); } @@ -194,6 +198,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/GitHub/src/Internal/Router/Get/Seven.php b/clients/GitHub/src/Internal/Router/Get/Seven.php index 755a8f4ad1e..2836539e34a 100644 --- a/clients/GitHub/src/Internal/Router/Get/Seven.php +++ b/clients/GitHub/src/Internal/Router/Get/Seven.php @@ -63,7 +63,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): iterable|OidcCustomSub|Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListSelfHostedRunnersInGroupForOrg\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListLabelsForSelfHostedRunnerForOrg\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok|Json|WithoutBody|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Dependabot\ListSelectedReposForOrgSecret\Response\ApplicationJson\Ok\Application\Json|HookDelivery|TeamDiscussion|TeamMembership|TeamProject|Artifact|ActionsCacheUsageByRepository|Job|ActionsWorkflowAccessToRepository|SelectedActions|ActionsGetDefaultWorkflowPermissions|Runner|WorkflowRun|ActionsPublicKey|ActionsSecret|ActionsVariable|Workflow|BranchProtection|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListForSuite\Response\ApplicationJson\Ok|CodeScanningAlert|CodeScanningAnalysis|CodeScanningSarifsStatus|CodespacesPublicKey|RepoCodespacesSecret|RepositoryCollaboratorPermission|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListForRef\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Checks\ListSuitesForRef\Response\ApplicationJson\Ok|CombinedCommitStatus|BasicError|DependabotAlert|DependabotPublicKey|DependabotSecret|\ApiClients\Client\GitHub\Schema\Operations\Repos\ListDeploymentBranchPolicies\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetAllDeploymentProtectionRules\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListEnvironmentSecrets\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListEnvironmentVariables\Response\ApplicationJson\Ok\Application\Json|Blob|GitCommit|GitRef|GitTag|GitTree|WebhookConfig|IssueComment|IssueEvent|PageBuild|PagesDeploymentStatus|PullRequestReviewComment|PullRequestReviewRequest|ReleaseAsset|Release|RuleSuite|SecretScanningAlert|TeamDiscussionComment|PackageVersion { if ($pathChunks[0] === '') { @@ -72,7 +72,11 @@ public function call(string $call, array $params, array $pathChunks): iterable|O if ($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); } @@ -182,7 +186,11 @@ public function call(string $call, array $params, array $pathChunks): iterable|O } 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/GitHub/src/Internal/Router/List/Copilot.php b/clients/GitHub/src/Internal/Router/List/Copilot.php index 5102f531f96..e334059e353 100644 --- a/clients/GitHub/src/Internal/Router/List/Copilot.php +++ b/clients/GitHub/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/GitHub/src/Internal/Router/List/Five.php b/clients/GitHub/src/Internal/Router/List/Five.php index 54dd93858a9..a345c3ae29b 100644 --- a/clients/GitHub/src/Internal/Router/List/Five.php +++ b/clients/GitHub/src/Internal/Router/List/Five.php @@ -16,14 +16,18 @@ public function __construct(private Routers $routers) { } - /** @return 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|Observable */ + /** @return 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|Observable */ public function call(string $call, array $params, array $pathChunks): iterable|BasicError|WithoutBody { if ($pathChunks[0] === '') { if ($pathChunks[1] === 'enterprises') { if ($pathChunks[2] === '{enterprise}') { if ($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); } @@ -59,7 +63,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/GitHub/src/Internal/Router/List/Seven.php b/clients/GitHub/src/Internal/Router/List/Seven.php index 6cec3584592..d2c0eee1934 100644 --- a/clients/GitHub/src/Internal/Router/List/Seven.php +++ b/clients/GitHub/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/GitHub/src/Operation/Copilot.php b/clients/GitHub/src/Operation/Copilot.php index 8159e005eaf..fc14d0edb28 100644 --- a/clients/GitHub/src/Operation/Copilot.php +++ b/clients/GitHub/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/GitHub/src/PHPStan/ClientCallReturnTypes.php b/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php index afad55b1667..cfe868fdd18 100644 --- a/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php +++ b/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php @@ -195,6 +195,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'); } @@ -211,6 +219,14 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method return $this->typeResolver->resolve('Observable'); } + 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'); } @@ -859,6 +875,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'); } @@ -1411,6 +1435,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/GitHub/src/Schema/CopilotDotcomChat.php b/clients/GitHub/src/Schema/CopilotDotcomChat.php new file mode 100644 index 00000000000..0974ee4e1aa --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListingTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamListingTest.php new file mode 100644 index 00000000000..0f4da695c14 --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTeamTest.php new file mode 100644 index 00000000000..a03e0ca8249 --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForEnterpriseTest.php new file mode 100644 index 00000000000..09ddff75734 --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationListingTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationListingTest.php new file mode 100644 index 00000000000..7603ca62e1f --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForOrganizationTest.php new file mode 100644 index 00000000000..5d4cc0381f0 --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForTeamListingTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForTeamListingTest.php new file mode 100644 index 00000000000..873bee5b36d --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForTeamTest.php b/clients/GitHub/tests/Internal/Operation/Copilot/CopilotMetricsForTeamTest.php new file mode 100644 index 00000000000..eab04dfaf17 --- /dev/null +++ b/clients/GitHub/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/GitHub/tests/Types/ClientCallReturnTypes.php b/clients/GitHub/tests/Types/ClientCallReturnTypes.php index 464e0bd254a..1fbd658ff25 100644 --- a/clients/GitHub/tests/Types/ClientCallReturnTypes.php +++ b/clients/GitHub/tests/Types/ClientCallReturnTypes.php @@ -55,10 +55,14 @@ function authHeader(): string assertType('', $client->call('GET /codes_of_conduct/{key}')); assertType('', $client->call('GET /emojis')); 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')); assertType('Observable', $client->call('GET /enterprises/{enterprise}/secret-scanning/alerts')); +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('Observable|WithoutBody', $client->call('GET /events')); @@ -221,6 +225,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|WithoutBody', $client->call('GET /orgs/{org}/dependabot/alerts')); @@ -359,6 +365,8 @@ function authHeader(): string assertType('', $client->call('GET /orgs/{org}/settings/billing/actions')); assertType('', $client->call('GET /orgs/{org}/settings/billing/packages')); assertType('', $client->call('GET /orgs/{org}/settings/billing/shared-storage')); +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/GitHub/current.spec.yaml b/etc/specs/GitHub/current.spec.yaml index a31b0bac0b9..8f4e76c4229 100644 --- a/etc/specs/GitHub/current.spec.yaml +++ b/etc/specs/GitHub/current.spec.yaml @@ -1508,6 +1508,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/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/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 @@ -1694,6 +1765,81 @@ paths: enabledForGitHubApps: false category: secret-scanning subcategory: secret-scanning + "/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/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/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 @@ -8635,6 +8781,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/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/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 @@ -13843,6 +14063,81 @@ paths: enabledForGitHubApps: false category: billing subcategory: billing + "/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/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/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 @@ -68298,6 +68593,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. @@ -200252,6 +200836,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' @@ -224375,6 +225058,13 @@ components: schema: type: boolean default: false + 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. @@ -225470,6 +226160,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" service_unavailable: description: Service unavailable content: