| POST | /v1/OnlineShowroomCsv/Stock | Search for Online Showroom Stock | Calls Vehicle Data API online showroom stock endpoint and searches for vehicles given a list of retailers. The results are used to populate the Online Showroom Stock full detail CSV export in OneAdmin |
|---|
#![allow(
dead_code,
non_camel_case_types,
non_snake_case,
clippy::upper_case_acronyms
)]
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct CsvVehicle {
#[serde(rename = "vehicle_Type")]
pub vehicle_type: String,
pub vid: String,
pub vin: String,
pub fin: String,
#[serde(rename = "comm")]
pub commission_number: String,
#[serde(rename = "chassis_Number")]
pub chassis_number: String,
#[serde(rename = "model_Year")]
pub model_year: String,
#[serde(rename = "model_Year_Code")]
pub model_year_code: String,
#[serde(rename = "half_Model_Year_Code")]
pub half_model_year_code: String,
#[serde(rename = "full_Model_Year_Code")]
pub full_model_year_code: String,
#[serde(rename = "description")]
pub sales_description_long: String,
#[serde(rename = "vehicle_Class")]
pub vehicle_class: String,
#[serde(rename = "body_Style")]
pub body_style: String,
pub model: String,
pub colour: String,
#[serde(rename = "colour_Group")]
pub colour_group: String,
#[serde(rename = "fuel_Type")]
pub fuel_type: String,
pub transmission: String,
pub packages: String,
pub lines: String,
#[serde(rename = "product_Range")]
pub product_range: String,
pub engine: String,
#[serde(rename = "isAMG")]
pub is_a_m_g: bool,
pub upholstery: String,
pub nst: String,
pub baumuster: String,
#[serde(rename = "bm7NST")]
pub bm7_n_s_t: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub acceleration: Option<f64>,
#[serde(rename = "boot_Capacity")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub boot_capacity: Option<i32>,
#[serde(rename = "top_Speed")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub top_speed: Option<f64>,
#[serde(rename = "drive_Concept")]
pub drive_concept: String,
#[serde(rename = "combustion_Power_HP")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub combustion_power_hp: Option<f64>,
#[serde(rename = "electric_Power_KW")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub electric_power_kw: Option<f64>,
#[serde(rename = "electric_Power_HP")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub electric_power_hp: Option<f64>,
#[serde(rename = "combined_Power_KW")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub combined_power_kw: Option<f64>,
#[serde(rename = "combined_Power_HP")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub combined_power_h_p: Option<f64>,
#[serde(rename = "electric_Range")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub electric_range: Option<f64>,
#[serde(rename = "electric_Consumption")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub electric_consumption: Option<f64>,
#[serde(rename = "emission_Combined")]
pub emission_combined: String,
#[serde(rename = "emission_Directive")]
pub emission_directive: String,
#[serde(rename = "emission_Extra_Urban")]
pub emission_extra_urban: String,
#[serde(rename = "emission_Urban")]
pub emission_urban: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emission: Option<f64>,
#[serde(rename = "test_Standard")]
pub test_standard: String,
#[serde(rename = "energy_Efficiency_Class")]
pub energy_efficiency_class: String,
#[serde(rename = "wltP_Combined")]
pub wltp_combined: String,
#[serde(rename = "wltP_Low")]
pub wltp_low: String,
#[serde(rename = "wltP_Medium")]
pub wltp_medium: String,
#[serde(rename = "wltP_High")]
pub wltp_high: String,
#[serde(rename = "wltP_Extra_High")]
pub wltp_extra_high: String,
#[serde(rename = "wltP_CO2_Emissions")]
pub wltp_emission_combined: String,
#[serde(rename = "port_Arrival_Date")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub port_arrival_date: Option<String>,
#[serde(rename = "creation_Date")]
pub creation_date: String,
#[serde(rename = "maintenance_Date")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_updated: Option<String>,
#[serde(rename = "net_Price")]
pub retail_price__ex_v_a_t: f64,
#[serde(rename = "retail_Price")]
pub retail_price__inc_v_a_t: f64,
#[serde(rename = "otR_Price")]
pub otr: f64,
#[serde(rename = "actual_Price")]
pub actual_price: f64,
#[serde(rename = "usage_Code")]
pub usage_code: String,
pub secured: String,
pub account: String,
#[serde(rename = "isDisplayStock")]
pub is_display_stock: String,
#[serde(rename = "display_Agent")]
pub display_stock_agent: String,
#[serde(rename = "isSpecialistCar")]
pub is_specialist_car: String,
#[serde(rename = "cesarIdShipToParty")]
pub cesar_id_ship_to_party: String,
#[serde(rename = "isSellable")]
pub is_sellable: String,
#[serde(rename = "under_Offer")]
pub under_offer: String,
#[serde(rename = "secured_Date")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub secured_date: Option<String>,
#[serde(rename = "secured_Reason")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub secured_reason: Option<String>,
#[serde(rename = "secured_By_Gas_Id")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub secured_by_gas_id: Option<String>,
#[serde(rename = "confirmed_Production_Date")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub confirmed_production_date: Option<String>,
#[serde(rename = "forecasted_Arrival_Date")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forecasted_arrival_date: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct InternalAvailableStockResponse {
#[serde(rename = "totalVehicles")]
pub total_vehicles: i32,
pub vehicles: Vec<CsvVehicle>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct OnlineShowroomStockCsvRequest {
pub gssns: Vec<String>,
}
Rust OnlineShowroomStockCsvRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/OnlineShowroomCsv/Stock HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"gssns":["String"]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"totalVehicles":0}