Skip to content

Commit 068930a

Browse files
authored
Merge pull request #1336 from php-api-clients/GitHub/from-1.1.4-5758ce6a93c789209abf3a01ab532091-from-1.1.4-5758ce6a93c789209abf3a01ab532091
2 parents 3c34e3c + afcfef4 commit 068930a

27 files changed

+497
-70
lines changed

clients/GitHub/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -13915,6 +13915,30 @@ $client->operations()->codeScanning()->getCodeqlDatabase( owner: 'generat
1391513915
You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository).
1391613916

1391713917

13918+
### code-scanning/delete-codeql-database
13919+
13920+
Delete a CodeQL database
13921+
13922+
Using the `call` method:
13923+
```php
13924+
$client->call('DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}', [
13925+
'owner' => 'generated',
13926+
'repo' => 'generated',
13927+
'language' => 'generated',
13928+
]);
13929+
```
13930+
13931+
Operations method:
13932+
```php
13933+
$client->operations()->codeScanning()->deleteCodeqlDatabase( owner: 'generated',
13934+
repo: 'generated',
13935+
language: 'generated',
13936+
);
13937+
```
13938+
13939+
You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/code-scanning/code-scanning#delete-a-codeql-database).
13940+
13941+
1391813942
### code-scanning/create-variant-analysis
1391913943

1392013944
Create a CodeQL variant analysis

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

