GameClient - JavaScript client
A friendly game of Capture the Flag
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://testdouble.com
The library is hosted at a git repository, e.g.https://github.com/danthompson/capture-the-flag-client-js then install it via:
npm install danthompson/capture-the-flag-client-js --save
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Please follow the installation instruction and execute the following JS code:
var GameClient = require('game-client');
var defaultClient = GameClient.ApiClient.instance;
// Configure API Endpoint
defaultClient.basePath = "GAME_API_ENDPOINT" // https://example.com/api
// Configure Bearer access token for authorization: token
var token = defaultClient.authentications['token'];
token.accessToken = "YOUR_ACCESS_TOKEN" // [email protected]
var api = new GameClient.GameApi()
api.getPlayer().then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
All URIs are relative to https://GAME-API-ENDPOINT/api
Class | Method | HTTP request | Description |
---|---|---|---|
GameClient.GameApi | getPlayer | GET /player | Get Player |
GameClient.GameApi | postMoves | POST /moves | Create Move |
- GameClient.Error
- GameClient.Flag
- GameClient.InlineResponse202
- GameClient.InlineResponse400
- GameClient.Player
Your bearer token is your email address.
- Type: Bearer authentication