Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 4.0.0 #3

Merged
merged 6 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
invokerPackage: Aternos\HangarApi
artifactVersion: 3.2.0
artifactVersion: 4.0.0
generatorName: php
outputDir: .
sourceFolder: src
Expand Down
90 changes: 40 additions & 50 deletions lib/Api/APIKeysApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: 1.0
* Generated by: https://openapi-generator.tech
* Generator version: 7.8.0
* Generator version: 7.10.0
*/

/**
Expand Down Expand Up @@ -95,7 +95,7 @@ public function __construct(
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->config = $config ?: Configuration::getDefaultConfiguration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
Expand Down Expand Up @@ -184,18 +184,6 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

switch($statusCode) {
case 403:
Expand Down Expand Up @@ -225,7 +213,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
$response->getStatusCode(),
$response->getHeaders()
];
case 201:
case 401:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
Expand All @@ -252,7 +240,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
$response->getStatusCode(),
$response->getHeaders()
];
case 401:
case 201:
if ('string' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
Expand Down Expand Up @@ -281,6 +269,19 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

$returnType = 'string';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
Expand Down Expand Up @@ -319,15 +320,15 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
);
$e->setResponseObject($data);
break;
case 201:
case 401:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 401:
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
Expand Down Expand Up @@ -563,18 +564,6 @@ public function deleteKeyWithHttpInfo($name, string $contentType = self::content

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

return [null, $statusCode, $response->getHeaders()];

Expand Down Expand Up @@ -751,7 +740,7 @@ public function deleteKeyRequest($name, string $contentType = self::contentTypes
*
* @throws \Aternos\HangarApi\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return \Aternos\HangarApi\Model\ApiKey|\Aternos\HangarApi\Model\ApiKey[]|\Aternos\HangarApi\Model\ApiKey[]
* @return \Aternos\HangarApi\Model\ApiKey[]|\Aternos\HangarApi\Model\ApiKey[]|\Aternos\HangarApi\Model\ApiKey[]
*/
public function getKeys(string $contentType = self::contentTypes['getKeys'][0])
{
Expand All @@ -768,7 +757,7 @@ public function getKeys(string $contentType = self::contentTypes['getKeys'][0])
*
* @throws \Aternos\HangarApi\ApiException on non-2xx response or if the response body is not in the expected format
* @throws \InvalidArgumentException
* @return array of \Aternos\HangarApi\Model\ApiKey|\Aternos\HangarApi\Model\ApiKey[]|\Aternos\HangarApi\Model\ApiKey[], HTTP status code, HTTP response headers (array of strings)
* @return array of \Aternos\HangarApi\Model\ApiKey[]|\Aternos\HangarApi\Model\ApiKey[]|\Aternos\HangarApi\Model\ApiKey[], HTTP status code, HTTP response headers (array of strings)
*/
public function getKeysWithHttpInfo(string $contentType = self::contentTypes['getKeys'][0])
{
Expand Down Expand Up @@ -796,26 +785,14 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

switch($statusCode) {
case 200:
if ('\Aternos\HangarApi\Model\ApiKey' === '\SplFileObject') {
if ('\Aternos\HangarApi\Model\ApiKey[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
if ('\Aternos\HangarApi\Model\ApiKey' !== 'string') {
if ('\Aternos\HangarApi\Model\ApiKey[]' !== 'string') {
try {
$content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $exception) {
Expand All @@ -833,7 +810,7 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
}

return [
ObjectSerializer::deserialize($content, '\Aternos\HangarApi\Model\ApiKey', []),
ObjectSerializer::deserialize($content, '\Aternos\HangarApi\Model\ApiKey[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
Expand Down Expand Up @@ -893,7 +870,20 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
];
}

$returnType = '\Aternos\HangarApi\Model\ApiKey';
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

$returnType = '\Aternos\HangarApi\Model\ApiKey[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
Expand Down Expand Up @@ -926,7 +916,7 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Aternos\HangarApi\Model\ApiKey',
'\Aternos\HangarApi\Model\ApiKey[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
Expand Down Expand Up @@ -984,7 +974,7 @@ function ($response) {
*/
public function getKeysAsyncWithHttpInfo(string $contentType = self::contentTypes['getKeys'][0])
{
$returnType = '\Aternos\HangarApi\Model\ApiKey';
$returnType = '\Aternos\HangarApi\Model\ApiKey[]';
$request = $this->getKeysRequest($contentType);

return $this->client
Expand Down
29 changes: 15 additions & 14 deletions lib/Api/AuthenticationApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* The version of the OpenAPI document: 1.0
* Generated by: https://openapi-generator.tech
* Generator version: 7.8.0
* Generator version: 7.10.0
*/

/**
Expand Down Expand Up @@ -89,7 +89,7 @@ public function __construct(
$hostIndex = 0
) {
$this->client = $client ?: new Client();
$this->config = $config ?: new Configuration();
$this->config = $config ?: Configuration::getDefaultConfiguration();
$this->headerSelector = $selector ?: new HeaderSelector();
$this->hostIndex = $hostIndex;
}
Expand Down Expand Up @@ -178,18 +178,6 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c

$statusCode = $response->getStatusCode();

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

switch($statusCode) {
case 200:
Expand Down Expand Up @@ -275,6 +263,19 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c
];
}

if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}

$returnType = '\Aternos\HangarApi\Model\ApiSession';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
Expand Down
Loading
Loading