browser-protocol 0.1.3

Generated Rust types and commands for the Chrome DevTools Protocol (browser-protocol)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;

/// Animation instance.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Animation<'a> {
    /// 'Animation''s id.
    id: Cow<'a, str>,
    /// 'Animation''s name.
    name: Cow<'a, str>,
    /// 'Animation''s internal paused state.
    pausedState: bool,
    /// 'Animation''s play state.
    playState: Cow<'a, str>,
    /// 'Animation''s playback rate.
    playbackRate: f64,
    /// 'Animation''s start time.
    /// Milliseconds for time based animations and
    /// percentage [0 - 100] for scroll driven animations
    /// (i.e. when viewOrScrollTimeline exists).
    startTime: f64,
    /// 'Animation''s current time.
    currentTime: f64,
    /// Animation type of 'Animation'.
    #[serde(rename = "type")]
    type_: Cow<'a, str>,
    /// 'Animation''s source animation node.
    #[serde(skip_serializing_if = "Option::is_none")]
    source: Option<AnimationEffect<'a>>,
    /// A unique ID for 'Animation' representing the sources that triggered this CSS
    /// animation/transition.
    #[serde(skip_serializing_if = "Option::is_none")]
    cssId: Option<Cow<'a, str>>,
    /// View or scroll timeline
    #[serde(skip_serializing_if = "Option::is_none")]
    viewOrScrollTimeline: Option<ViewOrScrollTimeline>,
}

impl<'a> Animation<'a> {
    pub fn builder(id: impl Into<Cow<'a, str>>, name: impl Into<Cow<'a, str>>, pausedState: bool, playState: impl Into<Cow<'a, str>>, playbackRate: f64, startTime: f64, currentTime: f64, type_: impl Into<Cow<'a, str>>) -> AnimationBuilder<'a> {
        AnimationBuilder {
            id: id.into(),
            name: name.into(),
            pausedState: pausedState,
            playState: playState.into(),
            playbackRate: playbackRate,
            startTime: startTime,
            currentTime: currentTime,
            type_: type_.into(),
            source: None,
            cssId: None,
            viewOrScrollTimeline: None,
        }
    }
    pub fn id(&self) -> &str { self.id.as_ref() }
    pub fn name(&self) -> &str { self.name.as_ref() }
    pub fn pausedState(&self) -> bool { self.pausedState }
    pub fn playState(&self) -> &str { self.playState.as_ref() }
    pub fn playbackRate(&self) -> f64 { self.playbackRate }
    pub fn startTime(&self) -> f64 { self.startTime }
    pub fn currentTime(&self) -> f64 { self.currentTime }
    pub fn type_(&self) -> &str { self.type_.as_ref() }
    pub fn source(&self) -> Option<&AnimationEffect<'a>> { self.source.as_ref() }
    pub fn cssId(&self) -> Option<&str> { self.cssId.as_deref() }
    pub fn viewOrScrollTimeline(&self) -> Option<&ViewOrScrollTimeline> { self.viewOrScrollTimeline.as_ref() }
}


pub struct AnimationBuilder<'a> {
    id: Cow<'a, str>,
    name: Cow<'a, str>,
    pausedState: bool,
    playState: Cow<'a, str>,
    playbackRate: f64,
    startTime: f64,
    currentTime: f64,
    type_: Cow<'a, str>,
    source: Option<AnimationEffect<'a>>,
    cssId: Option<Cow<'a, str>>,
    viewOrScrollTimeline: Option<ViewOrScrollTimeline>,
}

