Function fortnite_api::get_cosmetic_by_id_v2
source · pub async fn get_cosmetic_by_id_v2(
http_client: &Client,
cosmetic_id: &str,
language: Option<&str>
) -> Result<CosmeticV2>
Expand description
Get the cosmetic by ID.
§Parameters
http_client
: The reqwest client.cosmetic_id
: The ID of the cosmetic.language
: The language of the cosmetic. Can beNone
or a language code.
§Returns
The cosmetic by ID.
§Example
#[tokio::main]
async fn main() {
let http_client = reqwest::Client::new();
let result = fortnite_api::get_cosmetics_new_v2(&http_client, None).await;
assert!(result.is_ok());
let cosmetic_id = result.unwrap().items.first().unwrap().id.clone();
let result = fortnite_api::get_cosmetic_by_id_v2(&http_client, &cosmetic_id, None).await;
println!("Result: {:#?}", result);
assert!(result.is_ok());
}