Class LeetCodeCN

Hierarchy

  • EventEmitter
    • LeetCodeCN

Constructors

  • If a credential is provided, the LeetCodeCN API will be authenticated. Otherwise, it will be anonymous.

    Parameters

    • credential: null | Credential = null
    • cache: Cache = default_cache

    Returns LeetCodeCN

Properties

cache: Cache

The internal cache.

credential: Credential

The credential this LeetCodeCN instance is using.

initialized: Promise<boolean>

Used to ensure the LeetCodeCN instance is initialized.

limiter: RateLimiter = ...

Rate limiter

prefixed: string | boolean

Methods

  • Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

  • Parameters

    • event: "receive-graphql"
    • res: Response

    Returns boolean

  • Parameters

    • event: "update-csrf"
    • credential: Credential

    Returns boolean

  • Parameters

    • event: string
    • Rest ...args: unknown[]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Parameters

    • event: "receive-graphql"
    • listener: ((res) => void)
        • (res): void
        • Parameters

          • res: Response

          Returns void

    Returns this

  • Parameters

    • event: "update-csrf"
    • listener: ((credential) => void)
        • (credential): void
        • Parameters

          • credential: Credential

          Returns void

    Returns this

  • Parameters

    • event: string
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Parameters

    • event: "receive-graphql"
    • listener: ((res) => void)
        • (res): void
        • Parameters

          • res: Response

          Returns void

    Returns this

  • Parameters

    • event: "update-csrf"
    • listener: ((credential) => void)
        • (credential): void
        • Parameters

          • credential: Credential

          Returns void

    Returns this

  • Parameters

    • event: string
    • listener: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: unknown[]

          Returns void

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Get public profile of a user.

    Parameters

    • username: string

    Returns Promise<UserResult>

    const leetcode = new LeetCodeCN();
    const profile = await leetcode.user("jacoblincool");

Generated using TypeDoc