Skip to main content

rustenium_cdp_definitions/browser_protocol/cast/
commands.rs

1use serde::{Deserialize, Serialize};
2#[doc = "Starts observing for sinks that can be used for tab mirroring, and if set,\nsinks compatible with |presentationUrl| as well. When sinks are found, a\n|sinksUpdated| event is fired.\nAlso starts observing for issue messages. When an issue is added or removed,\nan |issueUpdated| event is fired.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-enable)"]
3#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4pub struct EnableParams {
5    #[serde(rename = "presentationUrl")]
6    #[serde(skip_serializing_if = "Option::is_none")]
7    #[serde(default)]
8    pub presentation_url: Option<String>,
9}
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11pub enum EnableMethod {
12    #[serde(rename = "Cast.enable")]
13    Enable,
14}
15#[doc = "Starts observing for sinks that can be used for tab mirroring, and if set,\nsinks compatible with |presentationUrl| as well. When sinks are found, a\n|sinksUpdated| event is fired.\nAlso starts observing for issue messages. When an issue is added or removed,\nan |issueUpdated| event is fired.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-enable)"]
16#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
17pub struct Enable {
18    pub method: EnableMethod,
19    pub params: EnableParams,
20}
21impl Enable {
22    pub const IDENTIFIER: &'static str = "Cast.enable";
23    pub fn identifier(&self) -> &'static str {
24        Self::IDENTIFIER
25    }
26}
27impl crate::CommandResult for Enable {
28    type Result = super::results::EnableResult;
29}
30#[doc = "Stops observing for sinks and issues.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-disable)"]
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32pub struct DisableParams {}
33#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
34pub enum DisableMethod {
35    #[serde(rename = "Cast.disable")]
36    Disable,
37}
38#[doc = "Stops observing for sinks and issues.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-disable)"]
39#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
40pub struct Disable {
41    pub method: DisableMethod,
42    pub params: DisableParams,
43}
44impl Disable {
45    pub const IDENTIFIER: &'static str = "Cast.disable";
46    pub fn identifier(&self) -> &'static str {
47        Self::IDENTIFIER
48    }
49}
50impl crate::CommandResult for Disable {
51    type Result = super::results::DisableResult;
52}
53#[doc = "Sets a sink to be used when the web page requests the browser to choose a\nsink via Presentation API, Remote Playback API, or Cast SDK.\n[setSinkToUse](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-setSinkToUse)"]
54#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
55pub struct SetSinkToUseParams {
56    #[serde(rename = "sinkName")]
57    pub sink_name: String,
58}
59impl SetSinkToUseParams {
60    pub fn new(sink_name: impl Into<String>) -> Self {
61        Self {
62            sink_name: sink_name.into(),
63        }
64    }
65}
66impl<T: Into<String>> From<T> for SetSinkToUseParams {
67    fn from(url: T) -> Self {
68        SetSinkToUseParams::new(url)
69    }
70}
71#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
72pub enum SetSinkToUseMethod {
73    #[serde(rename = "Cast.setSinkToUse")]
74    SetSinkToUse,
75}
76#[doc = "Sets a sink to be used when the web page requests the browser to choose a\nsink via Presentation API, Remote Playback API, or Cast SDK.\n[setSinkToUse](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-setSinkToUse)"]
77#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
78pub struct SetSinkToUse {
79    pub method: SetSinkToUseMethod,
80    pub params: SetSinkToUseParams,
81}
82impl SetSinkToUse {
83    pub const IDENTIFIER: &'static str = "Cast.setSinkToUse";
84    pub fn identifier(&self) -> &'static str {
85        Self::IDENTIFIER
86    }
87}
88impl crate::CommandResult for SetSinkToUse {
89    type Result = super::results::SetSinkToUseResult;
90}
91#[doc = "Starts mirroring the desktop to the sink.\n[startDesktopMirroring](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-startDesktopMirroring)"]
92#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
93pub struct StartDesktopMirroringParams {
94    #[serde(rename = "sinkName")]
95    pub sink_name: String,
96}
97impl StartDesktopMirroringParams {
98    pub fn new(sink_name: impl Into<String>) -> Self {
99        Self {
100            sink_name: sink_name.into(),
101        }
102    }
103}
104impl<T: Into<String>> From<T> for StartDesktopMirroringParams {
105    fn from(url: T) -> Self {
106        StartDesktopMirroringParams::new(url)
107    }
108}
109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
110pub enum StartDesktopMirroringMethod {
111    #[serde(rename = "Cast.startDesktopMirroring")]
112    StartDesktopMirroring,
113}
114#[doc = "Starts mirroring the desktop to the sink.\n[startDesktopMirroring](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-startDesktopMirroring)"]
115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
116pub struct StartDesktopMirroring {
117    pub method: StartDesktopMirroringMethod,
118    pub params: StartDesktopMirroringParams,
119}
120impl StartDesktopMirroring {
121    pub const IDENTIFIER: &'static str = "Cast.startDesktopMirroring";
122    pub fn identifier(&self) -> &'static str {
123        Self::IDENTIFIER
124    }
125}
126impl crate::CommandResult for StartDesktopMirroring {
127    type Result = super::results::StartDesktopMirroringResult;
128}
129#[doc = "Starts mirroring the tab to the sink.\n[startTabMirroring](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-startTabMirroring)"]
130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
131pub struct StartTabMirroringParams {
132    #[serde(rename = "sinkName")]
133    pub sink_name: String,
134}
135impl StartTabMirroringParams {
136    pub fn new(sink_name: impl Into<String>) -> Self {
137        Self {
138            sink_name: sink_name.into(),
139        }
140    }
141}
142impl<T: Into<String>> From<T> for StartTabMirroringParams {
143    fn from(url: T) -> Self {
144        StartTabMirroringParams::new(url)
145    }
146}
147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
148pub enum StartTabMirroringMethod {
149    #[serde(rename = "Cast.startTabMirroring")]
150    StartTabMirroring,
151}
152#[doc = "Starts mirroring the tab to the sink.\n[startTabMirroring](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-startTabMirroring)"]
153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
154pub struct StartTabMirroring {
155    pub method: StartTabMirroringMethod,
156    pub params: StartTabMirroringParams,
157}
158impl StartTabMirroring {
159    pub const IDENTIFIER: &'static str = "Cast.startTabMirroring";
160    pub fn identifier(&self) -> &'static str {
161        Self::IDENTIFIER
162    }
163}
164impl crate::CommandResult for StartTabMirroring {
165    type Result = super::results::StartTabMirroringResult;
166}
167#[doc = "Stops the active Cast session on the sink.\n[stopCasting](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-stopCasting)"]
168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
169pub struct StopCastingParams {
170    #[serde(rename = "sinkName")]
171    pub sink_name: String,
172}
173impl StopCastingParams {
174    pub fn new(sink_name: impl Into<String>) -> Self {
175        Self {
176            sink_name: sink_name.into(),
177        }
178    }
179}
180impl<T: Into<String>> From<T> for StopCastingParams {
181    fn from(url: T) -> Self {
182        StopCastingParams::new(url)
183    }
184}
185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
186pub enum StopCastingMethod {
187    #[serde(rename = "Cast.stopCasting")]
188    StopCasting,
189}
190#[doc = "Stops the active Cast session on the sink.\n[stopCasting](https://chromedevtools.github.io/devtools-protocol/tot/Cast/#method-stopCasting)"]
191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
192pub struct StopCasting {
193    pub method: StopCastingMethod,
194    pub params: StopCastingParams,
195}
196impl StopCasting {
197    pub const IDENTIFIER: &'static str = "Cast.stopCasting";
198    pub fn identifier(&self) -> &'static str {
199        Self::IDENTIFIER
200    }
201}
202impl crate::CommandResult for StopCasting {
203    type Result = super::results::StopCastingResult;
204}
205group_enum ! (CastCommands { Enable (Enable) , Disable (Disable) , SetSinkToUse (SetSinkToUse) , StartDesktopMirroring (StartDesktopMirroring) , StartTabMirroring (StartTabMirroring) , StopCasting (StopCasting) } + identifiable);