Skip to content

Commit 4411109

Browse files
authored
Merge pull request #1337 from php-api-clients/GitHubEnterpriseCloud/from-1.1.4-09be262377cbbbe8917c66c1d01da07c-from-1.1.4-09be262377cbbbe8917c66c1d01da07c
2 parents 068930a + ab51828 commit 4411109

27 files changed

+497
-70
lines changed

clients/GitHubEnterpriseCloud/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15957,6 +15957,30 @@ $client->operations()->codeScanning()->getCodeqlDatabase( owner: 'generat
1595715957
You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository).
1595815958

1595915959

15960+
### code-scanning/delete-codeql-database
15961+
15962+
Delete a CodeQL database
15963+
15964+
Using the `call` method:
15965+
```php
15966+
$client->call('DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}', [
15967+
'owner' => 'generated',
15968+
'repo' => 'generated',
15969+
'language' => 'generated',
15970+
]);
15971+
```
15972+
15973+
Operations method:
15974+
```php
15975+
$client->operations()->codeScanning()->deleteCodeqlDatabase( owner: 'generated',
15976+
repo: 'generated',
15977+
language: 'generated',
15978+
);
15979+
```
15980+
15981+
You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/code-scanning/code-scanning#delete-a-codeql-database).
15982+
15983+
1596015984
### code-scanning/create-variant-analysis
1596115985

1596215986
Create a CodeQL variant analysis

clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"specHash": "fedf0d71c08f1b559e2c2e12a07bcb84",
2+
"specHash": "09be262377cbbbe8917c66c1d01da07c",
33
"generatedFiles": {
44
"files": [
55
{
@@ -5892,7 +5892,7 @@
58925892
},
58935893
{
58945894
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/CodeScanning.php",
5895-
"hash": "0384545e7e1b3f73b106042d267eed72"
5895+
"hash": "58601a484d7de1bf91de1604bb929066"
58965896
},
58975897
{
58985898
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/SecretScanning.php",
@@ -12104,7 +12104,7 @@
1210412104
},
1210512105
{
1210612106
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Copilot.php",
12107-
"hash": "aed1e41f26356ebb08a5216efc0238fa"
12107+
"hash": "b9c6a45bbe925c6bcebdcd125c897ad2"
1210812108
},
1210912109
{
1211012110
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/CheckAutomatedSecurityFixes.php",
@@ -26072,7 +26072,7 @@
2607226072
},
2607326073
{
2607426074
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Copilot.php",
26075-
"hash": "460d6fd9d96b86c5d5b9b4741898de53"
26075+
"hash": "63a3be14fb1725c07a25cc70e4f31ae0"
2607626076
},
2607726077
{
2607826078
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Pulls.php",
@@ -26428,7 +26428,7 @@
2642826428
},
2642926429
{
2643026430
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/CodeScanning.php",
26431-
"hash": "25a6bee584c6d6d516ec327c2484d4cd"
26431+
"hash": "c29d62152192087250bb531506ef865a"
2643226432
},
2643326433
{
2643426434
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Dependabot.php",
@@ -26560,15 +26560,15 @@
2656026560
},
2656126561
{
2656226562
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Five.php",
26563-
"hash": "185301118cc1712e30f1edfee14db654"
26563+
"hash": "32132353c07f536308f8b2a130e869a4"
2656426564
},
2656526565
{
2656626566
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php",
2656726567
"hash": "77cf4e9f2070d524bd40e99d7a32ad14"
2656826568
},
2656926569
{
2657026570
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php",
26571-
"hash": "1a7c8bb261e194035b3b6c279452b4e2"
26571+
"hash": "db30d8b72a1cbd735e1336ee83f1d4ba"
2657226572
},
2657326573
{
2657426574
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Eight.php",
@@ -26660,7 +26660,7 @@
2666026660
},
2666126661
{
2666226662
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Five.php",
26663-
"hash": "1de17086c95a8637b744bd2e2fee3db5"
26663+
"hash": "381b412abe49fd76e8e7e3fabc5978d8"
2666426664
},
2666526665
{
2666626666
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Two.php",
@@ -26672,7 +26672,7 @@
2667226672
},
2667326673
{
2667426674
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Seven.php",
26675-
"hash": "ce83f84d79bef7edb2a68862bc4f812d"
26675+
"hash": "bc242c26c12709c84b10be958a6843b6"
2667626676
},
2667726677
{
2667826678
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Eight.php",
@@ -26704,7 +26704,7 @@
2670426704
},
2670526705
{
2670626706
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Eight.php",
26707-
"hash": "b3ca37b67ac3b9455789674e0de6ceb3"
26707+
"hash": "373f92e055424898f30979087e3c64d0"
2670826708
},
2670926709
{
2671026710
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Three.php",
@@ -26768,7 +26768,7 @@
2676826768
},
2676926769
{
2677026770
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operators.php",
26771-
"hash": "78ce0b46035a1e1871adaaa7f4600b1e"
26771+
"hash": "b33f3f32f93232be2c2eb91b86e60b14"
2677226772
},
2677326773
{
2677426774
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Root.php",
@@ -29740,11 +29740,11 @@
2974029740
},
2974129741
{
2974229742
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php",
29743-
"hash": "6bbcf54e3374f3804ad8abc42f0a303f"
29743+
"hash": "6dda1e3ef8dc53f142eaba92686ddb48"
2974429744
},
2974529745
{
2974629746
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php",
29747-
"hash": "638af93e91b1611aaad95aee48a38294"
29747+
"hash": "34d2168ae585ead7e06e68792fbcd180"
2974829748
},
2974929749
{
2975029750
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon",
@@ -30860,7 +30860,7 @@
3086030860
},
3086130861
{
3086230862
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/List\/Copilot.php",
30863-
"hash": "1afb0f463ab213b53f2b0c04f44fcf3a"
30863+
"hash": "a3d79de7364e415086ca20e98eaf2a8c"
3086430864
},
3086530865
{
3086630866
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Usage.php",
@@ -32828,7 +32828,7 @@
3282832828
},
3282932829
{
3283032830
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterprise.php",
32831-
"hash": "cebcf4e7ae4df2dddd6180ab175a4dc4"
32831+
"hash": "296116d6e3e61e48a4640dc82a394625"
3283232832
},
3283332833
{
3283432834
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTest.php",
@@ -32840,7 +32840,7 @@
3284032840
},
3284132841
{
3284232842
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseListing.php",
32843-
"hash": "f94d06f5a4e35edd820e98e7aefbff49"
32843+
"hash": "81fc79cd5074dccab49358ce0563c6d4"
3284432844
},
3284532845
{
3284632846
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseListingTest.php",
@@ -32852,7 +32852,7 @@
3285232852
},
3285332853
{
3285432854
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeam.php",
32855-
"hash": "8eef6e54734c220ad24a82da07b5ba66"
32855+
"hash": "9fdb29a0996180b0f56a940aa169243a"
3285632856
},
3285732857
{
3285832858
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamTest.php",
@@ -32864,7 +32864,7 @@
3286432864
},
3286532865
{
3286632866
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeamListing.php",
32867-
"hash": "dc8742055a09ba8eb7ab1f7e3e7b5bd5"
32867+
"hash": "435a346e5923b060018d79670c30f388"
3286832868
},
3286932869
{
3287032870
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamListingTest.php",
@@ -32876,7 +32876,7 @@
3287632876
},
3287732877
{
3287832878
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganization.php",
32879-
"hash": "6aad600b542d0c1205369ebd803fe80e"
32879+
"hash": "02bc5e012daa638a25e4b513464f54c9"
3288032880
},
3288132881
{
3288232882
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationTest.php",
@@ -32888,7 +32888,7 @@
3288832888
},
3288932889
{
3289032890
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganizationListing.php",
32891-
"hash": "d489d84b0e1cb734c4f86614bd52596e"
32891+
"hash": "1145747f159b8395ea35a8038cb873ee"
3289232892
},
3289332893
{
3289432894
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationListingTest.php",
@@ -32900,7 +32900,7 @@
3290032900
},
3290132901
{
3290232902
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeam.php",
32903-
"hash": "f54a280beafca10361540b4375428870"
32903+
"hash": "0d04feb1619561d536c91311f0e372df"
3290432904
},
3290532905
{
3290632906
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamTest.php",
@@ -32912,7 +32912,7 @@
3291232912
},
3291332913
{
3291432914
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeamListing.php",
32915-
"hash": "a93e85a960eecee24066d7df98972918"
32915+
"hash": "b1bb83685b01617d89c6d62c693e9689"
3291632916
},
3291732917
{
3291832918
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamListingTest.php",
@@ -32989,6 +32989,18 @@
3298932989
{
3299032990
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Team\/TeamSlug\/Copilot\/Metrics.php",
3299132991
"hash": "4ee33e9f889360c744665482b9bd1dcd"
32992+
},
32993+
{
32994+
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/CodeScanning\/DeleteCodeqlDatabase.php",
32995+
"hash": "c75769521566b6a79993f470910ab3dc"
32996+
},
32997+
{
32998+
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/CodeScanning\/DeleteCodeqlDatabase.php",
32999+
"hash": "71d317cae8d11785750c73ff31941116"
33000+
},
33001+
{
33002+
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/CodeScanning\/DeleteCodeqlDatabaseTest.php",
33003+
"hash": "9a0b1d9f6a1b6fcc12264c3b3459885e"
3299233004
}
3299333005
]
3299433006
},
@@ -33008,7 +33020,7 @@
3300833020
},
3300933021
{
3301033022
"name": "..\/..\/composer.lock",
33011-
"hash": "9ed7ffbea5b997bda1a2ac835aa0787b"
33023+
"hash": "57a58662b6da9a7cae285c7edb32d15d"
3301233024
}
3301333025
]
3301433026
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\CodeScanning;
6+
7+
use ApiClients\Client\GitHubEnterpriseCloud\Error as ErrorSchemas;
8+
use ApiClients\Client\GitHubEnterpriseCloud\Internal;
9+
use ApiClients\Client\GitHubEnterpriseCloud\Schema;
10+
use ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody;
11+
use cebe\openapi\Reader;
12+
use League\OpenAPIValidation\Schema\SchemaValidator;
13+
use Psr\Http\Message\RequestInterface;
14+
use Psr\Http\Message\ResponseInterface;
15+
use RingCentral\Psr7\Request;
16+
use RuntimeException;
17+
18+
use function explode;
19+
use function json_decode;
20+
use function str_replace;
21+
22+
final class DeleteCodeqlDatabase
23+
{
24+
public const OPERATION_ID = 'code-scanning/delete-codeql-database';
25+
public const OPERATION_MATCH = 'DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}';
26+
/**The account owner of the repository. The name is not case sensitive. **/
27+
private string $owner;
28+
/**The name of the repository without the `.git` extension. The name is not case sensitive. **/
29+
private string $repo;
30+
/**The language of the CodeQL database. **/
31+
private string $language;
32+
33+
public function __construct(private readonly SchemaValidator $responseSchemaValidator, private readonly Internal\Hydrator\Operation\Repos\Owner\Repo\CodeScanning\Codeql\Databases\Language $hydrator, string $owner, string $repo, string $language)
34+
{
35+
$this->owner = $owner;
36+
$this->repo = $repo;
37+
$this->language = $language;
38+
}
39+
40+
public function createRequest(): RequestInterface
41+
{
42+
return new Request('DELETE', str_replace(['{owner}', '{repo}', '{language}'], [$this->owner, $this->repo, $this->language], '/repos/{owner}/{repo}/code-scanning/codeql/databases/{language}'));
43+
}
44+
45+
public function createResponse(ResponseInterface $response): WithoutBody
46+
{
47+
$code = $response->getStatusCode();
48+
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
49+
switch ($contentType) {
50+
case 'application/json':
51+
$body = json_decode($response->getBody()->getContents(), true);
52+
switch ($code) {
53+
/**
54+
* Response if the repository is archived or if GitHub Advanced Security is not enabled for this repository
55+
**/
56+
case 403:
57+
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
58+
59+
throw new ErrorSchemas\BasicError(403, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
60+
/**
61+
* Resource not found
62+
**/
63+
64+
case 404:
65+
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
66+
67+
throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
68+
/**
69+
* Service unavailable
70+
**/
71+
72+
case 503:
73+
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
74+
75+
throw new ErrorSchemas\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable(503, $this->hydrator->hydrateObject(Schema\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable::class, $body));
76+
}
77+
78+
break;
79+
}
80+
81+
switch ($code) {
82+
/**
83+
* Response
84+
**/
85+
case 204:
86+
return new WithoutBody(204, []);
87+
}
88+
89+
throw new RuntimeException('Unable to find matching response code and content type');
90+
}
91+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHubEnterpriseCloud\Internal\Operator\CodeScanning;
6+
7+
use ApiClients\Client\GitHubEnterpriseCloud\Internal;
8+
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
9+
use ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody;
10+
use League\OpenAPIValidation\Schema\SchemaValidator;
11+
use Psr\Http\Message\ResponseInterface;
12+
use React\Http\Browser;
13+
use Rx\Observable;
14+
15+
use function React\Async\await;
16+
use function WyriHaximus\React\awaitObservable;
17+
18+
final readonly class DeleteCodeqlDatabase
19+
{
20+
public const OPERATION_ID = 'code-scanning/delete-codeql-database';
21+
public const OPERATION_MATCH = 'DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}';
22+
23+
public function __construct(private Browser $browser, private AuthenticationInterface $authentication, private SchemaValidator $responseSchemaValidator, private Internal\Hydrator\Operation\Repos\Owner\Repo\CodeScanning\Codeql\Databases\Language $hydrator)
24+
{
25+
}
26+
27+
public function call(string $owner, string $repo, string $language): WithoutBody
28+
{
29+
$operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\CodeScanning\DeleteCodeqlDatabase($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $language);
30+
$request = $operation->createRequest();
31+
$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): WithoutBody {
32+
return $operation->createResponse($response);
33+
}));
34+
if ($result instanceof Observable) {
35+
$result = awaitObservable($result);
36+
}
37+
38+
return $result;
39+
}
40+
}

clients/GitHubEnterpriseCloud/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(private Browser $browser, private AuthenticationInte
2424
{
2525
}
2626

27-
/** @return iterable<int,Schema\CopilotUsageMetricsDay> */
27+
/** @return Observable<Schema\CopilotUsageMetricsDay> */
2828
public function call(string $enterprise, string $since, string $until, int $page = 1, int $perPage = 28): iterable
2929
{
3030
$operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Copilot\CopilotMetricsForEnterprise($this->responseSchemaValidator, $this->hydrator, $enterprise, $since, $until, $page, $perPage);

0 commit comments

Comments
 (0)