@my-swu/simulator-client / MatchAccess
Type Alias: MatchAccess
MatchAccess =
MatchAccessResponse
Defined in: packages/ts-sdk/src/resources/matches.ts:39
Access token and private snapshot returned after creating or joining a match.
Keep seatToken private. It authorizes one player seat for socket and format event calls.
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',
})
// Use card ids; the server validates deck legality.
const premierHostDeck = {
leader: 46102, // Leia Organa - Someone Who Loves You
base: 308, // Echo Base
cards: Array.from({ length: 50 }, () => 45), // Alliance X-Wing
}
const matchAccess = await simulatorClient.matches.create({ hostDeck: premierHostDeck })
console.log(matchAccess)Example
ts
import { createSimulatorClient, type MatchAccess } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const premierHostDeck = {
leader: 46102,
base: 308,
cards: Array.from({ length: 50 }, () => 45),
}
const hostAccess: MatchAccess = await simulatorClient.matches.create({
hostDeck: premierHostDeck,
})
console.log(hostAccess.matchId)