diff --git a/clients/GitHubEnterprise-3.14/etc/openapi-client-generator.state b/clients/GitHubEnterprise-3.14/etc/openapi-client-generator.state index a6dddbd1918..7fb421f3b15 100644 --- a/clients/GitHubEnterprise-3.14/etc/openapi-client-generator.state +++ b/clients/GitHubEnterprise-3.14/etc/openapi-client-generator.state @@ -1,5 +1,5 @@ { - "specHash": "d5ac2a68d76d323d5182cd11d4daf614", + "specHash": "c6bac21f127e4771c961c4af72e21fc4", "generatedFiles": { "files": [ { @@ -7112,15 +7112,15 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Operation\/CodeScanning\/UpdateAlert.php", - "hash": "4414595983724d58e1cdf5c09e8f409f" + "hash": "b7b8c2aaaf47299f09adbb2b88b5daf5" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Operator\/CodeScanning\/UpdateAlert.php", - "hash": "0d58379475f7ab773df9ae4b3b7d84c5" + "hash": "fd3b96fa7070fd31d1490b2ae4861c54" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/tests\/\/Internal\/Operation\/CodeScanning\/UpdateAlertTest.php", - "hash": "5e18056057b185cf3a4348a8b97f093c" + "hash": "78119db7046be60d7d867ad3af28c6fa" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Operation\/CodeScanning\/ListAlertInstances.php", @@ -15372,15 +15372,15 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/ExemptionRequest\/ExemptionRequestData.php", - "hash": "1fc2f779d08ed5752c34175a6d602409" + "hash": "be43c3a32b264a082842b4342eeed775" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Attribute\/CastUnionToType\/Schema\/ExemptionRequest\/Metadata.php", - "hash": "838b43367eb6df1a6caf3240812fc8e5" + "hash": "988efed4f7c1c3059ab0f63d472321a6" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/ExemptionRequest.php", - "hash": "5658982cf775d944e65e8d66e337f54f" + "hash": "bc1f73d90a1b2bbdf5c6f1ecdf0d6ce4" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/SimpleCheckSuite.php", @@ -26072,7 +26072,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/CodeScanning\/UpdateAlert\/Request\/ApplicationJson.php", - "hash": "ffbb63d8bfc655b760e73bb0a84b41b7" + "hash": "ef09173d8d817efd8e1e4e81d9f0edcc" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/CodeScanning\/UploadSarif\/Request\/ApplicationJson.php", @@ -27108,7 +27108,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/CodeScanning.php", - "hash": "f4eded73dbc98d19cc03cd2545bc0a44" + "hash": "b169946b91470cd53c5ec292b35ad780" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/Issues.php", @@ -27376,7 +27376,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/Seven.php", - "hash": "619ee85831f1ccf3b4aa9570bc701fb6" + "hash": "e6af182f8222fb648cfc3c789507197c" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Router\/Patch\/Nine.php", @@ -27440,11 +27440,11 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php", - "hash": "eb9acf050e7c53fe1a316472b8cdc81d" + "hash": "97dd79ecd381fec3cd9fc9f457fd7a7e" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php", - "hash": "e5864aba0dd4de9cada7ede4eeee69c5" + "hash": "33e3e8b67ec421309a6fd76be03316dc" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon", @@ -27456,7 +27456,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/Meta.php", - "hash": "efb7434a503625c23355172c4638e6bb" + "hash": "41cc72ff89d01e5b48be965d9a5b63fd" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/EnterpriseAdmin.php", @@ -27488,7 +27488,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/CodeScanning.php", - "hash": "035196723d9518e17e7f016fa71af9c8" + "hash": "254f6e3c029935a79e15b051e78e67ba" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/SecretScanning.php", @@ -27572,7 +27572,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/DependencyGraph.php", - "hash": "a69f445c74c4b7b7c28abe4e750cc769" + "hash": "a638452f9411a0fc738141835c32327d" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/Git.php", @@ -27584,7 +27584,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/Search.php", - "hash": "6e92f41ff9de1bd3067e80b3f3da380d" + "hash": "522fda33c8ae6024675365cb3775c1f1" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Operation\/Users.php", @@ -29028,7 +29028,7 @@ }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/CodeScanning\/Alerts\/AlertNumber.php", - "hash": "b9452bc32629313c2650579a65f77f38" + "hash": "a926bd101b56e9d2fa2d26b4ba0ef2d2" }, { "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Repos\/Owner\/Repo\/CodeScanning\/Alerts\/AlertNumber\/Instances.php", @@ -30283,20 +30283,24 @@ "hash": "d0ca0c14c2d902d47122181008e84185" }, { - "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/ExemptionRequestSecretScanningClosure.php", - "hash": "402d90be4e3731ec2090b344dd7be2cb" + "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/WebhookReleaseEdited\/Changes\/TagName.php", + "hash": "918a75e1fc3897bd242cdd1f3516cd1a" }, { - "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/ExemptionRequestSecretScanningClosureMetadata.php", - "hash": "481b587324bb974972dd0edc53d33df7" + "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/CodeScanningAlertCreateRequest.php", + "hash": "b1c32113d0944e1335325145d49ced03" }, { - "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/ExemptionRequestSecretScanningClosure\/Data.php", - "hash": "7e31b58800848793f0d914de6f592979" + "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/DismissalRequestSecretScanning.php", + "hash": "4311c37f93cd8a3fa3609969d2db5374" }, { - "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/WebhookReleaseEdited\/Changes\/TagName.php", - "hash": "918a75e1fc3897bd242cdd1f3516cd1a" + "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/DismissalRequestSecretScanningMetadata.php", + "hash": "4d08e7e942465ee37362f1f5a8df1060" + }, + { + "name": ".\/clients\/GitHubEnterprise-3.14\/etc\/..\/\/src\/\/Schema\/DismissalRequestSecretScanning\/Data.php", + "hash": "2a8bbc4780615e5e98d79b6596143aaf" } ] }, diff --git a/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/ExemptionRequestData.php b/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/ExemptionRequestData.php index 6675f92fc09..eb79e94ae2a 100644 --- a/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/ExemptionRequestData.php +++ b/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/ExemptionRequestData.php @@ -41,7 +41,7 @@ public function cast(mixed $value, ObjectMapper $hydrator): mixed if ($signature === 'data|type' && $value['type'] === 'secret_scanning_closure') { try { - return $hydrator->hydrateObject(Schema\ExemptionRequestSecretScanningClosure::class, $value); + return $hydrator->hydrateObject(Schema\DismissalRequestSecretScanning::class, $value); } catch (Throwable) { } } diff --git a/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/Metadata.php b/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/Metadata.php index 77f03f2525e..91b890d5b3e 100644 --- a/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/Metadata.php +++ b/clients/GitHubEnterprise-3.14/src/Internal/Attribute/CastUnionToType/Schema/ExemptionRequest/Metadata.php @@ -34,7 +34,7 @@ public function cast(mixed $value, ObjectMapper $hydrator): mixed if ($signature === 'alert_title|reason' && ($value['reason'] === 'fixed_later' || $value['reason'] === 'false_positive' || $value['reason'] === 'tests' || $value['reason'] === 'revoked')) { try { - return $hydrator->hydrateObject(Schema\ExemptionRequestSecretScanningClosureMetadata::class, $value); + return $hydrator->hydrateObject(Schema\DismissalRequestSecretScanningMetadata::class, $value); } catch (Throwable) { } } diff --git a/clients/GitHubEnterprise-3.14/src/Internal/Hydrator/Operation/Repos/Owner/Repo/CodeScanning/Alerts/AlertNumber.php b/clients/GitHubEnterprise-3.14/src/Internal/Hydrator/Operation/Repos/Owner/Repo/CodeScanning/Alerts/AlertNumber.php index ac16c1c6208..c42e5d0d8e8 100644 --- a/clients/GitHubEnterprise-3.14/src/Internal/Hydrator/Operation/Repos/Owner/Repo/CodeScanning/Alerts/AlertNumber.php +++ b/clients/GitHubEnterprise-3.14/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.14/src/Internal/Operation/CodeScanning/UpdateAlert.php b/clients/GitHubEnterprise-3.14/src/Internal/Operation/CodeScanning/UpdateAlert.php index 1da32c3c658..5ada5811c28 100644 --- a/clients/GitHubEnterprise-3.14/src/Internal/Operation/CodeScanning/UpdateAlert.php +++ b/clients/GitHubEnterprise-3.14/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.14/src/Internal/Operator/CodeScanning/UpdateAlert.php b/clients/GitHubEnterprise-3.14/src/Internal/Operator/CodeScanning/UpdateAlert.php index 16b4474e1eb..1e824a18990 100644 --- a/clients/GitHubEnterprise-3.14/src/Internal/Operator/CodeScanning/UpdateAlert.php +++ b/clients/GitHubEnterprise-3.14/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.14/src/Internal/Router/Patch/CodeScanning.php b/clients/GitHubEnterprise-3.14/src/Internal/Router/Patch/CodeScanning.php index 030665bed3c..76d1f89f954 100644 --- a/clients/GitHubEnterprise-3.14/src/Internal/Router/Patch/CodeScanning.php +++ b/clients/GitHubEnterprise-3.14/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.14/src/Internal/Router/Patch/Seven.php b/clients/GitHubEnterprise-3.14/src/Internal/Router/Patch/Seven.php index 46952949b86..624131f90f6 100644 --- a/clients/GitHubEnterprise-3.14/src/Internal/Router/Patch/Seven.php +++ b/clients/GitHubEnterprise-3.14/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.14/src/Operation/CodeScanning.php b/clients/GitHubEnterprise-3.14/src/Operation/CodeScanning.php index 1a0d5c77f3a..5cab50b880e 100644 --- a/clients/GitHubEnterprise-3.14/src/Operation/CodeScanning.php +++ b/clients/GitHubEnterprise-3.14/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.14/src/PHPStan/ClientCallReturnTypes.php b/clients/GitHubEnterprise-3.14/src/PHPStan/ClientCallReturnTypes.php index bb6c23f2e35..a4bd9eae15c 100644 --- a/clients/GitHubEnterprise-3.14/src/PHPStan/ClientCallReturnTypes.php +++ b/clients/GitHubEnterprise-3.14/src/PHPStan/ClientCallReturnTypes.php @@ -2552,7 +2552,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.14/src/Schema/CodeScanning/UpdateAlert/Request/ApplicationJson.php b/clients/GitHubEnterprise-3.14/src/Schema/CodeScanning/UpdateAlert/Request/ApplicationJson.php index c1ed911dd0c..772af2b8465 100644 --- a/clients/GitHubEnterprise-3.14/src/Schema/CodeScanning/UpdateAlert/Request/ApplicationJson.php +++ b/clients/GitHubEnterprise-3.14/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.14/src/Schema/CodeScanningAlertCreateRequest.php b/clients/GitHubEnterprise-3.14/src/Schema/CodeScanningAlertCreateRequest.php new file mode 100644 index 00000000000..8c03fd8fa39 --- /dev/null +++ b/clients/GitHubEnterprise-3.14/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.14/tests/Types/ClientCallReturnTypes.php b/clients/GitHubEnterprise-3.14/tests/Types/ClientCallReturnTypes.php index 4b3f93bace6..fb710ec106b 100644 --- a/clients/GitHubEnterprise-3.14/tests/Types/ClientCallReturnTypes.php +++ b/clients/GitHubEnterprise-3.14/tests/Types/ClientCallReturnTypes.php @@ -644,7 +644,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.14/current.spec.yaml b/etc/specs/GitHubEnterprise-3.14/current.spec.yaml index 6da32092e35..18a5f5fd70b 100644 --- a/etc/specs/GitHubEnterprise-3.14/current.spec.yaml +++ b/etc/specs/GitHubEnterprise-3.14/current.spec.yaml @@ -25910,6 +25910,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: @@ -25919,6 +25921,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 @@ -25929,6 +25932,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': @@ -81643,6 +81648,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. @@ -91983,7 +91991,7 @@ components: path: type: string description: The path of the file where the secret was detected - exemption-request-secret-scanning-closure: + dismissal-request-secret-scanning: title: Secret scanning alert dismissal request data description: Secret scanning alerts that have dismissal requests. type: object @@ -92021,7 +92029,7 @@ components: - fixed_later - false_positive - tests - exemption-request-secret-scanning-closure-metadata: + dismissal-request-secret-scanning-metadata: title: Secret scanning alert dismissal request metadata description: Metadata for a secret scanning alert dismissal request. type: object @@ -92102,7 +92110,7 @@ components: oneOf: - "$ref": "#/components/schemas/exemption-request-push-ruleset-bypass" - "$ref": "#/components/schemas/exemption-request-secret-scanning" - - "$ref": "#/components/schemas/exemption-request-secret-scanning-closure" + - "$ref": "#/components/schemas/dismissal-request-secret-scanning" resource_identifier: type: string description: The unique identifier for the request type of the exemption @@ -92130,7 +92138,7 @@ components: description: Metadata about the exemption request. oneOf: - "$ref": "#/components/schemas/exemption-request-secret-scanning-metadata" - - "$ref": "#/components/schemas/exemption-request-secret-scanning-closure-metadata" + - "$ref": "#/components/schemas/dismissal-request-secret-scanning-metadata" expires_at: type: string format: date-time