Class for fetching EnkaData from enka.network

Hierarchy

Constructors

  • Create a EnkaManager

    Returns EnkaManager

Properties

cache: Map<number, EnkaData> = ...

Cache of EnkaData

Key

UID

Value

Cached EnkaData

defaultFetchOption: RequestInit = ...

Default fetch option

enkaBaseURL: "https://enka.network" = 'https://enka.network'

URL of enka.network

enkaStatusBaseURL: "http://status.enka.network" = 'http://status.enka.network'

URL of status.enka.network

Methods

  • Alias for emitter.on(eventName, listener).

    Type Parameters

    • K

    Parameters

    • eventName: "GET_NEW_ENKA_DATA" | GET_NEW_ENKA_DATA | K

      The name of the event.

    • listener: K extends "GET_NEW_ENKA_DATA"
          ? EnkaManagerEventMap[K<K>] extends unknown[]
              ? ((...args) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    See

    EventEmitter.addListener()

  • Clear cache over nextShowCaseDate

    Returns void

  • Synchronously calls each of the listeners registered for the event namedeventName, in the order they were registered, passing the supplied arguments to each. Returns true if the event had listeners, false otherwise.

    Type Parameters

    • K

    Parameters

    • eventName: "GET_NEW_ENKA_DATA" | GET_NEW_ENKA_DATA | K

      The name of the event.

    • Rest ...args: K extends "GET_NEW_ENKA_DATA"
          ? EnkaManagerEventMap[K<K>]
          : never

      Arguments to pass to the listeners.

    Returns boolean

    See

    EventEmitter.emit()

  • Fetch All from enka.network

    Parameters

    • uid: number

      UID

    • Optional fetchOption: RequestInit

      Fetch option

    Returns Promise<EnkaData>

    EnkaData

    Description

    The data fetched by this method is stored as a temporary cache. The storage period depends on ttl.

  • Fetch Status from 1 hour ago to now

    Parameters

    • Optional fetchOption: RequestInit

      Fetch option

    Returns Promise<{
        [dateText: string]: APIEnkaStatus;
    }>

    Status from 1 hour ago to now

  • Fetch EnkaAccount from enka.network

    Parameters

    • username: string

      Enka Account Username

    • Optional fetchOption: RequestInit

      Fetch option

    Returns Promise<EnkaAccount>

    EnkaAccount

    Description

    Data fetched by this method is not stored as a temporary cache.

  • Fetch GenshinAccounts from enka.network

    Parameters

    • username: string

      Enka Account Username

    • Optional fetchOption: RequestInit

      Fetch option

    Returns Promise<GenshinAccount[]>

    GenshinAccounts

    Description

    Data fetched by this method is not stored as a temporary cache.

  • Fetch now Status

    Parameters

    • Optional fetchOption: RequestInit

      Fetch option

    Returns Promise<APIEnkaStatus>

    Now status

  • Fetch PlayerDetail from enka.network

    Parameters

    • uid: number

      UID

    • Optional fetchOption: RequestInit

      Fetch option

    Returns Promise<PlayerDetail>

    PlayerDetail

    Description

    The data fetched by this method is stored as a temporary cache. The storage period depends on ttl.

  • Fetch UIDEndPoint from URL

    Parameters

    • uid: number

      UID

    • url: string

      URL

    • Optional fetchOption: RequestInit

      Fetch option

    Returns Promise<EnkaData>

    EnkaData

  • Alias for emitter.removeListener().

    Type Parameters

    • K

    Parameters

    • eventName: "GET_NEW_ENKA_DATA" | GET_NEW_ENKA_DATA | K

      The name of the event.

    • listener: K extends "GET_NEW_ENKA_DATA"
          ? EnkaManagerEventMap[K<K>] extends unknown[]
              ? ((...args) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    See

    EventEmitter.off()

  • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

    Type Parameters

    • K

    Parameters

    • eventName: "GET_NEW_ENKA_DATA" | GET_NEW_ENKA_DATA | K

      The name of the event.

    • listener: K extends "GET_NEW_ENKA_DATA"
          ? EnkaManagerEventMap[K<K>] extends unknown[]
              ? ((...args) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    See

    EventEmitter.on()

  • Adds a one-timelistener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

    Type Parameters

    • K

    Parameters

    • eventName: "GET_NEW_ENKA_DATA" | GET_NEW_ENKA_DATA | K

      The name of the event.

    • listener: K extends "GET_NEW_ENKA_DATA"
          ? EnkaManagerEventMap[K<K>] extends unknown[]
              ? ((...args) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    See

    EventEmitter.once()

  • Removes all listeners, or those of the specified eventName.

    Type Parameters

    • K

    Parameters

    Returns this

    See

    EventEmitter.removeAllListeners()

  • Removes the specified listener from the listener array for the event namedeventName.

    Type Parameters

    • K

    Parameters

    • eventName: "GET_NEW_ENKA_DATA" | GET_NEW_ENKA_DATA | K

      The name of the event.

    • listener: K extends "GET_NEW_ENKA_DATA"
          ? EnkaManagerEventMap[K<K>] extends unknown[]
              ? ((...args) => Awaitable<void>)
              : never
          : never

      The callback function. (supports async)

    Returns this

    See

    EventEmitter.removeListener()