diff --git a/clients/GitHubEnterprise-3.13/etc/openapi-client-generator.state b/clients/GitHubEnterprise-3.13/etc/openapi-client-generator.state index 24100b7dad3..1059165f137 100644 --- a/clients/GitHubEnterprise-3.13/etc/openapi-client-generator.state +++ b/clients/GitHubEnterprise-3.13/etc/openapi-client-generator.state @@ -1,5 +1,5 @@ { - "specHash": "802a0cd5a04204e42ef5ea0492e36a70", + "specHash": "ffac604ed0c1f24261dd953b32c2fba3", "generatedFiles": { "files": [ { @@ -6948,15 +6948,15 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Operation\/CodeScanning\/UpdateAlert.php", - "hash": "4414595983724d58e1cdf5c09e8f409f" + "hash": "b7b8c2aaaf47299f09adbb2b88b5daf5" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Operator\/CodeScanning\/UpdateAlert.php", - "hash": "0d58379475f7ab773df9ae4b3b7d84c5" + "hash": "fd3b96fa7070fd31d1490b2ae4861c54" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/tests\/\/Internal\/Operation\/CodeScanning\/UpdateAlertTest.php", - "hash": "5e18056057b185cf3a4348a8b97f093c" + "hash": "78119db7046be60d7d867ad3af28c6fa" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Operation\/CodeScanning\/ListAlertInstances.php", @@ -25776,7 +25776,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Schema\/CodeScanning\/UpdateAlert\/Request\/ApplicationJson.php", - "hash": "ffbb63d8bfc655b760e73bb0a84b41b7" + "hash": "ef09173d8d817efd8e1e4e81d9f0edcc" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Schema\/CodeScanning\/UploadSarif\/Request\/ApplicationJson.php", @@ -26812,7 +26812,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/CodeScanning.php", - "hash": "f4eded73dbc98d19cc03cd2545bc0a44" + "hash": "b169946b91470cd53c5ec292b35ad780" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/Issues.php", @@ -27080,7 +27080,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/Seven.php", - "hash": "619ee85831f1ccf3b4aa9570bc701fb6" + "hash": "e6af182f8222fb648cfc3c789507197c" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/Nine.php", @@ -27144,11 +27144,11 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php", - "hash": "2fb5474325448bccbcb22bb7d1158ea1" + "hash": "6e5907cbb91f9f456405e81c70a308bb" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php", - "hash": "54beea339c8099994a522e19c9c55b8c" + "hash": "5b04e61e38fb830021cb4372f584f019" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon", @@ -27160,7 +27160,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/Meta.php", - "hash": "efb7434a503625c23355172c4638e6bb" + "hash": "41cc72ff89d01e5b48be965d9a5b63fd" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/EnterpriseAdmin.php", @@ -27192,7 +27192,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/CodeScanning.php", - "hash": "035196723d9518e17e7f016fa71af9c8" + "hash": "254f6e3c029935a79e15b051e78e67ba" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/SecretScanning.php", @@ -27276,7 +27276,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/DependencyGraph.php", - "hash": "a69f445c74c4b7b7c28abe4e750cc769" + "hash": "a638452f9411a0fc738141835c32327d" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/Git.php", @@ -27288,7 +27288,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/Search.php", - "hash": "6e92f41ff9de1bd3067e80b3f3da380d" + "hash": "522fda33c8ae6024675365cb3775c1f1" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Operation\/Users.php", @@ -28716,7 +28716,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/CodeScanning\/Alerts\/AlertNumber.php", - "hash": "b9452bc32629313c2650579a65f77f38" + "hash": "a926bd101b56e9d2fa2d26b4ba0ef2d2" }, { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/CodeScanning\/Alerts\/AlertNumber\/Instances.php", @@ -29969,6 +29969,10 @@ { "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Schema\/WebhookReleaseEdited\/Changes\/TagName.php", "hash": "918a75e1fc3897bd242cdd1f3516cd1a" + }, + { + "name": ".\/clients\/GitHubEnterprise-3.13\/etc\/..\/\/src\/\/Schema\/CodeScanningAlertCreateRequest.php", + "hash": "b1c32113d0944e1335325145d49ced03" } ] }, diff --git a/clients/GitHubEnterprise-3.13/src/Internal/Hydrator/Operation/Repos/Owner/Repo/CodeScanning/Alerts/AlertNumber.php b/clients/GitHubEnterprise-3.13/src/Internal/Hydrator/Operation/Repos/Owner/Repo/CodeScanning/Alerts/AlertNumber.php index ac16c1c6208..c42e5d0d8e8 100644 --- a/clients/GitHubEnterprise-3.13/src/Internal/Hydrator/Operation/Repos/Owner/Repo/CodeScanning/Alerts/AlertNumber.php +++ b/clients/GitHubEnterprise-3.13/src/Internal/Hydrator/Operation/Repos/Owner/Repo/CodeScanning/Alerts/AlertNumber.php @@ -12,6 +12,7 @@ use ApiClients\Client\GitHubEnterprise\Schema\CodeScanningAlertRule; use ApiClients\Client\GitHubEnterprise\Schema\CodeScanningAnalysisTool; use ApiClients\Client\GitHubEnterprise\Schema\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable; +use ApiClients\Client\GitHubEnterprise\Schema\ScimError; use ApiClients\Client\GitHubEnterprise\Schema\SimpleUser; use EventSauce\ObjectHydrator\IterableList; use EventSauce\ObjectHydrator\ObjectMapper; @@ -57,6 +58,7 @@ public function hydrateObject(string $className, array $payload): object 'ApiClients\Client\GitHubEnterprise\Schema\CodeScanningAlertLocation' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️CodeScanningAlertLocation($payload), 'ApiClients\Client\GitHubEnterprise\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️BasicError($payload), 'ApiClients\Client\GitHubEnterprise\Schema\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️Operations⚡️CodeScanning⚡️ListAlertsForEnterprise⚡️Response⚡️ApplicationJson⚡️ServiceUnavailable($payload), + 'ApiClients\Client\GitHubEnterprise\Schema\ScimError' => $this->hydrateApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️ScimError($payload), default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), }; } @@ -1098,6 +1100,91 @@ private function hydrateApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema } } + private function hydrateApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️ScimError(array $payload): ScimError + { + $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['detail'] ?? null; + + if ($value === null) { + $properties['detail'] = null; + goto after_detail; + } + + $properties['detail'] = $value; + + after_detail: + + $value = $payload['status'] ?? null; + + if ($value === null) { + $properties['status'] = null; + goto after_status; + } + + $properties['status'] = $value; + + after_status: + + $value = $payload['scim_type'] ?? null; + + if ($value === null) { + $properties['scimType'] = null; + goto after_scimType; + } + + $properties['scimType'] = $value; + + after_scimType: + + $value = $payload['schemas'] ?? null; + + if ($value === null) { + $properties['schemas'] = null; + goto after_schemas; + } + + $properties['schemas'] = $value; + + after_schemas: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHubEnterprise\Schema\ScimError', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(ScimError::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new ScimError(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHubEnterprise\Schema\ScimError', $exception, stack: $this->hydrationStack); + } + } + private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array { foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) { @@ -1138,6 +1225,7 @@ public function serializeObjectOfType(object $object, string $className): mixed 'ApiClients\Client\GitHubEnterprise\Schema\CodeScanningAlertLocation' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️CodeScanningAlertLocation($object), 'ApiClients\Client\GitHubEnterprise\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️BasicError($object), 'ApiClients\Client\GitHubEnterprise\Schema\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️Operations⚡️CodeScanning⚡️ListAlertsForEnterprise⚡️Response⚡️ApplicationJson⚡️ServiceUnavailable($object), + 'ApiClients\Client\GitHubEnterprise\Schema\ScimError' => $this->serializeObjectApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️ScimError($object), default => throw new LogicException("No serialization defined for $className"), }; } catch (Throwable $exception) { @@ -1752,6 +1840,69 @@ private function serializeObjectApiClients⚡️Client⚡️GitHubEnterprise⚡ return $result; } + private function serializeObjectApiClients⚡️Client⚡️GitHubEnterprise⚡️Schema⚡️ScimError(mixed $object): mixed + { + assert($object instanceof ScimError); + $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; + + $detail = $object->detail; + + if ($detail === null) { + goto after_detail; + } + + after_detail: $result['detail'] = $detail; + + $status = $object->status; + + if ($status === null) { + goto after_status; + } + + after_status: $result['status'] = $status; + + $scimType = $object->scimType; + + if ($scimType === null) { + goto after_scimType; + } + + after_scimType: $result['scim_type'] = $scimType; + + $schemas = $object->schemas; + + if ($schemas === null) { + goto after_schemas; + } + + static $schemasSerializer0; + + if ($schemasSerializer0 === null) { + $schemasSerializer0 = new SerializeArrayItems(...[]); + } + + $schemas = $schemasSerializer0->serialize($schemas, $this); + after_schemas: $result['schemas'] = $schemas; + + return $result; + } + /** * @param class-string $className * @param iterable $payloads; diff --git a/clients/GitHubEnterprise-3.13/src/Internal/Operation/CodeScanning/UpdateAlert.php b/clients/GitHubEnterprise-3.13/src/Internal/Operation/CodeScanning/UpdateAlert.php index 1da32c3c658..5ada5811c28 100644 --- a/clients/GitHubEnterprise-3.13/src/Internal/Operation/CodeScanning/UpdateAlert.php +++ b/clients/GitHubEnterprise-3.13/src/Internal/Operation/CodeScanning/UpdateAlert.php @@ -59,6 +59,14 @@ public function createResponse(ResponseInterface $response): Schema\CodeScanning $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CodeScanningAlert::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); return $this->hydrator->hydrateObject(Schema\CodeScanningAlert::class, $body); + /** + * Bad Request + **/ + + case 400: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(400, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); /** * Response if the repository is archived or if GitHub Advanced Security is not enabled for this repository **/ @@ -85,6 +93,19 @@ public function createResponse(ResponseInterface $response): Schema\CodeScanning throw new ErrorSchemas\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable(503, $this->hydrator->hydrateObject(Schema\Operations\CodeScanning\ListAlertsForEnterprise\Response\ApplicationJson\ServiceUnavailable::class, $body)); } + break; + case 'application/scim+json': + $body = json_decode($response->getBody()->getContents(), true); + switch ($code) { + /** + * Bad Request + **/ + case 400: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\ScimError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\ScimError(400, $this->hydrator->hydrateObject(Schema\ScimError::class, $body)); + } + break; } diff --git a/clients/GitHubEnterprise-3.13/src/Internal/Operator/CodeScanning/UpdateAlert.php b/clients/GitHubEnterprise-3.13/src/Internal/Operator/CodeScanning/UpdateAlert.php index 16b4474e1eb..1e824a18990 100644 --- a/clients/GitHubEnterprise-3.13/src/Internal/Operator/CodeScanning/UpdateAlert.php +++ b/clients/GitHubEnterprise-3.13/src/Internal/Operator/CodeScanning/UpdateAlert.php @@ -24,7 +24,6 @@ public function __construct(private Browser $browser, private AuthenticationInte { } - /** @return */ public function call(string $owner, string $repo, int $alertNumber, array $params): CodeScanningAlert { $operation = new \ApiClients\Client\GitHubEnterprise\Internal\Operation\CodeScanning\UpdateAlert($this->requestSchemaValidator, $this->responseSchemaValidator, $this->hydrator, $owner, $repo, $alertNumber); diff --git a/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/CodeScanning.php b/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/CodeScanning.php index 030665bed3c..76d1f89f954 100644 --- a/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/CodeScanning.php +++ b/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/CodeScanning.php @@ -42,7 +42,6 @@ public function updateDefaultSetup(array $params): EmptyObject|CodeScanningDefau return $operator->call($arguments['owner'], $arguments['repo'], $params); } - /** @return */ public function updateAlert(array $params): CodeScanningAlert { $arguments = []; diff --git a/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/Seven.php b/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/Seven.php index 46952949b86..624131f90f6 100644 --- a/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/Seven.php +++ b/clients/GitHubEnterprise-3.13/src/Internal/Router/Patch/Seven.php @@ -26,6 +26,7 @@ public function __construct(private Routers $routers) { } + /** @return |Schema\CodeScanningAlert */ public function call(string $call, array $params, array $pathChunks): TeamDiscussion|WithoutBody|CodeScanningAlert|DependabotAlert|GitRef|WebhookConfig|IssueComment|PullRequestReviewComment|ReleaseAsset|SecretScanningAlert|GroupResponse|UserResponse|TeamDiscussionComment { if ($pathChunks[0] === '') { diff --git a/clients/GitHubEnterprise-3.13/src/Operation/CodeScanning.php b/clients/GitHubEnterprise-3.13/src/Operation/CodeScanning.php index 1a0d5c77f3a..5cab50b880e 100644 --- a/clients/GitHubEnterprise-3.13/src/Operation/CodeScanning.php +++ b/clients/GitHubEnterprise-3.13/src/Operation/CodeScanning.php @@ -64,7 +64,6 @@ public function getAlert(string $owner, string $repo, int $alertNumber): CodeSca return $this->operators->codeScanning👷GetAlert()->call($owner, $repo, $alertNumber); } - /** @return */ public function updateAlert(string $owner, string $repo, int $alertNumber, array $params): CodeScanningAlert { return $this->operators->codeScanning👷UpdateAlert()->call($owner, $repo, $alertNumber, $params); diff --git a/clients/GitHubEnterprise-3.13/src/PHPStan/ClientCallReturnTypes.php b/clients/GitHubEnterprise-3.13/src/PHPStan/ClientCallReturnTypes.php index e42785fc5cb..bcc46fabbef 100644 --- a/clients/GitHubEnterprise-3.13/src/PHPStan/ClientCallReturnTypes.php +++ b/clients/GitHubEnterprise-3.13/src/PHPStan/ClientCallReturnTypes.php @@ -2488,7 +2488,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method } if ($call === 'PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}') { - return $this->typeResolver->resolve(''); + return $this->typeResolver->resolve('Schema\\CodeScanningAlert'); } if ($call === 'GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances') { diff --git a/clients/GitHubEnterprise-3.13/src/Schema/CodeScanning/UpdateAlert/Request/ApplicationJson.php b/clients/GitHubEnterprise-3.13/src/Schema/CodeScanning/UpdateAlert/Request/ApplicationJson.php index c1ed911dd0c..772af2b8465 100644 --- a/clients/GitHubEnterprise-3.13/src/Schema/CodeScanning/UpdateAlert/Request/ApplicationJson.php +++ b/clients/GitHubEnterprise-3.13/src/Schema/CodeScanning/UpdateAlert/Request/ApplicationJson.php @@ -42,6 +42,10 @@ "null" ], "description": "The dismissal comment associated with the dismissal of the alert." + }, + "create_request": { + "type": "boolean", + "description": "If `true`, attempt to create an alert dismissal request." } } }'; @@ -50,17 +54,20 @@ public const SCHEMA_EXAMPLE_DATA = '{ "state": "open", "dismissed_reason": "used in tests", - "dismissed_comment": "generated" + "dismissed_comment": "generated", + "create_request": false }'; /** * state: Sets the state of the code scanning alert. You must provide `dismissed_reason` when you set the state to `dismissed`. * dismissedReason: **Required when the state is dismissed.** The reason for dismissing or closing the alert. * dismissedComment: The dismissal comment associated with the dismissal of the alert. + * createRequest: If `true`, attempt to create an alert dismissal request. */ public function __construct(public string $state, #[MapFrom('dismissed_reason')] public string|null $dismissedReason, #[MapFrom('dismissed_comment')] - public string|null $dismissedComment,) + public string|null $dismissedComment, #[MapFrom('create_request')] + public bool|null $createRequest,) { } } diff --git a/clients/GitHubEnterprise-3.13/src/Schema/CodeScanningAlertCreateRequest.php b/clients/GitHubEnterprise-3.13/src/Schema/CodeScanningAlertCreateRequest.php new file mode 100644 index 00000000000..8c03fd8fa39 --- /dev/null +++ b/clients/GitHubEnterprise-3.13/src/Schema/CodeScanningAlertCreateRequest.php @@ -0,0 +1,20 @@ +operations()->codeScanning()->updateAlert('generated', 'generated', 12, json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); } + /** @test */ + public function call_httpCode_400_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(400, ['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('PATCH', '/repos/generated/generated/code-scanning/alerts/12', Argument::type('array'), json_encode(json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeScanning\UpdateAlert::OPERATION_MATCH, (static function (array $data): array { + $data['owner'] = 'generated'; + $data['repo'] = 'generated'; + $data['alert_number'] = 12; + + return $data; + })(json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true))); + } + + /** @test */ + public function operations_httpCode_400_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(400, ['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('PATCH', '/repos/generated/generated/code-scanning/alerts/12', Argument::type('array'), json_encode(json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeScanning()->updateAlert('generated', 'generated', 12, json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); + } + + /** @test */ + public function call_httpCode_400_requestContentType_application_json_responseContentType_application_scim_json_zero(): void + { + self::expectException(ErrorSchemas\ScimError::class); + $response = new Response(400, ['Content-Type' => 'application/scim+json'], json_encode(json_decode(Schema\ScimError::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('PATCH', '/repos/generated/generated/code-scanning/alerts/12', Argument::type('array'), json_encode(json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeScanning\UpdateAlert::OPERATION_MATCH, (static function (array $data): array { + $data['owner'] = 'generated'; + $data['repo'] = 'generated'; + $data['alert_number'] = 12; + + return $data; + })(json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true))); + } + + /** @test */ + public function operations_httpCode_400_requestContentType_application_json_responseContentType_application_scim_json_zero(): void + { + self::expectException(ErrorSchemas\ScimError::class); + $response = new Response(400, ['Content-Type' => 'application/scim+json'], json_encode(json_decode(Schema\ScimError::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('PATCH', '/repos/generated/generated/code-scanning/alerts/12', Argument::type('array'), json_encode(json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeScanning()->updateAlert('generated', 'generated', 12, json_decode(Schema\CodeScanning\UpdateAlert\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); + } + /** @test */ public function call_httpCode_403_requestContentType_application_json_responseContentType_application_json_zero(): void { diff --git a/clients/GitHubEnterprise-3.13/tests/Types/ClientCallReturnTypes.php b/clients/GitHubEnterprise-3.13/tests/Types/ClientCallReturnTypes.php index e5157d7a68e..9dc180832fd 100644 --- a/clients/GitHubEnterprise-3.13/tests/Types/ClientCallReturnTypes.php +++ b/clients/GitHubEnterprise-3.13/tests/Types/ClientCallReturnTypes.php @@ -628,7 +628,7 @@ function authHeader(): string assertType('Observable|WithoutBody', $client->call('GET /repos/{owner}/{repo}/code-scanning/alerts')); assertType('Observable|WithoutBody', $client->call('LIST /repos/{owner}/{repo}/code-scanning/alerts')); assertType('', $client->call('GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}')); -assertType('', $client->call('PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}')); +assertType('Schema\\CodeScanningAlert', $client->call('PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}')); assertType('Observable', $client->call('GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances')); assertType('Observable', $client->call('LIST /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances')); assertType('Observable', $client->call('GET /repos/{owner}/{repo}/code-scanning/analyses')); diff --git a/etc/specs/GitHubEnterprise-3.13/current.spec.yaml b/etc/specs/GitHubEnterprise-3.13/current.spec.yaml index 5fdb3cfc3bd..404f4e16af0 100644 --- a/etc/specs/GitHubEnterprise-3.13/current.spec.yaml +++ b/etc/specs/GitHubEnterprise-3.13/current.spec.yaml @@ -25291,6 +25291,8 @@ paths: "$ref": "#/components/schemas/code-scanning-alert-dismissed-reason" dismissed_comment: "$ref": "#/components/schemas/code-scanning-alert-dismissed-comment" + create_request: + "$ref": "#/components/schemas/code-scanning-alert-create-request" required: - state examples: @@ -25300,6 +25302,7 @@ paths: dismissed_reason: false positive dismissed_comment: This alert is not actually correct, because there's a sanitizer included in the library. + create_request: true responses: '200': description: Response @@ -25310,6 +25313,8 @@ paths: examples: default: "$ref": "#/components/examples/code-scanning-alert-dismissed" + '400': + "$ref": "#/components/responses/bad_request" '403': "$ref": "#/components/responses/code_scanning_forbidden_write" '404': @@ -80278,6 +80283,9 @@ components: enum: - open - dismissed + code-scanning-alert-create-request: + type: boolean + description: If `true`, attempt to create an alert dismissal request. code-scanning-analysis-sarif-id: type: string description: An identifier for the upload.