impl<'a> AnimationBuilder<'a> {
    /// 'Animation''s source animation node.
    pub fn source(mut self, source: AnimationEffect<'a>) -> Self { self.source = Some(source); self }
    /// A unique ID for 'Animation' representing the sources that triggered this CSS
    /// animation/transition.
    pub fn cssId(mut self, cssId: impl Into<Cow<'a, str>>) -> Self { self.cssId = Some(cssId.into()); self }
    /// View or scroll timeline
    pub fn viewOrScrollTimeline(mut self, viewOrScrollTimeline: ViewOrScrollTimeline) -> Self { self.viewOrScrollTimeline = Some(viewOrScrollTimeline); self }
    pub fn build(self) -> Animation<'a> {
        Animation {
            id: self.id,
            name: self.name,
            pausedState: self.pausedState,
            playState: self.playState,
            playbackRate: self.playbackRate,
            startTime: self.startTime,
            currentTime: self.currentTime,
            type_: self.type_,
            source: self.source,
            cssId: self.cssId,
            viewOrScrollTimeline: self.viewOrScrollTimeline,
        }
    }
}

/// Timeline instance

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ViewOrScrollTimeline {
    /// Scroll container node
    #[serde(skip_serializing_if = "Option::is_none")]
    sourceNodeId: Option<crate::dom::BackendNodeId>,
    /// Represents the starting scroll position of the timeline
    /// as a length offset in pixels from scroll origin.
    #[serde(skip_serializing_if = "Option::is_none")]
    startOffset: Option<f64>,
    /// Represents the ending scroll position of the timeline
    /// as a length offset in pixels from scroll origin.
    #[serde(skip_serializing_if = "Option::is_none")]
    endOffset: Option<f64>,
    /// The element whose principal box's visibility in the
    /// scrollport defined the progress of the timeline.
    /// Does not exist for animations with ScrollTimeline
    #[serde(skip_serializing_if = "Option::is_none")]
    subjectNodeId: Option<crate::dom::BackendNodeId>,
    /// Orientation of the scroll
    axis: crate::dom::ScrollOrientation,
}

impl ViewOrScrollTimeline {
    pub fn builder(axis: crate::dom::ScrollOrientation) -> ViewOrScrollTimelineBuilder {
        ViewOrScrollTimelineBuilder {
            sourceNodeId: None,
            startOffset: None,
            endOffset: None,
            subjectNodeId: None,
            axis: axis,
        }
    }
    pub fn sourceNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.sourceNodeId.as_ref() }
    pub fn startOffset(&self) -> Option<f64> { self.startOffset }
    pub fn endOffset(&self) -> Option<f64> { self.endOffset }
    pub fn subjectNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.subjectNodeId.as_ref() }
    pub fn axis(&self) -> &crate::dom::ScrollOrientation { &self.axis }
}


pub struct ViewOrScrollTimelineBuilder {
    sourceNodeId: Option<crate::dom::BackendNodeId>,
    startOffset: Option<f64>,
    endOffset: Option<f64>,
    subjectNodeId: Option<crate::dom::BackendNodeId>,
    axis: crate::dom::ScrollOrientation,
}

impl ViewOrScrollTimelineBuilder {
    /// Scroll container node
    pub fn sourceNodeId(mut self, sourceNodeId: crate::dom::BackendNodeId) -> Self { self.sourceNodeId = Some(sourceNodeId); self }
    /// Represents the starting scroll position of the timeline
    /// as a length offset in pixels from scroll origin.
    pub fn startOffset(mut self, startOffset: f64) -> Self { self.startOffset = Some(startOffset); self }
    /// Represents the ending scroll position of the timeline
    /// as a length offset in pixels from scroll origin.
    pub fn endOffset(mut self, endOffset: f64) -> Self { self.endOffset = Some(endOffset); self }
    /// The element whose principal box's visibility in the
    /// scrollport defined the progress of the timeline.
    /// Does not exist for animations with ScrollTimeline
    pub fn subjectNodeId(mut self, subjectNodeId: crate::dom::BackendNodeId) -> Self { self.subjectNodeId = Some(subjectNodeId); self }
    pub fn build(self) -> ViewOrScrollTimeline {
        ViewOrScrollTimeline {
            sourceNodeId: self.sourceNodeId,
            startOffset: self.startOffset,
            endOffset: self.endOffset,
            subjectNodeId: self.subjectNodeId,
            axis: self.axis,
        }
    }
}

/// AnimationEffect instance

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AnimationEffect<'a> {
    /// 'AnimationEffect''s delay.
    delay: f64,
    /// 'AnimationEffect''s end delay.
    endDelay: f64,
    /// 'AnimationEffect''s iteration start.
    iterationStart: f64,
    /// 'AnimationEffect''s iterations. Omitted if the value is infinite.
    #[serde(skip_serializing_if = "Option::is_none")]
    iterations: Option<f64>,
    /// 'AnimationEffect''s iteration duration.
    /// Milliseconds for time based animations and
    /// percentage [0 - 100] for scroll driven animations
    /// (i.e. when viewOrScrollTimeline exists).
    duration: f64,
    /// 'AnimationEffect''s playback direction.
    direction: Cow<'a, str>,
    /// 'AnimationEffect''s fill mode.
    fill: Cow<'a, str>,
    /// 'AnimationEffect''s target node.
    #[serde(skip_serializing_if = "Option::is_none")]
    backendNodeId: Option<crate::dom::BackendNodeId>,
    /// 'AnimationEffect''s keyframes.
    #[serde(skip_serializing_if = "Option::is_none")]
    keyframesRule: Option<KeyframesRule<'a>>,
    /// 'AnimationEffect''s timing function.
    easing: Cow<'a, str>,
}

