docs | ||
lib | ||
composer.json | ||
README.md |
Perudo PHP api
Play perudo with your friends through the api!
Created for/from https://perudo.loken.nl/api/doc
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
Note: It is modified to remove some unused/wrong object deserializations
Requirements
PHP 7.0 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://git.loken.nl/ardent/PerudoPhpApi.git"
}
],
"require": {
"ardent/perudo-php-api": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?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 | POST /player/call/{player} | |
DefaultApi | createGame | GET /game/create | |
DefaultApi | gameIsStarted | GET /game/started/{player} | |
DefaultApi | getTurn | GET /player/turn/{player} | |
DefaultApi | joinGame | GET /game/join/{code} | |
DefaultApi | postTurn | POST /player/guess/{player} | |
DefaultApi | setGameRules | POST /game/rules/{player} | |
DefaultApi | startGame | GET /game/start/{player} |
Documentation For Models
Documentation For Authorization
All endpoints do not require authorization.