rustenium_cdp_definitions/browser_protocol/background_service/
commands.rs1use serde::{Deserialize, Serialize};
2#[doc = "Enables event updates for the service.\n[startObserving](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-startObserving)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct StartObservingParams {
5 #[serde(rename = "service")]
6 pub service: super::types::ServiceName,
7}
8impl StartObservingParams {
9 pub fn new(service: impl Into<super::types::ServiceName>) -> Self {
10 Self {
11 service: service.into(),
12 }
13 }
14}
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
16pub enum StartObservingMethod {
17 #[serde(rename = "BackgroundService.startObserving")]
18 StartObserving,
19}
20#[doc = "Enables event updates for the service.\n[startObserving](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-startObserving)"]
21#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub struct StartObserving {
23 pub method: StartObservingMethod,
24 pub params: StartObservingParams,
25}
26impl StartObserving {
27 pub const IDENTIFIER: &'static str = "BackgroundService.startObserving";
28 pub fn identifier(&self) -> &'static str {
29 Self::IDENTIFIER
30 }
31}
32impl crate::CommandResult for StartObserving {
33 type Result = super::results::StartObservingResult;
34}
35#[doc = "Disables event updates for the service.\n[stopObserving](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-stopObserving)"]
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
37pub struct StopObservingParams {
38 #[serde(rename = "service")]
39 pub service: super::types::ServiceName,
40}
41impl StopObservingParams {
42 pub fn new(service: impl Into<super::types::ServiceName>) -> Self {
43 Self {
44 service: service.into(),
45 }
46 }
47}
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
49pub enum StopObservingMethod {
50 #[serde(rename = "BackgroundService.stopObserving")]
51 StopObserving,
52}
53#[doc = "Disables event updates for the service.\n[stopObserving](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-stopObserving)"]
54#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
55pub struct StopObserving {
56 pub method: StopObservingMethod,
57 pub params: StopObservingParams,
58}
59impl StopObserving {
60 pub const IDENTIFIER: &'static str = "BackgroundService.stopObserving";
61 pub fn identifier(&self) -> &'static str {
62 Self::IDENTIFIER
63 }
64}
65impl crate::CommandResult for StopObserving {
66 type Result = super::results::StopObservingResult;
67}
68#[doc = "Set the recording state for the service.\n[setRecording](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-setRecording)"]
69#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
70pub struct SetRecordingParams {
71 #[serde(rename = "shouldRecord")]
72 pub should_record: bool,
73 #[serde(rename = "service")]
74 pub service: super::types::ServiceName,
75}
76impl SetRecordingParams {
77 pub fn new(
78 should_record: impl Into<bool>,
79 service: impl Into<super::types::ServiceName>,
80 ) -> Self {
81 Self {
82 should_record: should_record.into(),
83 service: service.into(),
84 }
85 }
86}
87#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
88pub enum SetRecordingMethod {
89 #[serde(rename = "BackgroundService.setRecording")]
90 SetRecording,
91}
92#[doc = "Set the recording state for the service.\n[setRecording](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-setRecording)"]
93#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
94pub struct SetRecording {
95 pub method: SetRecordingMethod,
96 pub params: SetRecordingParams,
97}
98impl SetRecording {
99 pub const IDENTIFIER: &'static str = "BackgroundService.setRecording";
100 pub fn identifier(&self) -> &'static str {
101 Self::IDENTIFIER
102 }
103}
104impl crate::CommandResult for SetRecording {
105 type Result = super::results::SetRecordingResult;
106}
107#[doc = "Clears all stored data for the service.\n[clearEvents](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-clearEvents)"]
108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
109pub struct ClearEventsParams {
110 #[serde(rename = "service")]
111 pub service: super::types::ServiceName,
112}
113impl ClearEventsParams {
114 pub fn new(service: impl Into<super::types::ServiceName>) -> Self {
115 Self {
116 service: service.into(),
117 }
118 }
119}
120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
121pub enum ClearEventsMethod {
122 #[serde(rename = "BackgroundService.clearEvents")]
123 ClearEvents,
124}
125#[doc = "Clears all stored data for the service.\n[clearEvents](https://chromedevtools.github.io/devtools-protocol/tot/BackgroundService/#method-clearEvents)"]
126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
127pub struct ClearEvents {
128 pub method: ClearEventsMethod,
129 pub params: ClearEventsParams,
130}
131impl ClearEvents {
132 pub const IDENTIFIER: &'static str = "BackgroundService.clearEvents";
133 pub fn identifier(&self) -> &'static str {
134 Self::IDENTIFIER
135 }
136}
137impl crate::CommandResult for ClearEvents {
138 type Result = super::results::ClearEventsResult;
139}
140group_enum ! (BackgroundServiceCommands { StartObserving (StartObserving) , StopObserving (StopObserving) , SetRecording (SetRecording) , ClearEvents (ClearEvents) } + identifiable);