data_for_seo/entity/merchant/mod.rs
1//! Entity models for the merchant API domain.
2//!
3//! See <https://docs.dataforseo.com/v3/merchant/>.
4
5mod amazon;
6mod google;
7
8pub use amazon::*;
9pub use google::*;
10use serde::{Deserialize, Serialize};
11
12/// A location supported by the Merchant API (`locations` endpoints).
13/// See <https://docs.dataforseo.com/v3/merchant/amazon/locations/>.
14#[derive(Debug, Default, Serialize, Deserialize, Clone)]
15pub struct MerchantApiLocation {
16 /// Unique location identifier used in `location_code` request fields.
17 pub location_code: Option<i32>,
18 /// Full location name (e.g. `"London,England,United Kingdom"`).
19 pub location_name: Option<String>,
20 /// `location_code` of the parent location in the hierarchy, if any.
21 pub location_code_parent: Option<i32>,
22 /// ISO 3166-1 country code the location belongs to.
23 pub country_iso_code: Option<String>,
24 /// Type of the location (e.g. `Country`, `Region`, `City`).
25 pub location_type: Option<String>,
26}
27
28/// A completed task returned by the `tasks_ready` endpoints.
29/// See <https://docs.dataforseo.com/v3/merchant/amazon/products/tasks_ready/>.
30#[derive(Debug, Default, Serialize, Deserialize, Clone)]
31pub struct MerchantApiTaskReady {
32 /// Identifier of the completed task, used to fetch its result.
33 pub id: Option<String>,
34 /// Search engine the task was run against (e.g. `amazon`, `google`).
35 pub se: Option<String>,
36 /// Type of the task (e.g. `products`, `asin`, `sellers`).
37 pub se_type: Option<String>,
38 /// UTC timestamp when the task was posted.
39 pub date_posted: Option<String>,
40 /// User-defined identifier supplied with the original task.
41 pub tag: Option<String>,
42 /// Ready-made path to fetch the advanced (parsed) result.
43 pub endpoint_advanced: Option<String>,
44 /// Ready-made path to fetch the raw HTML result.
45 pub endpoint_html: Option<String>,
46}
47
48/// Spelling autocorrection applied to a search query.
49#[derive(Debug, Default, Serialize, Deserialize, Clone)]
50pub struct MerchantApiSpell {
51 /// Autocorrected keyword the results were actually returned for.
52 pub keyword: Option<String>,
53 /// Kind of correction applied (e.g. `did_you_mean`, `including_results_for`).
54 #[serde(rename = "type")]
55 pub correction_type: Option<String>,
56}
57
58/// Price information attached to products and offers.
59#[derive(Debug, Default, Serialize, Deserialize, Clone)]
60pub struct MerchantApiPrice {
61 /// Current price, in the units of `currency`.
62 pub current: Option<f64>,
63 /// Regular (pre-discount) price, in the units of `currency`.
64 pub regular: Option<f64>,
65 /// Upper bound of the price when a range is displayed.
66 pub max_value: Option<f64>,
67 /// ISO 4217 currency code of the price values.
68 pub currency: Option<String>,
69 /// `true` when the price is shown as a range rather than a single value.
70 pub is_price_range: Option<bool>,
71 /// Price exactly as rendered on the page (e.g. `"$799.00"`).
72 pub displayed_price: Option<String>,
73}
74
75/// Rating information attached to products, sellers and reviews.
76#[derive(Debug, Default, Serialize, Deserialize, Clone)]
77pub struct MerchantApiRating {
78 /// Rating scale type (e.g. `Max5`).
79 pub rating_type: Option<String>,
80 /// Rating value on the `rating_type` scale.
81 pub value: Option<f64>,
82 /// Number of votes the rating is based on.
83 pub votes_count: Option<i64>,
84 /// Maximum possible rating value (e.g. `5`).
85 pub rating_max: Option<i64>,
86}
87
88/// Delivery / shipping details attached to products and offers.
89#[derive(Debug, Default, Serialize, Deserialize, Clone)]
90pub struct MerchantApiDeliveryInfo {
91 /// Delivery message rendered on the page (e.g. `"FREE delivery"`).
92 pub delivery_message: Option<String>,
93 /// Shipping cost charged for the delivery.
94 pub delivery_price: Option<MerchantApiPrice>,
95 /// Earliest estimated delivery date for standard shipping.
96 pub delivery_date_from: Option<String>,
97 /// Latest estimated delivery date for standard shipping.
98 pub delivery_date_to: Option<String>,
99 /// Earliest estimated delivery date for the fastest shipping option.
100 pub fastest_delivery_date_from: Option<String>,
101 /// Latest estimated delivery date for the fastest shipping option.
102 pub fastest_delivery_date_to: Option<String>,
103}