genshin-manager
    Preparing search index...

    Class EnkaManager

    Class for fetching EnkaData from enka.network

    Hierarchy

    Index

    Constructors

    • Create a PromiseEventEmitter.

      Returns EnkaManager

    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: EnkaManagerEventMap[K<K>]) => Awaitable
                : never
            : never

        The callback function. (supports async)

      Returns this

      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.

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

        Arguments to pass to the listeners.

      Returns boolean

      EventEmitter.emit()

    • Fetch All from enka.network

      Parameters

      • uid: number

        UID

      • OptionalfetchOption: RequestInit

        Fetch option

      Returns Promise<EnkaData>

      EnkaData

      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

      • OptionalfetchOption: RequestInit

        Fetch option

      Returns Promise<Record<string, APIEnkaStatus>>

      Status from 1 hour ago to now

    • Fetch EnkaAccount from enka.network

      Parameters

      • username: string

        Enka Account Username

      • OptionalfetchOption: RequestInit

        Fetch option

      Returns Promise<EnkaAccount>

      EnkaAccount

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

    • Fetch GenshinAccounts from enka.network

      Parameters

      • username: string

        Enka Account Username

      • OptionalfetchOption: RequestInit

        Fetch option

      Returns Promise<GenshinAccount[]>

      GenshinAccounts

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

    • Fetch now Status

      Parameters

      • OptionalfetchOption: RequestInit

        Fetch option

      Returns Promise<APIEnkaStatus>

      Now status

    • Fetch PlayerDetail from enka.network

      Parameters

      • uid: number

        UID

      • OptionalfetchOption: RequestInit

        Fetch option

      Returns Promise<PlayerDetail>

      PlayerDetail

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

    • 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: EnkaManagerEventMap[K<K>]) => Awaitable
                : never
            : never

        The callback function. (supports async)

      Returns this

      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: EnkaManagerEventMap[K<K>]) => Awaitable
                : never
            : never

        The callback function. (supports async)

      Returns this

      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: EnkaManagerEventMap[K<K>]) => Awaitable
                : never
            : never

        The callback function. (supports async)

      Returns this

      EventEmitter.once()

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

      Type Parameters

      • K

      Parameters

      Returns this

      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: EnkaManagerEventMap[K<K>]) => Awaitable
                : never
            : never

        The callback function. (supports async)

      Returns this

      EventEmitter.removeListener()