Skip to main content

rustenium_cdp_definitions/browser_protocol/animation/
commands.rs

1use serde::{Deserialize, Serialize};
2#[doc = "Disables animation domain notifications.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-disable)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct DisableParams {}
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub enum DisableMethod {
7    #[serde(rename = "Animation.disable")]
8    Disable,
9}
10#[doc = "Disables animation domain notifications.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-disable)"]
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12pub struct Disable {
13    pub method: DisableMethod,
14    pub params: DisableParams,
15}
16impl Disable {
17    pub const IDENTIFIER: &'static str = "Animation.disable";
18    pub fn identifier(&self) -> &'static str {
19        Self::IDENTIFIER
20    }
21}
22impl crate::CommandResult for Disable {
23    type Result = super::results::DisableResult;
24}
25#[doc = "Enables animation domain notifications.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-enable)"]
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct EnableParams {}
28#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
29pub enum EnableMethod {
30    #[serde(rename = "Animation.enable")]
31    Enable,
32}
33#[doc = "Enables animation domain notifications.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-enable)"]
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct Enable {
36    pub method: EnableMethod,
37    pub params: EnableParams,
38}
39impl Enable {
40    pub const IDENTIFIER: &'static str = "Animation.enable";
41    pub fn identifier(&self) -> &'static str {
42        Self::IDENTIFIER
43    }
44}
45impl crate::CommandResult for Enable {
46    type Result = super::results::EnableResult;
47}
48#[doc = "Returns the current time of the an animation.\n[getCurrentTime](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-getCurrentTime)"]
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
50pub struct GetCurrentTimeParams {
51    #[doc = "Id of animation."]
52    #[serde(rename = "id")]
53    pub id: String,
54}
55impl GetCurrentTimeParams {
56    pub fn new(id: impl Into<String>) -> Self {
57        Self { id: id.into() }
58    }
59}
60impl<T: Into<String>> From<T> for GetCurrentTimeParams {
61    fn from(url: T) -> Self {
62        GetCurrentTimeParams::new(url)
63    }
64}
65#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
66pub enum GetCurrentTimeMethod {
67    #[serde(rename = "Animation.getCurrentTime")]
68    GetCurrentTime,
69}
70#[doc = "Returns the current time of the an animation.\n[getCurrentTime](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-getCurrentTime)"]
71#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
72pub struct GetCurrentTime {
73    pub method: GetCurrentTimeMethod,
74    pub params: GetCurrentTimeParams,
75}
76impl GetCurrentTime {
77    pub const IDENTIFIER: &'static str = "Animation.getCurrentTime";
78    pub fn identifier(&self) -> &'static str {
79        Self::IDENTIFIER
80    }
81}
82impl crate::CommandResult for GetCurrentTime {
83    type Result = super::results::GetCurrentTimeResult;
84}
85#[doc = "Gets the playback rate of the document timeline.\n[getPlaybackRate](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-getPlaybackRate)"]
86#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
87pub struct GetPlaybackRateParams {}
88#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
89pub enum GetPlaybackRateMethod {
90    #[serde(rename = "Animation.getPlaybackRate")]
91    GetPlaybackRate,
92}
93#[doc = "Gets the playback rate of the document timeline.\n[getPlaybackRate](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-getPlaybackRate)"]
94#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
95pub struct GetPlaybackRate {
96    pub method: GetPlaybackRateMethod,
97    pub params: GetPlaybackRateParams,
98}
99impl GetPlaybackRate {
100    pub const IDENTIFIER: &'static str = "Animation.getPlaybackRate";
101    pub fn identifier(&self) -> &'static str {
102        Self::IDENTIFIER
103    }
104}
105impl crate::CommandResult for GetPlaybackRate {
106    type Result = super::results::GetPlaybackRateResult;
107}
108#[doc = "Releases a set of animations to no longer be manipulated.\n[releaseAnimations](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-releaseAnimations)"]
109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
110pub struct ReleaseAnimationsParams {
111    #[doc = "List of animation ids to seek."]
112    #[serde(rename = "animations")]
113    #[serde(skip_serializing_if = "Vec::is_empty")]
114    pub animations: Vec<String>,
115}
116impl ReleaseAnimationsParams {
117    pub fn new(animations: Vec<String>) -> Self {
118        Self { animations }
119    }
120}
121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
122pub enum ReleaseAnimationsMethod {
123    #[serde(rename = "Animation.releaseAnimations")]
124    ReleaseAnimations,
125}
126#[doc = "Releases a set of animations to no longer be manipulated.\n[releaseAnimations](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-releaseAnimations)"]
127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
128pub struct ReleaseAnimations {
129    pub method: ReleaseAnimationsMethod,
130    pub params: ReleaseAnimationsParams,
131}
132impl ReleaseAnimations {
133    pub const IDENTIFIER: &'static str = "Animation.releaseAnimations";
134    pub fn identifier(&self) -> &'static str {
135        Self::IDENTIFIER
136    }
137}
138impl crate::CommandResult for ReleaseAnimations {
139    type Result = super::results::ReleaseAnimationsResult;
140}
141#[doc = "Gets the remote object of the Animation.\n[resolveAnimation](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-resolveAnimation)"]
142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
143pub struct ResolveAnimationParams {
144    #[doc = "Animation id."]
145    #[serde(rename = "animationId")]
146    pub animation_id: String,
147}
148impl ResolveAnimationParams {
149    pub fn new(animation_id: impl Into<String>) -> Self {
150        Self {
151            animation_id: animation_id.into(),
152        }
153    }
154}
155impl<T: Into<String>> From<T> for ResolveAnimationParams {
156    fn from(url: T) -> Self {
157        ResolveAnimationParams::new(url)
158    }
159}
160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
161pub enum ResolveAnimationMethod {
162    #[serde(rename = "Animation.resolveAnimation")]
163    ResolveAnimation,
164}
165#[doc = "Gets the remote object of the Animation.\n[resolveAnimation](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-resolveAnimation)"]
166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
167pub struct ResolveAnimation {
168    pub method: ResolveAnimationMethod,
169    pub params: ResolveAnimationParams,
170}
171impl ResolveAnimation {
172    pub const IDENTIFIER: &'static str = "Animation.resolveAnimation";
173    pub fn identifier(&self) -> &'static str {
174        Self::IDENTIFIER
175    }
176}
177impl crate::CommandResult for ResolveAnimation {
178    type Result = super::results::ResolveAnimationResult;
179}
180#[doc = "Seek a set of animations to a particular time within each animation.\n[seekAnimations](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-seekAnimations)"]
181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
182pub struct SeekAnimationsParams {
183    #[doc = "List of animation ids to seek."]
184    #[serde(rename = "animations")]
185    #[serde(skip_serializing_if = "Vec::is_empty")]
186    pub animations: Vec<String>,
187    #[doc = "Set the current time of each animation."]
188    #[serde(rename = "currentTime")]
189    pub current_time: f64,
190}
191impl SeekAnimationsParams {
192    pub fn new(animations: Vec<String>, current_time: impl Into<f64>) -> Self {
193        Self {
194            animations,
195            current_time: current_time.into(),
196        }
197    }
198}
199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
200pub enum SeekAnimationsMethod {
201    #[serde(rename = "Animation.seekAnimations")]
202    SeekAnimations,
203}
204#[doc = "Seek a set of animations to a particular time within each animation.\n[seekAnimations](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-seekAnimations)"]
205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
206pub struct SeekAnimations {
207    pub method: SeekAnimationsMethod,
208    pub params: SeekAnimationsParams,
209}
210impl SeekAnimations {
211    pub const IDENTIFIER: &'static str = "Animation.seekAnimations";
212    pub fn identifier(&self) -> &'static str {
213        Self::IDENTIFIER
214    }
215}
216impl crate::CommandResult for SeekAnimations {
217    type Result = super::results::SeekAnimationsResult;
218}
219#[doc = "Sets the paused state of a set of animations.\n[setPaused](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-setPaused)"]
220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
221pub struct SetPausedParams {
222    #[doc = "Animations to set the pause state of."]
223    #[serde(rename = "animations")]
224    #[serde(skip_serializing_if = "Vec::is_empty")]
225    pub animations: Vec<String>,
226    #[doc = "Paused state to set to."]
227    #[serde(rename = "paused")]
228    pub paused: bool,
229}
230impl SetPausedParams {
231    pub fn new(animations: Vec<String>, paused: impl Into<bool>) -> Self {
232        Self {
233            animations,
234            paused: paused.into(),
235        }
236    }
237}
238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
239pub enum SetPausedMethod {
240    #[serde(rename = "Animation.setPaused")]
241    SetPaused,
242}
243#[doc = "Sets the paused state of a set of animations.\n[setPaused](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-setPaused)"]
244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
245pub struct SetPaused {
246    pub method: SetPausedMethod,
247    pub params: SetPausedParams,
248}
249impl SetPaused {
250    pub const IDENTIFIER: &'static str = "Animation.setPaused";
251    pub fn identifier(&self) -> &'static str {
252        Self::IDENTIFIER
253    }
254}
255impl crate::CommandResult for SetPaused {
256    type Result = super::results::SetPausedResult;
257}
258#[doc = "Sets the playback rate of the document timeline.\n[setPlaybackRate](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-setPlaybackRate)"]
259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
260pub struct SetPlaybackRateParams {
261    #[doc = "Playback rate for animations on page"]
262    #[serde(rename = "playbackRate")]
263    pub playback_rate: f64,
264}
265impl SetPlaybackRateParams {
266    pub fn new(playback_rate: impl Into<f64>) -> Self {
267        Self {
268            playback_rate: playback_rate.into(),
269        }
270    }
271}
272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
273pub enum SetPlaybackRateMethod {
274    #[serde(rename = "Animation.setPlaybackRate")]
275    SetPlaybackRate,
276}
277#[doc = "Sets the playback rate of the document timeline.\n[setPlaybackRate](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-setPlaybackRate)"]
278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
279pub struct SetPlaybackRate {
280    pub method: SetPlaybackRateMethod,
281    pub params: SetPlaybackRateParams,
282}
283impl SetPlaybackRate {
284    pub const IDENTIFIER: &'static str = "Animation.setPlaybackRate";
285    pub fn identifier(&self) -> &'static str {
286        Self::IDENTIFIER
287    }
288}
289impl crate::CommandResult for SetPlaybackRate {
290    type Result = super::results::SetPlaybackRateResult;
291}
292#[doc = "Sets the timing of an animation node.\n[setTiming](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-setTiming)"]
293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
294pub struct SetTimingParams {
295    #[doc = "Animation id."]
296    #[serde(rename = "animationId")]
297    pub animation_id: String,
298    #[doc = "Duration of the animation."]
299    #[serde(rename = "duration")]
300    pub duration: f64,
301    #[doc = "Delay of the animation."]
302    #[serde(rename = "delay")]
303    pub delay: f64,
304}
305impl SetTimingParams {
306    pub fn new(
307        animation_id: impl Into<String>,
308        duration: impl Into<f64>,
309        delay: impl Into<f64>,
310    ) -> Self {
311        Self {
312            animation_id: animation_id.into(),
313            duration: duration.into(),
314            delay: delay.into(),
315        }
316    }
317}
318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
319pub enum SetTimingMethod {
320    #[serde(rename = "Animation.setTiming")]
321    SetTiming,
322}
323#[doc = "Sets the timing of an animation node.\n[setTiming](https://chromedevtools.github.io/devtools-protocol/tot/Animation/#method-setTiming)"]
324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
325pub struct SetTiming {
326    pub method: SetTimingMethod,
327    pub params: SetTimingParams,
328}
329impl SetTiming {
330    pub const IDENTIFIER: &'static str = "Animation.setTiming";
331    pub fn identifier(&self) -> &'static str {
332        Self::IDENTIFIER
333    }
334}
335impl crate::CommandResult for SetTiming {
336    type Result = super::results::SetTimingResult;
337}
338group_enum ! (AnimationCommands { Disable (Disable) , Enable (Enable) , GetCurrentTime (GetCurrentTime) , GetPlaybackRate (GetPlaybackRate) , ReleaseAnimations (ReleaseAnimations) , ResolveAnimation (ResolveAnimation) , SeekAnimations (SeekAnimations) , SetPaused (SetPaused) , SetPlaybackRate (SetPlaybackRate) , SetTiming (SetTiming) } + identifiable);