TopggEx.HttpClient (topgg_ex v0.1.6)

View Source

HTTP client for making requests to the Top.gg API using Finch.

This module handles all HTTP communication with the Top.gg API, including request building, execution, and response parsing.

Summary

Functions

Makes an HTTP request to the Top.gg API.

Types

request_options()

@type request_options() :: TopggEx.HttpClientBehaviour.request_options()

Functions

request(options, method, path, body \\ nil)

@spec request(request_options(), atom(), String.t(), map() | nil) ::
  {:ok, any()} | {:error, any()}

Makes an HTTP request to the Top.gg API.

Parameters

  • options - Request configuration containing token, finch_name, and base_url
  • method - HTTP method (:get, :post, etc.)
  • path - API endpoint path
  • body - Request body (optional)

Examples

iex> options = %{token: "token", finch_name: :topgg_finch, base_url: "https://top.gg/api"}
iex> TopggEx.HttpClient.request(options, :get, "/bots/stats")
{:ok, %{"server_count" => 100}}