data_for_seo/entity/dataforseo_labs/app.rs
1//! App-store item models (Google Play and Apple App Store) for the Labs API.
2
3use crate::entity::DataForSeoLabsKeywordData;
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7/// One keyword an app ranks for.
8/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/keywords_for_app/live/>.
9#[derive(Debug, Default, Serialize, Deserialize, Clone)]
10pub struct DataForSeoLabsAppKeywordItem {
11 /// Search engine type (e.g. `"google"`).
12 pub se_type: Option<String>,
13 /// The ranked SERP position the target holds for this keyword.
14 pub ranked_serp_element: Option<DataForSeoLabsAppRankedSerpElement>,
15 /// Keyword metrics for the returned keyword.
16 pub keyword_data: Option<DataForSeoLabsKeywordData>,
17}
18
19/// A ranked position on the app-store SERP, wrapping the app item.
20/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/keywords_for_app/live/>.
21#[derive(Debug, Default, Serialize, Deserialize, Clone)]
22pub struct DataForSeoLabsAppRankedSerpElement {
23 /// Search engine type (e.g. `"google"`).
24 pub se_type: Option<String>,
25 /// The SERP element occupying this ranked position.
26 pub serp_item: Option<DataForSeoLabsAppSerpItem>,
27 /// URL used to check the SERP.
28 pub check_url: Option<String>,
29 /// Timestamp when this data was last updated (UTC).
30 pub last_updated_time: Option<String>,
31}
32
33/// A single app listing on the app-store SERP.
34/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/keywords_for_app/live/>.
35#[derive(Debug, Default, Serialize, Deserialize, Clone)]
36pub struct DataForSeoLabsAppSerpItem {
37 /// Search engine type (e.g. `"google"`).
38 pub se_type: Option<String>,
39 /// Type of SERP element (serialized as `type`).
40 #[serde(rename = "type")]
41 pub item_type: Option<String>,
42 /// Rank within elements of the same type.
43 pub rank_group: Option<i64>,
44 /// Absolute rank among all SERP elements.
45 pub rank_absolute: Option<i64>,
46 /// Store identifier of the app.
47 pub app_id: Option<String>,
48 /// Title of the result.
49 pub title: Option<String>,
50 /// URL of the result (for an id-list entry, the endpoint the task was posted to).
51 pub url: Option<String>,
52 /// URL of the app icon.
53 pub icon: Option<String>,
54 /// Whether the app is free.
55 pub is_free: Option<bool>,
56 /// Price of the app.
57 pub price: Option<DataForSeoLabsAppPrice>,
58 /// Star rating of the product or app.
59 pub rating: Option<DataForSeoLabsAppRating>,
60}
61
62/// Price of an app listing.
63/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/keywords_for_app/live/>.
64#[derive(Debug, Default, Serialize, Deserialize, Clone)]
65pub struct DataForSeoLabsAppPrice {
66 /// Current price value.
67 pub current: Option<f64>,
68 /// ISO currency code of the prices.
69 pub currency: Option<String>,
70}
71
72/// Star rating of an app listing.
73/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/keywords_for_app/live/>.
74#[derive(Debug, Default, Serialize, Deserialize, Clone)]
75pub struct DataForSeoLabsAppRating {
76 /// Type of the rating.
77 pub rating_type: Option<String>,
78 /// Rating value (e.g. average number of stars).
79 pub value: Option<f64>,
80 /// Number of ratings.
81 pub votes_count: Option<i64>,
82 /// Maximum possible rating value.
83 pub rating_max: Option<i64>,
84}
85
86/// Ranking metrics of an app for one SERP feature type.
87/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/bulk_app_metrics/live/>.
88#[derive(Debug, Default, Serialize, Deserialize, Clone)]
89pub struct DataForSeoLabsAppMetricsInfo {
90 /// Number of SERPs where the target ranks #1.
91 pub pos_1: Option<i64>,
92 /// Number of SERPs where the target ranks #2-3.
93 pub pos_2_3: Option<i64>,
94 /// Number of SERPs where the target ranks #4-10.
95 pub pos_4_10: Option<i64>,
96 /// Number of SERPs where the target ranks #11-100.
97 pub pos_11_100: Option<i64>,
98 /// Number of SERPs containing the target for this feature type.
99 pub count: Option<i64>,
100 /// Average monthly search volume.
101 pub search_volume: Option<i64>,
102}
103
104/// A competing app and its ranking-metric intersection with the target app.
105/// The metric maps are keyed by SERP feature type (e.g. `"google_play_organic"`).
106/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/app_competitors/live/>.
107#[derive(Debug, Default, Serialize, Deserialize, Clone)]
108pub struct DataForSeoLabsAppCompetitorItem {
109 /// Search engine type (e.g. `"google"`).
110 pub se_type: Option<String>,
111 /// Store identifier of the app.
112 pub app_id: Option<String>,
113 /// Average SERP position across intersecting keywords.
114 pub avg_position: Option<f64>,
115 /// Sum of SERP positions across intersecting keywords.
116 pub sum_position: Option<i64>,
117 /// Number of keywords the targets have in common.
118 pub intersections: Option<i64>,
119 /// Metrics limited to keywords shared with the target.
120 pub competitor_metrics: Option<HashMap<String, DataForSeoLabsAppMetricsInfo>>,
121 /// Metrics across all of the app's keywords.
122 pub full_metrics: Option<HashMap<String, DataForSeoLabsAppMetricsInfo>>,
123}
124
125/// A keyword and the SERP element each analyzed app holds for it.
126/// `intersection_result` is keyed by the app-ids-map keys from the request.
127/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/app_intersection/live/>.
128#[derive(Debug, Default, Serialize, Deserialize, Clone)]
129pub struct DataForSeoLabsAppIntersectionItem {
130 /// Search engine type (e.g. `"google"`).
131 pub se_type: Option<String>,
132 /// Keyword metrics for the returned keyword.
133 pub keyword_data: Option<DataForSeoLabsKeywordData>,
134 /// SERP element each analyzed target holds for the keyword, keyed by target.
135 pub intersection_result: Option<HashMap<String, DataForSeoLabsAppSerpItem>>,
136}
137
138/// Aggregated ranking metrics of a single app.
139/// The metric map is keyed by SERP feature type.
140/// See <https://docs.dataforseo.com/v3/dataforseo_labs/google/bulk_app_metrics/live/>.
141#[derive(Debug, Default, Serialize, Deserialize, Clone)]
142pub struct DataForSeoLabsBulkAppMetricsItem {
143 /// Search engine type (e.g. `"google"`).
144 pub se_type: Option<String>,
145 /// Store identifier of the app.
146 pub app_id: Option<String>,
147 /// Ranking and traffic metrics, grouped by SERP feature type.
148 pub metrics: Option<HashMap<String, DataForSeoLabsAppMetricsInfo>>,
149}