Skip to content

Commit 56a8bec

Browse files
authored
Merge pull request #34 from factorio-item-browser/feature/status-request
feature/status-request
2 parents c2ef418 + 72efc42 commit 56a8bec

File tree

14 files changed

+396
-370
lines changed

14 files changed

+396
-370
lines changed

.github/problem-matchers/coverage-check.json

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

.github/workflows/ci.yaml

Lines changed: 12 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -6,147 +6,15 @@ on:
66
- cron: "0 0 * * 0"
77

88
jobs:
9-
composer-validation:
10-
name: Composer Validation
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: checkout
14-
uses: actions/checkout@v2
15-
16-
- name: Setup PHP
17-
uses: shivammathur/setup-php@v2
18-
with:
19-
php-version: "8.0"
20-
extensions: json, pdo_mysql, zip
21-
coverage: none
22-
23-
- name: Run composer validate
24-
run: composer validate --strict
25-
26-
unit-tests:
27-
name: Unit Tests
28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
php-version:
32-
- "8.0"
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Checkout
36-
uses: actions/checkout@v2
37-
38-
- name: Setup PHP
39-
uses: shivammathur/setup-php@v2
40-
with:
41-
php-version: ${{ matrix.php-version }}
42-
extensions: json, pdo_mysql, zip
43-
coverage: xdebug
44-
45-
- name: Get composer cache directory
46-
id: composer-cache
47-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
48-
49-
- name: Cache composer dependencies
50-
uses: actions/cache@v2
51-
with:
52-
path: ${{ steps.composer-cache.outputs.dir }}
53-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
54-
restore-keys: ${{ runner.os }}-composer-
55-
56-
- name: Setup problem matchers
57-
run: |
58-
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
59-
echo "::add-matcher::.github/problem-matchers/coverage-check.json"
60-
61-
- name: Install dependencies
62-
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
63-
64-
- name: Run phpunit
65-
run: vendor/bin/phpunit --testsuite unit-test --coverage-clover=coverage.xml
66-
67-
- name: Check coverage.xml existence
68-
id: check-coverage-file
69-
uses: andstor/file-existence-action@v1
70-
with:
71-
files: coverage.xml
72-
73-
- name: Run coverage-check
74-
if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }}
75-
run: vendor/bin/coverage-check coverage.xml 100
76-
77-
- name: Upload coverage as artifacts
78-
if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }}
79-
uses: actions/upload-artifact@v2
80-
with:
81-
name: coverage-${{ matrix.php-version }}
82-
path: coverage.xml
83-
84-
- name: Upload coverage to Codecov
85-
if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }}
86-
uses: codecov/codecov-action@v1
87-
with:
88-
name: coverage-${{ matrix.php-version }}
89-
file: coverage.xml
90-
91-
coding-guidelines:
92-
name: Coding Guidelines
93-
runs-on: ubuntu-latest
94-
steps:
95-
- name: checkout
96-
uses: actions/checkout@v2
97-
98-
- name: Setup PHP
99-
uses: shivammathur/setup-php@v2
100-
with:
101-
php-version: "8.0"
102-
extensions: json, pdo_mysql, zip
103-
tools: cs2pr
104-
coverage: none
105-
106-
- name: Get composer cache directory
107-
id: composer-cache
108-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
109-
110-
- name: Cache composer dependencies
111-
uses: actions/cache@v2
112-
with:
113-
path: ${{ steps.composer-cache.outputs.dir }}
114-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
115-
restore-keys: ${{ runner.os }}-composer-
116-
117-
- name: Install dependencies
118-
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
119-
120-
- name: Run phpcs
121-
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr
122-
123-
type-checker:
124-
name: Type Checker
125-
runs-on: ubuntu-latest
126-
steps:
127-
- name: Checkout
128-
uses: actions/checkout@v2
129-
130-
- name: Setup PHP
131-
uses: shivammathur/setup-php@v2
132-
with:
133-
php-version: "8.0"
134-
extensions: json, pdo_mysql, zip
135-
coverage: none
136-
137-
- name: Get composer cache directory
138-
id: composer-cache
139-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
140-
141-
- name: Cache composer dependencies
142-
uses: actions/cache@v2
143-
with:
144-
path: ${{ steps.composer-cache.outputs.dir }}
145-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
146-
restore-keys: ${{ runner.os }}-composer-
147-
148-
- name: Install dependencies
149-
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
150-
151-
- name: Run phpstan
152-
run: vendor/bin/phpstan analyse --no-interaction
9+
call-workflow-ci-php-general:
10+
name: General
11+
uses: factorio-item-browser/github-workflows/.github/workflows/ci-php-general.yaml@v1
12+
with:
13+
extensions: json, pdo_mysql, zip
14+
15+
call-workflow-ci-php-tests:
16+
name: Tests
17+
uses: factorio-item-browser/github-workflows/.github/workflows/ci-php-tests.yaml@v1
18+
with:
19+
extensions: json, pdo_mysql, zip
20+
php-versions: "8.0" # Package "laminas/laminas-log" does not support PHP 8.1 yet.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 3.2.0 - 2021-12-04
4+
5+
### Added
6+
7+
- Status request providing meta-level data to a combination.
8+
39
## 3.1.8 - 2021-11-13
410

