Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / CardIdResolution

Type Alias: CardIdResolution

CardIdResolution = ResolveCardIdsResponse["resolutions"][number]

Defined in: packages/ts-sdk/src/resources/card-types.ts:133

Set-code/card-number lookup result.

cardId is present only when the lookup produced exactly one match. When it is missing, inspect matches to show a not-found or ambiguous-reference UI.

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 [
cardIdResolution
] = await
simulatorClient
.
cards
.
resolveIds
([
{
setCode
: 'SOR',
cardNumber
: 1,
cardTypes
: [
'leader', ], }, ])
console
.
log
(
cardIdResolution
)

Example

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

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

const [leaderResolution]: CardIdResolution[] =
  await simulatorClient.cards.resolveIds([
    {
      setCode: 'SOR',
      cardNumber: 1,
      cardTypes: [
        'leader',
      ],
    },
  ])
console.log(leaderResolution?.cardId)

See

https://simulator-sdk.my-swu.com/guide/card-ids#resolving-card-ids

Released under the MIT License.