impl<'a> AnimationEffect<'a> {
    pub fn builder(delay: f64, endDelay: f64, iterationStart: f64, duration: f64, direction: impl Into<Cow<'a, str>>, fill: impl Into<Cow<'a, str>>, easing: impl Into<Cow<'a, str>>) -> AnimationEffectBuilder<'a> {
        AnimationEffectBuilder {
            delay: delay,
            endDelay: endDelay,
            iterationStart: iterationStart,
            iterations: None,
            duration: duration,
            direction: direction.into(),
            fill: fill.into(),
            backendNodeId: None,
            keyframesRule: None,
            easing: easing.into(),
        }
    }
    pub fn delay(&self) -> f64 { self.delay }
    pub fn endDelay(&self) -> f64 { self.endDelay }
    pub fn iterationStart(&self) -> f64 { self.iterationStart }
    pub fn iterations(&self) -> Option<f64> { self.iterations }
    pub fn duration(&self) -> f64 { self.duration }
    pub fn direction(&self) -> &str { self.direction.as_ref() }
    pub fn fill(&self) -> &str { self.fill.as_ref() }
    pub fn backendNodeId(&self) -> Option<&crate::dom::BackendNodeId> { self.backendNodeId.as_ref() }
    pub fn keyframesRule(&self) -> Option<&KeyframesRule<'a>> { self.keyframesRule.as_ref() }
    pub fn easing(&self) -> &str { self.easing.as_ref() }
}


pub struct AnimationEffectBuilder<'a> {
    delay: f64,
    endDelay: f64,
    iterationStart: f64,
    iterations: Option<f64>,
    duration: f64,
    direction: Cow<'a, str>,
    fill: Cow<'a, str>,
    backendNodeId: Option<crate::dom::BackendNodeId>,
    keyframesRule: Option<KeyframesRule<'a>>,
    easing: Cow<'a, str>,
}

impl<'a> AnimationEffectBuilder<'a> {
    /// 'AnimationEffect''s iterations. Omitted if the value is infinite.
    pub fn iterations(mut self, iterations: f64) -> Self { self.iterations = Some(iterations); self }
    /// 'AnimationEffect''s target node.
    pub fn backendNodeId(mut self, backendNodeId: crate::dom::BackendNodeId) -> Self { self.backendNodeId = Some(backendNodeId); self }
    /// 'AnimationEffect''s keyframes.
    pub fn keyframesRule(mut self, keyframesRule: KeyframesRule<'a>) -> Self { self.keyframesRule = Some(keyframesRule); self }
    pub fn build(self) -> AnimationEffect<'a> {
        AnimationEffect {
            delay: self.delay,
            endDelay: self.endDelay,
            iterationStart: self.iterationStart,
            iterations: self.iterations,
            duration: self.duration,
            direction: self.direction,
            fill: self.fill,
            backendNodeId: self.backendNodeId,
            keyframesRule: self.keyframesRule,
            easing: self.easing,
        }
    }
}

/// Keyframes Rule

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct KeyframesRule<'a> {
    /// CSS keyframed animation's name.
    #[serde(skip_serializing_if = "Option::is_none")]
    name: Option<Cow<'a, str>>,
    /// List of animation keyframes.
    keyframes: Vec<KeyframeStyle<'a>>,
}

impl<'a> KeyframesRule<'a> {
    pub fn builder(keyframes: Vec<KeyframeStyle<'a>>) -> KeyframesRuleBuilder<'a> {
        KeyframesRuleBuilder {
            name: None,
            keyframes: keyframes,
        }
    }
    pub fn name(&self) -> Option<&str> { self.name.as_deref() }
    pub fn keyframes(&self) -> &[KeyframeStyle<'a>] { &self.keyframes }
}


pub struct KeyframesRuleBuilder<'a> {
    name: Option<Cow<'a, str>>,
    keyframes: Vec<KeyframeStyle<'a>>,
}

impl<'a> KeyframesRuleBuilder<'a> {
    /// CSS keyframed animation's name.
    pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
    pub fn build(self) -> KeyframesRule<'a> {
        KeyframesRule {
            name: self.name,
            keyframes: self.keyframes,
        }
    }
}

