Skip to main content

cdp_protocol/
service_worker.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: ServiceWorker
2#![allow(dead_code)]
3use super::target;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use derive_builder::Builder;
8#[allow(unused_imports)]
9use serde::{Deserialize, Serialize};
10#[allow(unused_imports)]
11use serde_json::Value as Json;
12pub type RegistrationId = String;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
15pub enum ServiceWorkerVersionRunningStatus {
16    #[serde(rename = "stopped")]
17    Stopped,
18    #[serde(rename = "starting")]
19    Starting,
20    #[serde(rename = "running")]
21    Running,
22    #[serde(rename = "stopping")]
23    Stopping,
24}
25#[allow(deprecated)]
26#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
27pub enum ServiceWorkerVersionStatus {
28    #[serde(rename = "new")]
29    New,
30    #[serde(rename = "installing")]
31    Installing,
32    #[serde(rename = "installed")]
33    Installed,
34    #[serde(rename = "activating")]
35    Activating,
36    #[serde(rename = "activated")]
37    Activated,
38    #[serde(rename = "redundant")]
39    Redundant,
40}
41#[allow(deprecated)]
42#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
43#[builder(setter(into, strip_option))]
44#[serde(rename_all = "camelCase")]
45#[doc = "ServiceWorker registration."]
46pub struct ServiceWorkerRegistration {
47    pub registration_id: RegistrationId,
48    #[serde(default)]
49    #[serde(rename = "scopeURL")]
50    pub scope_url: String,
51    #[serde(default)]
52    pub is_deleted: bool,
53}
54#[allow(deprecated)]
55#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
56#[builder(setter(into, strip_option))]
57#[serde(rename_all = "camelCase")]
58#[doc = "ServiceWorker version."]
59pub struct ServiceWorkerVersion {
60    #[serde(default)]
61    pub version_id: String,
62    pub registration_id: RegistrationId,
63    #[serde(default)]
64    #[serde(rename = "scriptURL")]
65    pub script_url: String,
66    pub running_status: ServiceWorkerVersionRunningStatus,
67    pub status: ServiceWorkerVersionStatus,
68    #[builder(default)]
69    #[serde(skip_serializing_if = "Option::is_none")]
70    #[serde(default)]
71    #[doc = "The Last-Modified header value of the main script."]
72    pub script_last_modified: Option<JsFloat>,
73    #[builder(default)]
74    #[serde(skip_serializing_if = "Option::is_none")]
75    #[serde(default)]
76    #[doc = "The time at which the response headers of the main script were received from the server.\n For cached script it is the last time the cache entry was validated."]
77    pub script_response_time: Option<JsFloat>,
78    #[builder(default)]
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub controlled_clients: Option<Vec<target::TargetId>>,
81    #[builder(default)]
82    #[serde(skip_serializing_if = "Option::is_none")]
83    pub target_id: Option<target::TargetId>,
84    #[builder(default)]
85    #[serde(skip_serializing_if = "Option::is_none")]
86    #[serde(default)]
87    pub router_rules: Option<String>,
88}
89#[allow(deprecated)]
90#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
91#[builder(setter(into, strip_option))]
92#[serde(rename_all = "camelCase")]
93#[doc = "ServiceWorker error message."]
94pub struct ServiceWorkerErrorMessage {
95    #[serde(default)]
96    pub error_message: String,
97    pub registration_id: RegistrationId,
98    #[serde(default)]
99    pub version_id: String,
100    #[serde(default)]
101    #[serde(rename = "sourceURL")]
102    pub source_url: String,
103    #[serde(default)]
104    pub line_number: JsUInt,
105    #[serde(default)]
106    pub column_number: JsUInt,
107}
108#[allow(deprecated)]
109#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
110#[builder(setter(into, strip_option))]
111#[serde(rename_all = "camelCase")]
112pub struct DeliverPushMessage {
113    #[serde(default)]
114    pub origin: String,
115    pub registration_id: RegistrationId,
116    #[serde(default)]
117    pub data: String,
118}
119#[allow(deprecated)]
120#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
121pub struct Disable(pub Option<Json>);
122#[allow(deprecated)]
123#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
124#[builder(setter(into, strip_option))]
125#[serde(rename_all = "camelCase")]
126pub struct DispatchSyncEvent {
127    #[serde(default)]
128    pub origin: String,
129    pub registration_id: RegistrationId,
130    #[serde(default)]
131    pub tag: String,
132    #[serde(default)]
133    pub last_chance: bool,
134}
135#[allow(deprecated)]
136#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
137#[builder(setter(into, strip_option))]
138#[serde(rename_all = "camelCase")]
139pub struct DispatchPeriodicSyncEvent {
140    #[serde(default)]
141    pub origin: String,
142    pub registration_id: RegistrationId,
143    #[serde(default)]
144    pub tag: String,
145}
146#[allow(deprecated)]
147#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
148pub struct Enable(pub Option<Json>);
149#[allow(deprecated)]
150#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
151#[builder(setter(into, strip_option))]
152#[serde(rename_all = "camelCase")]
153pub struct SetForceUpdateOnPageLoad {
154    #[serde(default)]
155    pub force_update_on_page_load: bool,
156}
157#[allow(deprecated)]
158#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
159#[builder(setter(into, strip_option))]
160#[serde(rename_all = "camelCase")]
161pub struct SkipWaiting {
162    #[serde(default)]
163    #[serde(rename = "scopeURL")]
164    pub scope_url: String,
165}
166#[allow(deprecated)]
167#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
168#[builder(setter(into, strip_option))]
169#[serde(rename_all = "camelCase")]
170pub struct StartWorker {
171    #[serde(default)]
172    #[serde(rename = "scopeURL")]
173    pub scope_url: String,
174}
175#[allow(deprecated)]
176#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
177pub struct StopAllWorkers(pub Option<Json>);
178#[allow(deprecated)]
179#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
180#[builder(setter(into, strip_option))]
181#[serde(rename_all = "camelCase")]
182pub struct StopWorker {
183    #[serde(default)]
184    pub version_id: String,
185}
186#[allow(deprecated)]
187#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
188#[builder(setter(into, strip_option))]
189#[serde(rename_all = "camelCase")]
190pub struct Unregister {
191    #[serde(default)]
192    #[serde(rename = "scopeURL")]
193    pub scope_url: String,
194}
195#[allow(deprecated)]
196#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
197#[builder(setter(into, strip_option))]
198#[serde(rename_all = "camelCase")]
199pub struct UpdateRegistration {
200    #[serde(default)]
201    #[serde(rename = "scopeURL")]
202    pub scope_url: String,
203}
204#[allow(deprecated)]
205#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
206pub struct DeliverPushMessageReturnObject(pub Option<Json>);
207#[allow(deprecated)]
208#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
209pub struct DisableReturnObject(pub Option<Json>);
210#[allow(deprecated)]
211#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
212pub struct DispatchSyncEventReturnObject(pub Option<Json>);
213#[allow(deprecated)]
214#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
215pub struct DispatchPeriodicSyncEventReturnObject(pub Option<Json>);
216#[allow(deprecated)]
217#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
218pub struct EnableReturnObject(pub Option<Json>);
219#[allow(deprecated)]
220#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
221pub struct SetForceUpdateOnPageLoadReturnObject(pub Option<Json>);
222#[allow(deprecated)]
223#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
224pub struct SkipWaitingReturnObject(pub Option<Json>);
225#[allow(deprecated)]
226#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
227pub struct StartWorkerReturnObject(pub Option<Json>);
228#[allow(deprecated)]
229#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
230pub struct StopAllWorkersReturnObject(pub Option<Json>);
231#[allow(deprecated)]
232#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
233pub struct StopWorkerReturnObject(pub Option<Json>);
234#[allow(deprecated)]
235#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
236pub struct UnregisterReturnObject(pub Option<Json>);
237#[allow(deprecated)]
238#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
239pub struct UpdateRegistrationReturnObject(pub Option<Json>);
240#[allow(deprecated)]
241impl Method for DeliverPushMessage {
242    const NAME: &'static str = "ServiceWorker.deliverPushMessage";
243    type ReturnObject = DeliverPushMessageReturnObject;
244}
245#[allow(deprecated)]
246impl Method for Disable {
247    const NAME: &'static str = "ServiceWorker.disable";
248    type ReturnObject = DisableReturnObject;
249}
250#[allow(deprecated)]
251impl Method for DispatchSyncEvent {
252    const NAME: &'static str = "ServiceWorker.dispatchSyncEvent";
253    type ReturnObject = DispatchSyncEventReturnObject;
254}
255#[allow(deprecated)]
256impl Method for DispatchPeriodicSyncEvent {
257    const NAME: &'static str = "ServiceWorker.dispatchPeriodicSyncEvent";
258    type ReturnObject = DispatchPeriodicSyncEventReturnObject;
259}
260#[allow(deprecated)]
261impl Method for Enable {
262    const NAME: &'static str = "ServiceWorker.enable";
263    type ReturnObject = EnableReturnObject;
264}
265#[allow(deprecated)]
266impl Method for SetForceUpdateOnPageLoad {
267    const NAME: &'static str = "ServiceWorker.setForceUpdateOnPageLoad";
268    type ReturnObject = SetForceUpdateOnPageLoadReturnObject;
269}
270#[allow(deprecated)]
271impl Method for SkipWaiting {
272    const NAME: &'static str = "ServiceWorker.skipWaiting";
273    type ReturnObject = SkipWaitingReturnObject;
274}
275#[allow(deprecated)]
276impl Method for StartWorker {
277    const NAME: &'static str = "ServiceWorker.startWorker";
278    type ReturnObject = StartWorkerReturnObject;
279}
280#[allow(deprecated)]
281impl Method for StopAllWorkers {
282    const NAME: &'static str = "ServiceWorker.stopAllWorkers";
283    type ReturnObject = StopAllWorkersReturnObject;
284}
285#[allow(deprecated)]
286impl Method for StopWorker {
287    const NAME: &'static str = "ServiceWorker.stopWorker";
288    type ReturnObject = StopWorkerReturnObject;
289}
290#[allow(deprecated)]
291impl Method for Unregister {
292    const NAME: &'static str = "ServiceWorker.unregister";
293    type ReturnObject = UnregisterReturnObject;
294}
295#[allow(deprecated)]
296impl Method for UpdateRegistration {
297    const NAME: &'static str = "ServiceWorker.updateRegistration";
298    type ReturnObject = UpdateRegistrationReturnObject;
299}
300#[allow(dead_code)]
301pub mod events {
302    #[allow(unused_imports)]
303    use super::super::types::*;
304    #[allow(unused_imports)]
305    use derive_builder::Builder;
306    #[allow(unused_imports)]
307    use serde::{Deserialize, Serialize};
308    #[allow(unused_imports)]
309    use serde_json::Value as Json;
310    #[allow(deprecated)]
311    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
312    pub struct WorkerErrorReportedEvent {
313        pub params: WorkerErrorReportedEventParams,
314    }
315    #[allow(deprecated)]
316    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
317    #[serde(rename_all = "camelCase")]
318    pub struct WorkerErrorReportedEventParams {
319        pub error_message: super::ServiceWorkerErrorMessage,
320    }
321    #[allow(deprecated)]
322    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
323    pub struct WorkerRegistrationUpdatedEvent {
324        pub params: WorkerRegistrationUpdatedEventParams,
325    }
326    #[allow(deprecated)]
327    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
328    #[serde(rename_all = "camelCase")]
329    pub struct WorkerRegistrationUpdatedEventParams {
330        pub registrations: Vec<super::ServiceWorkerRegistration>,
331    }
332    #[allow(deprecated)]
333    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
334    pub struct WorkerVersionUpdatedEvent {
335        pub params: WorkerVersionUpdatedEventParams,
336    }
337    #[allow(deprecated)]
338    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
339    #[serde(rename_all = "camelCase")]
340    pub struct WorkerVersionUpdatedEventParams {
341        pub versions: Vec<super::ServiceWorkerVersion>,
342    }
343}