Skip to content

Commit c34db9c

Browse files
committed
Use enum for ecample data when available
1 parent b00516f commit c34db9c

File tree

586 files changed

+1437
-581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

586 files changed

+1437
-581
lines changed

src/Client.php

Lines changed: 38 additions & 2 deletions
Large diffs are not rendered by default.

src/ClientInterface.php

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/Hydrator/Operation/Repos/CbOwnerRcb/CbRepoRcb/CodeScanning/DefaultSetup.php

Lines changed: 561 additions & 0 deletions
Large diffs are not rendered by default.

src/Hydrators.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ final class Hydrators implements \EventSauce\ObjectHydrator\ObjectMapper
330330
private ?Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeDashScanning\Analyses\CbAnalysisIdRcb $operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeDashScanning🌀Analyses🌀CbAnalysisIdRcb = null;
331331
private ?Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\Codeql\Databases $operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Codeql🌀Databases = null;
332332
private ?Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\Codeql\Databases\CbLanguageRcb $operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Codeql🌀Databases🌀CbLanguageRcb = null;
333+
private ?Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup $operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀DefaultSetup = null;
333334
private ?Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\Sarifs $operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Sarifs = null;
334335
private ?Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeDashScanning\Sarifs\CbSarifIdRcb $operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeDashScanning🌀Sarifs🌀CbSarifIdRcb = null;
335336
private ?Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\Codeowners\Errors $operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀Codeowners🌀Errors = null;
@@ -822,6 +823,7 @@ public function hydrateObject(string $className, array $payload) : object
822823
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningAnalysis' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Analyses()->hydrateObject($className, $payload),
823824
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\AuditLogEvent\\Data', 'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningAnalysisDeletion' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeDashScanning🌀Analyses🌀CbAnalysisIdRcb()->hydrateObject($className, $payload),
824825
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningCodeqlDatabase' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Codeql🌀Databases()->hydrateObject($className, $payload),
826+
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningDefaultSetup', 'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningDefaultSetupUpdateResponse' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀DefaultSetup()->hydrateObject($className, $payload),
825827
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningSarifsReceipt' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Sarifs()->hydrateObject($className, $payload),
826828
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningSarifsStatus' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeDashScanning🌀Sarifs🌀CbSarifIdRcb()->hydrateObject($className, $payload),
827829
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeownersErrors', 'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeownersErrors\\Errors' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀Codeowners🌀Errors()->hydrateObject($className, $payload),
@@ -1136,6 +1138,7 @@ public function serializeObjectOfType(object $object, string $className) : mixed
11361138
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningAnalysis' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Analyses()->serializeObject($object),
11371139
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\AuditLogEvent\\Data', 'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningAnalysisDeletion' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeDashScanning🌀Analyses🌀CbAnalysisIdRcb()->serializeObject($object),
11381140
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningCodeqlDatabase' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Codeql🌀Databases()->serializeObject($object),
1141+
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningDefaultSetup', 'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningDefaultSetupUpdateResponse' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀DefaultSetup()->serializeObject($object),
11391142
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningSarifsReceipt' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Sarifs()->serializeObject($object),
11401143
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeScanningSarifsStatus' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeDashScanning🌀Sarifs🌀CbSarifIdRcb()->serializeObject($object),
11411144
'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeownersErrors', 'ApiClients\\Client\\GitHubEnterpriseCloud\\Schema\\CodeownersErrors\\Errors' => $this->getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀Codeowners🌀Errors()->serializeObject($object),
@@ -3551,6 +3554,13 @@ public function getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀
35513554
}
35523555
return $this->operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Codeql🌀Databases🌀CbLanguageRcb;
35533556
}
3557+
public function getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀DefaultSetup() : Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup
3558+
{
3559+
if ($this->operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀DefaultSetup instanceof Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup === false) {
3560+
$this->operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀DefaultSetup = new Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup();
3561+
}
3562+
return $this->operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀DefaultSetup;
3563+
}
35543564
public function getObjectMapperOperation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Sarifs() : Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\Sarifs
35553565
{
35563566
if ($this->operation🌀Repos🌀CbOwnerRcb🌀CbRepoRcb🌀CodeScanning🌀Sarifs instanceof Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\Sarifs === false) {
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
3+
declare (strict_types=1);
4+
namespace ApiClients\Client\GitHubEnterpriseCloud\Operation\CodeScanning;
5+
6+
use ApiClients\Client\GitHubEnterpriseCloud\Error as ErrorSchemas;
7+
use ApiClients\Client\GitHubEnterpriseCloud\Hydrator;
8+
use ApiClients\Client\GitHubEnterpriseCloud\Operation;
9+
use ApiClients\Client\GitHubEnterpriseCloud\Schema;
10+
use ApiClients\Client\GitHubEnterpriseCloud\WebHook;
11+
final class GetDefaultSetup
12+
{
13+
public const OPERATION_ID = 'code-scanning/get-default-setup';
14+
public const OPERATION_MATCH = 'GET /repos/{owner}/{repo}/code-scanning/default-setup';
15+
private const METHOD = 'GET';
16+
private const PATH = '/repos/{owner}/{repo}/code-scanning/default-setup';
17+
/**The account owner of the repository. The name is not case sensitive.**/
18+
private string $owner;
19+
/**The name of the repository. The name is not case sensitive.**/
20+
private string $repo;
21+
private readonly \League\OpenAPIValidation\Schema\SchemaValidator $responseSchemaValidator;
22+
private readonly Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup $hydrator;
23+
public function __construct(\League\OpenAPIValidation\Schema\SchemaValidator $responseSchemaValidator, Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup $hydrator, string $owner, string $repo)
24+
{
25+
$this->owner = $owner;
26+
$this->repo = $repo;
27+
$this->responseSchemaValidator = $responseSchemaValidator;
28+
$this->hydrator = $hydrator;
29+
}
30+
function createRequest(array $data = array()) : \Psr\Http\Message\RequestInterface
31+
{
32+
return new \RingCentral\Psr7\Request(self::METHOD, \str_replace(array('{owner}', '{repo}'), array($this->owner, $this->repo), self::PATH));
33+
}
34+
/**
35+
* @return Schema\CodeScanningDefaultSetup
36+
*/
37+
function createResponse(\Psr\Http\Message\ResponseInterface $response) : Schema\CodeScanningDefaultSetup
38+
{
39+
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
40+
$body = json_decode($response->getBody()->getContents(), true);
41+
switch ($response->getStatusCode()) {
42+
/**Response**/
43+
case 200:
44+
switch ($contentType) {
45+
case 'application/json':
46+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\CodeScanningDefaultSetup::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
47+
return $this->hydrator->hydrateObject(Schema\CodeScanningDefaultSetup::class, $body);
48+
}
49+
break;
50+
/**Response if GitHub Advanced Security is not enabled for this repository**/
51+
case 403:
52+
switch ($contentType) {
53+
case 'application/json':
54+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
55+
throw new ErrorSchemas\BasicError(403, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
56+
}
57+
break;
58+
/**Resource not found**/
59+
case 404:
60+
switch ($contentType) {
61+
case 'application/json':
62+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
63+
throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
64+
}
65+
break;
66+
/**Service unavailable**/
67+
case 503:
68+
switch ($contentType) {
69+
case 'application/json':
70+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\Operation\CodeScanning\ListAlertsForEnterprise\Response\Applicationjson\H503::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
71+
throw new ErrorSchemas\Operation\CodeScanning\ListAlertsForEnterprise\Response\Applicationjson\H503(503, $this->hydrator->hydrateObject(Schema\Operation\CodeScanning\ListAlertsForEnterprise\Response\Applicationjson\H503::class, $body));
72+
}
73+
break;
74+
}
75+
throw new \RuntimeException('Unable to find matching response code and content type');
76+
}
77+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
3+
declare (strict_types=1);
4+
namespace ApiClients\Client\GitHubEnterpriseCloud\Operation\CodeScanning;
5+
6+
use ApiClients\Client\GitHubEnterpriseCloud\Error as ErrorSchemas;
7+
use ApiClients\Client\GitHubEnterpriseCloud\Hydrator;
8+
use ApiClients\Client\GitHubEnterpriseCloud\Operation;
9+
use ApiClients\Client\GitHubEnterpriseCloud\Schema;
10+
use ApiClients\Client\GitHubEnterpriseCloud\WebHook;
11+
final class UpdateDefaultSetup
12+
{
13+
public const OPERATION_ID = 'code-scanning/update-default-setup';
14+
public const OPERATION_MATCH = 'PATCH /repos/{owner}/{repo}/code-scanning/default-setup';
15+
private const METHOD = 'PATCH';
16+
private const PATH = '/repos/{owner}/{repo}/code-scanning/default-setup';
17+
private readonly \League\OpenAPIValidation\Schema\SchemaValidator $requestSchemaValidator;
18+
/**The account owner of the repository. The name is not case sensitive.**/
19+
private string $owner;
20+
/**The name of the repository. The name is not case sensitive.**/
21+
private string $repo;
22+
private readonly \League\OpenAPIValidation\Schema\SchemaValidator $responseSchemaValidator;
23+
private readonly Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup $hydrator;
24+
public function __construct(\League\OpenAPIValidation\Schema\SchemaValidator $requestSchemaValidator, \League\OpenAPIValidation\Schema\SchemaValidator $responseSchemaValidator, Hydrator\Operation\Repos\CbOwnerRcb\CbRepoRcb\CodeScanning\DefaultSetup $hydrator, string $owner, string $repo)
25+
{
26+
$this->requestSchemaValidator = $requestSchemaValidator;
27+
$this->owner = $owner;
28+
$this->repo = $repo;
29+
$this->responseSchemaValidator = $responseSchemaValidator;
30+
$this->hydrator = $hydrator;
31+
}
32+
function createRequest(array $data = array()) : \Psr\Http\Message\RequestInterface
33+
{
34+
$this->requestSchemaValidator->validate($data, \cebe\openapi\Reader::readFromJson(Schema\CodeScanningDefaultSetupUpdate::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
35+
return new \RingCentral\Psr7\Request(self::METHOD, \str_replace(array('{owner}', '{repo}'), array($this->owner, $this->repo), self::PATH), array('Content-Type' => 'application/json'), json_encode($data));
36+
}
37+
/**
38+
* @return Schema\EmptyObject|Schema\CodeScanningDefaultSetupUpdateResponse
39+
*/
40+
function createResponse(\Psr\Http\Message\ResponseInterface $response) : Schema\EmptyObject|Schema\CodeScanningDefaultSetupUpdateResponse
41+
{
42+
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
43+
$body = json_decode($response->getBody()->getContents(), true);
44+
switch ($response->getStatusCode()) {
45+
/**Response**/
46+
case 200:
47+
switch ($contentType) {
48+
case 'application/json':
49+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\EmptyObject::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
50+
return $this->hydrator->hydrateObject(Schema\EmptyObject::class, $body);
51+
}
52+
break;
53+
/**Response**/
54+
case 202:
55+
switch ($contentType) {
56+
case 'application/json':
57+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\CodeScanningDefaultSetupUpdateResponse::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
58+
return $this->hydrator->hydrateObject(Schema\CodeScanningDefaultSetupUpdateResponse::class, $body);
59+
}
60+
break;
61+
/**Response if GitHub Advanced Security is not enabled for this repository**/
62+
case 403:
63+
switch ($contentType) {
64+
case 'application/json':
65+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
66+
throw new ErrorSchemas\BasicError(403, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
67+
}
68+
break;
69+
/**Resource not found**/
70+
case 404:
71+
switch ($contentType) {
72+
case 'application/json':
73+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
74+
throw new ErrorSchemas\BasicError(404, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
75+
}
76+
break;
77+
/**Response if there is already a validation run in progress with a different default setup configuration**/
78+
case 409:
79+
switch ($contentType) {
80+
case 'application/json':
81+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
82+
throw new ErrorSchemas\BasicError(409, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
83+
}
84+
break;
85+
/**Service unavailable**/
86+
case 503:
87+
switch ($contentType) {
88+
case 'application/json':
89+
$this->responseSchemaValidator->validate($body, \cebe\openapi\Reader::readFromJson(Schema\Operation\CodeScanning\ListAlertsForEnterprise\Response\Applicationjson\H503::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));
90+
throw new ErrorSchemas\Operation\CodeScanning\ListAlertsForEnterprise\Response\Applicationjson\H503(503, $this->hydrator->hydrateObject(Schema\Operation\CodeScanning\ListAlertsForEnterprise\Response\Applicationjson\H503::class, $body));
91+
}
92+
break;
93+
}
94+
throw new \RuntimeException('Unable to find matching response code and content type');
95+
}
96+
}

src/Schema/Actions/CreateOrUpdateOrgSecret/Request/Applicationjson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public const SCHEMA_JSON = '{"required":["visibility"],"type":"object","properties":{"encrypted_value":{"pattern":"^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$","type":"string","description":"Value for your secret, encrypted with [LibSodium](https:\\/\\/libsodium.gitbook.io\\/doc\\/bindings_for_other_languages) using the public key retrieved from the [Get an organization public key](https:\\/\\/docs.github.com\\/enterprise-cloud@latest\\/\\/rest\\/reference\\/actions#get-an-organization-public-key) endpoint."},"key_id":{"type":"string","description":"ID of the key you used to encrypt the secret."},"visibility":{"enum":["all","private","selected"],"type":"string","description":"Which type of organization repositories have access to the organization secret. `selected` means only the repositories specified by `selected_repository_ids` can access the secret."},"selected_repository_ids":{"type":"array","items":{"type":"integer"},"description":"An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the `visibility` is set to `selected`. You can manage the list of selected repositories using the [List selected repositories for an organization secret](https:\\/\\/docs.github.com\\/enterprise-cloud@latest\\/\\/rest\\/reference\\/actions#list-selected-repositories-for-an-organization-secret), [Set selected repositories for an organization secret](https:\\/\\/docs.github.com\\/enterprise-cloud@latest\\/\\/rest\\/reference\\/actions#set-selected-repositories-for-an-organization-secret), and [Remove selected repository from an organization secret](https:\\/\\/docs.github.com\\/enterprise-cloud@latest\\/\\/rest\\/reference\\/actions#remove-selected-repository-from-an-organization-secret) endpoints."}}}';
1414
public const SCHEMA_TITLE = '';
1515
public const SCHEMA_DESCRIPTION = '';
16-
public const SCHEMA_EXAMPLE_DATA = '{"encrypted_value":"generated_encrypted_value_null","key_id":"generated_key_id_null","visibility":"generated_visibility_null","selected_repository_ids":[13]}';
16+
public const SCHEMA_EXAMPLE_DATA = '{"encrypted_value":"generated_encrypted_value_null","key_id":"generated_key_id_null","visibility":"all","selected_repository_ids":[13]}';
1717
/**
1818
* encrypted_value: Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an organization public key](https://docs.github.com/enterprise-cloud@latest//rest/reference/actions#get-an-organization-public-key) endpoint.
1919
* key_id: ID of the key you used to encrypt the secret.

0 commit comments

Comments
 (0)