/// Keyframe Style

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct KeyframeStyle<'a> {
    /// Keyframe's time offset.
    offset: Cow<'a, str>,
    /// 'AnimationEffect''s timing function.
    easing: Cow<'a, str>,
}

impl<'a> KeyframeStyle<'a> {
    pub fn builder(offset: impl Into<Cow<'a, str>>, easing: impl Into<Cow<'a, str>>) -> KeyframeStyleBuilder<'a> {
        KeyframeStyleBuilder {
            offset: offset.into(),
            easing: easing.into(),
        }
    }
    pub fn offset(&self) -> &str { self.offset.as_ref() }
    pub fn easing(&self) -> &str { self.easing.as_ref() }
}


pub struct KeyframeStyleBuilder<'a> {
    offset: Cow<'a, str>,
    easing: Cow<'a, str>,
}

impl<'a> KeyframeStyleBuilder<'a> {
    pub fn build(self) -> KeyframeStyle<'a> {
        KeyframeStyle {
            offset: self.offset,
            easing: self.easing,
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}

impl DisableParams { pub const METHOD: &'static str = "Animation.disable"; }

impl<'a> crate::CdpCommand<'a> for DisableParams {
    const METHOD: &'static str = "Animation.disable";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}

impl EnableParams { pub const METHOD: &'static str = "Animation.enable"; }

impl<'a> crate::CdpCommand<'a> for EnableParams {
    const METHOD: &'static str = "Animation.enable";
    type Response = crate::EmptyReturns;
}

/// Returns the current time of the an animation.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetCurrentTimeParams<'a> {
    /// Id of animation.
    id: Cow<'a, str>,
}

impl<'a> GetCurrentTimeParams<'a> {
    pub fn builder(id: impl Into<Cow<'a, str>>) -> GetCurrentTimeParamsBuilder<'a> {
        GetCurrentTimeParamsBuilder {
            id: id.into(),
        }
    }
    pub fn id(&self) -> &str { self.id.as_ref() }
}


pub struct GetCurrentTimeParamsBuilder<'a> {
    id: Cow<'a, str>,
}

impl<'a> GetCurrentTimeParamsBuilder<'a> {
    pub fn build(self) -> GetCurrentTimeParams<'a> {
        GetCurrentTimeParams {
            id: self.id,
        }
    }
}

/// Returns the current time of the an animation.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetCurrentTimeReturns {
    /// Current time of the page.
    currentTime: f64,
}

impl GetCurrentTimeReturns {
    pub fn builder(currentTime: f64) -> GetCurrentTimeReturnsBuilder {
        GetCurrentTimeReturnsBuilder {
            currentTime: currentTime,
        }
    }
    pub fn currentTime(&self) -> f64 { self.currentTime }
}


pub struct GetCurrentTimeReturnsBuilder {
    currentTime: f64,
}

impl GetCurrentTimeReturnsBuilder {
    pub fn build(self) -> GetCurrentTimeReturns {
        GetCurrentTimeReturns {
            currentTime: self.currentTime,
        }
    }
}

impl<'a> GetCurrentTimeParams<'a> { pub const METHOD: &'static str = "Animation.getCurrentTime"; }

impl<'a> crate::CdpCommand<'a> for GetCurrentTimeParams<'a> {
    const METHOD: &'static str = "Animation.getCurrentTime";
    type Response = GetCurrentTimeReturns;
}

/// Gets the playback rate of the document timeline.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetPlaybackRateReturns {
    /// Playback rate for animations on page.
    playbackRate: f64,
}

impl GetPlaybackRateReturns {
    pub fn builder(playbackRate: f64) -> GetPlaybackRateReturnsBuilder {
        GetPlaybackRateReturnsBuilder {
            playbackRate: playbackRate,
        }
    }
    pub fn playbackRate(&self) -> f64 { self.playbackRate }
}


pub struct GetPlaybackRateReturnsBuilder {
    playbackRate: f64,
}

