README.md•5.02 kB
# gamebrain
GameBrain API
## Installation & Usage
### Requirements
PHP 7.4 and later.
Should also work with PHP 8.0.
### Composer
To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
```json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ddsky/gamebrain-clients/tree/master/php/.git"
}
],
"require": {
"ddsky/gamebrain-clients/tree/master/php/": "*@dev"
}
}
```
Then run `composer install`
### Manual Installation
Download the files and include `autoload.php`:
```php
<?php
require_once('/path/to/gamebrain/vendor/autoload.php');
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apiKey
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: headerApiKey
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');
$apiInstance = new OpenAPI\Client\Api\DefaultApi(
// 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
);
$id = 56; // int | The unique identifier of the game.
$api_key = abc123; // string | Your API key for authentication.
try {
$result = $apiInstance->detail($id, $api_key);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->detail: ', $e->getMessage(), PHP_EOL;
}
```
## API Endpoints
All URIs are relative to *https://api.gamebrain.co/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**detail**](docs/Api/DefaultApi.md#detail) | **GET** /games/{id} | Get Game Details
*DefaultApi* | [**news**](docs/Api/DefaultApi.md#news) | **GET** /games/{id}/news | Get Game News
*DefaultApi* | [**search**](docs/Api/DefaultApi.md#search) | **GET** /games | Search Games
*DefaultApi* | [**similar**](docs/Api/DefaultApi.md#similar) | **GET** /games/{id}/similar | Get Similar Games
*DefaultApi* | [**suggest**](docs/Api/DefaultApi.md#suggest) | **GET** /games/suggestions | Get Game Suggestions
## Models
- [GameNewsItem](docs/Model/GameNewsItem.md)
- [GameNewsResponse](docs/Model/GameNewsResponse.md)
- [GameResponse](docs/Model/GameResponse.md)
- [GameResponseOffersInner](docs/Model/GameResponseOffersInner.md)
- [GameResponseOffersInnerPrice](docs/Model/GameResponseOffersInnerPrice.md)
- [GameResponseOfficialStoresInner](docs/Model/GameResponseOfficialStoresInner.md)
- [GameResponsePlatformsInner](docs/Model/GameResponsePlatformsInner.md)
- [GameResponsePlaytime](docs/Model/GameResponsePlaytime.md)
- [GameResponseRating](docs/Model/GameResponseRating.md)
- [SearchResponse](docs/Model/SearchResponse.md)
- [SearchResponseActiveFilterOptionsInner](docs/Model/SearchResponseActiveFilterOptionsInner.md)
- [SearchResponseActiveFilterOptionsInnerValuesInner](docs/Model/SearchResponseActiveFilterOptionsInnerValuesInner.md)
- [SearchResponseFilterOptionsInner](docs/Model/SearchResponseFilterOptionsInner.md)
- [SearchResponseFilterOptionsInnerValuesInner](docs/Model/SearchResponseFilterOptionsInnerValuesInner.md)
- [SearchResponseResultsInner](docs/Model/SearchResponseResultsInner.md)
- [SearchResponseResultsInnerRating](docs/Model/SearchResponseResultsInnerRating.md)
- [SearchResponseSorting](docs/Model/SearchResponseSorting.md)
- [SearchResponseSortingOptionsInner](docs/Model/SearchResponseSortingOptionsInner.md)
- [SearchSuggestionResponse](docs/Model/SearchSuggestionResponse.md)
- [SearchSuggestionResponseResultsInner](docs/Model/SearchSuggestionResponseResultsInner.md)
- [SimilarGamesResponse](docs/Model/SimilarGamesResponse.md)
## Authorization
Authentication schemes defined for the API:
### apiKey
- **Type**: API key
- **API key parameter name**: api-key
- **Location**: URL query string
### headerApiKey
- **Type**: API key
- **API key parameter name**: x-api-key
- **Location**: HTTP header
## Tests
To run the tests, use:
```bash
composer install
vendor/bin/phpunit
```
## Author
mail@gamebrain.co
## About this package
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: `1.0.1`
- Package version: `1.0.2`
- Generator version: `7.8.0-SNAPSHOT`
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`