511
### Fixed

api/openapi.yaml

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,44 @@ info:
77
contact:
88
name: BluePsyduck
99
10-
version: 3.1.8
10+
version: 3.2.0
1111

1212
servers:
1313
- url: https://data-api.factorio-item-browser.com/
1414
description: Live API server
1515

1616
tags:
17+
- name: Meta
1718
- name: Generic
1819
- name: Items
1920
- name: Mods
2021
- name: Recipes
2122
- name: Search
2223

2324
paths:
25+
/{combination-id}:
26+
post:
27+
summary: Provides the data status and availability of the combination.
28+
description: >
29+
This request provides some meta-level data to the requested combination, mainly whether or not data for it is
30+
actually available.
31+
<br><br>
32+
The data availability is represented by the status code: If data is available, a status 200 is returned,
33+
together with some meta data. If the data is not available, a status 404 is returned.
34+
operationId: meta.status
35+
tags:
36+
- Meta
37+
parameters:
38+
- $ref: "#/components/parameters/combination-id"
39+
- $ref: "#/components/parameters/Accept-Language"
40+
responses:
41+
"200":
42+
$ref: "#/components/responses/status"
43+
"404":
44+
$ref: "#/components/responses/combinationNotFound"
45+
security:
46+
- apiKey: []
47+
2448
/{combination-id}/generic/details:
2549
post:
2650
summary: Provides generic data to the entities.
@@ -723,6 +747,13 @@ components:
723747
description: The total number of results of the search.
724748
example: 1
725749

750+
status:
751+
description: The status of the combination.
752+
content:
753+
application/json:
754+
schema:
755+
$ref: "#/components/schemas/CombinationStatus"
756+
726757
# 400 responses
727758
badRequest:
728759
description:
@@ -756,6 +787,20 @@ components:
756787
example: Invalid or missing Api-Key.
757788

758789
# 404 responses
790+
combinationNotFound:
791+
description: The requested combination is not available.
792+
content:
793+
application/json:
794+
schema:
795+
type: object
796+
properties:
797+
error:
798+
type: object
799+
properties:
800+
message:
801+
type: string
802+
example: The combination with the id "01234567-89ab-cdef-0123-456789abcdef" is not known.
803+
759804
itemNotFound:
760805
description: The requested item is not known in the combination of mods.
761806
content:
@@ -785,6 +830,20 @@ components:
785830
example: Recipe not found in the combination of mods.
786831

787832
schemas:
833+
CombinationStatus:
834+
type: object
835+
description: The status of the combination.
836+
properties:
837+
dataVersion:
838+
type: integer
839+
description: The version of the data available in the API.
840+
example: 1
841+
importTime:
842+
type: string
843+
format: datetime
844+
description: The time when the data of the combination was imported into the database.
845+
example: 2038-01-19T03:14:07Z
846+
788847
GenericEntity:
789848
type: object
790849
description: A generic entity with basic information.
@@ -842,13 +901,13 @@ components:
842901
name:
843902
type: string
844903
description: The name of the entity using this icon.
845-
example:
846-
- type: item
847-
name: iron-plate
848-
- type: item
849-
name: bob-iron-plate
850-
- type: recipe
851-
name: irom-plate
904+
example:
905+
- type: item
906+
name: iron-plate
907+
- type: item
908+
name: bob-iron-plate
909+
- type: recipe
910+
name: irom-plate
852911
content:
853912
type: string
854913
description: The base64 encoded contents of the icon file.

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"bluepsyduck/laminas-autowire-factory": "^1.0",
2121
"bluepsyduck/ga4-measurement-protocol": "^2.0",
2222
"doctrine/cache": "^1.10",
23-
"factorio-item-browser/api-client": "^4.0",
23+
"factorio-item-browser/api-client": "^4.1",
2424
"factorio-item-browser/api-database": "^3.7",
2525
"factorio-item-browser/api-search": "^2.1",
2626
"factorio-item-browser/combination-api-client": "^1.1",
@@ -37,9 +37,9 @@
3737
},
3838
"require-dev": {
3939
"bluepsyduck/test-helper": "^2.0",
40-
"phpstan/phpstan": "^0.12",
41-
"phpstan/phpstan-phpunit": "^0.12",
42-
"phpstan/phpstan-strict-rules": "^0.12",
40+
"phpstan/phpstan": "^1.0",
41+
"phpstan/phpstan-phpunit": "^1.0",
42+
"phpstan/phpstan-strict-rules": "^1.0",
4343
"phpunit/phpunit": "^9.0",
4444
"rregeer/phpunit-coverage-check": "^0.3",
4545
"squizlabs/php_codesniffer": "^3.3"

0 commit comments

Comments
 (0)