Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / FormatEventResponse

Interface: FormatEventResponse ​

Defined in: packages/ts-sdk/src/generated/types/common.ts:1669

HTTP response after applying a format-event command.

Example:

ts
import type { FormatEventResponse } from '@my-swu/simulator-client'
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',
})

// Format events return an updated snapshot after the server applies them.
const matchSnapshot = await simulatorClient.matches.get('match_123')
const formatEventResponse = { snapshot: matchSnapshot } satisfies FormatEventResponse

console.log(formatEventResponse)

Properties ​

snapshot ​

Example:

ts
import type { FormatEventResponse } from '@my-swu/simulator-client'
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',
})

// Format events return an updated snapshot after the server applies them.
const matchSnapshot = await simulatorClient.matches.get('match_123')
const formatEventResponse = { snapshot: matchSnapshot } satisfies FormatEventResponse

const { snapshot: updatedMatchSnapshot } = formatEventResponse

console.log(updatedMatchSnapshot)

snapshot: GameState

Defined in: packages/ts-sdk/src/generated/types/common.ts:1673

Updated match snapshot visible to the acting seat.

Released under the MIT License.