Skip to main content

browser_protocol/serviceworker/
mod.rs

1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5
6pub type RegistrationID<'a> = Cow<'a, str>;
7
8/// ServiceWorker registration.
9
10#[derive(Debug, Clone, Serialize, Deserialize, Default)]
11#[serde(rename_all = "camelCase")]
12pub struct ServiceWorkerRegistration<'a> {
13    #[serde(rename = "registrationId")]
14    registration_id: RegistrationID<'a>,
15    #[serde(rename = "scopeURL")]
16    scope_url: Cow<'a, str>,
17    #[serde(rename = "isDeleted")]
18    is_deleted: bool,
19}
20
21impl<'a> ServiceWorkerRegistration<'a> {
22    /// Creates a builder for this type with the required parameters:
23    /// * `registration_id`: 
24    /// * `scope_url`: 
25    /// * `is_deleted`: 
26    pub fn builder(registration_id: impl Into<RegistrationID<'a>>, scope_url: impl Into<Cow<'a, str>>, is_deleted: bool) -> ServiceWorkerRegistrationBuilder<'a> {
27        ServiceWorkerRegistrationBuilder {
28            registration_id: registration_id.into(),
29            scope_url: scope_url.into(),
30            is_deleted: is_deleted,
31        }
32    }
33    pub fn registration_id(&self) -> &RegistrationID<'a> { &self.registration_id }
34    pub fn scope_url(&self) -> &str { self.scope_url.as_ref() }
35    pub fn is_deleted(&self) -> bool { self.is_deleted }
36}
37
38
39pub struct ServiceWorkerRegistrationBuilder<'a> {
40    registration_id: RegistrationID<'a>,
41    scope_url: Cow<'a, str>,
42    is_deleted: bool,
43}
44
45impl<'a> ServiceWorkerRegistrationBuilder<'a> {
46    pub fn build(self) -> ServiceWorkerRegistration<'a> {
47        ServiceWorkerRegistration {
48            registration_id: self.registration_id,
49            scope_url: self.scope_url,
50            is_deleted: self.is_deleted,
51        }
52    }
53}
54
55
56#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
57pub enum ServiceWorkerVersionRunningStatus {
58    #[default]
59    #[serde(rename = "stopped")]
60    Stopped,
61    #[serde(rename = "starting")]
62    Starting,
63    #[serde(rename = "running")]
64    Running,
65    #[serde(rename = "stopping")]
66    Stopping,
67}
68
69
70#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
71pub enum ServiceWorkerVersionStatus {
72    #[default]
73    #[serde(rename = "new")]
74    New,
75    #[serde(rename = "installing")]
76    Installing,
77    #[serde(rename = "installed")]
78    Installed,
79    #[serde(rename = "activating")]
80    Activating,
81    #[serde(rename = "activated")]
82    Activated,
83    #[serde(rename = "redundant")]
84    Redundant,
85}
86
87/// ServiceWorker version.
88
89#[derive(Debug, Clone, Serialize, Deserialize, Default)]
90#[serde(rename_all = "camelCase")]
91pub struct ServiceWorkerVersion<'a> {
92    #[serde(rename = "versionId")]
93    version_id: Cow<'a, str>,
94    #[serde(rename = "registrationId")]
95    registration_id: RegistrationID<'a>,
96    #[serde(rename = "scriptURL")]
97    script_url: Cow<'a, str>,
98    #[serde(rename = "runningStatus")]
99    running_status: ServiceWorkerVersionRunningStatus,
100    status: ServiceWorkerVersionStatus,
101    /// The Last-Modified header value of the main script.
102    #[serde(skip_serializing_if = "Option::is_none", rename = "scriptLastModified")]
103    script_last_modified: Option<f64>,
104    /// The time at which the response headers of the main script were received from the server.
105    /// For cached script it is the last time the cache entry was validated.
106    #[serde(skip_serializing_if = "Option::is_none", rename = "scriptResponseTime")]
107    script_response_time: Option<f64>,
108    #[serde(skip_serializing_if = "Option::is_none", rename = "controlledClients")]
109    controlled_clients: Option<Vec<crate::target::TargetID<'a>>>,
110    #[serde(skip_serializing_if = "Option::is_none", rename = "targetId")]
111    target_id: Option<crate::target::TargetID<'a>>,
112    #[serde(skip_serializing_if = "Option::is_none", rename = "routerRules")]
113    router_rules: Option<Cow<'a, str>>,
114}
115
116impl<'a> ServiceWorkerVersion<'a> {
117    /// Creates a builder for this type with the required parameters:
118    /// * `version_id`: 
119    /// * `registration_id`: 
120    /// * `script_url`: 
121    /// * `running_status`: 
122    /// * `status`: 
123    pub fn builder(version_id: impl Into<Cow<'a, str>>, registration_id: impl Into<RegistrationID<'a>>, script_url: impl Into<Cow<'a, str>>, running_status: impl Into<ServiceWorkerVersionRunningStatus>, status: impl Into<ServiceWorkerVersionStatus>) -> ServiceWorkerVersionBuilder<'a> {
124        ServiceWorkerVersionBuilder {
125            version_id: version_id.into(),
126            registration_id: registration_id.into(),
127            script_url: script_url.into(),
128            running_status: running_status.into(),
129            status: status.into(),
130            script_last_modified: None,
131            script_response_time: None,
132            controlled_clients: None,
133            target_id: None,
134            router_rules: None,
135        }
136    }
137    pub fn version_id(&self) -> &str { self.version_id.as_ref() }
138    pub fn registration_id(&self) -> &RegistrationID<'a> { &self.registration_id }
139    pub fn script_url(&self) -> &str { self.script_url.as_ref() }
140    pub fn running_status(&self) -> &ServiceWorkerVersionRunningStatus { &self.running_status }
141    pub fn status(&self) -> &ServiceWorkerVersionStatus { &self.status }
142    /// The Last-Modified header value of the main script.
143    pub fn script_last_modified(&self) -> Option<f64> { self.script_last_modified }
144    /// The time at which the response headers of the main script were received from the server.
145    /// For cached script it is the last time the cache entry was validated.
146    pub fn script_response_time(&self) -> Option<f64> { self.script_response_time }
147    pub fn controlled_clients(&self) -> Option<&[crate::target::TargetID<'a>]> { self.controlled_clients.as_deref() }
148    pub fn target_id(&self) -> Option<&crate::target::TargetID<'a>> { self.target_id.as_ref() }
149    pub fn router_rules(&self) -> Option<&str> { self.router_rules.as_deref() }
150}
151
152
153pub struct ServiceWorkerVersionBuilder<'a> {
154    version_id: Cow<'a, str>,
155    registration_id: RegistrationID<'a>,
156    script_url: Cow<'a, str>,
157    running_status: ServiceWorkerVersionRunningStatus,
158    status: ServiceWorkerVersionStatus,
159    script_last_modified: Option<f64>,
160    script_response_time: Option<f64>,
161    controlled_clients: Option<Vec<crate::target::TargetID<'a>>>,
162    target_id: Option<crate::target::TargetID<'a>>,
163    router_rules: Option<Cow<'a, str>>,
164}
165
166impl<'a> ServiceWorkerVersionBuilder<'a> {
167    /// The Last-Modified header value of the main script.
168    pub fn script_last_modified(mut self, script_last_modified: f64) -> Self { self.script_last_modified = Some(script_last_modified); self }
169    /// The time at which the response headers of the main script were received from the server.
170    /// For cached script it is the last time the cache entry was validated.
171    pub fn script_response_time(mut self, script_response_time: f64) -> Self { self.script_response_time = Some(script_response_time); self }
172    pub fn controlled_clients(mut self, controlled_clients: Vec<crate::target::TargetID<'a>>) -> Self { self.controlled_clients = Some(controlled_clients); self }
173    pub fn target_id(mut self, target_id: crate::target::TargetID<'a>) -> Self { self.target_id = Some(target_id); self }
174    pub fn router_rules(mut self, router_rules: impl Into<Cow<'a, str>>) -> Self { self.router_rules = Some(router_rules.into()); self }
175    pub fn build(self) -> ServiceWorkerVersion<'a> {
176        ServiceWorkerVersion {
177            version_id: self.version_id,
178            registration_id: self.registration_id,
179            script_url: self.script_url,
180            running_status: self.running_status,
181            status: self.status,
182            script_last_modified: self.script_last_modified,
183            script_response_time: self.script_response_time,
184            controlled_clients: self.controlled_clients,
185            target_id: self.target_id,
186            router_rules: self.router_rules,
187        }
188    }
189}
190
191/// ServiceWorker error message.
192
193#[derive(Debug, Clone, Serialize, Deserialize, Default)]
194#[serde(rename_all = "camelCase")]
195pub struct ServiceWorkerErrorMessage<'a> {
196    #[serde(rename = "errorMessage")]
197    error_message: Cow<'a, str>,
198    #[serde(rename = "registrationId")]
199    registration_id: RegistrationID<'a>,
200    #[serde(rename = "versionId")]
201    version_id: Cow<'a, str>,
202    #[serde(rename = "sourceURL")]
203    source_url: Cow<'a, str>,
204    #[serde(rename = "lineNumber")]
205    line_number: i64,
206    #[serde(rename = "columnNumber")]
207    column_number: i64,
208}
209
210impl<'a> ServiceWorkerErrorMessage<'a> {
211    /// Creates a builder for this type with the required parameters:
212    /// * `error_message`: 
213    /// * `registration_id`: 
214    /// * `version_id`: 
215    /// * `source_url`: 
216    /// * `line_number`: 
217    /// * `column_number`: 
218    pub fn builder(error_message: impl Into<Cow<'a, str>>, registration_id: impl Into<RegistrationID<'a>>, version_id: impl Into<Cow<'a, str>>, source_url: impl Into<Cow<'a, str>>, line_number: i64, column_number: i64) -> ServiceWorkerErrorMessageBuilder<'a> {
219        ServiceWorkerErrorMessageBuilder {
220            error_message: error_message.into(),
221            registration_id: registration_id.into(),
222            version_id: version_id.into(),
223            source_url: source_url.into(),
224            line_number: line_number,
225            column_number: column_number,
226        }
227    }
228    pub fn error_message(&self) -> &str { self.error_message.as_ref() }
229    pub fn registration_id(&self) -> &RegistrationID<'a> { &self.registration_id }
230    pub fn version_id(&self) -> &str { self.version_id.as_ref() }
231    pub fn source_url(&self) -> &str { self.source_url.as_ref() }
232    pub fn line_number(&self) -> i64 { self.line_number }
233    pub fn column_number(&self) -> i64 { self.column_number }
234}
235
236
237pub struct ServiceWorkerErrorMessageBuilder<'a> {
238    error_message: Cow<'a, str>,
239    registration_id: RegistrationID<'a>,
240    version_id: Cow<'a, str>,
241    source_url: Cow<'a, str>,
242    line_number: i64,
243    column_number: i64,
244}
245
246impl<'a> ServiceWorkerErrorMessageBuilder<'a> {
247    pub fn build(self) -> ServiceWorkerErrorMessage<'a> {
248        ServiceWorkerErrorMessage {
249            error_message: self.error_message,
250            registration_id: self.registration_id,
251            version_id: self.version_id,
252            source_url: self.source_url,
253            line_number: self.line_number,
254            column_number: self.column_number,
255        }
256    }
257}
258
259
260#[derive(Debug, Clone, Serialize, Deserialize, Default)]
261#[serde(rename_all = "camelCase")]
262pub struct DeliverPushMessageParams<'a> {
263    origin: Cow<'a, str>,
264    #[serde(rename = "registrationId")]
265    registration_id: RegistrationID<'a>,
266    data: Cow<'a, str>,
267}
268
269impl<'a> DeliverPushMessageParams<'a> {
270    /// Creates a builder for this type with the required parameters:
271    /// * `origin`: 
272    /// * `registration_id`: 
273    /// * `data`: 
274    pub fn builder(origin: impl Into<Cow<'a, str>>, registration_id: impl Into<RegistrationID<'a>>, data: impl Into<Cow<'a, str>>) -> DeliverPushMessageParamsBuilder<'a> {
275        DeliverPushMessageParamsBuilder {
276            origin: origin.into(),
277            registration_id: registration_id.into(),
278            data: data.into(),
279        }
280    }
281    pub fn origin(&self) -> &str { self.origin.as_ref() }
282    pub fn registration_id(&self) -> &RegistrationID<'a> { &self.registration_id }
283    pub fn data(&self) -> &str { self.data.as_ref() }
284}
285
286
287pub struct DeliverPushMessageParamsBuilder<'a> {
288    origin: Cow<'a, str>,
289    registration_id: RegistrationID<'a>,
290    data: Cow<'a, str>,
291}
292
293impl<'a> DeliverPushMessageParamsBuilder<'a> {
294    pub fn build(self) -> DeliverPushMessageParams<'a> {
295        DeliverPushMessageParams {
296            origin: self.origin,
297            registration_id: self.registration_id,
298            data: self.data,
299        }
300    }
301}
302
303impl<'a> DeliverPushMessageParams<'a> { pub const METHOD: &'static str = "ServiceWorker.deliverPushMessage"; }
304
305impl<'a> crate::CdpCommand<'a> for DeliverPushMessageParams<'a> {
306    const METHOD: &'static str = "ServiceWorker.deliverPushMessage";
307    type Response = crate::EmptyReturns;
308}
309
310#[derive(Debug, Clone, Serialize, Deserialize, Default)]
311pub struct DisableParams {}
312
313impl DisableParams { pub const METHOD: &'static str = "ServiceWorker.disable"; }
314
315impl<'a> crate::CdpCommand<'a> for DisableParams {
316    const METHOD: &'static str = "ServiceWorker.disable";
317    type Response = crate::EmptyReturns;
318}
319
320
321#[derive(Debug, Clone, Serialize, Deserialize, Default)]
322#[serde(rename_all = "camelCase")]
323pub struct DispatchSyncEventParams<'a> {
324    origin: Cow<'a, str>,
325    #[serde(rename = "registrationId")]
326    registration_id: RegistrationID<'a>,
327    tag: Cow<'a, str>,
328    #[serde(rename = "lastChance")]
329    last_chance: bool,
330}
331
332impl<'a> DispatchSyncEventParams<'a> {
333    /// Creates a builder for this type with the required parameters:
334    /// * `origin`: 
335    /// * `registration_id`: 
336    /// * `tag`: 
337    /// * `last_chance`: 
338    pub fn builder(origin: impl Into<Cow<'a, str>>, registration_id: impl Into<RegistrationID<'a>>, tag: impl Into<Cow<'a, str>>, last_chance: bool) -> DispatchSyncEventParamsBuilder<'a> {
339        DispatchSyncEventParamsBuilder {
340            origin: origin.into(),
341            registration_id: registration_id.into(),
342            tag: tag.into(),
343            last_chance: last_chance,
344        }
345    }
346    pub fn origin(&self) -> &str { self.origin.as_ref() }
347    pub fn registration_id(&self) -> &RegistrationID<'a> { &self.registration_id }
348    pub fn tag(&self) -> &str { self.tag.as_ref() }
349    pub fn last_chance(&self) -> bool { self.last_chance }
350}
351
352
353pub struct DispatchSyncEventParamsBuilder<'a> {
354    origin: Cow<'a, str>,
355    registration_id: RegistrationID<'a>,
356    tag: Cow<'a, str>,
357    last_chance: bool,
358}
359
360impl<'a> DispatchSyncEventParamsBuilder<'a> {
361    pub fn build(self) -> DispatchSyncEventParams<'a> {
362        DispatchSyncEventParams {
363            origin: self.origin,
364            registration_id: self.registration_id,
365            tag: self.tag,
366            last_chance: self.last_chance,
367        }
368    }
369}
370
371impl<'a> DispatchSyncEventParams<'a> { pub const METHOD: &'static str = "ServiceWorker.dispatchSyncEvent"; }
372
373impl<'a> crate::CdpCommand<'a> for DispatchSyncEventParams<'a> {
374    const METHOD: &'static str = "ServiceWorker.dispatchSyncEvent";
375    type Response = crate::EmptyReturns;
376}
377
378
379#[derive(Debug, Clone, Serialize, Deserialize, Default)]
380#[serde(rename_all = "camelCase")]
381pub struct DispatchPeriodicSyncEventParams<'a> {
382    origin: Cow<'a, str>,
383    #[serde(rename = "registrationId")]
384    registration_id: RegistrationID<'a>,
385    tag: Cow<'a, str>,
386}
387
388impl<'a> DispatchPeriodicSyncEventParams<'a> {
389    /// Creates a builder for this type with the required parameters:
390    /// * `origin`: 
391    /// * `registration_id`: 
392    /// * `tag`: 
393    pub fn builder(origin: impl Into<Cow<'a, str>>, registration_id: impl Into<RegistrationID<'a>>, tag: impl Into<Cow<'a, str>>) -> DispatchPeriodicSyncEventParamsBuilder<'a> {
394        DispatchPeriodicSyncEventParamsBuilder {
395            origin: origin.into(),
396            registration_id: registration_id.into(),
397            tag: tag.into(),
398        }
399    }
400    pub fn origin(&self) -> &str { self.origin.as_ref() }
401    pub fn registration_id(&self) -> &RegistrationID<'a> { &self.registration_id }
402    pub fn tag(&self) -> &str { self.tag.as_ref() }
403}
404
405
406pub struct DispatchPeriodicSyncEventParamsBuilder<'a> {
407    origin: Cow<'a, str>,
408    registration_id: RegistrationID<'a>,
409    tag: Cow<'a, str>,
410}
411
412impl<'a> DispatchPeriodicSyncEventParamsBuilder<'a> {
413    pub fn build(self) -> DispatchPeriodicSyncEventParams<'a> {
414        DispatchPeriodicSyncEventParams {
415            origin: self.origin,
416            registration_id: self.registration_id,
417            tag: self.tag,
418        }
419    }
420}
421
422impl<'a> DispatchPeriodicSyncEventParams<'a> { pub const METHOD: &'static str = "ServiceWorker.dispatchPeriodicSyncEvent"; }
423
424impl<'a> crate::CdpCommand<'a> for DispatchPeriodicSyncEventParams<'a> {
425    const METHOD: &'static str = "ServiceWorker.dispatchPeriodicSyncEvent";
426    type Response = crate::EmptyReturns;
427}
428
429#[derive(Debug, Clone, Serialize, Deserialize, Default)]
430pub struct EnableParams {}
431
432impl EnableParams { pub const METHOD: &'static str = "ServiceWorker.enable"; }
433
434impl<'a> crate::CdpCommand<'a> for EnableParams {
435    const METHOD: &'static str = "ServiceWorker.enable";
436    type Response = crate::EmptyReturns;
437}
438
439
440#[derive(Debug, Clone, Serialize, Deserialize, Default)]
441#[serde(rename_all = "camelCase")]
442pub struct SetForceUpdateOnPageLoadParams {
443    #[serde(rename = "forceUpdateOnPageLoad")]
444    force_update_on_page_load: bool,
445}
446
447impl SetForceUpdateOnPageLoadParams {
448    /// Creates a builder for this type with the required parameters:
449    /// * `force_update_on_page_load`: 
450    pub fn builder(force_update_on_page_load: bool) -> SetForceUpdateOnPageLoadParamsBuilder {
451        SetForceUpdateOnPageLoadParamsBuilder {
452            force_update_on_page_load: force_update_on_page_load,
453        }
454    }
455    pub fn force_update_on_page_load(&self) -> bool { self.force_update_on_page_load }
456}
457
458
459pub struct SetForceUpdateOnPageLoadParamsBuilder {
460    force_update_on_page_load: bool,
461}
462
463impl SetForceUpdateOnPageLoadParamsBuilder {
464    pub fn build(self) -> SetForceUpdateOnPageLoadParams {
465        SetForceUpdateOnPageLoadParams {
466            force_update_on_page_load: self.force_update_on_page_load,
467        }
468    }
469}
470
471impl SetForceUpdateOnPageLoadParams { pub const METHOD: &'static str = "ServiceWorker.setForceUpdateOnPageLoad"; }
472
473impl<'a> crate::CdpCommand<'a> for SetForceUpdateOnPageLoadParams {
474    const METHOD: &'static str = "ServiceWorker.setForceUpdateOnPageLoad";
475    type Response = crate::EmptyReturns;
476}
477
478
479#[derive(Debug, Clone, Serialize, Deserialize, Default)]
480#[serde(rename_all = "camelCase")]
481pub struct SkipWaitingParams<'a> {
482    #[serde(rename = "scopeURL")]
483    scope_url: Cow<'a, str>,
484}
485
486impl<'a> SkipWaitingParams<'a> {
487    /// Creates a builder for this type with the required parameters:
488    /// * `scope_url`: 
489    pub fn builder(scope_url: impl Into<Cow<'a, str>>) -> SkipWaitingParamsBuilder<'a> {
490        SkipWaitingParamsBuilder {
491            scope_url: scope_url.into(),
492        }
493    }
494    pub fn scope_url(&self) -> &str { self.scope_url.as_ref() }
495}
496
497
498pub struct SkipWaitingParamsBuilder<'a> {
499    scope_url: Cow<'a, str>,
500}
501
502impl<'a> SkipWaitingParamsBuilder<'a> {
503    pub fn build(self) -> SkipWaitingParams<'a> {
504        SkipWaitingParams {
505            scope_url: self.scope_url,
506        }
507    }
508}
509
510impl<'a> SkipWaitingParams<'a> { pub const METHOD: &'static str = "ServiceWorker.skipWaiting"; }
511
512impl<'a> crate::CdpCommand<'a> for SkipWaitingParams<'a> {
513    const METHOD: &'static str = "ServiceWorker.skipWaiting";
514    type Response = crate::EmptyReturns;
515}
516
517
518#[derive(Debug, Clone, Serialize, Deserialize, Default)]
519#[serde(rename_all = "camelCase")]
520pub struct StartWorkerParams<'a> {
521    #[serde(rename = "scopeURL")]
522    scope_url: Cow<'a, str>,
523}
524
525impl<'a> StartWorkerParams<'a> {
526    /// Creates a builder for this type with the required parameters:
527    /// * `scope_url`: 
528    pub fn builder(scope_url: impl Into<Cow<'a, str>>) -> StartWorkerParamsBuilder<'a> {
529        StartWorkerParamsBuilder {
530            scope_url: scope_url.into(),
531        }
532    }
533    pub fn scope_url(&self) -> &str { self.scope_url.as_ref() }
534}
535
536
537pub struct StartWorkerParamsBuilder<'a> {
538    scope_url: Cow<'a, str>,
539}
540
541impl<'a> StartWorkerParamsBuilder<'a> {
542    pub fn build(self) -> StartWorkerParams<'a> {
543        StartWorkerParams {
544            scope_url: self.scope_url,
545        }
546    }
547}
548
549impl<'a> StartWorkerParams<'a> { pub const METHOD: &'static str = "ServiceWorker.startWorker"; }
550
551impl<'a> crate::CdpCommand<'a> for StartWorkerParams<'a> {
552    const METHOD: &'static str = "ServiceWorker.startWorker";
553    type Response = crate::EmptyReturns;
554}
555
556#[derive(Debug, Clone, Serialize, Deserialize, Default)]
557pub struct StopAllWorkersParams {}
558
559impl StopAllWorkersParams { pub const METHOD: &'static str = "ServiceWorker.stopAllWorkers"; }
560
561impl<'a> crate::CdpCommand<'a> for StopAllWorkersParams {
562    const METHOD: &'static str = "ServiceWorker.stopAllWorkers";
563    type Response = crate::EmptyReturns;
564}
565
566
567#[derive(Debug, Clone, Serialize, Deserialize, Default)]
568#[serde(rename_all = "camelCase")]
569pub struct StopWorkerParams<'a> {
570    #[serde(rename = "versionId")]
571    version_id: Cow<'a, str>,
572}
573
574impl<'a> StopWorkerParams<'a> {
575    /// Creates a builder for this type with the required parameters:
576    /// * `version_id`: 
577    pub fn builder(version_id: impl Into<Cow<'a, str>>) -> StopWorkerParamsBuilder<'a> {
578        StopWorkerParamsBuilder {
579            version_id: version_id.into(),
580        }
581    }
582    pub fn version_id(&self) -> &str { self.version_id.as_ref() }
583}
584
585
586pub struct StopWorkerParamsBuilder<'a> {
587    version_id: Cow<'a, str>,
588}
589
590impl<'a> StopWorkerParamsBuilder<'a> {
591    pub fn build(self) -> StopWorkerParams<'a> {
592        StopWorkerParams {
593            version_id: self.version_id,
594        }
595    }
596}
597
598impl<'a> StopWorkerParams<'a> { pub const METHOD: &'static str = "ServiceWorker.stopWorker"; }
599
600impl<'a> crate::CdpCommand<'a> for StopWorkerParams<'a> {
601    const METHOD: &'static str = "ServiceWorker.stopWorker";
602    type Response = crate::EmptyReturns;
603}
604
605
606#[derive(Debug, Clone, Serialize, Deserialize, Default)]
607#[serde(rename_all = "camelCase")]
608pub struct UnregisterParams<'a> {
609    #[serde(rename = "scopeURL")]
610    scope_url: Cow<'a, str>,
611}
612
613impl<'a> UnregisterParams<'a> {
614    /// Creates a builder for this type with the required parameters:
615    /// * `scope_url`: 
616    pub fn builder(scope_url: impl Into<Cow<'a, str>>) -> UnregisterParamsBuilder<'a> {
617        UnregisterParamsBuilder {
618            scope_url: scope_url.into(),
619        }
620    }
621    pub fn scope_url(&self) -> &str { self.scope_url.as_ref() }
622}
623
624
625pub struct UnregisterParamsBuilder<'a> {
626    scope_url: Cow<'a, str>,
627}
628
629impl<'a> UnregisterParamsBuilder<'a> {
630    pub fn build(self) -> UnregisterParams<'a> {
631        UnregisterParams {
632            scope_url: self.scope_url,
633        }
634    }
635}
636
637impl<'a> UnregisterParams<'a> { pub const METHOD: &'static str = "ServiceWorker.unregister"; }
638
639impl<'a> crate::CdpCommand<'a> for UnregisterParams<'a> {
640    const METHOD: &'static str = "ServiceWorker.unregister";
641    type Response = crate::EmptyReturns;
642}
643
644
645#[derive(Debug, Clone, Serialize, Deserialize, Default)]
646#[serde(rename_all = "camelCase")]
647pub struct UpdateRegistrationParams<'a> {
648    #[serde(rename = "scopeURL")]
649    scope_url: Cow<'a, str>,
650}
651
652impl<'a> UpdateRegistrationParams<'a> {
653    /// Creates a builder for this type with the required parameters:
654    /// * `scope_url`: 
655    pub fn builder(scope_url: impl Into<Cow<'a, str>>) -> UpdateRegistrationParamsBuilder<'a> {
656        UpdateRegistrationParamsBuilder {
657            scope_url: scope_url.into(),
658        }
659    }
660    pub fn scope_url(&self) -> &str { self.scope_url.as_ref() }
661}
662
663
664pub struct UpdateRegistrationParamsBuilder<'a> {
665    scope_url: Cow<'a, str>,
666}
667
668impl<'a> UpdateRegistrationParamsBuilder<'a> {
669    pub fn build(self) -> UpdateRegistrationParams<'a> {
670        UpdateRegistrationParams {
671            scope_url: self.scope_url,
672        }
673    }
674}
675
676impl<'a> UpdateRegistrationParams<'a> { pub const METHOD: &'static str = "ServiceWorker.updateRegistration"; }
677
678impl<'a> crate::CdpCommand<'a> for UpdateRegistrationParams<'a> {
679    const METHOD: &'static str = "ServiceWorker.updateRegistration";
680    type Response = crate::EmptyReturns;
681}