Skip to content

Commit 2a35781

Browse files
committed
Handle empry response bodies a little bit better
1 parent 3a4d5dd commit 2a35781

File tree

600 files changed

+1705
-4933
lines changed

Some content is hidden

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

600 files changed

+1705
-4933
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ else
2121
-v "`pwd`:`pwd`" \
2222
-v "${COMPOSER_CACHE_DIR}:/home/app/.composer/cache" \
2323
-w "`pwd`" \
24-
"wyrihaximusnet/php:8.1-nts-alpine-slim-dev"
24+
"wyrihaximusnet/php:8.2-nts-alpine-slim-dev"
2525
endif
2626

2727
all: ## Runs everything ###

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
}
1010
],
1111
"require": {
12-
"php": "^8.1",
12+
"php": "^8.2",
13+
"api-clients/contracts": "dev-main",
1314
"api-clients/openapi-client-generator": "dev-master",
1415
"cebe/php-openapi": "dev-openapi-31 as 1.6.0",
1516
"wyrihaximus/hydrator": "dev-master"
@@ -27,7 +28,7 @@
2728
"config": {
2829
"sort-packages": true,
2930
"platform": {
30-
"php": "8.1.13"
31+
"php": "8.2.13"
3132
},
3233
"allow-plugins": {
3334
"dealerdirect/phpcodesniffer-composer-installer": true,

composer.lock

Lines changed: 81 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/OpenAPI/ApiGitHubCom/AuthenticationInterface.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/OpenAPI/ApiGitHubCom/Client.php

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

src/OpenAPI/ApiGitHubCom/Operation/Actions/AddSelectedRepoToOrgSecret.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,21 @@ function createRequest(array $data = array()) : \Psr\Http\Message\RequestInterfa
3030
return new \RingCentral\Psr7\Request('PUT', \str_replace(array('{org}', '{secret_name}', '{repository_id}'), array($this->org, $this->secret_name, $this->repository_id), '/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}'));
3131
}
3232
/**
33-
* @return
33+
* @return int
3434
*/
35-
function createResponse(\Psr\Http\Message\ResponseInterface $response) :
35+
function createResponse(\Psr\Http\Message\ResponseInterface $response) : int
3636
{
3737
$contentType = $response->getHeaderLine('Content-Type');
3838
$body = json_decode($response->getBody()->getContents(), true);
3939
$hydrator = new \WyriHaximus\Hydrator\Hydrator();
4040
switch ($response->getStatusCode()) {
4141
/**No Content when repository was added to the selected list**/
4242
case 204:
43-
switch ($contentType) {
44-
}
43+
return 204;
4544
break;
4645
/**Conflict when visibility type is not set to selected**/
4746
case 409:
48-
switch ($contentType) {
49-
}
47+
return 409;
5048
break;
5149
}
5250
throw new \RuntimeException('Unable to find matching reponse code and content type');

src/OpenAPI/ApiGitHubCom/Operation/Actions/AddSelectedRepoToOrgVariable.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,21 @@ function createRequest(array $data = array()) : \Psr\Http\Message\RequestInterfa
3030
return new \RingCentral\Psr7\Request('PUT', \str_replace(array('{org}', '{name}', '{repository_id}'), array($this->org, $this->name, $this->repository_id), '/orgs/{org}/actions/variables/{name}/repositories/{repository_id}'));
3131
}
3232
/**
33-
* @return
33+
* @return int
3434
*/
35-
function createResponse(\Psr\Http\Message\ResponseInterface $response) :
35+
function createResponse(\Psr\Http\Message\ResponseInterface $response) : int
3636
{
3737
$contentType = $response->getHeaderLine('Content-Type');
3838
$body = json_decode($response->getBody()->getContents(), true);
3939
$hydrator = new \WyriHaximus\Hydrator\Hydrator();
4040
switch ($response->getStatusCode()) {
4141
/**Response**/
4242
case 204:
43-
switch ($contentType) {
44-
}
43+
return 204;
4544
break;
4645
/**Response when the visibility of the variable is not set to `selected`**/
4746
case 409:
48-
switch ($contentType) {
49-
}
47+
return 409;
5048
break;
5149
}
5250
throw new \RuntimeException('Unable to find matching reponse code and content type');

src/OpenAPI/ApiGitHubCom/Operation/Actions/AddSelectedRepoToRequiredWorkflow.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,25 @@ function createRequest(array $data = array()) : \Psr\Http\Message\RequestInterfa
3131
return new \RingCentral\Psr7\Request('PUT', \str_replace(array('{org}', '{required_workflow_id}', '{repository_id}'), array($this->org, $this->required_workflow_id, $this->repository_id), '/orgs/{org}/actions/required_workflows/{required_workflow_id}/repositories/{repository_id}'));
3232
}
3333
/**
34-
* @return
34+
* @return int
3535
*/
36-
function createResponse(\Psr\Http\Message\ResponseInterface $response) :
36+
function createResponse(\Psr\Http\Message\ResponseInterface $response) : int
3737
{
3838
$contentType = $response->getHeaderLine('Content-Type');
3939
$body = json_decode($response->getBody()->getContents(), true);
4040
$hydrator = new \WyriHaximus\Hydrator\Hydrator();
4141
switch ($response->getStatusCode()) {
4242
/**Success**/
4343
case 204:
44-
switch ($contentType) {
45-
}
44+
return 204;
4645
break;
4746
/**Resource Not Found**/
4847
case 404:
49-
switch ($contentType) {
50-
}
48+
return 404;
5149
break;
5250
/**Validation Error**/
5351
case 422:
54-
switch ($contentType) {
55-
}
52+
return 422;
5653
break;
5754
}
5855
throw new \RuntimeException('Unable to find matching reponse code and content type');

0 commit comments

Comments
 (0)