@my-swu/simulator-client / LimitedEventsResource
Interface: LimitedEventsResource
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:209
Limited Event resource API methods.
Use this resource for Draft and Sealed pods before creating a match from the completed pool.
Example:
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',
})
// Draft creation returns event access for the first seat.
const draftEventAccess = await simulatorClient.limitedEvents.create({
kind: 'draft',
draftRounds: [], // Chaos draft only; a plain draft repeats `setCode`.
pickTimerEnabled: false,
setCode: 'SOR',
playerCount: 4,
})
// Passing access includes viewer-private state in the snapshot.
const limitedEventSnapshot = await simulatorClient.limitedEvents.get(draftEventAccess)
console.log(limitedEventSnapshot.phase)Example
import { createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const draftEventAccess = await simulatorClient.limitedEvents.create({
kind: 'draft',
draftRounds: [],
pickTimerEnabled: false,
setCode: 'SOR',
playerCount: 4,
})
console.log(draftEventAccess.snapshot.phase.kind)See
https://simulator-sdk.my-swu.com/guide/limited-events
Methods
applyCommand()
Example:
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',
})
// Commands mutate the current viewer's draft or sealed event state.
const draftSeatAccess = { eventId: 'event_123', seatToken: 'limited_token_123' }
const limitedEventSnapshot = await simulatorClient.limitedEvents.applyCommand(
draftSeatAccess,
{ type: 'readyForNextDraft' },
)applyCommand(
access,command,options?):Promise<LimitedEventSnapshot>
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:299
Applies one seat command to a limited event.
Parameters
access
command
LimitedEventCommand
options?
Returns
Promise<LimitedEventSnapshot>
Example
import { createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const draftSeatAccess = {
eventId: 'event_123',
seatToken: 'limited_token_123',
}
const limitedEventSnapshot =
await simulatorClient.limitedEvents.applyCommand(
draftSeatAccess,
{ type: 'readyForNextDraft' },
)
console.log(limitedEventSnapshot.phase.kind)See
https://simulator-sdk.my-swu.com/guide/limited-events#draft-commands
create()
Example:
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',
})
// Creation returns private access for the event's first seat.
const draftEventAccess = await simulatorClient.limitedEvents.create({
kind: 'draft',
draftRounds: [], // Chaos draft only; a plain draft repeats `setCode`.
pickTimerEnabled: false,
setCode: 'SOR',
playerCount: 4,
})create(
request,options?):Promise<LimitedEventAccessResponse>
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:242
Creates one generated Draft or Sealed event.
Parameters
request
options?
Returns
Promise<LimitedEventAccessResponse>
Example
import { createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const draftEventAccess = await simulatorClient.limitedEvents.create({
kind: 'draft',
draftRounds: [],
pickTimerEnabled: false,
setCode: 'SOR',
playerCount: 4,
})
console.log(draftEventAccess.eventId)See
https://simulator-sdk.my-swu.com/guide/limited-events#create
createSession()
Example:
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 limitedEventsResource = simulatorClient.limitedEvents
const { createSession } = limitedEventsResource
console.log(createSession)createSession(
access):LimitedEventSession
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:335
Creates live presence for one direct event seat.
Parameters
access
LimitedEventAccessResponse | LimitedEventAccessInput
Returns
get()
Example:
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',
})
// Seat access includes viewer-private pack and pool state.
const draftSeatAccess = { eventId: 'event_123', seatToken: 'limited_token_123' }
const limitedEventSnapshot = await simulatorClient.limitedEvents.get(draftSeatAccess)get(
event,options?):Promise<LimitedEventSnapshot>
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:269
Fetches one limited event, optionally with viewer-private state.
Parameters
event
string | LimitedEventReference | LimitedEventAccessInput
options?
Returns
Promise<LimitedEventSnapshot>
Example
import { createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const draftSeatAccess = {
eventId: 'event_123',
seatToken: 'limited_token_123',
}
const limitedEventSnapshot =
await simulatorClient.limitedEvents.get(draftSeatAccess)
console.log(limitedEventSnapshot.viewer?.activePack.length)See
https://simulator-sdk.my-swu.com/guide/limited-events#fetch-state
join()
Example:
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',
})
// Joining fills the next open pod seat.
const draftEvent = { eventId: 'event_123' }
const draftSeatAccess = await simulatorClient.limitedEvents.join(draftEvent)join(
event,request?,options?):Promise<LimitedEventAccessResponse>
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:324
Joins one limited event.
Parameters
event
request?
options?
Returns
Promise<LimitedEventAccessResponse>
Example
import { createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({
baseUrl: 'http://127.0.0.1:4000',
})
const draftEventReference = { eventId: 'event_123' }
const draftSeatAccess =
await simulatorClient.limitedEvents.join(draftEventReference)
console.log(draftSeatAccess.seatIndex)See
https://simulator-sdk.my-swu.com/guide/limited-events#join
leave()
Example:
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 limitedEventsResource = simulatorClient.limitedEvents
const { leave } = limitedEventsResource
console.log(leave)leave(
access,options?):Promise<void>
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:330
Permanently leaves one direct event seat.
Parameters
access
options?
Returns
Promise<void>
preflight()
Example:
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 limitedEventsResource = simulatorClient.limitedEvents
const { preflight } = limitedEventsResource
console.log(preflight)preflight(
request,options?):Promise<LimitedEventPreflightResponse>
Defined in: packages/ts-sdk/src/resources/limited-event-types.ts:214
Checks whether every required booster can be generated without creating an event. Use the returned seed when creating the event after a clean check.
Parameters
request
options?
Returns
Promise<LimitedEventPreflightResponse>
