use std::error::Error;
use crate::{
client::Requests,
model::{
platform::Platform, price::Price, price_category::PriceCategory, result::StandardResult,
},
};
pub fn get_prices(
c: &impl Requests,
platform: Platform,
) -> Result<StandardResult<Vec<Price>>, Box<dyn Error>> {
let resp = c.get(&format!("/prices/{}/", platform))?;
let res: StandardResult<Vec<Price>> = serde_json::from_str(&resp)?;
Ok(res)
}
pub fn get_categories(
c: &impl Requests,
) -> Result<StandardResult<Vec<PriceCategory>>, Box<dyn Error>> {
let resp = c.get("/price-categories/")?;
let res: StandardResult<Vec<PriceCategory>> = serde_json::from_str(&resp)?;
Ok(res)
}