coinglecko/categories

Coin category endpoints.

Types

A category with market data.

pub type Category {
  Category(
    id: String,
    name: String,
    market_cap: option.Option(Float),
    market_cap_change_24h: option.Option(Float),
    top_3_coins: List(String),
    volume_24h: option.Option(Float),
  )
}

Constructors

A simple category list item.

pub type CategoryListItem {
  CategoryListItem(category_id: String, name: String)
}

Constructors

  • CategoryListItem(category_id: String, name: String)

Values

pub fn decode_categories(
  json_string: String,
) -> Result(List(Category), error.CoinGeckoError)

Decode categories with market data from a JSON string.

pub fn decode_category_list(
  json_string: String,
) -> Result(List(CategoryListItem), error.CoinGeckoError)

Decode a category list from a JSON string.

pub fn get_all(
  client: client.Client,
  order order: option.Option(String),
  send sender: fn(request.Request(String)) -> Result(
    response.Response(String),
    String,
  ),
) -> Result(List(Category), error.CoinGeckoError)

Get all coin categories with market data.

Example

let assert Ok(cats) = categories.get_all(client, order: None, send: sender)
pub fn get_all_request(
  client: client.Client,
  order order: option.Option(String),
) -> Result(request.Request(String), error.CoinGeckoError)

Build a request to get all coin categories with market data.

pub fn list(
  client: client.Client,
  send sender: fn(request.Request(String)) -> Result(
    response.Response(String),
    String,
  ),
) -> Result(List(CategoryListItem), error.CoinGeckoError)

Get list of all coin categories (id and name only).

Example

let assert Ok(categories) = categories.list(client, send: sender)
pub fn list_request(
  client: client.Client,
) -> Result(request.Request(String), error.CoinGeckoError)

Build a request to get list of all coin categories.

Search Document