google_search_console_api/url_inspection/
mod.rs

1use serde_derive::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize, Clone)]
4pub struct RequestUrlInspection {
5    #[serde(rename = "inspectionUrl")]
6    pub inspection_url: String,
7    #[serde(rename = "siteUrl")]
8    pub site_url: String,
9    #[serde(rename = "languageCode")]
10    pub language_code: String,
11}
12
13#[derive(Debug, Serialize, Deserialize, Clone)]
14pub struct ResponseInspectionResult {
15    #[serde(rename = "inspectionResult")]
16    pub inspection_result: InspectionResult,
17}
18
19#[derive(Debug, Serialize, Deserialize, Clone)]
20pub struct InspectionResult {
21    #[serde(rename = "inspectionResultLink")]
22    pub inspection_result_link: Option<String>,
23    #[serde(rename = "indexStatusResult")]
24    pub index_status_result: Option<IndexStatusResult>,
25    #[serde(rename = "ampResult")]
26    pub amp_result: Option<AmpInspectionResult>,
27    #[serde(rename = "mobileUsabilityResult")]
28    pub mobile_usability_result: Option<MobileUsabilityInspectionResult>,
29    #[serde(rename = "richResultsResult")]
30    pub rich_results_result: Option<RichResultsInspectionResult>,
31}
32
33#[derive(Debug, Serialize, Deserialize, Clone)]
34pub struct IndexStatusResult {
35    pub sitemap: Option<Vec<String>>,
36    #[serde(rename = "referringUrls")]
37    pub referring_urls: Option<Vec<String>>,
38    pub verdict: Option<Verdict>,
39    #[serde(rename = "coverageState")]
40    pub coverage_state: Option<String>,
41    #[serde(rename = "robotsTxtState")]
42    pub robots_txt_state: Option<RobotsTxtState>,
43    #[serde(rename = "indexingState")]
44    pub indexing_state: Option<IndexingState>,
45    #[serde(rename = "lastCrawlTime")]
46    pub last_crawl_time: Option<String>,
47    #[serde(rename = "pageFetchState")]
48    pub page_fetch_state: Option<PageFetchState>,
49    #[serde(rename = "googleCanonical")]
50    pub google_canonical: Option<String>,
51    #[serde(rename = "userCanonical")]
52    pub user_canonical: Option<String>,
53    #[serde(rename = "crawledAs")]
54    pub crawled_as: Option<CrawlUserAgent>,
55}
56
57#[derive(Debug, Serialize, Deserialize, Clone)]
58pub enum Verdict {
59    #[serde(rename = "VERDICT_UNSPECIFIED")]
60    VerdictUnspecified,
61    PASS,
62    PARTIAL,
63    FAIL,
64    NEUTRAL,
65}
66
67#[derive(Debug, Serialize, Deserialize, Clone)]
68pub enum RobotsTxtState {
69    #[serde(rename = "ROBOTS_TXT_STATE_UNSPECIFIED")]
70    RobotsTxtStateUnspecified,
71    ALLOWED,
72    DISALLOWED,
73}
74
75#[derive(Debug, Serialize, Deserialize, Clone)]
76pub enum IndexingState {
77    #[serde(rename = "INDEXING_STATE_UNSPECIFIED")]
78    IndexingStateUnspecified,
79    #[serde(rename = "INDEXING_ALLOWED")]
80    IndexingAllowed,
81    #[serde(rename = "BLOCKED_BY_META_TAG")]
82    BlockedByMetaTag,
83    #[serde(rename = "BLOCKED_BY_HTTP_HEADER")]
84    BlockedByHttpHeader,
85    #[serde(rename = "BLOCKED_BY_ROBOTS_TXT")]
86    BlockedByRobotsTxt,
87}
88
89#[derive(Debug, Serialize, Deserialize, Clone)]
90pub enum PageFetchState {
91    #[serde(rename = "PAGE_FETCH_STATE_UNSPECIFIED")]
92    PageFetchStateUnspecified,
93    SUCCESSFUL,
94    #[serde(rename = "SOFT_404")]
95    Soft404,
96    #[serde(rename = "BLOCKED_ROBOTS_TXT")]
97    BlockedRobotsTxt,
98    #[serde(rename = "NOT_FOUND")]
99    NotFound,
100    #[serde(rename = "ACCESS_DENIED")]
101    AccessDenied,
102    #[serde(rename = "SERVER_ERROR")]
103    ServerError,
104    #[serde(rename = "REDIRECT_ERROR")]
105    RedirectError,
106    #[serde(rename = "ACCESS_FORBIDDEN")]
107    AccessForbidden,
108    #[serde(rename = "BLOCKED_4XX")]
109    Blocked4xx,
110    #[serde(rename = "INTERNAL_CRAWL_ERROR")]
111    InternalCrawlError,
112    #[serde(rename = "INVALID_URL")]
113    InvalidUrl,
114}
115
116#[derive(Debug, Serialize, Deserialize, Clone)]
117pub enum CrawlUserAgent {
118    #[serde(rename = "CRAWLING_USER_AGENT_UNSPECIFIED")]
119    CrawlingUserAgentUnspecified,
120    DESKTOP,
121    MOBILE,
122}
123
124#[derive(Debug, Serialize, Deserialize, Clone)]
125pub struct AmpInspectionResult {
126    issues: Option<Vec<AmpIssue>>,
127    verdict: Option<Verdict>,
128    #[serde(rename = "ampUrl")]
129    amp_url: Option<String>,
130    #[serde(rename = "robotsTxtState")]
131    robots_txt_state: Option<RobotsTxtState>,
132    #[serde(rename = "indexingState")]
133    indexing_state: Option<AmpIndexingState>,
134    #[serde(rename = "ampIndexStatusVerdict")]
135    amp_index_status_verdict: Option<Verdict>,
136    #[serde(rename = "lastCrawlTime")]
137    last_crawl_time: Option<String>,
138    #[serde(rename = "pageFetchState")]
139    page_fetch_state: Option<PageFetchState>,
140}
141
142#[derive(Debug, Serialize, Deserialize, Clone)]
143pub enum AmpIndexingState {
144    #[serde(rename = "AMP_INDEXING_STATE_UNSPECIFIED")]
145    AmpIndexingStateUnspecified,
146    #[serde(rename = "AMP_INDEXING_ALLOWED")]
147    AmpIndexingAllowed,
148    #[serde(rename = "BLOCKED_DUE_TO_NOINDEX")]
149    BlockedDueToNoindex,
150    #[serde(rename = "BLOCKED_DUE_TO_EXPIRED_UNAVAILABLE_AFTER")]
151    BlockedDueToExpiredUnavailableAfter,
152}
153
154#[derive(Debug, Serialize, Deserialize, Clone)]
155pub struct AmpIssue {
156    #[serde(rename = "issueMessage")]
157    pub issue_message: Option<String>,
158    pub severity: Option<Severity>,
159}
160
161#[derive(Debug, Serialize, Deserialize, Clone)]
162pub enum Severity {
163    #[serde(rename = "SEVERITY_UNSPECIFIED")]
164    SeverityUnspecified,
165    WARNING,
166    ERROR,
167}
168
169#[derive(Debug, Serialize, Deserialize, Clone)]
170pub struct MobileUsabilityInspectionResult {
171    pub issues: Option<Vec<MobileUsabilityIssue>>,
172    pub verdict: Option<Verdict>,
173}
174
175#[derive(Debug, Serialize, Deserialize, Clone)]
176pub struct MobileUsabilityIssue {
177    #[serde(rename = "issueType")]
178    pub issue_type: Option<MobileUsabilityIssueType>,
179    pub severity: Option<Severity>,
180    pub message: Option<String>,
181}
182
183#[derive(Debug, Serialize, Deserialize, Clone)]
184pub enum MobileUsabilityIssueType {
185    #[serde(rename = "MOBILE_USABILITY_ISSUE_TYPE_UNSPECIFIED")]
186    MobileUsabilityIssueTypeUnspecified,
187    #[serde(rename = "USES_INCOMPATIBLE_PLUGINS")]
188    UsesIncompatiblePlugins,
189    #[serde(rename = "CONFIGURE_VIEWPORT")]
190    ConfigureViewport,
191    #[serde(rename = "FixedWidthViewport")]
192    FixedWidthViewport,
193    #[serde(rename = "SizeContentToViewport")]
194    SizeContentToViewport,
195    #[serde(rename = "UseLegibleFontSizes")]
196    UseLegibleFontSizes,
197    #[serde(rename = "TapTargetsTooClose")]
198    TapTargetsTooClose,
199}
200
201#[derive(Debug, Serialize, Deserialize, Clone)]
202pub struct RichResultsInspectionResult {
203    #[serde(rename = "detectedItems")]
204    pub detected_items: Option<Vec<DetectedItems>>,
205    pub verdict: Option<Verdict>,
206}
207
208#[derive(Debug, Serialize, Deserialize, Clone)]
209pub struct DetectedItems {
210    pub items: Option<Vec<DetectedItemsItem>>,
211    #[serde(rename = "richResultType")]
212    pub rich_result_type: Option<String>,
213}
214
215#[derive(Debug, Serialize, Deserialize, Clone)]
216pub struct DetectedItemsItem {
217    pub issues: Option<Vec<RichResultsIssue>>,
218    pub name: Option<String>,
219}
220
221#[derive(Debug, Serialize, Deserialize, Clone)]
222pub struct RichResultsIssue {
223    #[serde(rename = "issueMessage")]
224    pub issue_message: Option<String>,
225    pub severity: Option<Severity>,
226}