Skip to content

Commit

Permalink
Merge pull request #4 from aternosorg/api-ids
Browse files Browse the repository at this point in the history
Add support for IDs
  • Loading branch information
JulianVennen authored Jan 15, 2025
2 parents f78f233 + 60339b8 commit e4c0aaf
Show file tree
Hide file tree
Showing 47 changed files with 4,408 additions and 2,825 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
php-version: [ '8.1', '8.2' ]
php-version: [ '8.1', '8.2', '8.3', '8.4' ]

name: Run tests on PHP v${{ matrix.php-version }}

Expand Down Expand Up @@ -43,4 +43,4 @@ jobs:
- name: Run phpunit tests
run: vendor/bin/phpunit --colors=always --testdox
env:
HANGAR_API_KEY: ${{ secrets.HANGAR_API_KEY }}
HANGAR_API_KEY: ${{ secrets.HANGAR_API_KEY }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ $versions = $hangarClient->getProjectVersions("mclogs");
$versions = $project->getVersions();

// get a specific version of a project by name
$version = $hangarClient->getProjectVersion("mclogs", "2.6.2");
$version = $hangarClient->getVersion("mclogs", "2.6.2");

// get a specific version of a project
$version = $project->getVersion("2.6.2");
Expand Down Expand Up @@ -148,4 +148,4 @@ $page->save();
The generated code can be updated by installing the [openapi generator](https://openapi-generator.tech/docs/installation) running the following command:
```bash
openapi-generator-cli generate -c config.yaml
```
```
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ artifactVersion: 4.0.0
generatorName: php
outputDir: .
sourceFolder: src
inputSpec: https://hangar.papermc.io/v3/api-docs/public
inputSpec: https://hangar.papermc.io/v3/api-docs/public
16 changes: 8 additions & 8 deletions lib/Api/APIKeysApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType


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

} catch (ApiException $e) {
switch ($e->getCode()) {
case 403:
case 201:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
Expand All @@ -328,7 +328,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
);
$e->setResponseObject($data);
break;
case 201:
case 403:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'string',
Expand Down Expand Up @@ -814,7 +814,7 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
$response->getStatusCode(),
$response->getHeaders()
];
case 403:
case 401:
if ('\Aternos\HangarApi\Model\ApiKey[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
Expand All @@ -841,7 +841,7 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
$response->getStatusCode(),
$response->getHeaders()
];
case 401:
case 403:
if ('\Aternos\HangarApi\Model\ApiKey[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
Expand Down Expand Up @@ -921,15 +921,15 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
);
$e->setResponseObject($data);
break;
case 403:
case 401:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Aternos\HangarApi\Model\ApiKey[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 401:
case 403:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Aternos\HangarApi\Model\ApiKey[]',
Expand Down
8 changes: 4 additions & 4 deletions lib/Api/AuthenticationApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c
$response->getStatusCode(),
$response->getHeaders()
];
case 401:
case 400:
if ('\Aternos\HangarApi\Model\ApiSession' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
Expand All @@ -234,7 +234,7 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c
$response->getStatusCode(),
$response->getHeaders()
];
case 400:
case 401:
if ('\Aternos\HangarApi\Model\ApiSession' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
Expand Down Expand Up @@ -314,15 +314,15 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c
);
$e->setResponseObject($data);
break;
case 401:
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Aternos\HangarApi\Model\ApiSession',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
case 401:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\Aternos\HangarApi\Model\ApiSession',
Expand Down
Loading

0 comments on commit e4c0aaf

Please sign in to comment.