pub async fn search(query: &str) -> Result<Vec<Product>, Error>
Expand description

Returns all products which contain a specific name in their title.

Arguments

  • query - String slice to query products.

Example

#[tokio::main]
async fn main() {
    use minehut::products;
     
    // Getting all products with "Skript" in its name
    products::search("Skript").await.unwrap().into_iter().for_each(|p| {
        println!("{}", p.title);
    })
}

Error

Returns an error if Reqwest could not fetch data from the path or if it failed to parse the response JSON. Usually network errors.