Class: ServerApi

server.ServerApi

Server wrapper class. Handles server requests.

Constructors

constructor

new ServerApi(client): ServerApi

Parameters

Name Type
client Client

Returns

ServerApi

Properties

client

Private client: Client

Methods

log

log(event, parameters): void

Parameters

Name Type
event string
parameters Object

Returns

void


post

post(handler, request, mode?): Promise<ApiResponse>

Post a request to the game server. By default the operation will be retried indefinitely in the case of network errors. If the handler is not idempotent the mode should be set to no-retry in which case all errors will be propagated. If the server responds with a non-ok status a ServerError will be thrown regardless of retry mode.

Parameters

Name Type Description
handler string Relative url of the handler. Logged in analytics events as handler parameter.
request any Request payload
mode? "no-retry" Optional operation mode

Returns

Promise<ApiResponse>