Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / SystemResource

Interface: SystemResource ​

Defined in: packages/ts-sdk/src/resources/system.ts:25

System-level API methods.

Use these calls for lightweight reachability checks and operational status before starting match flows.

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Health checks simulator liveness.
const health = await simulatorClient.system.health()

console.log(health.status)

Example ​

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const health = await simulatorClient.system.health()
console.log(health.status)

See ​

https://simulator-sdk.my-swu.com/guide/http-client

Methods ​

availability() ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const systemResource = simulatorClient.system

const { availability } = systemResource

console.log(availability)

availability(options?): Promise<SimulatorAvailabilityResponse>

Defined in: packages/ts-sdk/src/resources/system.ts:47

Returns whether the simulator is accepting new matches/sessions.

Parameters ​

options? ​

SimulatorRequestOptions

Returns ​

Promise<SimulatorAvailabilityResponse>


health() ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Health is the lightest server reachability check.
const health = await simulatorClient.system.health()

health(options?): Promise<HealthResponse>

Defined in: packages/ts-sdk/src/resources/system.ts:43

Calls the simulator liveness probe.

Parameters ​

options? ​

SimulatorRequestOptions

Returns ​

Promise<HealthResponse>

Example ​

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

const health = await simulatorClient.system.health()
console.log(health.status)

See ​

https://simulator-sdk.my-swu.com/guide/http-client#health-checks

Released under the MIT License.