Skip to content

Commit 0765899

Browse files
authored
Merge pull request #1131 from php-api-clients/GitHub/from-1.1.4-3fc5da0b62540a45f2138abebf230a76-from-1.1.4-3fc5da0b62540a45f2138abebf230a76
2 parents 5fd74a1 + dffd406 commit 0765899

File tree

10 files changed

+66
-15
lines changed

10 files changed

+66
-15
lines changed

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

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"specHash": "b76fea2cb5ac476be8636e4403ed63dc",
2+
"specHash": "3fc5da0b62540a45f2138abebf230a76",
33
"generatedFiles": {
44
"files": [
55
{
@@ -5832,7 +5832,7 @@
58325832
},
58335833
{
58345834
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Pulls.php",
5835-
"hash": "d922518f8c93d21148f0207ad009c14a"
5835+
"hash": "c04a3852a873caba1c1cb5fa1d6809ce"
58365836
},
58375837
{
58385838
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/SecurityAdvisories.php",
@@ -22320,15 +22320,15 @@
2232022320
},
2232122321
{
2232222322
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Pulls\/Get.php",
22323-
"hash": "2fdac8b8f47e6ef4665bd0358f0c1303"
22323+
"hash": "39895d1dabf4bc14944fd5cf16d06c5c"
2232422324
},
2232522325
{
2232622326
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Pulls\/Get.php",
22327-
"hash": "73ee842fc0292c59dc2200e2846b63bb"
22327+
"hash": "92889b523b752b34c4fc662a887df619"
2232822328
},
2232922329
{
2233022330
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Pulls\/GetTest.php",
22331-
"hash": "f6749ab29ba4d6f24c162254d2f6a004"
22331+
"hash": "bb15700ce4e6ece8b994139f72d3783e"
2233222332
},
2233322333
{
2233422334
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Pulls\/Update.php",
@@ -26412,7 +26412,7 @@
2641226412
},
2641326413
{
2641426414
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Pulls.php",
26415-
"hash": "5b1290dc5c87df2b913fae08560df1aa"
26415+
"hash": "e632b6b1ae6e372daddc51110fac546a"
2641626416
},
2641726417
{
2641826418
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Billing.php",
@@ -26848,7 +26848,7 @@
2684826848
},
2684926849
{
2685026850
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php",
26851-
"hash": "147555754780b5408e6bdfb6561e2110"
26851+
"hash": "5d810b435cc9e1551a09c8f901cd27b0"
2685226852
},
2685326853
{
2685426854
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php",
@@ -29676,11 +29676,11 @@
2967629676
},
2967729677
{
2967829678
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php",
29679-
"hash": "9408a4fb50e75c12f4b05aa107e8928a"
29679+
"hash": "cfc185879effdc3851bfcb4839c949a6"
2968029680
},
2968129681
{
2968229682
"name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php",
29683-
"hash": "036db8bcfe296b31facfe15f66d870a5"
29683+
"hash": "dbbccace5b74e0da6ee51b823dd6a2bf"
2968429684
},
2968529685
{
2968629686
"name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon",

clients/GitHub/src/Internal/Operation/Pulls/Get.php

+8
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ public function createResponse(ResponseInterface $response): Schema\PullRequest|
6565
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
6666

6767
throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
68+
/**
69+
* Unacceptable
70+
**/
71+
72+
case 406:
73+
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
74+
75+
throw new ErrorSchemas\BasicError(406, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
6876
/**
6977
* Internal Error
7078
**/

clients/GitHub/src/Internal/Operator/Pulls/Get.php

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public function __construct(private Browser $browser, private AuthenticationInte
2525
{
2626
}
2727

28-
/** @return */
2928
public function call(string $owner, string $repo, int $pullNumber): PullRequest|WithoutBody
3029
{
3130
$operation = new \ApiClients\Client\GitHub\Internal\Operation\Pulls\Get($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $pullNumber);

clients/GitHub/src/Internal/Router/Get/Pulls.php

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ public function listReviewCommentsForRepo(array $params): iterable
138138
return $operator->call($arguments['owner'], $arguments['repo'], $arguments['sort'], $arguments['direction'], $arguments['since'], $arguments['per_page'], $arguments['page']);
139139
}
140140

141-
/** @return */
142141
public function get(array $params): PullRequest|WithoutBody
143142
{
144143
$arguments = [];

clients/GitHub/src/Internal/Router/Get/Six.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function __construct(private Routers $routers)
7373
{
7474
}
7575

76-
/** @return Observable<Schema\MarketplacePurchase>||Observable<Schema\RunnerApplication>|Observable<Schema\HookDeliveryItem>|Observable<Schema\Team>|Observable<Schema\MinimalRepository>|WithoutBody|Observable<Schema\SimpleUser>|Observable<Schema\TeamDiscussion>|Observable<Schema\OrganizationInvitation>|Observable<Schema\TeamProject>|Observable<Schema\CodeScanningAlertItems>|Observable<Schema\CodeScanningAnalysis>|Observable<Schema\DependabotAlert>|Observable<Schema\PorterAuthor>|Observable<Schema\PorterLargeFile>|Observable<Schema\IssueComment>|Observable<Schema\IssueEvent>|Observable<Schema\PageBuild>|Observable<Schema\CustomPropertyValue>|Observable<Schema\PullRequestReviewComment>|Observable<Schema\RuleSuites>|Observable<Schema\SecretScanningAlert>|Observable<int>|Schema\Operations\Repos\GetCodeFrequencyStats\Response\ApplicationJson\Accepted\Application\Json|Observable<Schema\CommitActivity>|Schema\Operations\Repos\GetCommitActivityStats\Response\ApplicationJson\Accepted\Application\Json|Observable<Schema\ContributorActivity>|Schema\Operations\Repos\GetContributorsStats\Response\ApplicationJson\Accepted\Application\Json|Observable<Schema\TagProtection>|Observable<Schema\TeamDiscussionComment>|Observable<Schema\Reaction>|Observable<Schema\PackageVersion>|Observable<Schema\Event> */
76+
/** @return Observable<Schema\MarketplacePurchase>||Observable<Schema\RunnerApplication>|Observable<Schema\HookDeliveryItem>|Observable<Schema\Team>|Observable<Schema\MinimalRepository>|WithoutBody|Observable<Schema\SimpleUser>|Observable<Schema\TeamDiscussion>|Observable<Schema\OrganizationInvitation>|Observable<Schema\TeamProject>|Observable<Schema\CodeScanningAlertItems>|Observable<Schema\CodeScanningAnalysis>|Observable<Schema\DependabotAlert>|Observable<Schema\PorterAuthor>|Observable<Schema\PorterLargeFile>|Observable<Schema\IssueComment>|Observable<Schema\IssueEvent>|Observable<Schema\PageBuild>|Observable<Schema\CustomPropertyValue>|Observable<Schema\PullRequestReviewComment>|Schema\PullRequest|\ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody|Observable<Schema\RuleSuites>|Observable<Schema\SecretScanningAlert>|Observable<int>|Schema\Operations\Repos\GetCodeFrequencyStats\Response\ApplicationJson\Accepted\Application\Json|Observable<Schema\CommitActivity>|Schema\Operations\Repos\GetCommitActivityStats\Response\ApplicationJson\Accepted\Application\Json|Observable<Schema\ContributorActivity>|Schema\Operations\Repos\GetContributorsStats\Response\ApplicationJson\Accepted\Application\Json|Observable<Schema\TagProtection>|Observable<Schema\TeamDiscussionComment>|Observable<Schema\Reaction>|Observable<Schema\PackageVersion>|Observable<Schema\Event> */
7777
public function call(string $call, array $params, array $pathChunks): iterable|ActionsCacheUsageOrgEnterprise|Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListSelectedRepositoriesEnabledGithubActionsOrganization\Response\ApplicationJson\Ok|SelectedActions|ActionsGetDefaultWorkflowPermissions|Runner|ActionsPublicKey|OrganizationActionsSecret|OrganizationActionsVariable|CodespacesPublicKey|CodespacesOrgSecret|\ApiClients\Client\GitHub\Schema\Operations\Copilot\ListCopilotSeats\Response\ApplicationJson\Ok|DependabotPublicKey|OrganizationDependabotSecret|WebhookConfig|Json|WithoutBody|CopilotSeatDetails|Package|OrgCustomProperty|RuleSuite|ActionsBillingUsage|PackagesBillingUsage|CombinedBillingUsage|ProjectCollaboratorPermission|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListArtifactsForRepo\Response\ApplicationJson\Ok|ActionsCacheList|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListRepoOrganizationSecrets\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListRepoOrganizationVariables\Response\ApplicationJson\Ok|ActionsRepositoryPermissions|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListSelfHostedRunnersForRepo\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListWorkflowRunsForRepo\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListRepoSecrets\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListRepoVariables\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListRepoWorkflows\Response\ApplicationJson\Ok|Autolink|BranchWithProtection|BasicError|CheckRun|CheckSuite|CodeScanningDefaultSetup|CodeownersErrors|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListDevcontainersInRepositoryForAuthenticatedUser\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\RepoMachinesForAuthenticatedUser\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\PreFlightWithRepoForAuthenticatedUser\Response\ApplicationJson\Ok|CodespacesPermissionsCheckForDevcontainer|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListRepoSecrets\Response\ApplicationJson\Ok|CommitComment|Commit|CommunityProfile|CommitComparison|ContentDirectory|ContentFile|ContentSymlink|ContentSubmodule|\ApiClients\Client\GitHub\Schema\Operations\Dependabot\ListRepoSecrets\Response\ApplicationJson\Ok|DependencyGraphSpdxSbom|Deployment|Environment|Hook|Issue|DeployKey|Label|Milestone|PagesHealthCheck|EmptyObject|PullRequest|Release|RepositoryRuleset|RepositoryAdvisory|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetCodeFrequencyStats\Response\ApplicationJson\Accepted\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetCommitActivityStats\Response\ApplicationJson\Accepted\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetContributorsStats\Response\ApplicationJson\Accepted\Application\Json|ParticipationStats|CloneTraffic|ViewTraffic|TeamRepository|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListRepositoriesForSecretForAuthenticatedUser\Response\ApplicationJson\Ok\Application\Json|CodespaceExportDetails
7878
{
7979
if ($pathChunks[0] === '') {

clients/GitHub/src/Operation/Pulls.php

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public function updateReviewComment(string $owner, string $repo, int $commentId,
6969
return $this->operators->pulls👷UpdateReviewComment()->call($owner, $repo, $commentId, $params);
7070
}
7171

72-
/** @return */
7372
public function get(string $owner, string $repo, int $pullNumber): PullRequest|WithoutBody
7473
{
7574
return $this->operators->pulls👷Get()->call($owner, $repo, $pullNumber);

clients/GitHub/src/PHPStan/ClientCallReturnTypes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3152,7 +3152,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
31523152
}
31533153

31543154
if ($call === 'GET /repos/{owner}/{repo}/pulls/{pull_number}') {
3155-
return $this->typeResolver->resolve('');
3155+
return $this->typeResolver->resolve('Schema\\PullRequest|\\ApiClients\\Tools\\OpenApiClient\\Utils\\Response\\WithoutBody');
31563156
}
31573157

31583158
if ($call === 'PATCH /repos/{owner}/{repo}/pulls/{pull_number}') {

clients/GitHub/tests/Internal/Operation/Pulls/GetTest.php

+36
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,42 @@ public function operations_httpCode_404_responseContentType_application_json_zer
9191
$result = $client->operations()->pulls()->get('generated', 'generated', 11);
9292
}
9393

94+
/** @test */
95+
public function call_httpCode_406_responseContentType_application_json_zero(): void
96+
{
97+
self::expectException(ErrorSchemas\BasicError::class);
98+
$response = new Response(406, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true)));
99+
$auth = $this->prophesize(AuthenticationInterface::class);
100+
$auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled();
101+
$browser = $this->prophesize(Browser::class);
102+
$browser->withBase(Argument::any())->willReturn($browser->reveal());
103+
$browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal());
104+
$browser->request('GET', '/repos/generated/generated/pulls/11', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled();
105+
$client = new Client($auth->reveal(), $browser->reveal());
106+
$result = $client->call(Internal\Operation\Pulls\Get::OPERATION_MATCH, (static function (array $data): array {
107+
$data['owner'] = 'generated';
108+
$data['repo'] = 'generated';
109+
$data['pull_number'] = 11;
110+
111+
return $data;
112+
})([]));
113+
}
114+
115+
/** @test */
116+
public function operations_httpCode_406_responseContentType_application_json_zero(): void
117+
{
118+
self::expectException(ErrorSchemas\BasicError::class);
119+
$response = new Response(406, ['Content-Type' => 'application/json'], json_encode(json_decode(Schema\BasicError::SCHEMA_EXAMPLE_DATA, true)));
120+
$auth = $this->prophesize(AuthenticationInterface::class);
121+
$auth->authHeader(Argument::any())->willReturn('Bearer beer')->shouldBeCalled();
122+
$browser = $this->prophesize(Browser::class);
123+
$browser->withBase(Argument::any())->willReturn($browser->reveal());
124+
$browser->withFollowRedirects(Argument::any())->willReturn($browser->reveal());
125+
$browser->request('GET', '/repos/generated/generated/pulls/11', Argument::type('array'), Argument::any())->willReturn(resolve($response))->shouldBeCalled();
126+
$client = new Client($auth->reveal(), $browser->reveal());
127+
$result = $client->operations()->pulls()->get('generated', 'generated', 11);
128+
}
129+
94130
/** @test */
95131
public function call_httpCode_500_responseContentType_application_json_zero(): void
96132
{

clients/GitHub/tests/Types/ClientCallReturnTypes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ function authHeader(): string
794794
assertType('Observable<Schema\\Reaction>', $client->call('LIST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions'));
795795
assertType('', $client->call('POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions'));
796796
assertType('', $client->call('DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}'));
797-
assertType('', $client->call('GET /repos/{owner}/{repo}/pulls/{pull_number}'));
797+
assertType('Schema\\PullRequest|\\ApiClients\\Tools\\OpenApiClient\\Utils\\Response\\WithoutBody', $client->call('GET /repos/{owner}/{repo}/pulls/{pull_number}'));
798798
assertType('', $client->call('PATCH /repos/{owner}/{repo}/pulls/{pull_number}'));
799799
assertType('', $client->call('POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces'));
800800
assertType('Observable<Schema\\PullRequestReviewComment>', $client->call('GET /repos/{owner}/{repo}/pulls/{pull_number}/comments'));

etc/specs/GitHub/current.spec.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -16761,6 +16761,8 @@ paths:
1676116761
Anyone with read access to the repository can use this endpoint.
1676216762

1676316763
OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository.
16764+
16765+
This API will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, `created`, `event`, `head_sha`, `status`.
1676416766
tags:
1676516767
- actions
1676616768
operationId: actions/list-workflow-runs-for-repo
@@ -33346,6 +33348,8 @@ paths:
3334633348
"$ref": "#/components/responses/not_modified"
3334733349
'404':
3334833350
"$ref": "#/components/responses/not_found"
33351+
'406':
33352+
"$ref": "#/components/responses/unacceptable"
3334933353
'500':
3335033354
"$ref": "#/components/responses/internal_error"
3335133355
'503':
@@ -237729,6 +237733,12 @@ components:
237729237733
application/json:
237730237734
schema:
237731237735
"$ref": "#/components/schemas/basic-error"
237736+
unacceptable:
237737+
description: Unacceptable
237738+
content:
237739+
application/json:
237740+
schema:
237741+
"$ref": "#/components/schemas/basic-error"
237732237742
headers:
237733237743
link:
237734237744
example: <https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>;

0 commit comments

Comments
 (0)