Module vinted_rs::queries

source ·
Expand description

The queries module provides functionality for querying the Vinted API.

This module contains the VintedWrapper struct, which represents the main wrapper for interacting with the Vinted API. It provides methods for retrieving items based on filters and handling cookies.

§Examples

use crate::vinted_rs::model::items::Items;
use crate::vinted_rs::model::filter::Filter;
use crate::vinted_rs::queries::VintedWrapper;
use crate::vinted_rs::queries::VintedWrapperError;
use fang::FangError;

async fn get_items_example() {
    let wrapper = VintedWrapper::new();
    let filter: Filter = Filter::builder().search_text(String::from("shoes")).build();
    let num = 10;

    match wrapper.get_items(&filter, num).await {
        Ok(items) => {
            println!("Retrieved {} items: {:?}", items.items.len(), items);
            assert_eq!(items.items.len(), 10);
        }
        Err(err) => match err {
            VintedWrapperError::ItemNumberError => unreachable!(),
            VintedWrapperError::CookiesError(_) => (),
        },
    }
}

Structs§

Enums§

Functions§