Skip to content

Commit e4c0aaf

Browse files
authored
Merge pull request #4 from aternosorg/api-ids
Add support for IDs
2 parents f78f233 + 60339b8 commit e4c0aaf

Some content is hidden

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

47 files changed

+4408
-2825
lines changed

.github/workflows/tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
php-version: [ '8.1', '8.2' ]
16+
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
1717

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

@@ -43,4 +43,4 @@ jobs:
4343
- name: Run phpunit tests
4444
run: vendor/bin/phpunit --colors=always --testdox
4545
env:
46-
HANGAR_API_KEY: ${{ secrets.HANGAR_API_KEY }}
46+
HANGAR_API_KEY: ${{ secrets.HANGAR_API_KEY }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ $versions = $hangarClient->getProjectVersions("mclogs");
101101
$versions = $project->getVersions();
102102

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

106106
// get a specific version of a project
107107
$version = $project->getVersion("2.6.2");
@@ -148,4 +148,4 @@ $page->save();
148148
The generated code can be updated by installing the [openapi generator](https://openapi-generator.tech/docs/installation) running the following command:
149149
```bash
150150
openapi-generator-cli generate -c config.yaml
151-
```
151+
```

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ artifactVersion: 4.0.0
33
generatorName: php
44
outputDir: .
55
sourceFolder: src
6-
inputSpec: https://hangar.papermc.io/v3/api-docs/public
6+
inputSpec: https://hangar.papermc.io/v3/api-docs/public

lib/Api/APIKeysApi.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
186186

187187

188188
switch($statusCode) {
189-
case 403:
189+
case 201:
190190
if ('string' === '\SplFileObject') {
191191
$content = $response->getBody(); //stream goes to serializer
192192
} else {
@@ -240,7 +240,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
240240
$response->getStatusCode(),
241241
$response->getHeaders()
242242
];
243-
case 201:
243+
case 403:
244244
if ('string' === '\SplFileObject') {
245245
$content = $response->getBody(); //stream goes to serializer
246246
} else {
@@ -312,7 +312,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
312312

313313
} catch (ApiException $e) {
314314
switch ($e->getCode()) {
315-
case 403:
315+
case 201:
316316
$data = ObjectSerializer::deserialize(
317317
$e->getResponseBody(),
318318
'string',
@@ -328,7 +328,7 @@ public function createKeyWithHttpInfo($create_api_key_form, string $contentType
328328
);
329329
$e->setResponseObject($data);
330330
break;
331-
case 201:
331+
case 403:
332332
$data = ObjectSerializer::deserialize(
333333
$e->getResponseBody(),
334334
'string',
@@ -814,7 +814,7 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
814814
$response->getStatusCode(),
815815
$response->getHeaders()
816816
];
817-
case 403:
817+
case 401:
818818
if ('\Aternos\HangarApi\Model\ApiKey[]' === '\SplFileObject') {
819819
$content = $response->getBody(); //stream goes to serializer
820820
} else {
@@ -841,7 +841,7 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
841841
$response->getStatusCode(),
842842
$response->getHeaders()
843843
];
844-
case 401:
844+
case 403:
845845
if ('\Aternos\HangarApi\Model\ApiKey[]' === '\SplFileObject') {
846846
$content = $response->getBody(); //stream goes to serializer
847847
} else {
@@ -921,15 +921,15 @@ public function getKeysWithHttpInfo(string $contentType = self::contentTypes['ge
921921
);
922922
$e->setResponseObject($data);
923923
break;
924-
case 403:
924+
case 401:
925925
$data = ObjectSerializer::deserialize(
926926
$e->getResponseBody(),
927927
'\Aternos\HangarApi\Model\ApiKey[]',
928928
$e->getResponseHeaders()
929929
);
930930
$e->setResponseObject($data);
931931
break;
932-
case 401:
932+
case 403:
933933
$data = ObjectSerializer::deserialize(
934934
$e->getResponseBody(),
935935
'\Aternos\HangarApi\Model\ApiKey[]',

lib/Api/AuthenticationApi.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c
207207
$response->getStatusCode(),
208208
$response->getHeaders()
209209
];
210-
case 401:
210+
case 400:
211211
if ('\Aternos\HangarApi\Model\ApiSession' === '\SplFileObject') {
212212
$content = $response->getBody(); //stream goes to serializer
213213
} else {
@@ -234,7 +234,7 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c
234234
$response->getStatusCode(),
235235
$response->getHeaders()
236236
];
237-
case 400:
237+
case 401:
238238
if ('\Aternos\HangarApi\Model\ApiSession' === '\SplFileObject') {
239239
$content = $response->getBody(); //stream goes to serializer
240240
} else {
@@ -314,15 +314,15 @@ public function authenticateWithHttpInfo($api_key, string $contentType = self::c
314314
);
315315
$e->setResponseObject($data);
316316
break;
317-
case 401:
317+
case 400:
318318
$data = ObjectSerializer::deserialize(
319319
$e->getResponseBody(),
320320
'\Aternos\HangarApi\Model\ApiSession',
321321
$e->getResponseHeaders()
322322
);
323323
$e->setResponseObject($data);
324324
break;
325-
case 400:
325+
case 401:
326326
$data = ObjectSerializer::deserialize(
327327
$e->getResponseBody(),
328328
'\Aternos\HangarApi\Model\ApiSession',

0 commit comments

Comments
 (0)