-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
6,007 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
on: pull_request | ||
name: Review | ||
jobs: | ||
test-composer-install: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: ['7.4', '7.3'] | ||
name: Validate composer (${{ matrix.php}}) | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php}} | ||
extension: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip | ||
coverage: none | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ matrix.php }}-composer- | ||
|
||
- name: Validate composer files | ||
run: composer validate composer.json | ||
|
||
- name: Composer install with exported .env variables | ||
run: | | ||
APP_ENV=prod composer install --no-dev -o | ||
runner-phpcs: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: ['7.4', '7.3'] | ||
name: Coding style (${{ matrix.php }}) | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extension: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip | ||
coverage: none | ||
|
||
- name: Install Reviewdog | ||
run: wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b $PWD/ v0.9.14 | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ matrix.php }}-composer- | ||
|
||
- name: Install Dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | ||
|
||
- name: PHPCS | ||
run: composer actions/phpcs | ./reviewdog -f=checkstyle -name=PHPCS -reporter=github-pr-check | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
phpcsfixer: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: ['7.4', '7.3'] | ||
name: Coding style fixer (${{ matrix.php }}) | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extension: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip | ||
coverage: none | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ matrix.php }}-composer- | ||
|
||
- name: Install Dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | ||
|
||
- name: phpcsfixerr | ||
run: composer actions/phpcsfixer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor/ | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__.'/lib') | ||
; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@PSR2' => true, | ||
'phpdoc_align' => false, | ||
'no_superfluous_phpdoc_tags' => false, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'array_indentation' => true, | ||
'trim_array_spaces' => true, | ||
]) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Swagger Codegen Ignore | ||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
|
||
composer.json | ||
git_push.sh | ||
.travis.yml | ||
.phpunit.xml.dist | ||
phpunit.xml.dist | ||
.php_cs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# | ||
This service provides covers for library materials indexed by isbn, issn, faust, pid. The service is provided by [Danskernes Digitale Bibliotek](https://www.danskernesdigitalebibliotek.dk/) ### Authentication notes Authentication is done via OAuth2 against auth.dbc.dk. To obtain a valid token follow instructions in [1.2. Password Grant](https://github.com/DBCDK/hejmdal/blob/master/docs/oauth2.md#12-password-grant). To use the \"Authorize\" option in this tool use your 'client_id' and 'client_secret' and fill in '@' for both username and password. ### Implementation notes Currently the API is not fully implemented. The following features are missing: * Generic Covers: parameter is currently ignored. Service doesn't yet provide generic covers. | ||
|
||
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: | ||
|
||
- API version: 2.0 | ||
- Package version: 2.0.0 | ||
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen | ||
|
||
## Requirements | ||
|
||
PHP 5.5 and later | ||
|
||
## Installation & Usage | ||
### Composer | ||
|
||
To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`: | ||
|
||
``` | ||
{ | ||
"repositories": [ | ||
{ | ||
"type": "git", | ||
"url": "https://github.com/danskernesdigitalebibliotek/ddb-cover-service-php-client.git" | ||
} | ||
], | ||
"require": { | ||
"danskernesdigitalebibliotek/ddb-cover-service-php-client": "*@dev" | ||
} | ||
} | ||
``` | ||
|
||
Then run `composer install` | ||
|
||
### Manual Installation | ||
|
||
Download the files and include `autoload.php`: | ||
|
||
```php | ||
require_once('/path/to//vendor/autoload.php'); | ||
``` | ||
|
||
## Tests | ||
|
||
To run the unit tests: | ||
|
||
``` | ||
composer install | ||
./vendor/bin/phpunit | ||
``` | ||
|
||
## Getting Started | ||
|
||
Please follow the [installation procedure](#installation--usage) and then run the following: | ||
|
||
```php | ||
<?php | ||
require_once(__DIR__ . '/vendor/autoload.php'); | ||
|
||
// Configure OAuth2 access token for authorization: oauth | ||
$config = CoverService\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); | ||
|
||
$apiInstance = new CoverService\Api\CoverApi( | ||
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. | ||
// This is optional, `GuzzleHttp\Client` will be used as default. | ||
new GuzzleHttp\Client(), | ||
$config | ||
); | ||
$type = "type_example"; // string | The type of the identifier, i.e. 'isbn', 'faust', 'pid' or 'issn' | ||
$identifiers = array("identifiers_example"); // string[] | A list of identifiers of {type}. Maximum number os identifiers per reqeust is 200 | ||
$sizes = array("sizes_example"); // string[] | A list of image sizes (Cloudinary transformations) for the cover(s) you want to receive. | ||
|
||
try { | ||
$result = $apiInstance->getCoverCollection($type, $identifiers, $sizes); | ||
print_r($result); | ||
} catch (Exception $e) { | ||
echo 'Exception when calling CoverApi->getCoverCollection: ', $e->getMessage(), PHP_EOL; | ||
} | ||
?> | ||
``` | ||
|
||
## Documentation for API Endpoints | ||
|
||
All URIs are relative to */* | ||
|
||
Class | Method | HTTP request | Description | ||
------------ | ------------- | ------------- | ------------- | ||
*CoverApi* | [**getCoverCollection**](docs/Api/CoverApi.md#getcovercollection) | **GET** /api/v2/covers | Search multiple covers | ||
|
||
## Documentation For Models | ||
|
||
- [Cover](docs/Model/Cover.md) | ||
- [ImageUrl](docs/Model/ImageUrl.md) | ||
|
||
## Documentation For Authorization | ||
|
||
|
||
## oauth | ||
|
||
- **Type**: OAuth | ||
- **Flow**: password | ||
- **Authorization URL**: | ||
- **Scopes**: | ||
- ****: | ||
|
||
|
||
## Author | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "danskernesdigitalebibliotek/ddb-cover-service-php-client", | ||
"version": "2.0.0", | ||
"description": "", | ||
"keywords": [ | ||
"swagger", | ||
"php", | ||
"sdk", | ||
"api" | ||
], | ||
"homepage": "http://swagger.io", | ||
"license": "AGPL-3.0-only", | ||
"authors": [ | ||
{ | ||
"name": "Swagger and contributors", | ||
"homepage": "https://github.com/swagger-api/swagger-codegen" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7", | ||
"ext-curl": "*", | ||
"ext-json": "*", | ||
"ext-mbstring": "*", | ||
"guzzlehttp/guzzle": "^6.2" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^2.16", | ||
"squizlabs/php_codesniffer": "^3.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { "CoverService\\" : "lib/" } | ||
}, | ||
"scripts":{ | ||
"check": [ | ||
"@check-coding-standards" | ||
], | ||
"check-coding-standards/php-cs-fixer": [ | ||
"php-cs-fixer --config=.php_cs.dist fix --dry-run --format=checkstyle" | ||
], | ||
"check-coding-standards/phpcs": [ | ||
"phpcs --standard=phpcs.xml.dist" | ||
], | ||
"check-coding-standards": [ | ||
"@check-coding-standards/php-cs-fixer", | ||
"@check-coding-standards/phpcs" | ||
], | ||
"apply-coding-standards/php-cs-fixer": [ | ||
"php-cs-fixer --config=.php_cs.dist fix" | ||
], | ||
"apply-coding-standards/phpcs": [ | ||
"phpcbf --standard=phpcs.xml.dist" | ||
], | ||
"apply-coding-standards": [ | ||
"@apply-coding-standards/php-cs-fixer", | ||
"@apply-coding-standards/phpcs" | ||
], | ||
"actions/phpcs": [ | ||
"phpcs --standard=phpcs.xml.dist --report=checkstyle" | ||
], | ||
"actions/phpcsfixer": [ | ||
"php-cs-fixer --config=.php_cs.dist fix --dry-run --diff --diff-format=udiff" | ||
] | ||
} | ||
} |
Oops, something went wrong.