A client for Satori server.

Hierarchy

  • Client

Constructors

  • Parameters

    • apiKey: string = DEFAULT_API_KEY
    • host: string = DEFAULT_HOST
    • port: string = DEFAULT_PORT
    • useSSL: boolean = false
    • timeout: number = DEFAULT_TIMEOUT_MS
    • autoRefreshSession: boolean = true

    Returns Client

Properties

apiClient: SatoriApi

The low level API client for Nakama server.

apiKey: string = DEFAULT_API_KEY
autoRefreshSession: boolean = true
expiredTimespanMs: number = DEFAULT_EXPIRED_TIMESPAN_MS

The expired timespan used to check session lifetime.

host: string = DEFAULT_HOST
port: string = DEFAULT_PORT
timeout: number = DEFAULT_TIMEOUT_MS
useSSL: boolean = false

Methods

  • Authenticate a user with an ID against the server.

    Parameters

    • id: string
    • Optional customProperties: Record<string, string>
    • Optional defaultProperties: Record<string, string>

    Returns Promise<Session>

  • Delete the caller's identity and associated data.

    Parameters

    Returns Promise<boolean>

  • Publish an event for this session.

    Parameters

    Returns Promise<boolean>

  • Publish multiple events for this session

    Parameters

    • session: Session
    • events: ApiEvent[]

    Returns Promise<boolean>

  • Get or list all available experiments for this identity.

    Parameters

    • session: Session
    • Optional names: string[]

    Returns Promise<ApiExperimentList>

  • Get a single flag for this identity. Throws an error when the flag does not exist.

    Parameters

    Returns Promise<never>

  • Get a single flag with its configured default value. Throws an error when the flag does not exist.

    Parameters

    • name: string

    Returns Promise<never>

  • Get a single flag with its configured default value.

    Parameters

    • name: string
    • Optional fallbackValue: string

    Returns Promise<{
        name: string;
        value: undefined | string;
    }>

  • Get a single flag for this identity.

    Parameters

    • session: Session
    • name: string
    • Optional fallbackValue: string

    Returns Promise<{
        name: string;
        value: undefined | string;
    }>

  • List all available flags for this identity.

    Parameters

    • session: Session
    • Optional names: string[]

    Returns Promise<ApiFlagList>

  • List all available default flags.

    Parameters

    • Optional names: string[]

    Returns Promise<ApiFlagList>

  • List available live events.

    Parameters

    • session: Session
    • Optional names: string[]

    Returns Promise<ApiLiveEventList>

  • Enrich/replace the current session with new identifier.

    Parameters

    • session: Session
    • id: string
    • Optional defaultProperties: Record<string, string>
    • Optional customProperties: Record<string, string>

    Returns Promise<Session>

  • List properties associated with this identity.

    Parameters

    Returns Promise<ApiProperties>

  • Log out a session, invalidate a refresh token, or log out all sessions/refresh tokens for a user.

    Parameters

    Returns Promise<boolean>

  • Parameters

    • session: Session
    • id: string
    • Optional consume_time: string
    • Optional read_time: string

    Returns Promise<boolean>

  • Update identity properties.

    Parameters

    • session: Session
    • Optional defaultProperties: Record<string, string>
    • Optional customProperties: Record<string, string>
    • Optional recompute: boolean

    Returns Promise<boolean>

Generated using TypeDoc