diff --git a/clients/GitHub/README.md b/clients/GitHub/README.md index 7f3946bb2ba..df2ea1e8350 100644 --- a/clients/GitHub/README.md +++ b/clients/GitHub/README.md @@ -3730,6 +3730,26 @@ $client->operations()->codeSecurity()->getDefaultConfigurations( org: 'ge You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/code-security/configurations#get-default-code-security-configurations). +### code-security/detach-configuration + +Detach configurations from repositories + +Using the `call` method: +```php +$client->call('DELETE /orgs/{org}/code-security/configurations/detach', [ + 'org' => 'generated', +]); +``` + +Operations method: +```php +$client->operations()->codeSecurity()->detachConfiguration( org: 'generated', +); +``` + +You can find more about this operation over at the [API method documentation](https://docs.github.com/rest/code-security/configurations#detach-configurations-from-repositories). + + ### code-security/get-configuration Get a code security configuration diff --git a/clients/GitHub/etc/openapi-client-generator.state b/clients/GitHub/etc/openapi-client-generator.state index 2d8b42c1e26..c619cb08367 100644 --- a/clients/GitHub/etc/openapi-client-generator.state +++ b/clients/GitHub/etc/openapi-client-generator.state @@ -1,5 +1,5 @@ { - "specHash": "12b8dbc76c459480c3e846bc22d32615", + "specHash": "c956dacd1ed3014e8efb91f1eb6a337d", "generatedFiles": { "files": [ { @@ -288,7 +288,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/OrganizationFull.php", - "hash": "fd40f8505e02daedbc846d0406c9eb96" + "hash": "3a018ac7ea2387bbc8405cb2b90dfd3f" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/ActionsCacheUsageOrgEnterprise.php", @@ -4468,7 +4468,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Orgs\/Update\/Request\/ApplicationJson.php", - "hash": "c0422933c5557db861e6207a78b73542" + "hash": "f6f7aad784e525decd37a79916b6a09d" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Operations\/Orgs\/Update\/Response\/ApplicationJson\/UnprocessableEntity.php", @@ -5612,7 +5612,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Repos.php", - "hash": "a0291fcee4301d2224ce2487ce42e878" + "hash": "b05be33ef97b8b7d3366d6e585dcd44a" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/Billing.php", @@ -17040,11 +17040,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/Repos\/CheckAutomatedSecurityFixes.php", - "hash": "8c5af271c27f39436ecca2b44c4ee10e" + "hash": "d111ff8130aefccc96d5cfbc13ecab4b" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/Repos\/CheckAutomatedSecurityFixes.php", - "hash": "661435f046f86ba7d65213887f17c7f1" + "hash": "80f967cdb9cdd63cbcd64a69372c81e9" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/Repos\/CheckAutomatedSecurityFixesTest.php", @@ -24476,7 +24476,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Repos.php", - "hash": "7f939a283bd4c652ec2384e186010197" + "hash": "99af889ce5ea9d2586ba5898f4edc7b3" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Users.php", @@ -24968,7 +24968,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Five.php", - "hash": "d99d9cc5cb5c29690e0b91c96416f739" + "hash": "f7000d6c43a48afcf7602d52940ffd2a" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php", @@ -25112,7 +25112,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Six.php", - "hash": "741f8353ae766d2cdbd56c0c5a43b801" + "hash": "08ccaed3cd1c6bf14a3562ee889d0655" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Eight.php", @@ -25176,7 +25176,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operators.php", - "hash": "6dbff33fe8e4f51ca2329a661168cf0c" + "hash": "6a427f682377fe3c4636b772e67b5bf4" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Root.php", @@ -27168,7 +27168,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrators.php", - "hash": "c4d66f4e9938472ee0098a2e3cd70430" + "hash": "5acd7ef5acdf5f96cee2384a7f5c9bb9" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/OrganizationSimpleWebhooks.php", @@ -27788,11 +27788,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php", - "hash": "34097be811968901ed3316c689e3d3eb" + "hash": "c4f8b4e0d0daaf6de6571573822d30a7" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php", - "hash": "b24dfb45ef8936c0dcfc11f99fb51c47" + "hash": "ff978093ecf334a8785c1f3add0fabe3" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon", @@ -29816,11 +29816,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CodeSecurityConfiguration.php", - "hash": "b8a95e4449711ae850dcd4a7e1380c6b" + "hash": "3079c2fbeb9341d5128ad0d86124c8a5" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CodeSecurityDefaultConfigurations.php", - "hash": "30594d8562f33fb560d2de7512b01029" + "hash": "80a90378337a30e5cb817beb5bb56f4f" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CodeSecurityConfigurationRepositories.php", @@ -29852,11 +29852,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CodeSecurity\/CreateConfiguration\/Request\/ApplicationJson.php", - "hash": "a8a7a883076d166c4f26d1d27ee1a52c" + "hash": "dde9c21271d743e986c64b6b1c1e6039" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CodeSecurity\/UpdateConfiguration\/Request\/ApplicationJson.php", - "hash": "c2a989ef2179f49a9e7d74142d281468" + "hash": "f2e0674220f301a4860e99d1e2d407c5" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CodeSecurity\/AttachConfiguration\/Request\/ApplicationJson.php", @@ -29868,7 +29868,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/Operations\/CodeSecurity\/SetConfigurationAsDefault\/Response\/ApplicationJson\/Ok.php", - "hash": "f0088d18c282cdae90d6c87195bb4d5d" + "hash": "e9b8b4a9300ca7d9535d546f1a9b80f6" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Get\/CodeSecurity.php", @@ -29884,7 +29884,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/CodeSecurity.php", - "hash": "a692bc85c60dc4f6bcab53efd490a715" + "hash": "fb93ff0e33eac9591443590799764b01" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Router\/Put\/CodeSecurity.php", @@ -29892,11 +29892,11 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Operation\/CodeSecurity.php", - "hash": "3be55afa7a9f4ffce735a60d8aeba814" + "hash": "b4c7c93d9dbb2fd7c7f460a2962ab710" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/CodeSecurity\/Configurations.php", - "hash": "6094cba68ed0dfb76e28d8a5dff5f067" + "hash": "0b53c9f45bd4aae9493fd73813bf88da" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/CodeSecurity\/Configurations\/Defaults.php", @@ -29904,7 +29904,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/CodeSecurity\/Configurations\/ConfigurationId.php", - "hash": "bd7df38d46045fecb136fe6256407f8a" + "hash": "870c6ee31d40d795fa4e3ee2027a4fd0" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/CodeSecurity\/Configurations\/ConfigurationId\/Attach.php", @@ -29912,7 +29912,7 @@ }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/CodeSecurity\/Configurations\/ConfigurationId\/Defaults.php", - "hash": "cf56ca7c6cbccfef97767e36022ac7fa" + "hash": "c2b302e68f2bfae240995c434f49c4c0" }, { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/CodeSecurity\/Configurations\/ConfigurationId\/Repositories.php", @@ -30301,6 +30301,26 @@ { "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/AliasAbstract\/TietA5593530\/TietD4C63CAD\/Tiet95D73CC3\/TietF1B17EC4.php", "hash": "d3532c34c3e68099213cce4009785394" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operation\/CodeSecurity\/DetachConfiguration.php", + "hash": "e73f415e19fd297e7cff67ce040bfa7e" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Operator\/CodeSecurity\/DetachConfiguration.php", + "hash": "2ca4499f84bbfaa55ef332d199c03945" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/tests\/\/Internal\/Operation\/CodeSecurity\/DetachConfigurationTest.php", + "hash": "db4e24ba6dc75672ab80bbba15b3b07a" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Schema\/CodeSecurity\/DetachConfiguration\/Request\/ApplicationJson.php", + "hash": "fa12f56c092f423a8bb62eec4443235b" + }, + { + "name": ".\/clients\/GitHub\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Orgs\/Org\/CodeSecurity\/Configurations\/Detach.php", + "hash": "561cacd15f68beda2496e4381907de94" } ] }, diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations.php b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations.php index 0b7fbaf0d17..0eb9b852415 100644 --- a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations.php +++ b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations.php @@ -256,6 +256,17 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Code after_privateVulnerabilityReporting: + $value = $payload['enforcement'] ?? null; + + if ($value === null) { + $properties['enforcement'] = null; + goto after_enforcement; + } + + $properties['enforcement'] = $value; + + after_enforcement: + $value = $payload['url'] ?? null; if ($value === null) { @@ -558,6 +569,14 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema after_privateVulnerabilityReporting: $result['private_vulnerability_reporting'] = $privateVulnerabilityReporting; + $enforcement = $object->enforcement; + + if ($enforcement === null) { + goto after_enforcement; + } + + after_enforcement: $result['enforcement'] = $enforcement; + $url = $object->url; if ($url === null) { diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId.php b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId.php index b49c84cd129..878117c347b 100644 --- a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId.php +++ b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId.php @@ -195,6 +195,17 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Code after_privateVulnerabilityReporting: + $value = $payload['enforcement'] ?? null; + + if ($value === null) { + $properties['enforcement'] = null; + goto after_enforcement; + } + + $properties['enforcement'] = $value; + + after_enforcement: + $value = $payload['url'] ?? null; if ($value === null) { @@ -606,6 +617,14 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema after_privateVulnerabilityReporting: $result['private_vulnerability_reporting'] = $privateVulnerabilityReporting; + $enforcement = $object->enforcement; + + if ($enforcement === null) { + goto after_enforcement; + } + + after_enforcement: $result['enforcement'] = $enforcement; + $url = $object->url; if ($url === null) { diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId/Defaults.php b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId/Defaults.php index 7aed4686330..f5bd03381c8 100644 --- a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId/Defaults.php +++ b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/ConfigurationId/Defaults.php @@ -247,6 +247,17 @@ private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️Code after_privateVulnerabilityReporting: + $value = $payload['enforcement'] ?? null; + + if ($value === null) { + $properties['enforcement'] = null; + goto after_enforcement; + } + + $properties['enforcement'] = $value; + + after_enforcement: + $value = $payload['url'] ?? null; if ($value === null) { @@ -598,6 +609,14 @@ private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema after_privateVulnerabilityReporting: $result['private_vulnerability_reporting'] = $privateVulnerabilityReporting; + $enforcement = $object->enforcement; + + if ($enforcement === null) { + goto after_enforcement; + } + + after_enforcement: $result['enforcement'] = $enforcement; + $url = $object->url; if ($url === null) { diff --git a/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/Detach.php b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/Detach.php new file mode 100644 index 00000000000..13375a0242f --- /dev/null +++ b/clients/GitHub/src/Internal/Hydrator/Operation/Orgs/Org/CodeSecurity/Configurations/Detach.php @@ -0,0 +1,437 @@ + $className + * + * @return T + * + * @template T of object + */ + public function hydrateObject(string $className, array $payload): object + { + return match ($className) { + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($payload), + 'ApiClients\Client\GitHub\Schema\ScimError' => $this->hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ScimError($payload), + default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack), + }; + } + + private function hydrateApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(array $payload): BasicError + { + $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['url'] ?? null; + + if ($value === null) { + $properties['url'] = null; + goto after_url; + } + + $properties['url'] = $value; + + after_url: + + $value = $payload['status'] ?? null; + + if ($value === null) { + $properties['status'] = null; + goto after_status; + } + + $properties['status'] = $value; + + after_status: + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + + if (count($missingFields) > 0) { + throw UnableToHydrateObject::dueToMissingFields(BasicError::class, $missingFields, stack: $this->hydrationStack); + } + + try { + return new BasicError(...$properties); + } catch (Throwable $exception) { + throw UnableToHydrateObject::dueToError('ApiClients\Client\GitHub\Schema\BasicError', $exception, stack: $this->hydrationStack); + } + } + + private function hydrateApiClients⚡️Client⚡️GitHub⚡️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\GitHub\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\GitHub\Schema\ScimError', $exception, stack: $this->hydrationStack); + } + } + + private function serializeViaTypeMap(string $accessor, object $object, array $payloadToTypeMap): array + { + foreach ($payloadToTypeMap as $payloadType => [$valueType, $method]) { + if (is_a($object, $valueType)) { + return [$accessor => $payloadType] + $this->{$method}($object); + } + } + + throw new LogicException('No type mapped for object of class: ' . $object::class); + } + + public function serializeObject(object $object): mixed + { + return $this->serializeObjectOfType($object, $object::class); + } + + /** + * @param T $object + * @param class-string $className + * + * @template T + */ + public function serializeObjectOfType(object $object, string $className): mixed + { + try { + return match ($className) { + 'array' => $this->serializeValuearray($object), + 'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object), + 'DateTime' => $this->serializeValueDateTime($object), + 'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object), + 'DateTimeInterface' => $this->serializeValueDateTimeInterface($object), + 'ApiClients\Client\GitHub\Schema\BasicError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError($object), + 'ApiClients\Client\GitHub\Schema\ScimError' => $this->serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️ScimError($object), + default => throw new LogicException('No serialization defined for $className'), + }; + } catch (Throwable $exception) { + throw UnableToSerializeObject::dueToError($className, $exception); + } + } + + private function serializeValuearray(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeArrayItems(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueRamsey⚡️Uuid⚡️UuidInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeUuidToString(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTime(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeImmutable(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeValueDateTimeInterface(mixed $value): mixed + { + static $serializer; + + if ($serializer === null) { + $serializer = new SerializeDateTime(...[]); + } + + return $serializer->serialize($value, $this); + } + + private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️Schema⚡️BasicError(mixed $object): mixed + { + assert($object instanceof BasicError); + $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; + + $url = $object->url; + + if ($url === null) { + goto after_url; + } + + after_url: $result['url'] = $url; + + $status = $object->status; + + if ($status === null) { + goto after_status; + } + + after_status: $result['status'] = $status; + + return $result; + } + + private function serializeObjectApiClients⚡️Client⚡️GitHub⚡️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; + * + * @return IterableList + * + * @throws UnableToHydrateObject + * + * @template T + */ + public function hydrateObjects(string $className, iterable $payloads): IterableList + { + return new IterableList($this->doHydrateObjects($className, $payloads)); + } + + private function doHydrateObjects(string $className, iterable $payloads): Generator + { + foreach ($payloads as $index => $payload) { + yield $index => $this->hydrateObject($className, $payload); + } + } + + /** + * @param class-string $className + * @param iterable $payloads; + * + * @return IterableList + * + * @throws UnableToSerializeObject + * + * @template T + */ + public function serializeObjects(iterable $payloads): IterableList + { + return new IterableList($this->doSerializeObjects($payloads)); + } + + private function doSerializeObjects(iterable $objects): Generator + { + foreach ($objects as $index => $object) { + yield $index => $this->serializeObject($object); + } + } +} diff --git a/clients/GitHub/src/Internal/Hydrators.php b/clients/GitHub/src/Internal/Hydrators.php index a495627f365..c1363f8af4f 100644 --- a/clients/GitHub/src/Internal/Hydrators.php +++ b/clients/GitHub/src/Internal/Hydrators.php @@ -108,6 +108,7 @@ final class Hydrators implements ObjectMapper private Internal\Hydrator\Operation\Orgs\Org\CodeScanning\Alerts|null $operation🌀Orgs🌀Org🌀CodeScanning🌀Alerts = null; private Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations|null $operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations = null; private Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\Defaults|null $operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Defaults = null; + private Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\Detach|null $operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Detach = null; private Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\ConfigurationId|null $operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀ConfigurationId = null; private Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\ConfigurationId\Attach|null $operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀ConfigurationId🌀Attach = null; private Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\ConfigurationId\Defaults|null $operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀ConfigurationId🌀Defaults = null; @@ -2282,6 +2283,15 @@ public function getObjectMapperOperation🌀Orgs🌀Org🌀CodeSecurity🌀Confi return $this->operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Defaults; } + public function getObjectMapperOperation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Detach(): Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\Detach + { + if ($this->operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Detach instanceof Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\Detach === false) { + $this->operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Detach = new Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\Detach(); + } + + return $this->operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Detach; + } + public function getObjectMapperOperation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀ConfigurationId(): Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\ConfigurationId { if ($this->operation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀ConfigurationId instanceof Internal\Hydrator\Operation\Orgs\Org\CodeSecurity\Configurations\ConfigurationId === false) { diff --git a/clients/GitHub/src/Internal/Operation/CodeSecurity/DetachConfiguration.php b/clients/GitHub/src/Internal/Operation/CodeSecurity/DetachConfiguration.php new file mode 100644 index 00000000000..80fed4b1e0b --- /dev/null +++ b/clients/GitHub/src/Internal/Operation/CodeSecurity/DetachConfiguration.php @@ -0,0 +1,109 @@ +org = $org; + } + + public function createRequest(array $data): RequestInterface + { + $this->requestSchemaValidator->validate($data, Reader::readFromJson(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + return new Request('DELETE', str_replace(['{org}'], [$this->org], '/orgs/{org}/code-security/configurations/detach'), ['Content-Type' => 'application/json'], json_encode($data)); + } + + public function createResponse(ResponseInterface $response): WithoutBody + { + $code = $response->getStatusCode(); + [$contentType] = explode(';', $response->getHeaderLine('Content-Type')); + switch ($contentType) { + case 'application/json': + $body = json_decode($response->getBody()->getContents(), true); + switch ($code) { + /** + * 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)); + /** + * Forbidden + **/ + + case 403: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(403, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + /** + * Resource not found + **/ + + case 404: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body)); + /** + * Conflict + **/ + + case 409: + $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); + + throw new ErrorSchemas\BasicError(409, $this->hydrator->hydrateObject(Schema\BasicError::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; + } + + switch ($code) { + /** + * A header with no content is returned. + **/ + case 204: + return new WithoutBody(204, []); + } + + throw new RuntimeException('Unable to find matching response code and content type'); + } +} diff --git a/clients/GitHub/src/Internal/Operation/Repos/CheckAutomatedSecurityFixes.php b/clients/GitHub/src/Internal/Operation/Repos/CheckAutomatedSecurityFixes.php index 2ef258c95fe..16c5ebd8608 100644 --- a/clients/GitHub/src/Internal/Operation/Repos/CheckAutomatedSecurityFixes.php +++ b/clients/GitHub/src/Internal/Operation/Repos/CheckAutomatedSecurityFixes.php @@ -47,7 +47,7 @@ public function createResponse(ResponseInterface $response): Schema\CheckAutomat $body = json_decode($response->getBody()->getContents(), true); switch ($code) { /** - * Response if dependabot is enabled + * Response if Dependabot is enabled **/ case 200: $this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\CheckAutomatedSecurityFixes::SCHEMA_JSON, \cebe\openapi\spec\Schema::class)); @@ -60,7 +60,7 @@ public function createResponse(ResponseInterface $response): Schema\CheckAutomat switch ($code) { /** - * Not Found if dependabot is not enabled for the repository + * Not Found if Dependabot is not enabled for the repository **/ case 404: return new WithoutBody(404, []); diff --git a/clients/GitHub/src/Internal/Operator/CodeSecurity/DetachConfiguration.php b/clients/GitHub/src/Internal/Operator/CodeSecurity/DetachConfiguration.php new file mode 100644 index 00000000000..0226934e075 --- /dev/null +++ b/clients/GitHub/src/Internal/Operator/CodeSecurity/DetachConfiguration.php @@ -0,0 +1,40 @@ +requestSchemaValidator, $this->responseSchemaValidator, $this->hydrator, $org); + $request = $operation->createRequest($params); + $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 { + return $operation->createResponse($response); + })); + if ($result instanceof Observable) { + $result = awaitObservable($result); + } + + return $result; + } +} diff --git a/clients/GitHub/src/Internal/Operator/Repos/CheckAutomatedSecurityFixes.php b/clients/GitHub/src/Internal/Operator/Repos/CheckAutomatedSecurityFixes.php index 6b8892e3a05..c09daa9d891 100644 --- a/clients/GitHub/src/Internal/Operator/Repos/CheckAutomatedSecurityFixes.php +++ b/clients/GitHub/src/Internal/Operator/Repos/CheckAutomatedSecurityFixes.php @@ -24,7 +24,6 @@ public function __construct(private Browser $browser, private AuthenticationInte { } - /** @return */ public function call(string $owner, string $repo): \ApiClients\Client\GitHub\Schema\CheckAutomatedSecurityFixes|WithoutBody { $operation = new \ApiClients\Client\GitHub\Internal\Operation\Repos\CheckAutomatedSecurityFixes($this->responseSchemaValidator, $this->hydrator, $owner, $repo); diff --git a/clients/GitHub/src/Internal/Operators.php b/clients/GitHub/src/Internal/Operators.php index e95f9fb54c7..a34c4b5b813 100644 --- a/clients/GitHub/src/Internal/Operators.php +++ b/clients/GitHub/src/Internal/Operators.php @@ -174,6 +174,7 @@ final class Operators private Internal\Operator\CodeSecurity\GetConfigurationsForOrg|null $codeSecurity👷GetConfigurationsForOrg = null; private Internal\Operator\CodeSecurity\CreateConfiguration|null $codeSecurity👷CreateConfiguration = null; private Internal\Operator\CodeSecurity\GetDefaultConfigurations|null $codeSecurity👷GetDefaultConfigurations = null; + private Internal\Operator\CodeSecurity\DetachConfiguration|null $codeSecurity👷DetachConfiguration = null; private Internal\Operator\CodeSecurity\GetConfiguration|null $codeSecurity👷GetConfiguration = null; private Internal\Operator\CodeSecurity\DeleteConfiguration|null $codeSecurity👷DeleteConfiguration = null; private Internal\Operator\CodeSecurity\UpdateConfiguration|null $codeSecurity👷UpdateConfiguration = null; @@ -2608,6 +2609,15 @@ public function codeSecurity👷GetDefaultConfigurations(): Internal\Operator\Co return $this->codeSecurity👷GetDefaultConfigurations; } + public function codeSecurity👷DetachConfiguration(): Internal\Operator\CodeSecurity\DetachConfiguration + { + if ($this->codeSecurity👷DetachConfiguration instanceof Internal\Operator\CodeSecurity\DetachConfiguration === false) { + $this->codeSecurity👷DetachConfiguration = new Internal\Operator\CodeSecurity\DetachConfiguration($this->browser, $this->authentication, $this->requestSchemaValidator, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Detach()); + } + + return $this->codeSecurity👷DetachConfiguration; + } + public function codeSecurity👷GetConfiguration(): Internal\Operator\CodeSecurity\GetConfiguration { if ($this->codeSecurity👷GetConfiguration instanceof Internal\Operator\CodeSecurity\GetConfiguration === false) { diff --git a/clients/GitHub/src/Internal/Router/Delete/CodeSecurity.php b/clients/GitHub/src/Internal/Router/Delete/CodeSecurity.php index 4ed5d617565..05ed52f85bd 100644 --- a/clients/GitHub/src/Internal/Router/Delete/CodeSecurity.php +++ b/clients/GitHub/src/Internal/Router/Delete/CodeSecurity.php @@ -19,6 +19,20 @@ public function __construct(private SchemaValidator $requestSchemaValidator, pri { } + public function detachConfiguration(array $params): WithoutBody + { + $arguments = []; + if (array_key_exists('org', $params) === false) { + throw new InvalidArgumentException('Missing mandatory field: org'); + } + + $arguments['org'] = $params['org']; + unset($params['org']); + $operator = new Internal\Operator\CodeSecurity\DetachConfiguration($this->browser, $this->authentication, $this->requestSchemaValidator, $this->responseSchemaValidator, $this->hydrators->getObjectMapperOperation🌀Orgs🌀Org🌀CodeSecurity🌀Configurations🌀Detach()); + + return $operator->call($arguments['org'], $params); + } + /** @return */ public function deleteConfiguration(array $params): WithoutBody { diff --git a/clients/GitHub/src/Internal/Router/Delete/Six.php b/clients/GitHub/src/Internal/Router/Delete/Six.php index 5534e4f48ad..3be687de8b9 100644 --- a/clients/GitHub/src/Internal/Router/Delete/Six.php +++ b/clients/GitHub/src/Internal/Router/Delete/Six.php @@ -18,6 +18,7 @@ public function __construct(private Routers $routers) { } + /** @return |\ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody */ public function call(string $call, array $params, array $pathChunks): WithoutBody|Ok|Json|ActionsCacheList|FileCommit { if ($pathChunks[0] === '') { @@ -45,7 +46,11 @@ public function call(string $call, array $params, array $pathChunks): WithoutBod } } elseif ($pathChunks[3] === 'code-security') { if ($pathChunks[4] === 'configurations') { - if ($pathChunks[5] === '{configuration_id}') { + if ($pathChunks[5] === 'detach') { + if ($call === 'DELETE /orgs/{org}/code-security/configurations/detach') { + return $this->routers->internal🔀Router🔀Delete🔀CodeSecurity()->detachConfiguration($params); + } + } elseif ($pathChunks[5] === '{configuration_id}') { if ($call === 'DELETE /orgs/{org}/code-security/configurations/{configuration_id}') { return $this->routers->internal🔀Router🔀Delete🔀CodeSecurity()->deleteConfiguration($params); } diff --git a/clients/GitHub/src/Internal/Router/Get/Five.php b/clients/GitHub/src/Internal/Router/Get/Five.php index 79c7c692dd1..e144a5a840d 100644 --- a/clients/GitHub/src/Internal/Router/Get/Five.php +++ b/clients/GitHub/src/Internal/Router/Get/Five.php @@ -50,7 +50,7 @@ public function __construct(private Routers $routers) { } - /** @return |Observable|Observable|WithoutBody|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ + /** @return |Observable|Observable|WithoutBody|Observable|Observable|Observable|Schema\BasicError|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Schema\CheckAutomatedSecurityFixes|\ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable|Observable */ public function call(string $call, array $params, array $pathChunks): HookDelivery|iterable|WithoutBody|GistComment|MarketplacePurchase|BasicError|ThreadSubscription|ActionsOrganizationPermissions|Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListOrgSecrets\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Actions\ListOrgVariables\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Orgs\ListAttestations\Response\ApplicationJson\Ok|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\ListOrgSecrets\Response\ApplicationJson\Ok|CopilotOrganizationDetails|\ApiClients\Client\GitHub\Schema\Operations\Dependabot\ListOrgSecrets\Response\ApplicationJson\Ok|OrgHook|OrgMembership|Migration|OrganizationRole|RepositoryRuleset|TeamFull|ProjectCard|CheckAutomatedSecurityFixes|Json|\ApiClients\Client\GitHub\Schema\Operations\Repos\GetAllEnvironments\Response\ApplicationJson\Ok|Import|Installation|InteractionLimitResponse|One|Language|LicenseContent|Page|\ApiClients\Client\GitHub\Schema\Operations\Repos\CheckPrivateVulnerabilityReporting\Response\ApplicationJson\Ok|ContentFile|SimpleUser|Stargazer|RepositorySubscription|Topic|TeamDiscussion|TeamMembership|TeamProject|CodespacesUserPublicKey|CodespacesSecret|\ApiClients\Client\GitHub\Schema\Operations\Codespaces\CodespaceMachinesForAuthenticatedUser\Response\ApplicationJson\Ok\Application\Json|\ApiClients\Client\GitHub\Schema\Operations\Apps\ListInstallationReposForAuthenticatedUser\Response\ApplicationJson\Ok|Package|\ApiClients\Client\GitHub\Schema\Operations\Users\ListAttestations\Response\ApplicationJson\Ok|EmptyObject { if ($pathChunks[0] === '') { diff --git a/clients/GitHub/src/Internal/Router/Get/Repos.php b/clients/GitHub/src/Internal/Router/Get/Repos.php index f98de9fa6e4..008efed8db4 100644 --- a/clients/GitHub/src/Internal/Router/Get/Repos.php +++ b/clients/GitHub/src/Internal/Router/Get/Repos.php @@ -465,7 +465,6 @@ public function listAutolinks(array $params): iterable return $operator->call($arguments['owner'], $arguments['repo']); } - /** @return */ public function checkAutomatedSecurityFixes(array $params): CheckAutomatedSecurityFixes|WithoutBody { $arguments = []; diff --git a/clients/GitHub/src/Operation/CodeSecurity.php b/clients/GitHub/src/Operation/CodeSecurity.php index d3d4c784360..dc21e5cc53f 100644 --- a/clients/GitHub/src/Operation/CodeSecurity.php +++ b/clients/GitHub/src/Operation/CodeSecurity.php @@ -35,6 +35,11 @@ public function getDefaultConfigurations(string $org): iterable|WithoutBody return $this->operators->codeSecurity👷GetDefaultConfigurations()->call($org); } + public function detachConfiguration(string $org, array $params): WithoutBody + { + return $this->operators->codeSecurity👷DetachConfiguration()->call($org, $params); + } + /** @return */ public function getConfiguration(string $org, int $configurationId): CodeSecurityConfiguration|WithoutBody { diff --git a/clients/GitHub/src/Operation/Repos.php b/clients/GitHub/src/Operation/Repos.php index 00ef6ec4227..f26c0ea58b7 100644 --- a/clients/GitHub/src/Operation/Repos.php +++ b/clients/GitHub/src/Operation/Repos.php @@ -203,7 +203,6 @@ public function deleteAutolink(string $owner, string $repo, int $autolinkId): Wi return $this->operators->repos👷DeleteAutolink()->call($owner, $repo, $autolinkId); } - /** @return */ public function checkAutomatedSecurityFixes(string $owner, string $repo): CheckAutomatedSecurityFixes|WithoutBody { return $this->operators->repos👷CheckAutomatedSecurityFixes()->call($owner, $repo); diff --git a/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php b/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php index 5beb1d03305..266396296bd 100644 --- a/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php +++ b/clients/GitHub/src/PHPStan/ClientCallReturnTypes.php @@ -695,6 +695,10 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method return $this->typeResolver->resolve('Observable|WithoutBody'); } + if ($call === 'DELETE /orgs/{org}/code-security/configurations/detach') { + return $this->typeResolver->resolve('\\ApiClients\\Tools\\OpenApiClient\\Utils\\Response\\WithoutBody'); + } + if ($call === 'GET /orgs/{org}/code-security/configurations/{configuration_id}') { return $this->typeResolver->resolve(''); } @@ -1996,7 +2000,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method } if ($call === 'GET /repos/{owner}/{repo}/automated-security-fixes') { - return $this->typeResolver->resolve(''); + return $this->typeResolver->resolve('Schema\\CheckAutomatedSecurityFixes|\\ApiClients\\Tools\\OpenApiClient\\Utils\\Response\\WithoutBody'); } if ($call === 'PUT /repos/{owner}/{repo}/automated-security-fixes') { diff --git a/clients/GitHub/src/Schema/CodeSecurity/CreateConfiguration/Request/ApplicationJson.php b/clients/GitHub/src/Schema/CodeSecurity/CreateConfiguration/Request/ApplicationJson.php index 1798f4d5818..ca13e076253 100644 --- a/clients/GitHub/src/Schema/CodeSecurity/CreateConfiguration/Request/ApplicationJson.php +++ b/clients/GitHub/src/Schema/CodeSecurity/CreateConfiguration/Request/ApplicationJson.php @@ -112,6 +112,15 @@ "type": "string", "description": "The enablement status of private vulnerability reporting", "default": "disabled" + }, + "enforcement": { + "enum": [ + "enforced", + "unenforced" + ], + "type": "string", + "description": "The status of enforcement", + "default": "enforced" } }, "additionalProperties": false @@ -129,7 +138,8 @@ "secret_scanning": "enabled", "secret_scanning_push_protection": "enabled", "secret_scanning_validity_checks": "enabled", - "private_vulnerability_reporting": "enabled" + "private_vulnerability_reporting": "enabled", + "enforcement": "enforced" }'; /** @@ -144,6 +154,7 @@ * secretScanningPushProtection: The enablement status of secret scanning push protection * secretScanningValidityChecks: The enablement status of secret scanning validity checks * privateVulnerabilityReporting: The enablement status of private vulnerability reporting + * enforcement: The status of enforcement */ public function __construct(public string $name, public string $description, #[MapFrom('advanced_security')] public string|null $advancedSecurity, #[MapFrom('dependency_graph')] @@ -154,7 +165,7 @@ public function __construct(public string $name, public string $description, #[M public string|null $secretScanning, #[MapFrom('secret_scanning_push_protection')] public string|null $secretScanningPushProtection, #[MapFrom('secret_scanning_validity_checks')] public string|null $secretScanningValidityChecks, #[MapFrom('private_vulnerability_reporting')] - public string|null $privateVulnerabilityReporting,) + public string|null $privateVulnerabilityReporting, public string|null $enforcement,) { } } diff --git a/clients/GitHub/src/Schema/CodeSecurity/DetachConfiguration/Request/ApplicationJson.php b/clients/GitHub/src/Schema/CodeSecurity/DetachConfiguration/Request/ApplicationJson.php new file mode 100644 index 00000000000..31e0c13fdcd --- /dev/null +++ b/clients/GitHub/src/Schema/CodeSecurity/DetachConfiguration/Request/ApplicationJson.php @@ -0,0 +1,41 @@ + '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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeSecurity\DetachConfiguration::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = 'generated'; + + return $data; + })(json_decode(Schema\CodeSecurity\DetachConfiguration\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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeSecurity()->detachConfiguration('generated', json_decode(Schema\CodeSecurity\DetachConfiguration\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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeSecurity\DetachConfiguration::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = 'generated'; + + return $data; + })(json_decode(Schema\CodeSecurity\DetachConfiguration\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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeSecurity()->detachConfiguration('generated', json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); + } + + /** @test */ + public function call_httpCode_403_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(403, ['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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeSecurity\DetachConfiguration::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = 'generated'; + + return $data; + })(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true))); + } + + /** @test */ + public function operations_httpCode_403_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(403, ['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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeSecurity()->detachConfiguration('generated', json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); + } + + /** @test */ + public function call_httpCode_404_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(404, ['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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeSecurity\DetachConfiguration::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = 'generated'; + + return $data; + })(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true))); + } + + /** @test */ + public function operations_httpCode_404_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(404, ['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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeSecurity()->detachConfiguration('generated', json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); + } + + /** @test */ + public function call_httpCode_409_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(409, ['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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeSecurity\DetachConfiguration::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = 'generated'; + + return $data; + })(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true))); + } + + /** @test */ + public function operations_httpCode_409_requestContentType_application_json_responseContentType_application_json_zero(): void + { + self::expectException(ErrorSchemas\BasicError::class); + $response = new Response(409, ['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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeSecurity()->detachConfiguration('generated', json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); + } + + /** @test */ + public function call_httpCode_204_requestContentType_application_json_empty(): void + { + $response = new Response(204, []); + $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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->call(Internal\Operation\CodeSecurity\DetachConfiguration::OPERATION_MATCH, (static function (array $data): array { + $data['org'] = 'generated'; + + return $data; + })(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true))); + } + + /** @test */ + public function operations_httpCode_204_requestContentType_application_json_empty(): void + { + $response = new Response(204, []); + $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('DELETE', '/orgs/generated/code-security/configurations/detach', Argument::type('array'), json_encode(json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)))->willReturn(resolve($response))->shouldBeCalled(); + $client = new Client($auth->reveal(), $browser->reveal()); + $result = $client->operations()->codeSecurity()->detachConfiguration('generated', json_decode(Schema\CodeSecurity\DetachConfiguration\Request\ApplicationJson::SCHEMA_EXAMPLE_DATA, true)); + self::assertArrayHasKey('code', $result); + self::assertSame(204, $result['code']); + } +} diff --git a/clients/GitHub/tests/Types/ClientCallReturnTypes.php b/clients/GitHub/tests/Types/ClientCallReturnTypes.php index 377c21ffe8e..8d87a2fc7ec 100644 --- a/clients/GitHub/tests/Types/ClientCallReturnTypes.php +++ b/clients/GitHub/tests/Types/ClientCallReturnTypes.php @@ -180,6 +180,7 @@ function authHeader(): string assertType('Observable', $client->call('GET /orgs/{org}/code-security/configurations')); assertType('', $client->call('POST /orgs/{org}/code-security/configurations')); assertType('Observable|WithoutBody', $client->call('GET /orgs/{org}/code-security/configurations/defaults')); +assertType('\\ApiClients\\Tools\\OpenApiClient\\Utils\\Response\\WithoutBody', $client->call('DELETE /orgs/{org}/code-security/configurations/detach')); assertType('', $client->call('GET /orgs/{org}/code-security/configurations/{configuration_id}')); assertType('', $client->call('DELETE /orgs/{org}/code-security/configurations/{configuration_id}')); assertType('', $client->call('PATCH /orgs/{org}/code-security/configurations/{configuration_id}')); @@ -505,7 +506,7 @@ function authHeader(): string assertType('', $client->call('POST /repos/{owner}/{repo}/autolinks')); assertType('', $client->call('GET /repos/{owner}/{repo}/autolinks/{autolink_id}')); assertType('', $client->call('DELETE /repos/{owner}/{repo}/autolinks/{autolink_id}')); -assertType('', $client->call('GET /repos/{owner}/{repo}/automated-security-fixes')); +assertType('Schema\\CheckAutomatedSecurityFixes|\\ApiClients\\Tools\\OpenApiClient\\Utils\\Response\\WithoutBody', $client->call('GET /repos/{owner}/{repo}/automated-security-fixes')); assertType('', $client->call('PUT /repos/{owner}/{repo}/automated-security-fixes')); assertType('', $client->call('DELETE /repos/{owner}/{repo}/automated-security-fixes')); assertType('Observable', $client->call('GET /repos/{owner}/{repo}/branches')); diff --git a/etc/specs/GitHub/current.spec.yaml b/etc/specs/GitHub/current.spec.yaml index 1852668ed64..71c188b816f 100644 --- a/etc/specs/GitHub/current.spec.yaml +++ b/etc/specs/GitHub/current.spec.yaml @@ -3795,17 +3795,6 @@ paths: To see the full details about an organization, the authenticated user must be an organization owner. - The values returned by this endpoint are set by the "Update an organization" endpoint. If your organization set a default security configuration (beta), the following values retrieved from the "Update an organization" endpoint have been overwritten by that configuration: - - - advanced_security_enabled_for_new_repositories - - dependabot_alerts_enabled_for_new_repositories - - dependabot_security_updates_enabled_for_new_repositories - - dependency_graph_enabled_for_new_repositories - - secret_scanning_enabled_for_new_repositories - - secret_scanning_push_protection_enabled_for_new_repositories - - For more information on security configurations, see "[Enabling security features at scale](https://docs.github.com/code-security/securing-your-organization/introduction-to-securing-your-organization-at-scale/about-enabling-security-features-at-scale)." - OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to see the full details about an organization. To see information about an organization's GitHub plan, GitHub Apps need the `Organization plan` permission. @@ -3839,18 +3828,9 @@ paths: description: |- **Parameter Deprecation Notice:** GitHub will replace and discontinue `members_allowed_repository_creation_type` in favor of more granular permissions. The new input parameters are `members_can_create_public_repositories`, `members_can_create_private_repositories` for all organizations and `members_can_create_internal_repositories` for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the [blog post](https://developer.github.com/changes/2019-12-03-internal-visibility-changes). - Updates the organization's profile and member privileges. - - With security configurations (beta), your organization can choose a default security configuration which will automatically apply a set of security enablement settings to new repositories in your organization based on their visibility. For targeted repositories, the following attributes will be overridden by the default security configuration: - - - advanced_security_enabled_for_new_repositories - - dependabot_alerts_enabled_for_new_repositories - - dependabot_security_updates_enabled_for_new_repositories - - dependency_graph_enabled_for_new_repositories - - secret_scanning_enabled_for_new_repositories - - secret_scanning_push_protection_enabled_for_new_repositories + **Parameter Deprecation Notice:** Code security product enablement for new repositories through the organization API is deprecated. Please use [code security configurations](https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-organization) to set defaults instead. For more information on setting a default security configuration, see the [changelog](https://github.blog/changelog/2024-07-09-sunsetting-security-settings-defaults-parameters-in-the-organizations-rest-api/). - For more information on setting a default security configuration, see "[Enabling security features at scale](https://docs.github.com/code-security/securing-your-organization/introduction-to-securing-your-organization-at-scale/about-enabling-security-features-at-scale)." + Updates the organization's profile and member privileges. The authenticated user must be an organization owner to use this endpoint. @@ -3985,51 +3965,69 @@ paths: advanced_security_enabled_for_new_repositories: type: boolean description: |- - Whether GitHub Advanced Security is automatically enabled for new repositories. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether GitHub Advanced Security is automatically enabled for new repositories and repositories transferred to this organization. To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)." You can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request. + deprecated: true dependabot_alerts_enabled_for_new_repositories: type: boolean description: |- - Whether Dependabot alerts is automatically enabled for new repositories. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether Dependabot alerts are automatically enabled for new repositories and repositories transferred to this organization. To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)." You can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request. + deprecated: true dependabot_security_updates_enabled_for_new_repositories: type: boolean description: |- - Whether Dependabot security updates is automatically enabled for new repositories. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether Dependabot security updates are automatically enabled for new repositories and repositories transferred to this organization. To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)." You can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request. + deprecated: true dependency_graph_enabled_for_new_repositories: type: boolean description: |- - Whether dependency graph is automatically enabled for new repositories. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether dependency graph is automatically enabled for new repositories and repositories transferred to this organization. To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)." You can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request. + deprecated: true secret_scanning_enabled_for_new_repositories: type: boolean description: |- - Whether secret scanning is automatically enabled for new repositories. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether secret scanning is automatically enabled for new repositories and repositories transferred to this organization. To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)." You can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request. + deprecated: true secret_scanning_push_protection_enabled_for_new_repositories: type: boolean description: |- - Whether secret scanning push protection is automatically enabled for new repositories. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether secret scanning push protection is automatically enabled for new repositories and repositories transferred to this organization. To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see "[Managing security managers in your organization](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)." You can check which security and analysis features are currently enabled by using a `GET /orgs/{org}` request. + deprecated: true secret_scanning_push_protection_custom_link_enabled: type: boolean description: Whether a custom link is shown to contributors who @@ -6277,6 +6275,13 @@ paths: - disabled - not_set default: disabled + enforcement: + type: string + description: The status of enforcement + enum: + - enforced + - unenforced + default: enforced required: - name - description @@ -6343,6 +6348,61 @@ paths: enabledForGitHubApps: true category: code-security subcategory: configurations + "/orgs/{org}/code-security/configurations/detach": + delete: + summary: Detach configurations from repositories + description: |- + Detach code security configuration(s) from a set of repositories. + Repositories will retain their settings but will no longer be associated with the configuration. + + The authenticated user must be an administrator or security manager for the organization to use this endpoint. + + OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + tags: + - code-security + operationId: code-security/detach-configuration + externalDocs: + description: API method documentation + url: https://docs.github.com/rest/code-security/configurations#detach-configurations-from-repositories + parameters: + - "$ref": "#/components/parameters/org" + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: false + properties: + selected_repository_ids: + type: array + description: An array of repository IDs to detach from configurations. + items: + type: integer + description: Unique identifier of the repository. + examples: + default: + summary: Example for detaching repositories from configurations. + value: + selected_repository_ids: + - 32 + - 91 + responses: + '204': + "$ref": "#/components/responses/no_content" + '400': + "$ref": "#/components/responses/bad_request" + '403': + "$ref": "#/components/responses/forbidden" + '404': + "$ref": "#/components/responses/not_found" + '409': + "$ref": "#/components/responses/conflict" + x-github: + githubCloudOnly: false + enabledForGitHubApps: true + category: code-security + subcategory: configurations "/orgs/{org}/code-security/configurations/{configuration_id}": get: summary: Get a code security configuration @@ -6477,6 +6537,12 @@ paths: - enabled - disabled - not_set + enforcement: + type: string + description: The status of enforcement + enum: + - enforced + - unenforced examples: default: summary: Example for updating a code security configuration @@ -19709,7 +19775,7 @@ paths: - "$ref": "#/components/parameters/repo" responses: '200': - description: Response if dependabot is enabled + description: Response if Dependabot is enabled content: application/json: schema: @@ -19720,7 +19786,7 @@ paths: enabled: true paused: false '404': - description: Not Found if dependabot is not enabled for the repository + description: Not Found if Dependabot is not enabled for the repository x-github: githubCloudOnly: false enabledForGitHubApps: true @@ -39254,7 +39320,7 @@ paths: type: string x-github: githubCloudOnly: false - enabledForGitHubApps: false + enabledForGitHubApps: true category: repos subcategory: repos "/repositories": @@ -70266,56 +70332,69 @@ components: advanced_security_enabled_for_new_repositories: type: boolean description: |- + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + Whether GitHub Advanced Security is enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. examples: - false + deprecated: true dependabot_alerts_enabled_for_new_repositories: type: boolean description: |- - Whether GitHub Advanced Security is automatically enabled for new repositories and repositories transferred to - this organization. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether Dependabot alerts are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. examples: - false + deprecated: true dependabot_security_updates_enabled_for_new_repositories: type: boolean description: |- - Whether dependabot security updates are automatically enabled for new repositories and repositories transferred - to this organization. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether Dependabot security updates are automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. examples: - false + deprecated: true dependency_graph_enabled_for_new_repositories: type: boolean description: |- - Whether dependency graph is automatically enabled for new repositories and repositories transferred to this - organization. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether dependency graph is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. examples: - false + deprecated: true secret_scanning_enabled_for_new_repositories: type: boolean description: |- - Whether secret scanning is automatically enabled for new repositories and repositories transferred to this - organization. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether secret scanning is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. examples: - false + deprecated: true secret_scanning_push_protection_enabled_for_new_repositories: type: boolean description: |- - Whether secret scanning push protection is automatically enabled for new repositories and repositories - transferred to this organization. + **Deprecated.** Please use [code security configurations](https://docs.github.com/rest/code-security/configurations) instead. + + Whether secret scanning push protection is automatically enabled for new repositories and repositories transferred to this organization. This field is only visible to organization owners or members of a team with the security manager role. examples: - false + deprecated: true secret_scanning_push_protection_custom_link_enabled: type: boolean description: Whether a custom link is shown to contributors who are blocked @@ -71075,6 +71154,12 @@ components: - enabled - disabled - not_set + enforcement: + type: string + description: The enforcement status for a security configuration + enum: + - enforced + - unenforced url: type: string format: uri @@ -201353,6 +201438,7 @@ components: code_scanning_default_setup: enabled secret_scanning: enabled secret_scanning_push_protection: enabled + secret_scanning_validity_checks: enabled private_vulnerability_reporting: enabled url: https://api.github.com/orgs/octo-org/code-security/configurations/17 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/view @@ -201370,6 +201456,7 @@ components: code_scanning_default_setup: enabled secret_scanning: enabled secret_scanning_push_protection: enabled + secret_scanning_validity_checks: disabled private_vulnerability_reporting: enabled url: https://api.github.com/orgs/octo-org/code-security/configurations/1326 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/edit/1326 @@ -201388,6 +201475,7 @@ components: code_scanning_default_setup: disabled secret_scanning: enabled secret_scanning_push_protection: disabled + secret_scanning_validity_checks: disabled private_vulnerability_reporting: disabled url: https://api.github.com/orgs/octo-org/code-security/configurations/1325 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/edit/1325 @@ -201408,6 +201496,7 @@ components: code_scanning_default_setup: enabled secret_scanning: enabled secret_scanning_push_protection: enabled + secret_scanning_validity_checks: enabled private_vulnerability_reporting: enabled url: https://api.github.com/orgs/octo-org/code-security/configurations/1325 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/edit/1325 @@ -201427,6 +201516,7 @@ components: code_scanning_default_setup: enabled secret_scanning: enabled secret_scanning_push_protection: enabled + secret_scanning_validity_checks: disabled private_vulnerability_reporting: enabled url: https://api.github.com/orgs/octo-org/code-security/configurations/17 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/view @@ -201445,6 +201535,7 @@ components: code_scanning_default_setup: enabled secret_scanning: disabled secret_scanning_push_protection: disabled + secret_scanning_validity_checks: disabled private_vulnerability_reporting: disabled url: https://api.github.com/orgs/octo-org/code-security/configurations/1325 html_url: https://github.com/organizations/octo-org/settings/security_products/configurations/edit/1325