impl GetPlaybackRateReturnsBuilder {
    pub fn build(self) -> GetPlaybackRateReturns {
        GetPlaybackRateReturns {
            playbackRate: self.playbackRate,
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetPlaybackRateParams {}

impl GetPlaybackRateParams { pub const METHOD: &'static str = "Animation.getPlaybackRate"; }

impl<'a> crate::CdpCommand<'a> for GetPlaybackRateParams {
    const METHOD: &'static str = "Animation.getPlaybackRate";
    type Response = GetPlaybackRateReturns;
}

/// Releases a set of animations to no longer be manipulated.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseAnimationsParams<'a> {
    /// List of animation ids to seek.
    animations: Vec<Cow<'a, str>>,
}

impl<'a> ReleaseAnimationsParams<'a> {
    pub fn builder(animations: Vec<Cow<'a, str>>) -> ReleaseAnimationsParamsBuilder<'a> {
        ReleaseAnimationsParamsBuilder {
            animations: animations,
        }
    }
    pub fn animations(&self) -> &[Cow<'a, str>] { &self.animations }
}


pub struct ReleaseAnimationsParamsBuilder<'a> {
    animations: Vec<Cow<'a, str>>,
}

impl<'a> ReleaseAnimationsParamsBuilder<'a> {
    pub fn build(self) -> ReleaseAnimationsParams<'a> {
        ReleaseAnimationsParams {
            animations: self.animations,
        }
    }
}

impl<'a> ReleaseAnimationsParams<'a> { pub const METHOD: &'static str = "Animation.releaseAnimations"; }

impl<'a> crate::CdpCommand<'a> for ReleaseAnimationsParams<'a> {
    const METHOD: &'static str = "Animation.releaseAnimations";
    type Response = crate::EmptyReturns;
}

/// Gets the remote object of the Animation.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ResolveAnimationParams<'a> {
    /// Animation id.
    animationId: Cow<'a, str>,
}

impl<'a> ResolveAnimationParams<'a> {
    pub fn builder(animationId: impl Into<Cow<'a, str>>) -> ResolveAnimationParamsBuilder<'a> {
        ResolveAnimationParamsBuilder {
            animationId: animationId.into(),
        }
    }
    pub fn animationId(&self) -> &str { self.animationId.as_ref() }
}


pub struct ResolveAnimationParamsBuilder<'a> {
    animationId: Cow<'a, str>,
}

impl<'a> ResolveAnimationParamsBuilder<'a> {
    pub fn build(self) -> ResolveAnimationParams<'a> {
        ResolveAnimationParams {
            animationId: self.animationId,
        }
    }
}

/// Gets the remote object of the Animation.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ResolveAnimationReturns {
    /// Corresponding remote object.
    remoteObject: crate::runtime::RemoteObject,
}

impl ResolveAnimationReturns {
    pub fn builder(remoteObject: crate::runtime::RemoteObject) -> ResolveAnimationReturnsBuilder {
        ResolveAnimationReturnsBuilder {
            remoteObject: remoteObject,
        }
    }
    pub fn remoteObject(&self) -> &crate::runtime::RemoteObject { &self.remoteObject }
}


pub struct ResolveAnimationReturnsBuilder {
    remoteObject: crate::runtime::RemoteObject,
}

impl ResolveAnimationReturnsBuilder {
    pub fn build(self) -> ResolveAnimationReturns {
        ResolveAnimationReturns {
            remoteObject: self.remoteObject,
        }
    }
}

impl<'a> ResolveAnimationParams<'a> { pub const METHOD: &'static str = "Animation.resolveAnimation"; }

impl<'a> crate::CdpCommand<'a> for ResolveAnimationParams<'a> {
    const METHOD: &'static str = "Animation.resolveAnimation";
    type Response = ResolveAnimationReturns;
}

/// Seek a set of animations to a particular time within each animation.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SeekAnimationsParams<'a> {
    /// List of animation ids to seek.
    animations: Vec<Cow<'a, str>>,
    /// Set the current time of each animation.
    currentTime: f64,
}

impl<'a> SeekAnimationsParams<'a> {
    pub fn builder(animations: Vec<Cow<'a, str>>, currentTime: f64) -> SeekAnimationsParamsBuilder<'a> {
        SeekAnimationsParamsBuilder {
            animations: animations,
            currentTime: currentTime,
        }
    }
    pub fn animations(&self) -> &[Cow<'a, str>] { &self.animations }
    pub fn currentTime(&self) -> f64 { self.currentTime }
}


pub struct SeekAnimationsParamsBuilder<'a> {
    animations: Vec<Cow<'a, str>>,
    currentTime: f64,
}

impl<'a> SeekAnimationsParamsBuilder<'a> {
    pub fn build(self) -> SeekAnimationsParams<'a> {
        SeekAnimationsParams {
            animations: self.animations,
            currentTime: self.currentTime,
        }
    }
}