+35-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"specHash": "4befd63c20b175c975d8d0d17534c658",
2+
"specHash": "5758ce6a93c789209abf3a01ab532091",
33
"generatedFiles": {
44
"files": [
55
{
@@ -5572,7 +5572,7 @@
55725572
},
55735573
{
55745574
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/CodeScanning.php",
5575-
"hash": "74a5460ad4d26c7340b86cb11329899d"
5575+
"hash": "b44a19071df22912d5b1612756134a44"
55765576
},
55775577
{
55785578
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Codespaces.php",
@@ -11632,7 +11632,7 @@
1163211632
},
1163311633
{
1163411634
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Copilot.php",
11635-
"hash": "6ade6b422ebb9bea2565934472391a0c"
11635+
"hash": "6688825af95a583a9a52e8a4d4cd4366"
1163611636
},
1163711637
{
1163811638
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CheckAutomatedSecurityFixes.php",
@@ -24436,7 +24436,7 @@
2443624436
},
2443724437
{
2443824438
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Copilot.php",
24439-
"hash": "0659af6cea81d05da85721e8288a2f95"
24439+
"hash": "ecf745142ae57eef3eefcb60dbd25986"
2444024440
},
2444124441
{
2444224442
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Pulls.php",
@@ -24752,7 +24752,7 @@
2475224752
},
2475324753
{
2475424754
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/CodeScanning.php",
24755-
"hash": "71ccf8a652e624bfdd747b3d7b17e195"
24755+
"hash": "84753ee31cc8bb9c8a149af182252cde"
2475624756
},
2475724757
{
2475824758
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Dependabot.php",
@@ -24872,15 +24872,15 @@
2487224872
},
2487324873
{
2487424874
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Five.php",
24875-
"hash": "a59507c14867ec757a540569fd6b2046"
24875+
"hash": "1ce432fd322550bce04d7db17e97a08e"
2487624876
},
2487724877
{
2487824878
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php",
2487924879
"hash": "b53d08b40a82186d3b569bde679af197"
2488024880
},
2488124881
{
2488224882
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php",
24883-
"hash": "7dcff0ea5a9034872b56f76ab8678ef0"
24883+
"hash": "cdab06537a7f98fdf3c5ed86ada2f5f4"
2488424884
},
2488524885
{
2488624886
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Eight.php",
@@ -24976,15 +24976,15 @@
2497624976
},
2497724977
{
2497824978
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Five.php",
24979-
"hash": "37adf0b0c605ed4b34da57553d40612a"
24979+
"hash": "123f6a936ba8096442dac832830411c2"
2498024980
},
2498124981
{
2498224982
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Six.php",
2498324983
"hash": "308c392e37c1750ea31302f83f39951f"
2498424984
},
2498524985
{
2498624986
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Seven.php",
24987-
"hash": "c955792e85ba9471e9a8eca2796c599b"
24987+
"hash": "d2b285c7b7a3494366fd113b6d5c5ac5"
2498824988
},
2498924989
{
2499024990
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Eight.php",
@@ -25020,7 +25020,7 @@
2502025020
},
2502125021
{
2502225022
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Eight.php",
25023-
"hash": "0f72420727cf7aa4c93b006ed06fe1ad"
25023+
"hash": "8a56724d85ab9ee985cdfd8c1f36c8b7"
2502425024
},
2502525025
{
2502625026
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Nine.php",
@@ -25080,7 +25080,7 @@
2508025080
},
2508125081
{
2508225082
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operators.php",
25083-
"hash": "73bddde1d49a446e360798671c62f0d1"
25083+
"hash": "0d4ee71e090bd30719d02f88808fff0d"
2508425084
},
2508525085
{
2508625086
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Root.php",
@@ -27656,11 +27656,11 @@
2765627656
},
2765727657
{
2765827658
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php",
27659-
"hash": "6d60fc896e49c812335d4df8359d7a6d"
27659+
"hash": "52f53add13f4dd9b4a254971b986fd4a"
2766027660
},
2766127661
{
2766227662
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php",
27663-
"hash": "d509d66ebb56bf9cb33ba8f6415a27a3"
27663+
"hash": "fd59bd2d3fcf851e7f60f4dd482837d1"
2766427664
},
2766527665
{
2766627666
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon",
@@ -28700,7 +28700,7 @@
2870028700
},
2870128701
{
2870228702
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/List\/Copilot.php",
28703-
"hash": "c481d55963d10b120edcfa7f38ce045c"
28703+
"hash": "93e6fb8747f9710c81901b8efd39acc9"
2870428704
},
2870528705
{
2870628706
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Enterprises\/Enterprise\/Copilot\/Usage.php",
@@ -30652,7 +30652,7 @@
3065230652
},
3065330653
{
3065430654
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterprise.php",
30655-
"hash": "399a6aa023a04ea00bd3f67d476c1470"
30655+
"hash": "ec49ebea2f9735ac8b509bb49be98fba"
3065630656
},
3065730657
{
3065830658
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTest.php",
@@ -30664,7 +30664,7 @@
3066430664
},
3066530665
{
3066630666
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseListing.php",
30667-
"hash": "2ce9f340b29fd008da29cc42965a0793"
30667+
"hash": "c10dd90716f736a5c0e90f665ae9e43c"
3066830668
},
3066930669
{
3067030670
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseListingTest.php",
@@ -30676,7 +30676,7 @@
3067630676
},
3067730677
{
3067830678
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeam.php",
30679-
"hash": "079572f2c14ba2251377966d5cb0f495"
30679+
"hash": "23dd121269a9f8f0025d70a3322deb04"
3068030680
},
3068130681
{
3068230682
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamTest.php",
@@ -30688,7 +30688,7 @@
3068830688
},
3068930689
{
3069030690
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForEnterpriseTeamListing.php",
30691-
"hash": "e27d1d3e0589130b81f0ffb0ff2ac456"
30691+
"hash": "a589e8b4b8a468806859f357e221c0fe"
3069230692
},
3069330693
{
3069430694
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForEnterpriseTeamListingTest.php",
@@ -30700,7 +30700,7 @@
3070030700
},
3070130701
{
3070230702
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganization.php",
30703-
"hash": "9dba5bb250e3b77d8a0ec7e8a126a2a6"
30703+
"hash": "8d05c840c6f75664f36b2d91a67a7e4a"
3070430704
},
3070530705
{
3070630706
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationTest.php",
@@ -30712,7 +30712,7 @@
3071230712
},
3071330713
{
3071430714
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForOrganizationListing.php",
30715-
"hash": "7a6ccd80e4b684213f121e7d9e8bf094"
30715+
"hash": "fc63b306462051abb3cdf1c9e567ef01"
3071630716
},
3071730717
{
3071830718
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForOrganizationListingTest.php",
@@ -30724,7 +30724,7 @@
3072430724
},
3072530725
{
3072630726
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeam.php",
30727-
"hash": "6bd86aa3e8852b527319d04049f2011c"
30727+
"hash": "d6e69a42ec401cb00d20e1fe5a8d02a5"
3072830728
},
3072930729
{
3073030730
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamTest.php",
@@ -30736,7 +30736,7 @@
3073630736
},
3073730737
{
3073830738
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Copilot\/CopilotMetricsForTeamListing.php",
30739-
"hash": "40043b868a899e74f4f8e23427ba5ecb"
30739+
"hash": "47bd4878bff236a51fe151fd772990cd"
3074030740
},
3074130741
{
3074230742
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Copilot\/CopilotMetricsForTeamListingTest.php",
@@ -30813,6 +30813,18 @@
3081330813
{
3081430814
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/Team\/TeamSlug\/Copilot\/Metrics.php",
3081530815
"hash": "e86a62d972b96c0dfef1bb5449415923"
30816+
},
30817+
{
30818+
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/CodeScanning\/DeleteCodeqlDatabase.php",
30819+
"hash": "41c58cb3fb29e55f122e249c9938b04e"
30820+
},
30821+
{
30822+
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/CodeScanning\/DeleteCodeqlDatabase.php",
30823+
"hash": "df190827fcd4219473ecf7999d93d76e"
30824+
},
30825+
{
30826+
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/CodeScanning\/DeleteCodeqlDatabaseTest.php",
30827+
"hash": "6f499eeba97d368253c2b5eb406630fa"
3081630828
}
3081730829
]
3081830830
},
@@ -30832,7 +30844,7 @@
3083230844
},
3083330845
{
3083430846
"name": "..\/..\/composer.lock",
30835-
"hash": "9ed7ffbea5b997bda1a2ac835aa0787b"
30847+
"hash": "57a58662b6da9a7cae285c7edb32d15d"
3083630848
}
3083730849
]
3083830850
}
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\GitHub\Internal\Operation\CodeScanning;
6+
7+
use ApiClients\Client\GitHub\Error as ErrorSchemas;
8+
use ApiClients\Client\GitHub\Internal;
9+
use ApiClients\Client\GitHub\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\SecretScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
74+
75+
throw new ErrorSchemas\Operations\SecretScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable(503, $this->hydrator->hydrateObject(Schema\Operations\SecretScanning\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+
}
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\GitHub\Internal\Operator\CodeScanning;
6+
7+
use ApiClients\Client\GitHub\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\GitHub\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/GitHub/src/Internal/Operator/Copilot/CopilotMetricsForEnterprise.php

+1-1
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\GitHub\Internal\Operation\Copilot\CopilotMetricsForEnterprise($this->responseSchemaValidator, $this->hydrator, $enterprise, $since, $until, $page, $perPage);

0 commit comments

Comments
 (0)