Skip to main content

cdp_protocol/
cast.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: Cast
2#![allow(dead_code)]
3#[allow(unused_imports)]
4use super::types::*;
5#[allow(unused_imports)]
6use derive_builder::Builder;
7#[allow(unused_imports)]
8use serde::{Deserialize, Serialize};
9#[allow(unused_imports)]
10use serde_json::Value as Json;
11#[allow(deprecated)]
12#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
13#[builder(setter(into, strip_option))]
14#[serde(rename_all = "camelCase")]
15pub struct Sink {
16    #[serde(default)]
17    pub name: String,
18    #[serde(default)]
19    pub id: String,
20    #[builder(default)]
21    #[serde(skip_serializing_if = "Option::is_none")]
22    #[serde(default)]
23    #[doc = "Text describing the current session. Present only if there is an active\n session on the sink."]
24    pub session: Option<String>,
25}
26#[allow(deprecated)]
27#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
28#[builder(setter(into, strip_option))]
29#[serde(rename_all = "camelCase")]
30#[doc = "Starts observing for sinks that can be used for tab mirroring, and if set,\n sinks compatible with |presentationUrl| as well. When sinks are found, a\n |sinksUpdated| event is fired.\n Also starts observing for issue messages. When an issue is added or removed,\n an |issueUpdated| event is fired."]
31pub struct Enable {
32    #[builder(default)]
33    #[serde(skip_serializing_if = "Option::is_none")]
34    #[serde(default)]
35    pub presentation_url: Option<String>,
36}
37#[allow(deprecated)]
38#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
39pub struct Disable(pub Option<Json>);
40#[allow(deprecated)]
41#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
42#[builder(setter(into, strip_option))]
43#[serde(rename_all = "camelCase")]
44#[doc = "Sets a sink to be used when the web page requests the browser to choose a\n sink via Presentation API, Remote Playback API, or Cast SDK."]
45pub struct SetSinkToUse {
46    #[serde(default)]
47    pub sink_name: String,
48}
49#[allow(deprecated)]
50#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
51#[builder(setter(into, strip_option))]
52#[serde(rename_all = "camelCase")]
53#[doc = "Starts mirroring the desktop to the sink."]
54pub struct StartDesktopMirroring {
55    #[serde(default)]
56    pub sink_name: String,
57}
58#[allow(deprecated)]
59#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
60#[builder(setter(into, strip_option))]
61#[serde(rename_all = "camelCase")]
62#[doc = "Starts mirroring the tab to the sink."]
63pub struct StartTabMirroring {
64    #[serde(default)]
65    pub sink_name: String,
66}
67#[allow(deprecated)]
68#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
69#[builder(setter(into, strip_option))]
70#[serde(rename_all = "camelCase")]
71#[doc = "Stops the active Cast session on the sink."]
72pub struct StopCasting {
73    #[serde(default)]
74    pub sink_name: String,
75}
76#[allow(deprecated)]
77#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
78#[doc = "Starts observing for sinks that can be used for tab mirroring, and if set,\n sinks compatible with |presentationUrl| as well. When sinks are found, a\n |sinksUpdated| event is fired.\n Also starts observing for issue messages. When an issue is added or removed,\n an |issueUpdated| event is fired."]
79pub struct EnableReturnObject(pub Option<Json>);
80#[allow(deprecated)]
81#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
82#[doc = "Stops observing for sinks and issues."]
83pub struct DisableReturnObject(pub Option<Json>);
84#[allow(deprecated)]
85#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
86#[doc = "Sets a sink to be used when the web page requests the browser to choose a\n sink via Presentation API, Remote Playback API, or Cast SDK."]
87pub struct SetSinkToUseReturnObject(pub Option<Json>);
88#[allow(deprecated)]
89#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
90#[doc = "Starts mirroring the desktop to the sink."]
91pub struct StartDesktopMirroringReturnObject(pub Option<Json>);
92#[allow(deprecated)]
93#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
94#[doc = "Starts mirroring the tab to the sink."]
95pub struct StartTabMirroringReturnObject(pub Option<Json>);
96#[allow(deprecated)]
97#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
98#[doc = "Stops the active Cast session on the sink."]
99pub struct StopCastingReturnObject(pub Option<Json>);
100#[allow(deprecated)]
101impl Method for Enable {
102    const NAME: &'static str = "Cast.enable";
103    type ReturnObject = EnableReturnObject;
104}
105#[allow(deprecated)]
106impl Method for Disable {
107    const NAME: &'static str = "Cast.disable";
108    type ReturnObject = DisableReturnObject;
109}
110#[allow(deprecated)]
111impl Method for SetSinkToUse {
112    const NAME: &'static str = "Cast.setSinkToUse";
113    type ReturnObject = SetSinkToUseReturnObject;
114}
115#[allow(deprecated)]
116impl Method for StartDesktopMirroring {
117    const NAME: &'static str = "Cast.startDesktopMirroring";
118    type ReturnObject = StartDesktopMirroringReturnObject;
119}
120#[allow(deprecated)]
121impl Method for StartTabMirroring {
122    const NAME: &'static str = "Cast.startTabMirroring";
123    type ReturnObject = StartTabMirroringReturnObject;
124}
125#[allow(deprecated)]
126impl Method for StopCasting {
127    const NAME: &'static str = "Cast.stopCasting";
128    type ReturnObject = StopCastingReturnObject;
129}
130#[allow(dead_code)]
131pub mod events {
132    #[allow(unused_imports)]
133    use super::super::types::*;
134    #[allow(unused_imports)]
135    use derive_builder::Builder;
136    #[allow(unused_imports)]
137    use serde::{Deserialize, Serialize};
138    #[allow(unused_imports)]
139    use serde_json::Value as Json;
140    #[allow(deprecated)]
141    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
142    pub struct SinksUpdatedEvent {
143        pub params: SinksUpdatedEventParams,
144    }
145    #[allow(deprecated)]
146    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
147    #[serde(rename_all = "camelCase")]
148    pub struct SinksUpdatedEventParams {
149        pub sinks: Vec<super::Sink>,
150    }
151    #[allow(deprecated)]
152    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
153    pub struct IssueUpdatedEvent {
154        pub params: IssueUpdatedEventParams,
155    }
156    #[allow(deprecated)]
157    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
158    #[serde(rename_all = "camelCase")]
159    pub struct IssueUpdatedEventParams {
160        #[serde(default)]
161        pub issue_message: String,
162    }
163}