wolt 0.1.0

A reqwest/tokio based api wrapper for Wolt
Documentation
use super::*;
use serde::Deserialize;

#[derive(Deserialize, Debug)]
#[serde(tag = "type")]
pub enum OpeningEvent {
    #[serde(rename = "open")]
    Open { value: Date },
    #[serde(rename = "close")]
    Close { value: Date },
}

#[derive(Deserialize, Debug)]
pub struct OpeningTimes {
    pub monday: Option<Vec<OpeningEvent>>,
    pub tuesday: Option<Vec<OpeningEvent>>,
    pub wednesday: Option<Vec<OpeningEvent>>,
    pub thursday: Option<Vec<OpeningEvent>>,
    pub friday: Option<Vec<OpeningEvent>>,
    pub saturday: Option<Vec<OpeningEvent>>,
    pub sunday: Option<Vec<OpeningEvent>>,
}

#[derive(Deserialize, Debug)]
pub struct CompletionEstimates {
    pub delivery: String,
    pub delivery_rush: String,
    pub normal: String,
    pub order_estimates_in_use: bool,
    pub rush: String,
}

#[derive(Deserialize, Debug)]
pub struct Rush {
    pub queue_minutes: bool,
    pub status: bool,
}

#[derive(Deserialize, Debug)]
pub struct Tag {}

#[derive(Deserialize, Debug)]
pub struct EggTimers {
    pub delivery: i32,
    pub eatin: i32,
    pub takeaway: i32,
}

#[derive(Deserialize, Debug)]
#[serde(tag = "type")]
pub enum GeoRange {
    Polygon { coordinates: Vec<Vec<(f64, f64)>> },
}

#[derive(Deserialize, Debug)]
pub struct PricingRange {
    pub a: i32,
    pub b: f64,
    pub max: i32,
    pub min: i32,
}

#[derive(Deserialize, Debug)]
pub struct DeliveryPricing {
    pub base_price: i32,
    pub distance_ranges: Vec<PricingRange>,
    pub price_multiplier: f64,
    pub price_ranges: Vec<PricingRange>,
    pub tax: f64,

    #[serde(flatten)]
    pub _extra_fields: std::collections::HashMap<String, serde_json::Value>,
}

#[derive(Deserialize, Debug)]
pub struct DeliverySpecsPrice {
    tax: f64,
}

#[derive(Deserialize, Debug)]
pub struct ServiceTime {
    bike: i32,
    car: i32,
}

#[derive(Deserialize, Debug)]
pub struct DeliverySpecs {
    pub capability_values: Option<Vec<String>>,
    pub courier_restrictions: i32,
    pub custom_geo_range: Option<GeoRange>,
    pub delivery_enabled: bool,
    pub delivery_pricing: DeliveryPricing,
    pub delivery_times: OpeningTimes,
    pub forbidden_capabilities: Vec<String>,
    pub geo_range: GeoRange,
    pub postcode_range: Vec<String>,
    pub price: DeliverySpecsPrice,
    pub require_street_address: bool,
    pub required_capabilities: Vec<String>,
    pub road_range: Option<i32>,
    pub road_range_mode: String,
    pub service_time: ServiceTime,
    pub use_default_autogenerated_geo_range: bool,
    pub use_default_delivery_pricing: bool,

    #[serde(flatten)]
    pub _extra_fields: std::collections::HashMap<String, serde_json::Value>,
}

#[derive(Deserialize, Debug)]
pub struct Rating {
    pub negative_percentage: i32,
    pub neutral_percentage: i32,
    pub positive_percentage: i32,
    pub rating: i32,
    pub score: f64,
    pub text: String,
    pub volume: i32,
}

#[derive(Deserialize, Debug)]
pub struct Venue {
    pub phone: String,
    pub id: ObjectReference,
    pub delivery_methods: Vec<String>,
    pub high_volume_venue: bool,
    pub bank_account_type: String,
    pub preorder_only: bool,
    pub comment_disabled: bool,
    pub group_order_enabled: bool,
    pub short_description: Vec<LocalizedString>,
    pub country: String,
    pub r#type: String,
    pub food_tags: Vec<String>,
    pub always_available: bool,
    pub itemid: ObjectReference,
    pub opening_times: OpeningTimes,
    pub description: Vec<LocalizedString>,
    pub wolt_delivery: bool,
    pub allowed_payment_methods: Vec<String>,
    pub relevancy: f64,
    pub show_delivery_info_on_merchant: bool,
    pub preorder_times: OpeningTimes,
    pub ratings_and_reviews_enabled: bool,
    pub show_delivery_price_on_merchant: bool,
    pub alive: i32,
    pub franchise: Option<String>,
    pub public_visible: bool,
    pub merchant: ObjectReference,
    pub post_code: String,
    pub show_allergy_disclaimer_on_menu: bool,
    pub slug: String,
    pub mainimage: String,
    pub status: String,
    pub city: String,
    pub completion_estimates: CompletionEstimates,
    pub customer_support_phone: String,
    pub preorder_enabled: bool,
    pub rush: Rush,
    pub dropoff_note_prefix: String,
    pub show_phone_number_on_merchant: bool,
    pub timezone_name: String,
    pub online: bool,
    pub timezone: String,
    pub website: String,
    pub menu_layout: String,
    pub name: Vec<LocalizedString>,
    pub mainimage_blurhash: String,
    pub tags: Vec<Tag>,
    pub estimates: Estimates,
    pub currency: String,
    pub delivery_specs: DeliverySpecs,
    pub egg_timers: Option<EggTimers>,
    pub price_range: i32,
    pub rating: Rating,
    pub favourite: bool,
    pub listimage_blurhash: String,
    pub address: String,
    pub relevancy_from_purchases: f64,
    pub presence: String,
    pub product_line: String,
    pub listimage: String,
    pub public_url: String,
    pub active_menu: ObjectReference,
    pub location: Location,
    pub b2b_recommended: Option<bool>,
    pub bank_routing_code: Option<String>,

    #[serde(flatten)]
    pub _extra_fields: std::collections::HashMap<String, serde_json::Value>,
}

#[derive(Deserialize, Debug)]
pub struct VenueResults {
    pub results: Vec<Venue>,
    pub status: String,

    #[serde(flatten)]
    pub _extra_fields: std::collections::HashMap<String, serde_json::Value>,
}