Service to communicate with game routes of the server application

Hierarchy (View Summary)

Constructors

Methods

  • Execute an action for the current player on the server application

    Parameters

    • actionAlias: string

      Alias of the action to execute

    • OptionalobjectAliases: string[]

      Aliases of the game objects to execute the action on

    Returns Promise<undefined | GameState>

    A type of game state, or undefined if the action was unhandled. This can indicate the action requires a second game object to work.

  • Get a type of game state for the current player from the server application

    Returns Promise<GameState>

    A type of game state for the current player

  • Perform a GET request and retrieve a JSON response

    Type Parameters

    • T1

      Return type of the function

    • T2 = unknown

      Type of query string attributes

    Parameters

    • path: string

      Url to request

    • Optionaldata: T2

      Optional object to use for the query string attributes

    Returns Promise<T1>

    JSON object of the response, otherwise undefined.

  • Perform a POST request and retrieve a JSON response

    Type Parameters

    • T1

      Return type of the function

    • T2 = unknown

      Type of request body

    Parameters

    • path: string

      Url to request

    • Optionaldata: T2

      Optional object to include in the body of the request

    Returns Promise<T1>

    JSON object of the response, otherwise undefined.