impl<'a> SeekAnimationsParams<'a> { pub const METHOD: &'static str = "Animation.seekAnimations"; }

impl<'a> crate::CdpCommand<'a> for SeekAnimationsParams<'a> {
    const METHOD: &'static str = "Animation.seekAnimations";
    type Response = crate::EmptyReturns;
}

/// Sets the paused state of a set of animations.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetPausedParams<'a> {
    /// Animations to set the pause state of.
    animations: Vec<Cow<'a, str>>,
    /// Paused state to set to.
    paused: bool,
}

impl<'a> SetPausedParams<'a> {
    pub fn builder(animations: Vec<Cow<'a, str>>, paused: bool) -> SetPausedParamsBuilder<'a> {
        SetPausedParamsBuilder {
            animations: animations,
            paused: paused,
        }
    }
    pub fn animations(&self) -> &[Cow<'a, str>] { &self.animations }
    pub fn paused(&self) -> bool { self.paused }
}


pub struct SetPausedParamsBuilder<'a> {
    animations: Vec<Cow<'a, str>>,
    paused: bool,
}

impl<'a> SetPausedParamsBuilder<'a> {
    pub fn build(self) -> SetPausedParams<'a> {
        SetPausedParams {
            animations: self.animations,
            paused: self.paused,
        }
    }
}

impl<'a> SetPausedParams<'a> { pub const METHOD: &'static str = "Animation.setPaused"; }

impl<'a> crate::CdpCommand<'a> for SetPausedParams<'a> {
    const METHOD: &'static str = "Animation.setPaused";
    type Response = crate::EmptyReturns;
}

/// Sets the playback rate of the document timeline.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetPlaybackRateParams {
    /// Playback rate for animations on page
    playbackRate: f64,
}

impl SetPlaybackRateParams {
    pub fn builder(playbackRate: f64) -> SetPlaybackRateParamsBuilder {
        SetPlaybackRateParamsBuilder {
            playbackRate: playbackRate,
        }
    }
    pub fn playbackRate(&self) -> f64 { self.playbackRate }
}


pub struct SetPlaybackRateParamsBuilder {
    playbackRate: f64,
}

impl SetPlaybackRateParamsBuilder {
    pub fn build(self) -> SetPlaybackRateParams {
        SetPlaybackRateParams {
            playbackRate: self.playbackRate,
        }
    }
}

impl SetPlaybackRateParams { pub const METHOD: &'static str = "Animation.setPlaybackRate"; }

impl<'a> crate::CdpCommand<'a> for SetPlaybackRateParams {
    const METHOD: &'static str = "Animation.setPlaybackRate";
    type Response = crate::EmptyReturns;
}

/// Sets the timing of an animation node.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetTimingParams<'a> {
    /// Animation id.
    animationId: Cow<'a, str>,
    /// Duration of the animation.
    duration: f64,
    /// Delay of the animation.
    delay: f64,
}

impl<'a> SetTimingParams<'a> {
    pub fn builder(animationId: impl Into<Cow<'a, str>>, duration: f64, delay: f64) -> SetTimingParamsBuilder<'a> {
        SetTimingParamsBuilder {
            animationId: animationId.into(),
            duration: duration,
            delay: delay,
        }
    }
    pub fn animationId(&self) -> &str { self.animationId.as_ref() }
    pub fn duration(&self) -> f64 { self.duration }
    pub fn delay(&self) -> f64 { self.delay }
}


pub struct SetTimingParamsBuilder<'a> {
    animationId: Cow<'a, str>,
    duration: f64,
    delay: f64,
}

impl<'a> SetTimingParamsBuilder<'a> {
    pub fn build(self) -> SetTimingParams<'a> {
        SetTimingParams {
            animationId: self.animationId,
            duration: self.duration,
            delay: self.delay,
        }
    }
}

impl<'a> SetTimingParams<'a> { pub const METHOD: &'static str = "Animation.setTiming"; }

impl<'a> crate::CdpCommand<'a> for SetTimingParams<'a> {
    const METHOD: &'static str = "Animation.setTiming";
    type Response = crate::EmptyReturns;
}