pub async fn of_category(category: Category) -> Result<Vec<Product>, Error>
Expand description

Gets all products of a specific category asynchronously.

Arguments

  • category - Category to filter products with.

Example

use minehut::products;
 
async fn print_plugins() {
    // Printing all available plugins
    products::of_category(products::Category::Plugin).await.unwrap().into_iter().for_each(|p| {
        println!("{} is a plugin", p.title);
    })
}

Error

Returns an error if Reqwest could not fetch the data from path or if it failed to parse JSON. Both of these are usually network errors.