@my-swu/simulator-client / createSimulatorClient
Function: createSimulatorClient()
createSimulatorClient(
options):SimulatorClient
Defined in: packages/ts-sdk/src/client.ts:116
Creates one typed simulator client.
Use one client per simulator server origin. Resource calls validate request and response payloads against the generated schema before returning typed values.
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',
})
// Resource calls share the base URL configured above.
const health = await simulatorClient.system.health()Parameters
options
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',
})
// Resource calls share the base URL configured above.
const health = await simulatorClient.system.health()Returns
Example
ts
import { createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const stats = await simulatorClient.system.stats()
console.log(stats.covered)