data_for_seo/entity/dataforseo_labs/common.rs
1//! Shared/utility endpoint models for the DataForSEO Labs API.
2
3use serde::{Deserialize, Serialize};
4use serde_json::Value;
5
6/// A previously posted task returned by the `id_list` endpoint.
7/// See <https://docs.dataforseo.com/v3/dataforseo_labs/id_list/>.
8#[derive(Debug, Default, Serialize, Deserialize, Clone)]
9pub struct DataForSeoLabsIdListItem {
10 /// Task identifier (UUID).
11 pub id: Option<String>,
12 /// When the task was created (UTC).
13 pub datetime_posted: Option<String>,
14 /// When the task finished (UTC).
15 pub datetime_done: Option<String>,
16 /// URL of the result (for an id-list entry, the endpoint the task was posted to).
17 pub url: Option<String>,
18 /// Task status.
19 pub status: Option<String>,
20 /// Cost of the task (USD).
21 pub cost: Option<f64>,
22 /// Original POST parameters of the task.
23 pub metadata: Option<Value>,
24}
25
26/// A location supported by the Labs API, with the languages available for it.
27/// See <https://docs.dataforseo.com/v3/dataforseo_labs/locations_and_languages/>.
28#[derive(Debug, Default, Serialize, Deserialize, Clone)]
29pub struct DataForSeoLabsLocation {
30 /// Location code (e.g. `2840`); alternative to `location_name`.
31 pub location_code: Option<i32>,
32 /// Full location name (e.g. `"United States"`); alternative to `location_code`.
33 pub location_name: Option<String>,
34 /// Code of the parent location.
35 pub location_code_parent: Option<i32>,
36 /// ISO country code of the location.
37 pub country_iso_code: Option<String>,
38 /// Type of the location (e.g. `"Country"`, `"City"`).
39 pub location_type: Option<String>,
40 /// Languages available for this location.
41 pub available_languages: Option<Vec<DataForSeoLabsLanguage>>,
42}
43
44/// A language available for a location.
45/// See <https://docs.dataforseo.com/v3/dataforseo_labs/locations_and_languages/>.
46#[derive(Debug, Default, Serialize, Deserialize, Clone)]
47pub struct DataForSeoLabsLanguage {
48 /// Full language name (e.g. `"English"`); alternative to `language_code`.
49 pub language_name: Option<String>,
50 /// Language code (e.g. `"en"`); alternative to `language_name`.
51 pub language_code: Option<String>,
52 /// Number of keywords available in the database for this language.
53 pub keywords: Option<i64>,
54 /// Number of SERPs available in the database for this language.
55 pub serps: Option<i64>,
56}
57
58/// A node of the product-category tree returned by `categories`.
59/// See <https://docs.dataforseo.com/v3/dataforseo_labs/categories/>.
60#[derive(Debug, Default, Serialize, Deserialize, Clone)]
61pub struct DataForSeoLabsCategory {
62 /// Category code.
63 pub category_code: Option<i64>,
64 /// Human-readable category name.
65 pub category_name: Option<String>,
66 /// Code of the parent category.
67 pub category_code_parent: Option<i64>,
68}
69
70/// Rate-limit / availability info returned by the Labs `status` endpoint.
71/// See <https://docs.dataforseo.com/v3/dataforseo_labs/status/>.
72#[derive(Debug, Default, Serialize, Deserialize, Clone)]
73pub struct DataForSeoLabsStatus {
74 /// Date and time of the record (UTC).
75 pub datetime: Option<String>,
76 /// Rate-limit information.
77 pub rates: Option<Value>,
78 /// Available metric types and their limits.
79 pub metric_types: Option<Value>,
80}