This api controlls the flow of a game and provides it's data.
It is desiged to be RESTfull so the structure works simmilar as file system.
The service will run and only work in a local network, game.host
is the IP of the Computer hosting the game and will be found via a IP scan
This C# SDK is automatically generated by the OpenAPI Generator project:
- API version: v2.13.3
- SDK version: 2.16.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
- RestSharp - 106.10.1 or later
- Json.NET - 12.0.1 or later
- JsonSubTypes - 1.5.2 or later
- System.ComponentModel.Annotations - 4.5.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742
Run the following command to generate the DLL
- [Mac/Linux]
/bin/sh build.sh
- [Windows]
build.bat
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using Tgm.Roborally.Api.Api;
using Tgm.Roborally.Api.Client;
using Tgm.Roborally.Api.Model;
A .nuspec
is included with the project. You can follow the Nuget quickstart to create and publish packages.
This .nuspec
uses placeholders from the .csproj
, so build the .csproj
directly:
nuget pack -Build -OutputDirectory out Tgm.Roborally.Api.csproj
Then, publish to a local feed or other host and consume the new package via Nuget as usual.
using System.Collections.Generic;
using System.Diagnostics;
using Tgm.Roborally.Api.Api;
using Tgm.Roborally.Api.Client;
using Tgm.Roborally.Api.Model;
namespace Example
{
public class Example
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://game.host/v1";
var apiInstance = new ConsumerApi(config);
var gameId = 56; // int | The id of the game to interact with
var consumerRegistration = new ConsumerRegistration(); // ConsumerRegistration | Information about the joining consumer (optional)
try
{
// Register Consumers
JoinResponse result = apiInstance.RegisterConsumer(gameId, consumerRegistration);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConsumerApi.RegisterConsumer: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
All URIs are relative to http://game.host/v1
Class | Method | HTTP request | Description |
---|---|---|---|
ConsumerApi | RegisterConsumer | POST /games/{game_id}/consumers | Register Consumers |
EventHandlingApi | FetchNextEvent | GET /games/{game_id}/events/head | Get next event |
EventHandlingApi | TraceEvent | GET /games/{game_id}/events/type | trace event |
GameApi | CommitAction | PUT /games/{game_id}/actions | Commit Action |
GameApi | CreateGame | POST /games/ | Create Game |
GameApi | GetActions | GET /games/{game_id}/actions | Get games actions |
GameApi | GetGameState | GET /games/{game_id}/status | Get game status |
GameApi | GetGames | GET /games/ | Get all games |
GameApi | GetProgrammingCard | GET /games/{game_id}/statements/{statement_id} | Get Programming Card |
GameApi | GetProgrammingCardIds | HEAD /games/{game_id}/statements | Get Programming Card IDs |
GameApi | GetProgrammingCards | GET /games/{game_id}/statements | Get Programming cards |
MapApi | GetGameMap | GET /games/{game_id}/map | Get Map |
MapApi | GetMapInfo | GET /games/{game_id}/map/info | Get Map info |
MapApi | GetTile | GET /games/{game_id}/map/tiles/{x}/{y} | Get tile |
MapRepoApi | DeleteMap | DELETE /maps/{map_name} | Delete Map |
MapRepoApi | GetMap | GET /maps/{map_name} | Get map |
MapRepoApi | GetMaps | GET /maps/ | Get Map Names |
MapRepoApi | SaveMap | POST /maps/ | Save Map |
PlayersApi | ChooseRobot | PATCH /games/{game_id}/players/{player_id} | Set Robots |
PlayersApi | GetAllPlayers | GET /games/{game_id}/players/ | Get all players |
PlayersApi | GetPlayer | GET /games/{game_id}/players/{player_id} | Get player |
PlayersApi | Join | POST /games/{game_id}/players/ | Join game |
PlayersApi | KickPlayer | DELETE /games/{game_id}/players/{player_id} | Remove Player |
RobotsApi | ClearRegisters | DELETE /games/{game_id}/entities/robots/{robot_id}/registers | clear registers |
RobotsApi | ClearUpgrades | DELETE /games/{game_id}/entities/robots/{robot_id}/upgrades | Clear Robot Upgrades |
RobotsApi | DoEntityAction | POST /games/{game_id}/entities/robots/{robot_id}/actions/stack/ | Add Entity Action to stack |
RobotsApi | GetActionStack | GET /games/{game_id}/entities/robots/{robot_id}/actions/stack/ | Get Robot action stack |
RobotsApi | GetInstalledUpgrades | GET /games/{game_id}/entities/robots/{robot_id}/upgrades | Get Robot Upgrades |
RobotsApi | GetPossibleActions | GET /games/{game_id}/entities/robots/{robot_id}/actions/avinable | Get Aviable actions |
RobotsApi | GetRegisterContent | GET /games/{game_id}/entities/robots/{robot_id}/registers/{register} | Get Register Content |
RobotsApi | GetRegisters | GET /games/{game_id}/entities/robots/{robot_id}/registers | Get register information |
RobotsApi | GetRobotStats | GET /games/{game_id}/entities/robots/{robot_id}/info | Get Robot Informations |
RobotsApi | GetRobots | GET /games/{game_id}/entities/robots/ | Get all robots |
RobotsApi | RemoveRobotUpgrade | PATCH /games/{game_id}/entities/robots/{robot_id}/upgrades | Remove Upgrade |
RobotsApi | SetRegister | PUT /games/{game_id}/entities/robots/{robot_id}/registers/{register} | Set Register Content |
UpgradesApi | BuyUpgrade | PATCH /games/{game_id}/upgrades/shop/{upgrade_id} | Buy Upgrade |
UpgradesApi | GetAllUpgradeIDs | GET /games/{game_id}/upgrades/ | get all Upgrades |
UpgradesApi | GetUpgradeInformation | GET /games/{game_id}/upgrades/{upgrade_id} | Get upgrade information |
UpgradesApi | GetUpgradeShop | GET /games/{game_id}/upgrades/shop | Get upgrade shop |
- Model.Action
- Model.ActionType
- Model.ChangeRegisterEvent
- Model.Checkpoint
- Model.CheckpointAllOf
- Model.ConsumerRegistration
- Model.DamageEvent
- Model.Direction
- Model.DiscardUpgradesEvent
- Model.DrawCardEvent
- Model.EnergyGainEvent
- Model.Entity
- Model.EntityAction
- Model.EntityActionPhase
- Model.EntityActionType
- Model.EntityEventOportunity
- Model.EntityUseUpgradeAction
- Model.ErrorMessage
- Model.EventType
- Model.Game
- Model.GameEndEvent
- Model.GameInfo
- Model.GameInfoExecutionInfo
- Model.GamePhaseChangedEvent
- Model.GameRules
- Model.GameState
- Model.GenericEvent
- Model.HealEvent
- Model.Instruction
- Model.JoinEvent
- Model.JoinResponse
- Model.LazerHitEvent
- Model.Map
- Model.MapEvent
- Model.MapEventType
- Model.MapInfo
- Model.MovementEvent
- Model.Pair
- Model.PauseEvent
- Model.Player
- Model.Position
- Model.ProgrammingTimerStartEvent
- Model.PurchaseEvent
- Model.PushEvent
- Model.RobotCommand
- Model.RobotInfo
- Model.RobotInfoAllOf
- Model.RobotPickEvent
- Model.RobotStartExecEvent
- Model.Robots
- Model.Rotation
- Model.RotatorPosition
- Model.RoundPhase
- Model.RoundPhaseChangedEvent
- Model.ShootEvent
- Model.ShutdownEvent
- Model.SimpleUpgradeActivation
- Model.SimpleUpgradeActivationAllOf
- Model.Tile
- Model.TileType
- Model.TimeElapsedEvent
- Model.TimerStartEvent
- Model.Upgrade
- Model.UpgradeShop
- Model.UpgradeShopInformation
- Model.UpgradeType
- Type: API key
- API key parameter name: skey
- Location: URL query string
- Type: API key
- API key parameter name: pat
- Location: URL query string