Class ApiRequest

Handles API requests to the Telegram Bot API.

Constructors

  • Parameters

    • authToken: string

      The authentication token for the Telegram Bot API.

    • OptionalrequestOptions: RequestInit

      Options for the fetch request.

    Returns ApiRequest

Properties

authToken: string
media: MediaData
requestOptions?: RequestInit

Methods

  • Makes a GET request to the Telegram Bot API.

    Type Parameters

    • T

    Parameters

    • method: string

      The API method to call.

    • Optionaloptions: Record<string, unknown>

      The options to include in the request.

    Returns Promise<T>

    The result from the API response.

    If the API response indicates an error.

  • Prepares the configuration for the fetch request based on the provided options.

    Parameters

    • options: Record<string, unknown>

      The options to include in the request.

    Returns Promise<RequestInit>

    The configuration for the fetch request.