Skip to main content

data_for_seo/entity/on_page/
lighthouse.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4/// Google Lighthouse audit results for a page.
5/// See <https://docs.dataforseo.com/v3/on_page/lighthouse/task_get/>.
6#[derive(Debug, Default, Serialize, Deserialize, Clone)]
7pub struct OnPageDataApiLighthouseTaskGet {
8    /// User agent Lighthouse emulated while auditing the page.
9    #[serde(rename = "userAgent")]
10    pub user_agent: Option<String>,
11    /// Details of the environment the audit ran in.
12    pub environment: Option<OnPageDataApiLighthouseEnvironment>,
13    /// Version of Lighthouse used for the audit.
14    #[serde(rename = "lighthouseVersion")]
15    pub lighthouse_version: Option<String>,
16    /// Timestamp when the page was fetched for auditing.
17    #[serde(rename = "fetchTime")]
18    pub fetch_time: Option<String>,
19    /// URL originally requested for auditing.
20    #[serde(rename = "requestedUrl")]
21    pub requested_url: Option<String>,
22    /// Final URL audited after following redirects.
23    #[serde(rename = "finalUrl")]
24    pub final_url: Option<String>,
25    /// Warnings raised during the audit run.
26    #[serde(rename = "runWarnings")]
27    pub run_warnings: Option<Vec<Value>>,
28    /// Raw individual audit results keyed by audit id.
29    pub audits: Option<Value>,
30    /// Category scores (performance, accessibility, SEO, etc.).
31    pub categories: Option<Value>,
32}
33
34/// Environment in which the Lighthouse audit was executed.
35/// See <https://docs.dataforseo.com/v3/on_page/lighthouse/task_get/>.
36#[derive(Debug, Default, Serialize, Deserialize, Clone)]
37pub struct OnPageDataApiLighthouseEnvironment {
38    /// User agent used for network requests during the audit.
39    #[serde(rename = "networkUserAgent")]
40    pub network_user_agent: Option<String>,
41    /// User agent of the host that ran the audit.
42    #[serde(rename = "hostUserAgent")]
43    pub host_user_agent: Option<String>,
44    /// CPU/performance benchmark score of the audit host.
45    #[serde(rename = "benchmarkIndex")]
46    pub benchmark_index: Option<f64>,
47    /// Credits for the libraries used during the audit.
48    pub credits: Option<Value>,
49}
50
51/// A Lighthouse task ready to be collected.
52/// See <https://docs.dataforseo.com/v3/on_page/lighthouse/task_get/>.
53#[derive(Debug, Default, Serialize, Deserialize, Clone)]
54pub struct OnPageDataApiLighthouseTasksReady {
55    /// Unique task identifier.
56    pub id: Option<String>,
57    /// Date and time the task was posted (UTC).
58    pub date_posted: Option<String>,
59    /// User-defined tag assigned to the task.
60    pub tag: Option<String>,
61    /// Endpoint to call to retrieve the task's result.
62    pub endpoint: Option<String>,
63}