Skip to content

danthompson/capture-the-flag-client-js

Repository files navigation

game-client

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

Installation

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

For browser (untested)

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.

Webpack Configuration

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
      }
    }
  ]
}

Getting Started

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);
});

Documentation for API Endpoints

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

Documentation for Models

Documentation for Authorization

Your bearer token is your email address.

token

  • Type: Bearer authentication

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published