telega/client

Types

pub opaque type TelegramApiRequest
pub opaque type TelegramClient

Functions

pub fn fetch(
  request api_request: TelegramApiRequest,
  client client: TelegramClient,
) -> Result(Response(String), TelegaError)
pub fn get_api_url(client client: TelegramClient) -> String
pub fn new(token token: String) -> TelegramClient

Create a new Telegram client. It uses httpc as a default HTTP client.

pub fn new_get_request(
  client client: TelegramClient,
  path path: String,
  query query: Option(List(#(String, String))),
) -> TelegramApiRequest
pub fn new_post_request(
  client client: TelegramClient,
  path path: String,
  body body: String,
) -> TelegramApiRequest
pub fn set_fetch_client(
  client client: TelegramClient,
  fetch_client fetch_client: fn(Request(String)) ->
    Result(Response(String), TelegaError),
) -> TelegramClient

Set the HTTP client to use.

pub fn set_max_retry_attempts(
  client client: TelegramClient,
  max_retry_attempts max_retry_attempts: Int,
) -> TelegramClient
pub fn set_tg_api_url(
  client client: TelegramClient,
  tg_api_url tg_api_url: String,
) -> TelegramClient
Search Document