use super::types::{Category, CategoryListItem};
use crate::client::Client;
use crate::error::Result;
pub struct CategoriesApi<'a> {
client: &'a Client,
}
impl<'a> CategoriesApi<'a> {
#[must_use]
pub fn new(client: &'a Client) -> Self {
Self { client }
}
pub async fn list(&self) -> Result<Vec<CategoryListItem>> {
self.client.get("/coins/categories/list").await
}
pub async fn with_market_data(&self) -> Result<Vec<Category>> {
self.client.get("/coins/categories").await
}
pub async fn with_market_data_sorted(&self, order: &str) -> Result<Vec<Category>> {
let path = format!("/coins/categories?order={order}");
self.client.get(&path).await
}
}