1use super::commands::*;
2impl CollectClassNamesFromSubtree {
3 pub fn builder() -> CollectClassNamesFromSubtreeBuilder {
4 <CollectClassNamesFromSubtreeBuilder as Default>::default()
5 }
6}
7#[derive(Default, Clone)]
8pub struct CollectClassNamesFromSubtreeBuilder {
9 node_id: Option<super::types::NodeId>,
10}
11impl CollectClassNamesFromSubtreeBuilder {
12 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
13 self.node_id = Some(node_id.into());
14 self
15 }
16 pub fn build(self) -> Result<CollectClassNamesFromSubtree, String> {
17 Ok(CollectClassNamesFromSubtree {
18 method: CollectClassNamesFromSubtreeMethod::CollectClassNamesFromSubtree,
19 params: CollectClassNamesFromSubtreeParams {
20 node_id: Box::new(self.node_id.ok_or_else(|| {
21 format!("Field `{}` is mandatory.", std::stringify!(node_id))
22 })?),
23 },
24 })
25 }
26}
27impl CopyTo {
28 pub fn builder() -> CopyToBuilder {
29 <CopyToBuilder as Default>::default()
30 }
31}
32#[derive(Default, Clone)]
33pub struct CopyToBuilder {
34 node_id: Option<super::types::NodeId>,
35 target_node_id: Option<super::types::NodeId>,
36 insert_before_node_id: Option<super::types::NodeId>,
37}
38impl CopyToBuilder {
39 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
40 self.node_id = Some(node_id.into());
41 self
42 }
43 pub fn target_node_id(mut self, target_node_id: impl Into<super::types::NodeId>) -> Self {
44 self.target_node_id = Some(target_node_id.into());
45 self
46 }
47 pub fn insert_before_node_id(
48 mut self,
49 insert_before_node_id: impl Into<super::types::NodeId>,
50 ) -> Self {
51 self.insert_before_node_id = Some(insert_before_node_id.into());
52 self
53 }
54 pub fn build(self) -> Result<CopyTo, String> {
55 Ok(CopyTo {
56 method: CopyToMethod::CopyTo,
57 params: CopyToParams {
58 node_id: Box::new(self.node_id.ok_or_else(|| {
59 format!("Field `{}` is mandatory.", std::stringify!(node_id))
60 })?),
61 target_node_id: self.target_node_id.ok_or_else(|| {
62 format!("Field `{}` is mandatory.", std::stringify!(target_node_id))
63 })?,
64 insert_before_node_id: self.insert_before_node_id,
65 },
66 })
67 }
68}
69impl DescribeNode {
70 pub fn builder() -> DescribeNodeBuilder {
71 <DescribeNodeBuilder as Default>::default()
72 }
73}
74#[derive(Default, Clone)]
75pub struct DescribeNodeBuilder {
76 node_id: Option<super::types::NodeId>,
77 backend_node_id: Option<super::types::BackendNodeId>,
78 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
79 depth: Option<i64>,
80 pierce: Option<bool>,
81}
82impl DescribeNodeBuilder {
83 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
84 self.node_id = Some(node_id.into());
85 self
86 }
87 pub fn backend_node_id(
88 mut self,
89 backend_node_id: impl Into<super::types::BackendNodeId>,
90 ) -> Self {
91 self.backend_node_id = Some(backend_node_id.into());
92 self
93 }
94 pub fn object_id(
95 mut self,
96 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
97 ) -> Self {
98 self.object_id = Some(object_id.into());
99 self
100 }
101 pub fn depth(mut self, depth: impl Into<i64>) -> Self {
102 self.depth = Some(depth.into());
103 self
104 }
105 pub fn pierce(mut self, pierce: impl Into<bool>) -> Self {
106 self.pierce = Some(pierce.into());
107 self
108 }
109 pub fn build(self) -> DescribeNode {
110 DescribeNode {
111 method: DescribeNodeMethod::DescribeNode,
112 params: DescribeNodeParams {
113 node_id: self.node_id.map(Box::new),
114 backend_node_id: self.backend_node_id.map(Box::new),
115 object_id: self.object_id,
116 depth: self.depth,
117 pierce: self.pierce,
118 },
119 }
120 }
121}
122impl ScrollIntoViewIfNeeded {
123 pub fn builder() -> ScrollIntoViewIfNeededBuilder {
124 <ScrollIntoViewIfNeededBuilder as Default>::default()
125 }
126}
127#[derive(Default, Clone)]
128pub struct ScrollIntoViewIfNeededBuilder {
129 node_id: Option<super::types::NodeId>,
130 backend_node_id: Option<super::types::BackendNodeId>,
131 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
132 rect: Option<super::types::Rect>,
133}
134impl ScrollIntoViewIfNeededBuilder {
135 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
136 self.node_id = Some(node_id.into());
137 self
138 }
139 pub fn backend_node_id(
140 mut self,
141 backend_node_id: impl Into<super::types::BackendNodeId>,
142 ) -> Self {
143 self.backend_node_id = Some(backend_node_id.into());
144 self
145 }
146 pub fn object_id(
147 mut self,
148 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
149 ) -> Self {
150 self.object_id = Some(object_id.into());
151 self
152 }
153 pub fn rect(mut self, rect: impl Into<super::types::Rect>) -> Self {
154 self.rect = Some(rect.into());
155 self
156 }
157 pub fn build(self) -> ScrollIntoViewIfNeeded {
158 ScrollIntoViewIfNeeded {
159 method: ScrollIntoViewIfNeededMethod::ScrollIntoViewIfNeeded,
160 params: ScrollIntoViewIfNeededParams {
161 node_id: self.node_id.map(Box::new),
162 backend_node_id: self.backend_node_id.map(Box::new),
163 object_id: self.object_id,
164 rect: self.rect,
165 },
166 }
167 }
168}
169#[derive(Debug, Clone, Default)]
170pub struct DisableBuilder;
171impl DisableBuilder {
172 pub fn new() -> Self {
173 Self
174 }
175 pub fn build(self) -> Disable {
176 Disable {
177 method: DisableMethod::Disable,
178 params: DisableParams {},
179 }
180 }
181}
182impl Disable {
183 pub fn builder() -> DisableBuilder {
184 DisableBuilder
185 }
186}
187impl DiscardSearchResults {
188 pub fn builder() -> DiscardSearchResultsBuilder {
189 <DiscardSearchResultsBuilder as Default>::default()
190 }
191}
192#[derive(Default, Clone)]
193pub struct DiscardSearchResultsBuilder {
194 search_id: Option<String>,
195}
196impl DiscardSearchResultsBuilder {
197 pub fn search_id(mut self, search_id: impl Into<String>) -> Self {
198 self.search_id = Some(search_id.into());
199 self
200 }
201 pub fn build(self) -> Result<DiscardSearchResults, String> {
202 Ok(DiscardSearchResults {
203 method: DiscardSearchResultsMethod::DiscardSearchResults,
204 params: DiscardSearchResultsParams {
205 search_id: self.search_id.ok_or_else(|| {
206 format!("Field `{}` is mandatory.", std::stringify!(search_id))
207 })?,
208 },
209 })
210 }
211}
212impl Enable {
213 pub fn builder() -> EnableBuilder {
214 <EnableBuilder as Default>::default()
215 }
216}
217#[derive(Default, Clone)]
218pub struct EnableBuilder {
219 include_whitespace: Option<EnableIncludeWhitespace>,
220}
221impl EnableBuilder {
222 pub fn include_whitespace(
223 mut self,
224 include_whitespace: impl Into<EnableIncludeWhitespace>,
225 ) -> Self {
226 self.include_whitespace = Some(include_whitespace.into());
227 self
228 }
229 pub fn build(self) -> Enable {
230 Enable {
231 method: EnableMethod::Enable,
232 params: EnableParams {
233 include_whitespace: self.include_whitespace,
234 },
235 }
236 }
237}
238impl Focus {
239 pub fn builder() -> FocusBuilder {
240 <FocusBuilder as Default>::default()
241 }
242}
243#[derive(Default, Clone)]
244pub struct FocusBuilder {
245 node_id: Option<super::types::NodeId>,
246 backend_node_id: Option<super::types::BackendNodeId>,
247 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
248}
249impl FocusBuilder {
250 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
251 self.node_id = Some(node_id.into());
252 self
253 }
254 pub fn backend_node_id(
255 mut self,
256 backend_node_id: impl Into<super::types::BackendNodeId>,
257 ) -> Self {
258 self.backend_node_id = Some(backend_node_id.into());
259 self
260 }
261 pub fn object_id(
262 mut self,
263 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
264 ) -> Self {
265 self.object_id = Some(object_id.into());
266 self
267 }
268 pub fn build(self) -> Focus {
269 Focus {
270 method: FocusMethod::Focus,
271 params: FocusParams {
272 node_id: self.node_id.map(Box::new),
273 backend_node_id: self.backend_node_id.map(Box::new),
274 object_id: self.object_id,
275 },
276 }
277 }
278}
279impl GetAttributes {
280 pub fn builder() -> GetAttributesBuilder {
281 <GetAttributesBuilder as Default>::default()
282 }
283}
284#[derive(Default, Clone)]
285pub struct GetAttributesBuilder {
286 node_id: Option<super::types::NodeId>,
287}
288impl GetAttributesBuilder {
289 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
290 self.node_id = Some(node_id.into());
291 self
292 }
293 pub fn build(self) -> Result<GetAttributes, String> {
294 Ok(GetAttributes {
295 method: GetAttributesMethod::GetAttributes,
296 params: GetAttributesParams {
297 node_id: Box::new(self.node_id.ok_or_else(|| {
298 format!("Field `{}` is mandatory.", std::stringify!(node_id))
299 })?),
300 },
301 })
302 }
303}
304impl GetBoxModel {
305 pub fn builder() -> GetBoxModelBuilder {
306 <GetBoxModelBuilder as Default>::default()
307 }
308}
309#[derive(Default, Clone)]
310pub struct GetBoxModelBuilder {
311 node_id: Option<super::types::NodeId>,
312 backend_node_id: Option<super::types::BackendNodeId>,
313 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
314}
315impl GetBoxModelBuilder {
316 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
317 self.node_id = Some(node_id.into());
318 self
319 }
320 pub fn backend_node_id(
321 mut self,
322 backend_node_id: impl Into<super::types::BackendNodeId>,
323 ) -> Self {
324 self.backend_node_id = Some(backend_node_id.into());
325 self
326 }
327 pub fn object_id(
328 mut self,
329 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
330 ) -> Self {
331 self.object_id = Some(object_id.into());
332 self
333 }
334 pub fn build(self) -> GetBoxModel {
335 GetBoxModel {
336 method: GetBoxModelMethod::GetBoxModel,
337 params: GetBoxModelParams {
338 node_id: self.node_id.map(Box::new),
339 backend_node_id: self.backend_node_id.map(Box::new),
340 object_id: self.object_id,
341 },
342 }
343 }
344}
345impl GetContentQuads {
346 pub fn builder() -> GetContentQuadsBuilder {
347 <GetContentQuadsBuilder as Default>::default()
348 }
349}
350#[derive(Default, Clone)]
351pub struct GetContentQuadsBuilder {
352 node_id: Option<super::types::NodeId>,
353 backend_node_id: Option<super::types::BackendNodeId>,
354 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
355}
356impl GetContentQuadsBuilder {
357 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
358 self.node_id = Some(node_id.into());
359 self
360 }
361 pub fn backend_node_id(
362 mut self,
363 backend_node_id: impl Into<super::types::BackendNodeId>,
364 ) -> Self {
365 self.backend_node_id = Some(backend_node_id.into());
366 self
367 }
368 pub fn object_id(
369 mut self,
370 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
371 ) -> Self {
372 self.object_id = Some(object_id.into());
373 self
374 }
375 pub fn build(self) -> GetContentQuads {
376 GetContentQuads {
377 method: GetContentQuadsMethod::GetContentQuads,
378 params: GetContentQuadsParams {
379 node_id: self.node_id.map(Box::new),
380 backend_node_id: self.backend_node_id.map(Box::new),
381 object_id: self.object_id,
382 },
383 }
384 }
385}
386impl GetDocument {
387 pub fn builder() -> GetDocumentBuilder {
388 <GetDocumentBuilder as Default>::default()
389 }
390}
391#[derive(Default, Clone)]
392pub struct GetDocumentBuilder {
393 depth: Option<i64>,
394 pierce: Option<bool>,
395}
396impl GetDocumentBuilder {
397 pub fn depth(mut self, depth: impl Into<i64>) -> Self {
398 self.depth = Some(depth.into());
399 self
400 }
401 pub fn pierce(mut self, pierce: impl Into<bool>) -> Self {
402 self.pierce = Some(pierce.into());
403 self
404 }
405 pub fn build(self) -> GetDocument {
406 GetDocument {
407 method: GetDocumentMethod::GetDocument,
408 params: GetDocumentParams {
409 depth: self.depth,
410 pierce: self.pierce,
411 },
412 }
413 }
414}
415impl GetNodesForSubtreeByStyle {
416 pub fn builder() -> GetNodesForSubtreeByStyleBuilder {
417 <GetNodesForSubtreeByStyleBuilder as Default>::default()
418 }
419}
420#[derive(Default, Clone)]
421pub struct GetNodesForSubtreeByStyleBuilder {
422 node_id: Option<super::types::NodeId>,
423 computed_styles: Option<Vec<super::types::CssComputedStyleProperty>>,
424 pierce: Option<bool>,
425}
426impl GetNodesForSubtreeByStyleBuilder {
427 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
428 self.node_id = Some(node_id.into());
429 self
430 }
431 pub fn computed_style(
432 mut self,
433 computed_style: impl Into<super::types::CssComputedStyleProperty>,
434 ) -> Self {
435 let v = self.computed_styles.get_or_insert(Vec::new());
436 v.push(computed_style.into());
437 self
438 }
439 pub fn computed_styles<I, S>(mut self, computed_styles: I) -> Self
440 where
441 I: IntoIterator<Item = S>,
442 S: Into<super::types::CssComputedStyleProperty>,
443 {
444 let v = self.computed_styles.get_or_insert(Vec::new());
445 for val in computed_styles {
446 v.push(val.into());
447 }
448 self
449 }
450 pub fn pierce(mut self, pierce: impl Into<bool>) -> Self {
451 self.pierce = Some(pierce.into());
452 self
453 }
454 pub fn build(self) -> Result<GetNodesForSubtreeByStyle, String> {
455 Ok(GetNodesForSubtreeByStyle {
456 method: GetNodesForSubtreeByStyleMethod::GetNodesForSubtreeByStyle,
457 params: GetNodesForSubtreeByStyleParams {
458 node_id: Box::new(self.node_id.ok_or_else(|| {
459 format!("Field `{}` is mandatory.", std::stringify!(node_id))
460 })?),
461 computed_styles: self.computed_styles.ok_or_else(|| {
462 format!("Field `{}` is mandatory.", std::stringify!(computed_styles))
463 })?,
464 pierce: self.pierce,
465 },
466 })
467 }
468}
469impl GetNodeForLocation {
470 pub fn builder() -> GetNodeForLocationBuilder {
471 <GetNodeForLocationBuilder as Default>::default()
472 }
473}
474#[derive(Default, Clone)]
475pub struct GetNodeForLocationBuilder {
476 x: Option<i64>,
477 y: Option<i64>,
478 include_user_agent_shadow_dom: Option<bool>,
479 ignore_pointer_events_none: Option<bool>,
480}
481impl GetNodeForLocationBuilder {
482 pub fn x(mut self, x: impl Into<i64>) -> Self {
483 self.x = Some(x.into());
484 self
485 }
486 pub fn y(mut self, y: impl Into<i64>) -> Self {
487 self.y = Some(y.into());
488 self
489 }
490 pub fn include_user_agent_shadow_dom(
491 mut self,
492 include_user_agent_shadow_dom: impl Into<bool>,
493 ) -> Self {
494 self.include_user_agent_shadow_dom = Some(include_user_agent_shadow_dom.into());
495 self
496 }
497 pub fn ignore_pointer_events_none(
498 mut self,
499 ignore_pointer_events_none: impl Into<bool>,
500 ) -> Self {
501 self.ignore_pointer_events_none = Some(ignore_pointer_events_none.into());
502 self
503 }
504 pub fn build(self) -> Result<GetNodeForLocation, String> {
505 Ok(GetNodeForLocation {
506 method: GetNodeForLocationMethod::GetNodeForLocation,
507 params: GetNodeForLocationParams {
508 x: self
509 .x
510 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(x)))?,
511 y: self
512 .y
513 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(y)))?,
514 include_user_agent_shadow_dom: self.include_user_agent_shadow_dom,
515 ignore_pointer_events_none: self.ignore_pointer_events_none,
516 },
517 })
518 }
519}
520impl GetOuterHtml {
521 pub fn builder() -> GetOuterHtmlBuilder {
522 <GetOuterHtmlBuilder as Default>::default()
523 }
524}
525#[derive(Default, Clone)]
526pub struct GetOuterHtmlBuilder {
527 node_id: Option<super::types::NodeId>,
528 backend_node_id: Option<super::types::BackendNodeId>,
529 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
530 include_shadow_dom: Option<bool>,
531}
532impl GetOuterHtmlBuilder {
533 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
534 self.node_id = Some(node_id.into());
535 self
536 }
537 pub fn backend_node_id(
538 mut self,
539 backend_node_id: impl Into<super::types::BackendNodeId>,
540 ) -> Self {
541 self.backend_node_id = Some(backend_node_id.into());
542 self
543 }
544 pub fn object_id(
545 mut self,
546 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
547 ) -> Self {
548 self.object_id = Some(object_id.into());
549 self
550 }
551 pub fn include_shadow_dom(mut self, include_shadow_dom: impl Into<bool>) -> Self {
552 self.include_shadow_dom = Some(include_shadow_dom.into());
553 self
554 }
555 pub fn build(self) -> GetOuterHtml {
556 GetOuterHtml {
557 method: GetOuterHtmlMethod::GetOuterHtml,
558 params: GetOuterHtmlParams {
559 node_id: self.node_id.map(Box::new),
560 backend_node_id: self.backend_node_id.map(Box::new),
561 object_id: self.object_id,
562 include_shadow_dom: self.include_shadow_dom,
563 },
564 }
565 }
566}
567impl GetRelayoutBoundary {
568 pub fn builder() -> GetRelayoutBoundaryBuilder {
569 <GetRelayoutBoundaryBuilder as Default>::default()
570 }
571}
572#[derive(Default, Clone)]
573pub struct GetRelayoutBoundaryBuilder {
574 node_id: Option<super::types::NodeId>,
575}
576impl GetRelayoutBoundaryBuilder {
577 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
578 self.node_id = Some(node_id.into());
579 self
580 }
581 pub fn build(self) -> Result<GetRelayoutBoundary, String> {
582 Ok(GetRelayoutBoundary {
583 method: GetRelayoutBoundaryMethod::GetRelayoutBoundary,
584 params: GetRelayoutBoundaryParams {
585 node_id: Box::new(self.node_id.ok_or_else(|| {
586 format!("Field `{}` is mandatory.", std::stringify!(node_id))
587 })?),
588 },
589 })
590 }
591}
592impl GetSearchResults {
593 pub fn builder() -> GetSearchResultsBuilder {
594 <GetSearchResultsBuilder as Default>::default()
595 }
596}
597#[derive(Default, Clone)]
598pub struct GetSearchResultsBuilder {
599 search_id: Option<String>,
600 from_index: Option<i64>,
601 to_index: Option<i64>,
602}
603impl GetSearchResultsBuilder {
604 pub fn search_id(mut self, search_id: impl Into<String>) -> Self {
605 self.search_id = Some(search_id.into());
606 self
607 }
608 pub fn from_index(mut self, from_index: impl Into<i64>) -> Self {
609 self.from_index = Some(from_index.into());
610 self
611 }
612 pub fn to_index(mut self, to_index: impl Into<i64>) -> Self {
613 self.to_index = Some(to_index.into());
614 self
615 }
616 pub fn build(self) -> Result<GetSearchResults, String> {
617 Ok(GetSearchResults {
618 method: GetSearchResultsMethod::GetSearchResults,
619 params: GetSearchResultsParams {
620 search_id: self.search_id.ok_or_else(|| {
621 format!("Field `{}` is mandatory.", std::stringify!(search_id))
622 })?,
623 from_index: self.from_index.ok_or_else(|| {
624 format!("Field `{}` is mandatory.", std::stringify!(from_index))
625 })?,
626 to_index: self.to_index.ok_or_else(|| {
627 format!("Field `{}` is mandatory.", std::stringify!(to_index))
628 })?,
629 },
630 })
631 }
632}
633#[derive(Debug, Clone, Default)]
634pub struct HideHighlightBuilder;
635impl HideHighlightBuilder {
636 pub fn new() -> Self {
637 Self
638 }
639 pub fn build(self) -> HideHighlight {
640 HideHighlight {
641 method: HideHighlightMethod::HideHighlight,
642 params: HideHighlightParams {},
643 }
644 }
645}
646impl HideHighlight {
647 pub fn builder() -> HideHighlightBuilder {
648 HideHighlightBuilder
649 }
650}
651#[derive(Debug, Clone, Default)]
652pub struct HighlightNodeBuilder;
653impl HighlightNodeBuilder {
654 pub fn new() -> Self {
655 Self
656 }
657 pub fn build(self) -> HighlightNode {
658 HighlightNode {
659 method: HighlightNodeMethod::HighlightNode,
660 params: HighlightNodeParams {},
661 }
662 }
663}
664impl HighlightNode {
665 pub fn builder() -> HighlightNodeBuilder {
666 HighlightNodeBuilder
667 }
668}
669#[derive(Debug, Clone, Default)]
670pub struct HighlightRectBuilder;
671impl HighlightRectBuilder {
672 pub fn new() -> Self {
673 Self
674 }
675 pub fn build(self) -> HighlightRect {
676 HighlightRect {
677 method: HighlightRectMethod::HighlightRect,
678 params: HighlightRectParams {},
679 }
680 }
681}
682impl HighlightRect {
683 pub fn builder() -> HighlightRectBuilder {
684 HighlightRectBuilder
685 }
686}
687#[derive(Debug, Clone, Default)]
688pub struct MarkUndoableStateBuilder;
689impl MarkUndoableStateBuilder {
690 pub fn new() -> Self {
691 Self
692 }
693 pub fn build(self) -> MarkUndoableState {
694 MarkUndoableState {
695 method: MarkUndoableStateMethod::MarkUndoableState,
696 params: MarkUndoableStateParams {},
697 }
698 }
699}
700impl MarkUndoableState {
701 pub fn builder() -> MarkUndoableStateBuilder {
702 MarkUndoableStateBuilder
703 }
704}
705impl MoveTo {
706 pub fn builder() -> MoveToBuilder {
707 <MoveToBuilder as Default>::default()
708 }
709}
710#[derive(Default, Clone)]
711pub struct MoveToBuilder {
712 node_id: Option<super::types::NodeId>,
713 target_node_id: Option<super::types::NodeId>,
714 insert_before_node_id: Option<super::types::NodeId>,
715}
716impl MoveToBuilder {
717 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
718 self.node_id = Some(node_id.into());
719 self
720 }
721 pub fn target_node_id(mut self, target_node_id: impl Into<super::types::NodeId>) -> Self {
722 self.target_node_id = Some(target_node_id.into());
723 self
724 }
725 pub fn insert_before_node_id(
726 mut self,
727 insert_before_node_id: impl Into<super::types::NodeId>,
728 ) -> Self {
729 self.insert_before_node_id = Some(insert_before_node_id.into());
730 self
731 }
732 pub fn build(self) -> Result<MoveTo, String> {
733 Ok(MoveTo {
734 method: MoveToMethod::MoveTo,
735 params: MoveToParams {
736 node_id: Box::new(self.node_id.ok_or_else(|| {
737 format!("Field `{}` is mandatory.", std::stringify!(node_id))
738 })?),
739 target_node_id: self.target_node_id.ok_or_else(|| {
740 format!("Field `{}` is mandatory.", std::stringify!(target_node_id))
741 })?,
742 insert_before_node_id: self.insert_before_node_id,
743 },
744 })
745 }
746}
747impl PerformSearch {
748 pub fn builder() -> PerformSearchBuilder {
749 <PerformSearchBuilder as Default>::default()
750 }
751}
752#[derive(Default, Clone)]
753pub struct PerformSearchBuilder {
754 query: Option<String>,
755 include_user_agent_shadow_dom: Option<bool>,
756}
757impl PerformSearchBuilder {
758 pub fn query(mut self, query: impl Into<String>) -> Self {
759 self.query = Some(query.into());
760 self
761 }
762 pub fn include_user_agent_shadow_dom(
763 mut self,
764 include_user_agent_shadow_dom: impl Into<bool>,
765 ) -> Self {
766 self.include_user_agent_shadow_dom = Some(include_user_agent_shadow_dom.into());
767 self
768 }
769 pub fn build(self) -> Result<PerformSearch, String> {
770 Ok(PerformSearch {
771 method: PerformSearchMethod::PerformSearch,
772 params: PerformSearchParams {
773 query: self
774 .query
775 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(query)))?,
776 include_user_agent_shadow_dom: self.include_user_agent_shadow_dom,
777 },
778 })
779 }
780}
781impl PushNodeByPathToFrontend {
782 pub fn builder() -> PushNodeByPathToFrontendBuilder {
783 <PushNodeByPathToFrontendBuilder as Default>::default()
784 }
785}
786#[derive(Default, Clone)]
787pub struct PushNodeByPathToFrontendBuilder {
788 path: Option<String>,
789}
790impl PushNodeByPathToFrontendBuilder {
791 pub fn path(mut self, path: impl Into<String>) -> Self {
792 self.path = Some(path.into());
793 self
794 }
795 pub fn build(self) -> Result<PushNodeByPathToFrontend, String> {
796 Ok(PushNodeByPathToFrontend {
797 method: PushNodeByPathToFrontendMethod::PushNodeByPathToFrontend,
798 params: PushNodeByPathToFrontendParams {
799 path: self
800 .path
801 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(path)))?,
802 },
803 })
804 }
805}
806impl PushNodesByBackendIdsToFrontend {
807 pub fn builder() -> PushNodesByBackendIdsToFrontendBuilder {
808 <PushNodesByBackendIdsToFrontendBuilder as Default>::default()
809 }
810}
811#[derive(Default, Clone)]
812pub struct PushNodesByBackendIdsToFrontendBuilder {
813 backend_node_ids: Option<Vec<super::types::BackendNodeId>>,
814}
815impl PushNodesByBackendIdsToFrontendBuilder {
816 pub fn backend_node_id(
817 mut self,
818 backend_node_id: impl Into<super::types::BackendNodeId>,
819 ) -> Self {
820 let v = self.backend_node_ids.get_or_insert(Vec::new());
821 v.push(backend_node_id.into());
822 self
823 }
824 pub fn backend_node_ids<I, S>(mut self, backend_node_ids: I) -> Self
825 where
826 I: IntoIterator<Item = S>,
827 S: Into<super::types::BackendNodeId>,
828 {
829 let v = self.backend_node_ids.get_or_insert(Vec::new());
830 for val in backend_node_ids {
831 v.push(val.into());
832 }
833 self
834 }
835 pub fn build(self) -> Result<PushNodesByBackendIdsToFrontend, String> {
836 Ok(PushNodesByBackendIdsToFrontend {
837 method: PushNodesByBackendIdsToFrontendMethod::PushNodesByBackendIdsToFrontend,
838 params: PushNodesByBackendIdsToFrontendParams {
839 backend_node_ids: self.backend_node_ids.ok_or_else(|| {
840 format!(
841 "Field `{}` is mandatory.",
842 std::stringify!(backend_node_ids)
843 )
844 })?,
845 },
846 })
847 }
848}
849impl QuerySelector {
850 pub fn builder() -> QuerySelectorBuilder {
851 <QuerySelectorBuilder as Default>::default()
852 }
853}
854#[derive(Default, Clone)]
855pub struct QuerySelectorBuilder {
856 node_id: Option<super::types::NodeId>,
857 selector: Option<String>,
858}
859impl QuerySelectorBuilder {
860 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
861 self.node_id = Some(node_id.into());
862 self
863 }
864 pub fn selector(mut self, selector: impl Into<String>) -> Self {
865 self.selector = Some(selector.into());
866 self
867 }
868 pub fn build(self) -> Result<QuerySelector, String> {
869 Ok(QuerySelector {
870 method: QuerySelectorMethod::QuerySelector,
871 params: QuerySelectorParams {
872 node_id: Box::new(self.node_id.ok_or_else(|| {
873 format!("Field `{}` is mandatory.", std::stringify!(node_id))
874 })?),
875 selector: self.selector.ok_or_else(|| {
876 format!("Field `{}` is mandatory.", std::stringify!(selector))
877 })?,
878 },
879 })
880 }
881}
882impl QuerySelectorAll {
883 pub fn builder() -> QuerySelectorAllBuilder {
884 <QuerySelectorAllBuilder as Default>::default()
885 }
886}
887#[derive(Default, Clone)]
888pub struct QuerySelectorAllBuilder {
889 node_id: Option<super::types::NodeId>,
890 selector: Option<String>,
891}
892impl QuerySelectorAllBuilder {
893 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
894 self.node_id = Some(node_id.into());
895 self
896 }
897 pub fn selector(mut self, selector: impl Into<String>) -> Self {
898 self.selector = Some(selector.into());
899 self
900 }
901 pub fn build(self) -> Result<QuerySelectorAll, String> {
902 Ok(QuerySelectorAll {
903 method: QuerySelectorAllMethod::QuerySelectorAll,
904 params: QuerySelectorAllParams {
905 node_id: Box::new(self.node_id.ok_or_else(|| {
906 format!("Field `{}` is mandatory.", std::stringify!(node_id))
907 })?),
908 selector: self.selector.ok_or_else(|| {
909 format!("Field `{}` is mandatory.", std::stringify!(selector))
910 })?,
911 },
912 })
913 }
914}
915#[derive(Debug, Clone, Default)]
916pub struct GetTopLayerElementsBuilder;
917impl GetTopLayerElementsBuilder {
918 pub fn new() -> Self {
919 Self
920 }
921 pub fn build(self) -> GetTopLayerElements {
922 GetTopLayerElements {
923 method: GetTopLayerElementsMethod::GetTopLayerElements,
924 params: GetTopLayerElementsParams {},
925 }
926 }
927}
928impl GetTopLayerElements {
929 pub fn builder() -> GetTopLayerElementsBuilder {
930 GetTopLayerElementsBuilder
931 }
932}
933impl GetElementByRelation {
934 pub fn builder() -> GetElementByRelationBuilder {
935 <GetElementByRelationBuilder as Default>::default()
936 }
937}
938#[derive(Default, Clone)]
939pub struct GetElementByRelationBuilder {
940 node_id: Option<super::types::NodeId>,
941 relation: Option<GetElementByRelationRelation>,
942}
943impl GetElementByRelationBuilder {
944 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
945 self.node_id = Some(node_id.into());
946 self
947 }
948 pub fn relation(mut self, relation: impl Into<GetElementByRelationRelation>) -> Self {
949 self.relation = Some(relation.into());
950 self
951 }
952 pub fn build(self) -> Result<GetElementByRelation, String> {
953 Ok(GetElementByRelation {
954 method: GetElementByRelationMethod::GetElementByRelation,
955 params: GetElementByRelationParams {
956 node_id: Box::new(self.node_id.ok_or_else(|| {
957 format!("Field `{}` is mandatory.", std::stringify!(node_id))
958 })?),
959 relation: self.relation.ok_or_else(|| {
960 format!("Field `{}` is mandatory.", std::stringify!(relation))
961 })?,
962 },
963 })
964 }
965}
966#[derive(Debug, Clone, Default)]
967pub struct RedoBuilder;
968impl RedoBuilder {
969 pub fn new() -> Self {
970 Self
971 }
972 pub fn build(self) -> Redo {
973 Redo {
974 method: RedoMethod::Redo,
975 params: RedoParams {},
976 }
977 }
978}
979impl Redo {
980 pub fn builder() -> RedoBuilder {
981 RedoBuilder
982 }
983}
984impl RemoveAttribute {
985 pub fn builder() -> RemoveAttributeBuilder {
986 <RemoveAttributeBuilder as Default>::default()
987 }
988}
989#[derive(Default, Clone)]
990pub struct RemoveAttributeBuilder {
991 node_id: Option<super::types::NodeId>,
992 name: Option<String>,
993}
994impl RemoveAttributeBuilder {
995 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
996 self.node_id = Some(node_id.into());
997 self
998 }
999 pub fn name(mut self, name: impl Into<String>) -> Self {
1000 self.name = Some(name.into());
1001 self
1002 }
1003 pub fn build(self) -> Result<RemoveAttribute, String> {
1004 Ok(RemoveAttribute {
1005 method: RemoveAttributeMethod::RemoveAttribute,
1006 params: RemoveAttributeParams {
1007 node_id: Box::new(self.node_id.ok_or_else(|| {
1008 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1009 })?),
1010 name: self
1011 .name
1012 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(name)))?,
1013 },
1014 })
1015 }
1016}
1017impl RemoveNode {
1018 pub fn builder() -> RemoveNodeBuilder {
1019 <RemoveNodeBuilder as Default>::default()
1020 }
1021}
1022#[derive(Default, Clone)]
1023pub struct RemoveNodeBuilder {
1024 node_id: Option<super::types::NodeId>,
1025}
1026impl RemoveNodeBuilder {
1027 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1028 self.node_id = Some(node_id.into());
1029 self
1030 }
1031 pub fn build(self) -> Result<RemoveNode, String> {
1032 Ok(RemoveNode {
1033 method: RemoveNodeMethod::RemoveNode,
1034 params: RemoveNodeParams {
1035 node_id: Box::new(self.node_id.ok_or_else(|| {
1036 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1037 })?),
1038 },
1039 })
1040 }
1041}
1042impl RequestChildNodes {
1043 pub fn builder() -> RequestChildNodesBuilder {
1044 <RequestChildNodesBuilder as Default>::default()
1045 }
1046}
1047#[derive(Default, Clone)]
1048pub struct RequestChildNodesBuilder {
1049 node_id: Option<super::types::NodeId>,
1050 depth: Option<i64>,
1051 pierce: Option<bool>,
1052}
1053impl RequestChildNodesBuilder {
1054 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1055 self.node_id = Some(node_id.into());
1056 self
1057 }
1058 pub fn depth(mut self, depth: impl Into<i64>) -> Self {
1059 self.depth = Some(depth.into());
1060 self
1061 }
1062 pub fn pierce(mut self, pierce: impl Into<bool>) -> Self {
1063 self.pierce = Some(pierce.into());
1064 self
1065 }
1066 pub fn build(self) -> Result<RequestChildNodes, String> {
1067 Ok(RequestChildNodes {
1068 method: RequestChildNodesMethod::RequestChildNodes,
1069 params: RequestChildNodesParams {
1070 node_id: Box::new(self.node_id.ok_or_else(|| {
1071 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1072 })?),
1073 depth: self.depth,
1074 pierce: self.pierce,
1075 },
1076 })
1077 }
1078}
1079impl RequestNode {
1080 pub fn builder() -> RequestNodeBuilder {
1081 <RequestNodeBuilder as Default>::default()
1082 }
1083}
1084#[derive(Default, Clone)]
1085pub struct RequestNodeBuilder {
1086 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
1087}
1088impl RequestNodeBuilder {
1089 pub fn object_id(
1090 mut self,
1091 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
1092 ) -> Self {
1093 self.object_id = Some(object_id.into());
1094 self
1095 }
1096 pub fn build(self) -> Result<RequestNode, String> {
1097 Ok(RequestNode {
1098 method: RequestNodeMethod::RequestNode,
1099 params: RequestNodeParams {
1100 object_id: self.object_id.ok_or_else(|| {
1101 format!("Field `{}` is mandatory.", std::stringify!(object_id))
1102 })?,
1103 },
1104 })
1105 }
1106}
1107impl ResolveNode {
1108 pub fn builder() -> ResolveNodeBuilder {
1109 <ResolveNodeBuilder as Default>::default()
1110 }
1111}
1112#[derive(Default, Clone)]
1113pub struct ResolveNodeBuilder {
1114 node_id: Option<super::types::NodeId>,
1115 backend_node_id: Option<super::types::BackendNodeId>,
1116 object_group: Option<String>,
1117 execution_context_id: Option<crate::js_protocol::runtime::types::ExecutionContextId>,
1118}
1119impl ResolveNodeBuilder {
1120 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1121 self.node_id = Some(node_id.into());
1122 self
1123 }
1124 pub fn backend_node_id(
1125 mut self,
1126 backend_node_id: impl Into<super::types::BackendNodeId>,
1127 ) -> Self {
1128 self.backend_node_id = Some(backend_node_id.into());
1129 self
1130 }
1131 pub fn object_group(mut self, object_group: impl Into<String>) -> Self {
1132 self.object_group = Some(object_group.into());
1133 self
1134 }
1135 pub fn execution_context_id(
1136 mut self,
1137 execution_context_id: impl Into<crate::js_protocol::runtime::types::ExecutionContextId>,
1138 ) -> Self {
1139 self.execution_context_id = Some(execution_context_id.into());
1140 self
1141 }
1142 pub fn build(self) -> ResolveNode {
1143 ResolveNode {
1144 method: ResolveNodeMethod::ResolveNode,
1145 params: ResolveNodeParams {
1146 node_id: self.node_id.map(Box::new),
1147 backend_node_id: self.backend_node_id.map(Box::new),
1148 object_group: self.object_group,
1149 execution_context_id: self.execution_context_id,
1150 },
1151 }
1152 }
1153}
1154impl SetAttributeValue {
1155 pub fn builder() -> SetAttributeValueBuilder {
1156 <SetAttributeValueBuilder as Default>::default()
1157 }
1158}
1159#[derive(Default, Clone)]
1160pub struct SetAttributeValueBuilder {
1161 node_id: Option<super::types::NodeId>,
1162 name: Option<String>,
1163 value: Option<String>,
1164}
1165impl SetAttributeValueBuilder {
1166 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1167 self.node_id = Some(node_id.into());
1168 self
1169 }
1170 pub fn name(mut self, name: impl Into<String>) -> Self {
1171 self.name = Some(name.into());
1172 self
1173 }
1174 pub fn value(mut self, value: impl Into<String>) -> Self {
1175 self.value = Some(value.into());
1176 self
1177 }
1178 pub fn build(self) -> Result<SetAttributeValue, String> {
1179 Ok(SetAttributeValue {
1180 method: SetAttributeValueMethod::SetAttributeValue,
1181 params: SetAttributeValueParams {
1182 node_id: Box::new(self.node_id.ok_or_else(|| {
1183 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1184 })?),
1185 name: self
1186 .name
1187 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(name)))?,
1188 value: self
1189 .value
1190 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(value)))?,
1191 },
1192 })
1193 }
1194}
1195impl SetAttributesAsText {
1196 pub fn builder() -> SetAttributesAsTextBuilder {
1197 <SetAttributesAsTextBuilder as Default>::default()
1198 }
1199}
1200#[derive(Default, Clone)]
1201pub struct SetAttributesAsTextBuilder {
1202 node_id: Option<super::types::NodeId>,
1203 text: Option<String>,
1204 name: Option<String>,
1205}
1206impl SetAttributesAsTextBuilder {
1207 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1208 self.node_id = Some(node_id.into());
1209 self
1210 }
1211 pub fn text(mut self, text: impl Into<String>) -> Self {
1212 self.text = Some(text.into());
1213 self
1214 }
1215 pub fn name(mut self, name: impl Into<String>) -> Self {
1216 self.name = Some(name.into());
1217 self
1218 }
1219 pub fn build(self) -> Result<SetAttributesAsText, String> {
1220 Ok(SetAttributesAsText {
1221 method: SetAttributesAsTextMethod::SetAttributesAsText,
1222 params: SetAttributesAsTextParams {
1223 node_id: Box::new(self.node_id.ok_or_else(|| {
1224 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1225 })?),
1226 text: self
1227 .text
1228 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
1229 name: self.name,
1230 },
1231 })
1232 }
1233}
1234impl SetFileInputFiles {
1235 pub fn builder() -> SetFileInputFilesBuilder {
1236 <SetFileInputFilesBuilder as Default>::default()
1237 }
1238}
1239#[derive(Default, Clone)]
1240pub struct SetFileInputFilesBuilder {
1241 files: Option<Vec<String>>,
1242 node_id: Option<super::types::NodeId>,
1243 backend_node_id: Option<super::types::BackendNodeId>,
1244 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
1245}
1246impl SetFileInputFilesBuilder {
1247 pub fn file(mut self, file: impl Into<String>) -> Self {
1248 let v = self.files.get_or_insert(Vec::new());
1249 v.push(file.into());
1250 self
1251 }
1252 pub fn files<I, S>(mut self, files: I) -> Self
1253 where
1254 I: IntoIterator<Item = S>,
1255 S: Into<String>,
1256 {
1257 let v = self.files.get_or_insert(Vec::new());
1258 for val in files {
1259 v.push(val.into());
1260 }
1261 self
1262 }
1263 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1264 self.node_id = Some(node_id.into());
1265 self
1266 }
1267 pub fn backend_node_id(
1268 mut self,
1269 backend_node_id: impl Into<super::types::BackendNodeId>,
1270 ) -> Self {
1271 self.backend_node_id = Some(backend_node_id.into());
1272 self
1273 }
1274 pub fn object_id(
1275 mut self,
1276 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
1277 ) -> Self {
1278 self.object_id = Some(object_id.into());
1279 self
1280 }
1281 pub fn build(self) -> Result<SetFileInputFiles, String> {
1282 Ok(SetFileInputFiles {
1283 method: SetFileInputFilesMethod::SetFileInputFiles,
1284 params: SetFileInputFilesParams {
1285 files: self
1286 .files
1287 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(files)))?,
1288 node_id: self.node_id.map(Box::new),
1289 backend_node_id: self.backend_node_id.map(Box::new),
1290 object_id: self.object_id,
1291 },
1292 })
1293 }
1294}
1295impl SetNodeStackTracesEnabled {
1296 pub fn builder() -> SetNodeStackTracesEnabledBuilder {
1297 <SetNodeStackTracesEnabledBuilder as Default>::default()
1298 }
1299}
1300#[derive(Default, Clone)]
1301pub struct SetNodeStackTracesEnabledBuilder {
1302 enable: Option<bool>,
1303}
1304impl SetNodeStackTracesEnabledBuilder {
1305 pub fn enable(mut self, enable: impl Into<bool>) -> Self {
1306 self.enable = Some(enable.into());
1307 self
1308 }
1309 pub fn build(self) -> Result<SetNodeStackTracesEnabled, String> {
1310 Ok(SetNodeStackTracesEnabled {
1311 method: SetNodeStackTracesEnabledMethod::SetNodeStackTracesEnabled,
1312 params: SetNodeStackTracesEnabledParams {
1313 enable: self
1314 .enable
1315 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
1316 },
1317 })
1318 }
1319}
1320impl GetNodeStackTraces {
1321 pub fn builder() -> GetNodeStackTracesBuilder {
1322 <GetNodeStackTracesBuilder as Default>::default()
1323 }
1324}
1325#[derive(Default, Clone)]
1326pub struct GetNodeStackTracesBuilder {
1327 node_id: Option<super::types::NodeId>,
1328}
1329impl GetNodeStackTracesBuilder {
1330 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1331 self.node_id = Some(node_id.into());
1332 self
1333 }
1334 pub fn build(self) -> Result<GetNodeStackTraces, String> {
1335 Ok(GetNodeStackTraces {
1336 method: GetNodeStackTracesMethod::GetNodeStackTraces,
1337 params: GetNodeStackTracesParams {
1338 node_id: Box::new(self.node_id.ok_or_else(|| {
1339 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1340 })?),
1341 },
1342 })
1343 }
1344}
1345impl GetFileInfo {
1346 pub fn builder() -> GetFileInfoBuilder {
1347 <GetFileInfoBuilder as Default>::default()
1348 }
1349}
1350#[derive(Default, Clone)]
1351pub struct GetFileInfoBuilder {
1352 object_id: Option<crate::js_protocol::runtime::types::RemoteObjectId>,
1353}
1354impl GetFileInfoBuilder {
1355 pub fn object_id(
1356 mut self,
1357 object_id: impl Into<crate::js_protocol::runtime::types::RemoteObjectId>,
1358 ) -> Self {
1359 self.object_id = Some(object_id.into());
1360 self
1361 }
1362 pub fn build(self) -> Result<GetFileInfo, String> {
1363 Ok(GetFileInfo {
1364 method: GetFileInfoMethod::GetFileInfo,
1365 params: GetFileInfoParams {
1366 object_id: self.object_id.ok_or_else(|| {
1367 format!("Field `{}` is mandatory.", std::stringify!(object_id))
1368 })?,
1369 },
1370 })
1371 }
1372}
1373#[derive(Debug, Clone, Default)]
1374pub struct GetDetachedDomNodesBuilder;
1375impl GetDetachedDomNodesBuilder {
1376 pub fn new() -> Self {
1377 Self
1378 }
1379 pub fn build(self) -> GetDetachedDomNodes {
1380 GetDetachedDomNodes {
1381 method: GetDetachedDomNodesMethod::GetDetachedDomNodes,
1382 params: GetDetachedDomNodesParams {},
1383 }
1384 }
1385}
1386impl GetDetachedDomNodes {
1387 pub fn builder() -> GetDetachedDomNodesBuilder {
1388 GetDetachedDomNodesBuilder
1389 }
1390}
1391impl SetInspectedNode {
1392 pub fn builder() -> SetInspectedNodeBuilder {
1393 <SetInspectedNodeBuilder as Default>::default()
1394 }
1395}
1396#[derive(Default, Clone)]
1397pub struct SetInspectedNodeBuilder {
1398 node_id: Option<super::types::NodeId>,
1399}
1400impl SetInspectedNodeBuilder {
1401 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1402 self.node_id = Some(node_id.into());
1403 self
1404 }
1405 pub fn build(self) -> Result<SetInspectedNode, String> {
1406 Ok(SetInspectedNode {
1407 method: SetInspectedNodeMethod::SetInspectedNode,
1408 params: SetInspectedNodeParams {
1409 node_id: Box::new(self.node_id.ok_or_else(|| {
1410 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1411 })?),
1412 },
1413 })
1414 }
1415}
1416impl SetNodeName {
1417 pub fn builder() -> SetNodeNameBuilder {
1418 <SetNodeNameBuilder as Default>::default()
1419 }
1420}
1421#[derive(Default, Clone)]
1422pub struct SetNodeNameBuilder {
1423 node_id: Option<super::types::NodeId>,
1424 name: Option<String>,
1425}
1426impl SetNodeNameBuilder {
1427 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1428 self.node_id = Some(node_id.into());
1429 self
1430 }
1431 pub fn name(mut self, name: impl Into<String>) -> Self {
1432 self.name = Some(name.into());
1433 self
1434 }
1435 pub fn build(self) -> Result<SetNodeName, String> {
1436 Ok(SetNodeName {
1437 method: SetNodeNameMethod::SetNodeName,
1438 params: SetNodeNameParams {
1439 node_id: Box::new(self.node_id.ok_or_else(|| {
1440 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1441 })?),
1442 name: self
1443 .name
1444 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(name)))?,
1445 },
1446 })
1447 }
1448}
1449impl SetNodeValue {
1450 pub fn builder() -> SetNodeValueBuilder {
1451 <SetNodeValueBuilder as Default>::default()
1452 }
1453}
1454#[derive(Default, Clone)]
1455pub struct SetNodeValueBuilder {
1456 node_id: Option<super::types::NodeId>,
1457 value: Option<String>,
1458}
1459impl SetNodeValueBuilder {
1460 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1461 self.node_id = Some(node_id.into());
1462 self
1463 }
1464 pub fn value(mut self, value: impl Into<String>) -> Self {
1465 self.value = Some(value.into());
1466 self
1467 }
1468 pub fn build(self) -> Result<SetNodeValue, String> {
1469 Ok(SetNodeValue {
1470 method: SetNodeValueMethod::SetNodeValue,
1471 params: SetNodeValueParams {
1472 node_id: Box::new(self.node_id.ok_or_else(|| {
1473 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1474 })?),
1475 value: self
1476 .value
1477 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(value)))?,
1478 },
1479 })
1480 }
1481}
1482impl SetOuterHtml {
1483 pub fn builder() -> SetOuterHtmlBuilder {
1484 <SetOuterHtmlBuilder as Default>::default()
1485 }
1486}
1487#[derive(Default, Clone)]
1488pub struct SetOuterHtmlBuilder {
1489 node_id: Option<super::types::NodeId>,
1490 outer_html: Option<String>,
1491}
1492impl SetOuterHtmlBuilder {
1493 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1494 self.node_id = Some(node_id.into());
1495 self
1496 }
1497 pub fn outer_html(mut self, outer_html: impl Into<String>) -> Self {
1498 self.outer_html = Some(outer_html.into());
1499 self
1500 }
1501 pub fn build(self) -> Result<SetOuterHtml, String> {
1502 Ok(SetOuterHtml {
1503 method: SetOuterHtmlMethod::SetOuterHtml,
1504 params: SetOuterHtmlParams {
1505 node_id: Box::new(self.node_id.ok_or_else(|| {
1506 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1507 })?),
1508 outer_html: self.outer_html.ok_or_else(|| {
1509 format!("Field `{}` is mandatory.", std::stringify!(outer_html))
1510 })?,
1511 },
1512 })
1513 }
1514}
1515#[derive(Debug, Clone, Default)]
1516pub struct UndoBuilder;
1517impl UndoBuilder {
1518 pub fn new() -> Self {
1519 Self
1520 }
1521 pub fn build(self) -> Undo {
1522 Undo {
1523 method: UndoMethod::Undo,
1524 params: UndoParams {},
1525 }
1526 }
1527}
1528impl Undo {
1529 pub fn builder() -> UndoBuilder {
1530 UndoBuilder
1531 }
1532}
1533impl GetFrameOwner {
1534 pub fn builder() -> GetFrameOwnerBuilder {
1535 <GetFrameOwnerBuilder as Default>::default()
1536 }
1537}
1538#[derive(Default, Clone)]
1539pub struct GetFrameOwnerBuilder {
1540 frame_id: Option<crate::browser_protocol::page::types::FrameId>,
1541}
1542impl GetFrameOwnerBuilder {
1543 pub fn frame_id(
1544 mut self,
1545 frame_id: impl Into<crate::browser_protocol::page::types::FrameId>,
1546 ) -> Self {
1547 self.frame_id = Some(frame_id.into());
1548 self
1549 }
1550 pub fn build(self) -> Result<GetFrameOwner, String> {
1551 Ok(GetFrameOwner {
1552 method: GetFrameOwnerMethod::GetFrameOwner,
1553 params: GetFrameOwnerParams {
1554 frame_id: self.frame_id.ok_or_else(|| {
1555 format!("Field `{}` is mandatory.", std::stringify!(frame_id))
1556 })?,
1557 },
1558 })
1559 }
1560}
1561impl GetContainerForNode {
1562 pub fn builder() -> GetContainerForNodeBuilder {
1563 <GetContainerForNodeBuilder as Default>::default()
1564 }
1565}
1566#[derive(Default, Clone)]
1567pub struct GetContainerForNodeBuilder {
1568 node_id: Option<super::types::NodeId>,
1569 container_name: Option<String>,
1570 physical_axes: Option<super::types::PhysicalAxes>,
1571 logical_axes: Option<super::types::LogicalAxes>,
1572 queries_scroll_state: Option<bool>,
1573 queries_anchored: Option<bool>,
1574}
1575impl GetContainerForNodeBuilder {
1576 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1577 self.node_id = Some(node_id.into());
1578 self
1579 }
1580 pub fn container_name(mut self, container_name: impl Into<String>) -> Self {
1581 self.container_name = Some(container_name.into());
1582 self
1583 }
1584 pub fn physical_axes(mut self, physical_axes: impl Into<super::types::PhysicalAxes>) -> Self {
1585 self.physical_axes = Some(physical_axes.into());
1586 self
1587 }
1588 pub fn logical_axes(mut self, logical_axes: impl Into<super::types::LogicalAxes>) -> Self {
1589 self.logical_axes = Some(logical_axes.into());
1590 self
1591 }
1592 pub fn queries_scroll_state(mut self, queries_scroll_state: impl Into<bool>) -> Self {
1593 self.queries_scroll_state = Some(queries_scroll_state.into());
1594 self
1595 }
1596 pub fn queries_anchored(mut self, queries_anchored: impl Into<bool>) -> Self {
1597 self.queries_anchored = Some(queries_anchored.into());
1598 self
1599 }
1600 pub fn build(self) -> Result<GetContainerForNode, String> {
1601 Ok(GetContainerForNode {
1602 method: GetContainerForNodeMethod::GetContainerForNode,
1603 params: GetContainerForNodeParams {
1604 node_id: Box::new(self.node_id.ok_or_else(|| {
1605 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1606 })?),
1607 container_name: self.container_name,
1608 physical_axes: self.physical_axes,
1609 logical_axes: self.logical_axes,
1610 queries_scroll_state: self.queries_scroll_state,
1611 queries_anchored: self.queries_anchored,
1612 },
1613 })
1614 }
1615}
1616impl GetQueryingDescendantsForContainer {
1617 pub fn builder() -> GetQueryingDescendantsForContainerBuilder {
1618 <GetQueryingDescendantsForContainerBuilder as Default>::default()
1619 }
1620}
1621#[derive(Default, Clone)]
1622pub struct GetQueryingDescendantsForContainerBuilder {
1623 node_id: Option<super::types::NodeId>,
1624}
1625impl GetQueryingDescendantsForContainerBuilder {
1626 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1627 self.node_id = Some(node_id.into());
1628 self
1629 }
1630 pub fn build(self) -> Result<GetQueryingDescendantsForContainer, String> {
1631 Ok(GetQueryingDescendantsForContainer {
1632 method: GetQueryingDescendantsForContainerMethod::GetQueryingDescendantsForContainer,
1633 params: GetQueryingDescendantsForContainerParams {
1634 node_id: Box::new(self.node_id.ok_or_else(|| {
1635 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1636 })?),
1637 },
1638 })
1639 }
1640}
1641impl GetAnchorElement {
1642 pub fn builder() -> GetAnchorElementBuilder {
1643 <GetAnchorElementBuilder as Default>::default()
1644 }
1645}
1646#[derive(Default, Clone)]
1647pub struct GetAnchorElementBuilder {
1648 node_id: Option<super::types::NodeId>,
1649 anchor_specifier: Option<String>,
1650}
1651impl GetAnchorElementBuilder {
1652 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1653 self.node_id = Some(node_id.into());
1654 self
1655 }
1656 pub fn anchor_specifier(mut self, anchor_specifier: impl Into<String>) -> Self {
1657 self.anchor_specifier = Some(anchor_specifier.into());
1658 self
1659 }
1660 pub fn build(self) -> Result<GetAnchorElement, String> {
1661 Ok(GetAnchorElement {
1662 method: GetAnchorElementMethod::GetAnchorElement,
1663 params: GetAnchorElementParams {
1664 node_id: Box::new(self.node_id.ok_or_else(|| {
1665 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1666 })?),
1667 anchor_specifier: self.anchor_specifier,
1668 },
1669 })
1670 }
1671}
1672impl ForceShowPopover {
1673 pub fn builder() -> ForceShowPopoverBuilder {
1674 <ForceShowPopoverBuilder as Default>::default()
1675 }
1676}
1677#[derive(Default, Clone)]
1678pub struct ForceShowPopoverBuilder {
1679 node_id: Option<super::types::NodeId>,
1680 enable: Option<bool>,
1681}
1682impl ForceShowPopoverBuilder {
1683 pub fn node_id(mut self, node_id: impl Into<super::types::NodeId>) -> Self {
1684 self.node_id = Some(node_id.into());
1685 self
1686 }
1687 pub fn enable(mut self, enable: impl Into<bool>) -> Self {
1688 self.enable = Some(enable.into());
1689 self
1690 }
1691 pub fn build(self) -> Result<ForceShowPopover, String> {
1692 Ok(ForceShowPopover {
1693 method: ForceShowPopoverMethod::ForceShowPopover,
1694 params: ForceShowPopoverParams {
1695 node_id: Box::new(self.node_id.ok_or_else(|| {
1696 format!("Field `{}` is mandatory.", std::stringify!(node_id))
1697 })?),
1698 enable: self
1699 .enable
1700 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
1701 },
1702 })
1703 }
1704}