• Wrapper function to handle rate limiting for any API call

    Type Parameters

    • T

    Parameters

    • config: RateLimitConfig

      Rate limiting configuration

    • credentialKey: string

      The credential key for the API

    • fn: (() => Promise<T>)

      The async function making the API call

        • (): Promise<T>
        • Returns Promise<T>

    Returns Promise<T>

    The result of the API call

    Throws

    Error if rate limit is exceeded or max wait time is reached