PerudoPhpApi/README.md

213 lines
6.6 KiB
Markdown

# SwaggerClient-php
Play perudo with your friends through the api!
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.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": "http://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
```
Then run `composer install`
### Manual Installation
Download the files and include `autoload.php`:
```php
require_once('/path/to/SwaggerClient-php/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');
$apiInstance = new Swagger\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()
);
$player = "player_example"; // string |
try {
$result = $apiInstance->callTurn($player);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->callTurn: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\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()
);
$name = "name_example"; // string |
try {
$result = $apiInstance->createGame($name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->createGame: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\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()
);
$player = "player_example"; // string |
try {
$result = $apiInstance->gameIsStarted($player);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->gameIsStarted: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\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()
);
$player = "player_example"; // string |
try {
$result = $apiInstance->getTurn($player);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->getTurn: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\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()
);
$name = "name_example"; // string |
$code = "code_example"; // string |
try {
$result = $apiInstance->joinGame($name, $code);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->joinGame: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\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()
);
$player = "player_example"; // string |
$body = new \Swagger\Client\Model\PlayerGuess(); // \Swagger\Client\Model\PlayerGuess |
try {
$result = $apiInstance->postTurn($player, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->postTurn: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\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()
);
$player = "player_example"; // string |
$body = new \Swagger\Client\Model\GameRules(); // \Swagger\Client\Model\GameRules |
try {
$result = $apiInstance->setGameRules($player, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->setGameRules: ', $e->getMessage(), PHP_EOL;
}
$apiInstance = new Swagger\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()
);
$player = "player_example"; // string |
try {
$result = $apiInstance->startGame($player);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->startGame: ', $e->getMessage(), PHP_EOL;
}
?>
```
## Documentation for API Endpoints
All URIs are relative to */*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**callTurn**](docs/Api/DefaultApi.md#callturn) | **POST** /player/call/{player} |
*DefaultApi* | [**createGame**](docs/Api/DefaultApi.md#creategame) | **GET** /game/create |
*DefaultApi* | [**gameIsStarted**](docs/Api/DefaultApi.md#gameisstarted) | **GET** /game/started/{player} |
*DefaultApi* | [**getTurn**](docs/Api/DefaultApi.md#getturn) | **GET** /player/turn/{player} |
*DefaultApi* | [**joinGame**](docs/Api/DefaultApi.md#joingame) | **GET** /game/join/{code} |
*DefaultApi* | [**postTurn**](docs/Api/DefaultApi.md#postturn) | **POST** /player/guess/{player} |
*DefaultApi* | [**setGameRules**](docs/Api/DefaultApi.md#setgamerules) | **POST** /game/rules/{player} |
*DefaultApi* | [**startGame**](docs/Api/DefaultApi.md#startgame) | **GET** /game/start/{player} |
## Documentation For Models
- [GameIsStarted](docs/Model/GameIsStarted.md)
- [GameRules](docs/Model/GameRules.md)
- [GameState](docs/Model/GameState.md)
- [MessageResponse](docs/Model/MessageResponse.md)
- [MyTurn](docs/Model/MyTurn.md)
- [Player](docs/Model/Player.md)
- [PlayerCode](docs/Model/PlayerCode.md)
- [PlayerGuess](docs/Model/PlayerGuess.md)
- [Round](docs/Model/Round.md)
- [Turn](docs/Model/Turn.md)
## Documentation For Authorization
All endpoints do not require authorization.
## Author