1use serde::{Serialize, Deserialize};
5use serde_json::Value as JsonValue;
6use std::borrow::Cow;
7
8pub type FrameId<'a> = Cow<'a, str>;
11
12#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
15pub enum AdFrameType {
16 #[default]
17 #[serde(rename = "none")]
18 None,
19 #[serde(rename = "child")]
20 Child,
21 #[serde(rename = "root")]
22 Root,
23}
24
25
26#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
27pub enum AdFrameExplanation {
28 #[default]
29 #[serde(rename = "ParentIsAd")]
30 ParentIsAd,
31 #[serde(rename = "CreatedByAdScript")]
32 CreatedByAdScript,
33 #[serde(rename = "MatchedBlockingRule")]
34 MatchedBlockingRule,
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize, Default)]
40#[serde(rename_all = "camelCase")]
41pub struct AdFrameStatus {
42 #[serde(rename = "adFrameType")]
43 ad_frame_type: AdFrameType,
44 #[serde(skip_serializing_if = "Option::is_none")]
45 explanations: Option<Vec<AdFrameExplanation>>,
46}
47
48impl AdFrameStatus {
49 pub fn builder(ad_frame_type: impl Into<AdFrameType>) -> AdFrameStatusBuilder {
52 AdFrameStatusBuilder {
53 ad_frame_type: ad_frame_type.into(),
54 explanations: None,
55 }
56 }
57 pub fn ad_frame_type(&self) -> &AdFrameType { &self.ad_frame_type }
58 pub fn explanations(&self) -> Option<&[AdFrameExplanation]> { self.explanations.as_deref() }
59}
60
61
62pub struct AdFrameStatusBuilder {
63 ad_frame_type: AdFrameType,
64 explanations: Option<Vec<AdFrameExplanation>>,
65}
66
67impl AdFrameStatusBuilder {
68 pub fn explanations(mut self, explanations: Vec<AdFrameExplanation>) -> Self { self.explanations = Some(explanations); self }
69 pub fn build(self) -> AdFrameStatus {
70 AdFrameStatus {
71 ad_frame_type: self.ad_frame_type,
72 explanations: self.explanations,
73 }
74 }
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
80pub enum SecureContextType {
81 #[default]
82 #[serde(rename = "Secure")]
83 Secure,
84 #[serde(rename = "SecureLocalhost")]
85 SecureLocalhost,
86 #[serde(rename = "InsecureScheme")]
87 InsecureScheme,
88 #[serde(rename = "InsecureAncestor")]
89 InsecureAncestor,
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
95pub enum CrossOriginIsolatedContextType {
96 #[default]
97 #[serde(rename = "Isolated")]
98 Isolated,
99 #[serde(rename = "NotIsolated")]
100 NotIsolated,
101 #[serde(rename = "NotIsolatedFeatureDisabled")]
102 NotIsolatedFeatureDisabled,
103}
104
105
106#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
107pub enum GatedAPIFeatures {
108 #[default]
109 #[serde(rename = "SharedArrayBuffers")]
110 SharedArrayBuffers,
111 #[serde(rename = "SharedArrayBuffersTransferAllowed")]
112 SharedArrayBuffersTransferAllowed,
113 #[serde(rename = "PerformanceMeasureMemory")]
114 PerformanceMeasureMemory,
115 #[serde(rename = "PerformanceProfile")]
116 PerformanceProfile,
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
124pub enum PermissionsPolicyFeature {
125 #[default]
126 #[serde(rename = "accelerometer")]
127 Accelerometer,
128 #[serde(rename = "all-screens-capture")]
129 AllScreensCapture,
130 #[serde(rename = "ambient-light-sensor")]
131 AmbientLightSensor,
132 #[serde(rename = "aria-notify")]
133 AriaNotify,
134 #[serde(rename = "attribution-reporting")]
135 AttributionReporting,
136 #[serde(rename = "autofill")]
137 Autofill,
138 #[serde(rename = "autoplay")]
139 Autoplay,
140 #[serde(rename = "bluetooth")]
141 Bluetooth,
142 #[serde(rename = "browsing-topics")]
143 BrowsingTopics,
144 #[serde(rename = "camera")]
145 Camera,
146 #[serde(rename = "captured-surface-control")]
147 CapturedSurfaceControl,
148 #[serde(rename = "ch-dpr")]
149 ChDpr,
150 #[serde(rename = "ch-device-memory")]
151 ChDeviceMemory,
152 #[serde(rename = "ch-downlink")]
153 ChDownlink,
154 #[serde(rename = "ch-ect")]
155 ChEct,
156 #[serde(rename = "ch-prefers-color-scheme")]
157 ChPrefersColorScheme,
158 #[serde(rename = "ch-prefers-reduced-motion")]
159 ChPrefersReducedMotion,
160 #[serde(rename = "ch-prefers-reduced-transparency")]
161 ChPrefersReducedTransparency,
162 #[serde(rename = "ch-rtt")]
163 ChRtt,
164 #[serde(rename = "ch-save-data")]
165 ChSaveData,
166 #[serde(rename = "ch-ua")]
167 ChUa,
168 #[serde(rename = "ch-ua-arch")]
169 ChUaArch,
170 #[serde(rename = "ch-ua-bitness")]
171 ChUaBitness,
172 #[serde(rename = "ch-ua-high-entropy-values")]
173 ChUaHighEntropyValues,
174 #[serde(rename = "ch-ua-platform")]
175 ChUaPlatform,
176 #[serde(rename = "ch-ua-model")]
177 ChUaModel,
178 #[serde(rename = "ch-ua-mobile")]
179 ChUaMobile,
180 #[serde(rename = "ch-ua-form-factors")]
181 ChUaFormFactors,
182 #[serde(rename = "ch-ua-full-version")]
183 ChUaFullVersion,
184 #[serde(rename = "ch-ua-full-version-list")]
185 ChUaFullVersionList,
186 #[serde(rename = "ch-ua-platform-version")]
187 ChUaPlatformVersion,
188 #[serde(rename = "ch-ua-wow64")]
189 ChUaWow64,
190 #[serde(rename = "ch-viewport-height")]
191 ChViewportHeight,
192 #[serde(rename = "ch-viewport-width")]
193 ChViewportWidth,
194 #[serde(rename = "ch-width")]
195 ChWidth,
196 #[serde(rename = "clipboard-read")]
197 ClipboardRead,
198 #[serde(rename = "clipboard-write")]
199 ClipboardWrite,
200 #[serde(rename = "compute-pressure")]
201 ComputePressure,
202 #[serde(rename = "controlled-frame")]
203 ControlledFrame,
204 #[serde(rename = "cross-origin-isolated")]
205 CrossOriginIsolated,
206 #[serde(rename = "deferred-fetch")]
207 DeferredFetch,
208 #[serde(rename = "deferred-fetch-minimal")]
209 DeferredFetchMinimal,
210 #[serde(rename = "device-attributes")]
211 DeviceAttributes,
212 #[serde(rename = "digital-credentials-create")]
213 DigitalCredentialsCreate,
214 #[serde(rename = "digital-credentials-get")]
215 DigitalCredentialsGet,
216 #[serde(rename = "direct-sockets")]
217 DirectSockets,
218 #[serde(rename = "direct-sockets-multicast")]
219 DirectSocketsMulticast,
220 #[serde(rename = "direct-sockets-private")]
221 DirectSocketsPrivate,
222 #[serde(rename = "display-capture")]
223 DisplayCapture,
224 #[serde(rename = "document-domain")]
225 DocumentDomain,
226 #[serde(rename = "encrypted-media")]
227 EncryptedMedia,
228 #[serde(rename = "execution-while-out-of-viewport")]
229 ExecutionWhileOutOfViewport,
230 #[serde(rename = "execution-while-not-rendered")]
231 ExecutionWhileNotRendered,
232 #[serde(rename = "focus-without-user-activation")]
233 FocusWithoutUserActivation,
234 #[serde(rename = "fullscreen")]
235 Fullscreen,
236 #[serde(rename = "frobulate")]
237 Frobulate,
238 #[serde(rename = "gamepad")]
239 Gamepad,
240 #[serde(rename = "geolocation")]
241 Geolocation,
242 #[serde(rename = "gyroscope")]
243 Gyroscope,
244 #[serde(rename = "hid")]
245 Hid,
246 #[serde(rename = "identity-credentials-get")]
247 IdentityCredentialsGet,
248 #[serde(rename = "idle-detection")]
249 IdleDetection,
250 #[serde(rename = "interest-cohort")]
251 InterestCohort,
252 #[serde(rename = "join-ad-interest-group")]
253 JoinAdInterestGroup,
254 #[serde(rename = "keyboard-map")]
255 KeyboardMap,
256 #[serde(rename = "language-detector")]
257 LanguageDetector,
258 #[serde(rename = "language-model")]
259 LanguageModel,
260 #[serde(rename = "local-fonts")]
261 LocalFonts,
262 #[serde(rename = "local-network")]
263 LocalNetwork,
264 #[serde(rename = "local-network-access")]
265 LocalNetworkAccess,
266 #[serde(rename = "loopback-network")]
267 LoopbackNetwork,
268 #[serde(rename = "magnetometer")]
269 Magnetometer,
270 #[serde(rename = "manual-text")]
271 ManualText,
272 #[serde(rename = "media-playback-while-not-visible")]
273 MediaPlaybackWhileNotVisible,
274 #[serde(rename = "microphone")]
275 Microphone,
276 #[serde(rename = "midi")]
277 Midi,
278 #[serde(rename = "on-device-speech-recognition")]
279 OnDeviceSpeechRecognition,
280 #[serde(rename = "otp-credentials")]
281 OtpCredentials,
282 #[serde(rename = "payment")]
283 Payment,
284 #[serde(rename = "picture-in-picture")]
285 PictureInPicture,
286 #[serde(rename = "private-aggregation")]
287 PrivateAggregation,
288 #[serde(rename = "private-state-token-issuance")]
289 PrivateStateTokenIssuance,
290 #[serde(rename = "private-state-token-redemption")]
291 PrivateStateTokenRedemption,
292 #[serde(rename = "publickey-credentials-create")]
293 PublickeyCredentialsCreate,
294 #[serde(rename = "publickey-credentials-get")]
295 PublickeyCredentialsGet,
296 #[serde(rename = "record-ad-auction-events")]
297 RecordAdAuctionEvents,
298 #[serde(rename = "rewriter")]
299 Rewriter,
300 #[serde(rename = "run-ad-auction")]
301 RunAdAuction,
302 #[serde(rename = "screen-wake-lock")]
303 ScreenWakeLock,
304 #[serde(rename = "serial")]
305 Serial,
306 #[serde(rename = "shared-storage")]
307 SharedStorage,
308 #[serde(rename = "shared-storage-select-url")]
309 SharedStorageSelectUrl,
310 #[serde(rename = "smart-card")]
311 SmartCard,
312 #[serde(rename = "speaker-selection")]
313 SpeakerSelection,
314 #[serde(rename = "storage-access")]
315 StorageAccess,
316 #[serde(rename = "sub-apps")]
317 SubApps,
318 #[serde(rename = "summarizer")]
319 Summarizer,
320 #[serde(rename = "sync-xhr")]
321 SyncXhr,
322 #[serde(rename = "tools")]
323 Tools,
324 #[serde(rename = "translator")]
325 Translator,
326 #[serde(rename = "unload")]
327 Unload,
328 #[serde(rename = "usb")]
329 Usb,
330 #[serde(rename = "usb-unrestricted")]
331 UsbUnrestricted,
332 #[serde(rename = "vertical-scroll")]
333 VerticalScroll,
334 #[serde(rename = "web-app-installation")]
335 WebAppInstallation,
336 #[serde(rename = "web-printing")]
337 WebPrinting,
338 #[serde(rename = "web-share")]
339 WebShare,
340 #[serde(rename = "window-management")]
341 WindowManagement,
342 #[serde(rename = "writer")]
343 Writer,
344 #[serde(rename = "xr-spatial-tracking")]
345 XrSpatialTracking,
346}
347
348#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
351pub enum PermissionsPolicyBlockReason {
352 #[default]
353 #[serde(rename = "Header")]
354 Header,
355 #[serde(rename = "IframeAttribute")]
356 IframeAttribute,
357 #[serde(rename = "InFencedFrameTree")]
358 InFencedFrameTree,
359 #[serde(rename = "InIsolatedApp")]
360 InIsolatedApp,
361}
362
363
364#[derive(Debug, Clone, Serialize, Deserialize, Default)]
365#[serde(rename_all = "camelCase")]
366pub struct PermissionsPolicyBlockLocator<'a> {
367 #[serde(rename = "frameId")]
368 frame_id: FrameId<'a>,
369 #[serde(rename = "blockReason")]
370 block_reason: PermissionsPolicyBlockReason,
371}
372
373impl<'a> PermissionsPolicyBlockLocator<'a> {
374 pub fn builder(frame_id: impl Into<FrameId<'a>>, block_reason: impl Into<PermissionsPolicyBlockReason>) -> PermissionsPolicyBlockLocatorBuilder<'a> {
378 PermissionsPolicyBlockLocatorBuilder {
379 frame_id: frame_id.into(),
380 block_reason: block_reason.into(),
381 }
382 }
383 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
384 pub fn block_reason(&self) -> &PermissionsPolicyBlockReason { &self.block_reason }
385}
386
387
388pub struct PermissionsPolicyBlockLocatorBuilder<'a> {
389 frame_id: FrameId<'a>,
390 block_reason: PermissionsPolicyBlockReason,
391}
392
393impl<'a> PermissionsPolicyBlockLocatorBuilder<'a> {
394 pub fn build(self) -> PermissionsPolicyBlockLocator<'a> {
395 PermissionsPolicyBlockLocator {
396 frame_id: self.frame_id,
397 block_reason: self.block_reason,
398 }
399 }
400}
401
402
403#[derive(Debug, Clone, Serialize, Deserialize, Default)]
404#[serde(rename_all = "camelCase")]
405pub struct PermissionsPolicyFeatureState<'a> {
406 feature: PermissionsPolicyFeature,
407 allowed: bool,
408 #[serde(skip_serializing_if = "Option::is_none")]
409 locator: Option<PermissionsPolicyBlockLocator<'a>>,
410}
411
412impl<'a> PermissionsPolicyFeatureState<'a> {
413 pub fn builder(feature: impl Into<PermissionsPolicyFeature>, allowed: bool) -> PermissionsPolicyFeatureStateBuilder<'a> {
417 PermissionsPolicyFeatureStateBuilder {
418 feature: feature.into(),
419 allowed: allowed,
420 locator: None,
421 }
422 }
423 pub fn feature(&self) -> &PermissionsPolicyFeature { &self.feature }
424 pub fn allowed(&self) -> bool { self.allowed }
425 pub fn locator(&self) -> Option<&PermissionsPolicyBlockLocator<'a>> { self.locator.as_ref() }
426}
427
428
429pub struct PermissionsPolicyFeatureStateBuilder<'a> {
430 feature: PermissionsPolicyFeature,
431 allowed: bool,
432 locator: Option<PermissionsPolicyBlockLocator<'a>>,
433}
434
435impl<'a> PermissionsPolicyFeatureStateBuilder<'a> {
436 pub fn locator(mut self, locator: PermissionsPolicyBlockLocator<'a>) -> Self { self.locator = Some(locator); self }
437 pub fn build(self) -> PermissionsPolicyFeatureState<'a> {
438 PermissionsPolicyFeatureState {
439 feature: self.feature,
440 allowed: self.allowed,
441 locator: self.locator,
442 }
443 }
444}
445
446#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
450pub enum OriginTrialTokenStatus {
451 #[default]
452 #[serde(rename = "Success")]
453 Success,
454 #[serde(rename = "NotSupported")]
455 NotSupported,
456 #[serde(rename = "Insecure")]
457 Insecure,
458 #[serde(rename = "Expired")]
459 Expired,
460 #[serde(rename = "WrongOrigin")]
461 WrongOrigin,
462 #[serde(rename = "InvalidSignature")]
463 InvalidSignature,
464 #[serde(rename = "Malformed")]
465 Malformed,
466 #[serde(rename = "WrongVersion")]
467 WrongVersion,
468 #[serde(rename = "FeatureDisabled")]
469 FeatureDisabled,
470 #[serde(rename = "TokenDisabled")]
471 TokenDisabled,
472 #[serde(rename = "FeatureDisabledForUser")]
473 FeatureDisabledForUser,
474 #[serde(rename = "UnknownTrial")]
475 UnknownTrial,
476}
477
478#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
481pub enum OriginTrialStatus {
482 #[default]
483 #[serde(rename = "Enabled")]
484 Enabled,
485 #[serde(rename = "ValidTokenNotProvided")]
486 ValidTokenNotProvided,
487 #[serde(rename = "OSNotSupported")]
488 OSNotSupported,
489 #[serde(rename = "TrialNotAllowed")]
490 TrialNotAllowed,
491}
492
493
494#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
495pub enum OriginTrialUsageRestriction {
496 #[default]
497 #[serde(rename = "None")]
498 None,
499 #[serde(rename = "Subset")]
500 Subset,
501}
502
503
504#[derive(Debug, Clone, Serialize, Deserialize, Default)]
505#[serde(rename_all = "camelCase")]
506pub struct OriginTrialToken<'a> {
507 origin: Cow<'a, str>,
508 #[serde(rename = "matchSubDomains")]
509 match_sub_domains: bool,
510 #[serde(rename = "trialName")]
511 trial_name: Cow<'a, str>,
512 #[serde(rename = "expiryTime")]
513 expiry_time: crate::network::TimeSinceEpoch,
514 #[serde(rename = "isThirdParty")]
515 is_third_party: bool,
516 #[serde(rename = "usageRestriction")]
517 usage_restriction: OriginTrialUsageRestriction,
518}
519
520impl<'a> OriginTrialToken<'a> {
521 pub fn builder(origin: impl Into<Cow<'a, str>>, match_sub_domains: bool, trial_name: impl Into<Cow<'a, str>>, expiry_time: crate::network::TimeSinceEpoch, is_third_party: bool, usage_restriction: impl Into<OriginTrialUsageRestriction>) -> OriginTrialTokenBuilder<'a> {
529 OriginTrialTokenBuilder {
530 origin: origin.into(),
531 match_sub_domains: match_sub_domains,
532 trial_name: trial_name.into(),
533 expiry_time: expiry_time,
534 is_third_party: is_third_party,
535 usage_restriction: usage_restriction.into(),
536 }
537 }
538 pub fn origin(&self) -> &str { self.origin.as_ref() }
539 pub fn match_sub_domains(&self) -> bool { self.match_sub_domains }
540 pub fn trial_name(&self) -> &str { self.trial_name.as_ref() }
541 pub fn expiry_time(&self) -> &crate::network::TimeSinceEpoch { &self.expiry_time }
542 pub fn is_third_party(&self) -> bool { self.is_third_party }
543 pub fn usage_restriction(&self) -> &OriginTrialUsageRestriction { &self.usage_restriction }
544}
545
546
547pub struct OriginTrialTokenBuilder<'a> {
548 origin: Cow<'a, str>,
549 match_sub_domains: bool,
550 trial_name: Cow<'a, str>,
551 expiry_time: crate::network::TimeSinceEpoch,
552 is_third_party: bool,
553 usage_restriction: OriginTrialUsageRestriction,
554}
555
556impl<'a> OriginTrialTokenBuilder<'a> {
557 pub fn build(self) -> OriginTrialToken<'a> {
558 OriginTrialToken {
559 origin: self.origin,
560 match_sub_domains: self.match_sub_domains,
561 trial_name: self.trial_name,
562 expiry_time: self.expiry_time,
563 is_third_party: self.is_third_party,
564 usage_restriction: self.usage_restriction,
565 }
566 }
567}
568
569
570#[derive(Debug, Clone, Serialize, Deserialize, Default)]
571#[serde(rename_all = "camelCase")]
572pub struct OriginTrialTokenWithStatus<'a> {
573 #[serde(rename = "rawTokenText")]
574 raw_token_text: Cow<'a, str>,
575 #[serde(skip_serializing_if = "Option::is_none", rename = "parsedToken")]
578 parsed_token: Option<OriginTrialToken<'a>>,
579 status: OriginTrialTokenStatus,
580}
581
582impl<'a> OriginTrialTokenWithStatus<'a> {
583 pub fn builder(raw_token_text: impl Into<Cow<'a, str>>, status: impl Into<OriginTrialTokenStatus>) -> OriginTrialTokenWithStatusBuilder<'a> {
587 OriginTrialTokenWithStatusBuilder {
588 raw_token_text: raw_token_text.into(),
589 parsed_token: None,
590 status: status.into(),
591 }
592 }
593 pub fn raw_token_text(&self) -> &str { self.raw_token_text.as_ref() }
594 pub fn parsed_token(&self) -> Option<&OriginTrialToken<'a>> { self.parsed_token.as_ref() }
597 pub fn status(&self) -> &OriginTrialTokenStatus { &self.status }
598}
599
600
601pub struct OriginTrialTokenWithStatusBuilder<'a> {
602 raw_token_text: Cow<'a, str>,
603 parsed_token: Option<OriginTrialToken<'a>>,
604 status: OriginTrialTokenStatus,
605}
606
607impl<'a> OriginTrialTokenWithStatusBuilder<'a> {
608 pub fn parsed_token(mut self, parsed_token: OriginTrialToken<'a>) -> Self { self.parsed_token = Some(parsed_token); self }
611 pub fn build(self) -> OriginTrialTokenWithStatus<'a> {
612 OriginTrialTokenWithStatus {
613 raw_token_text: self.raw_token_text,
614 parsed_token: self.parsed_token,
615 status: self.status,
616 }
617 }
618}
619
620
621#[derive(Debug, Clone, Serialize, Deserialize, Default)]
622#[serde(rename_all = "camelCase")]
623pub struct OriginTrial<'a> {
624 #[serde(rename = "trialName")]
625 trial_name: Cow<'a, str>,
626 status: OriginTrialStatus,
627 #[serde(rename = "tokensWithStatus")]
628 tokens_with_status: Vec<OriginTrialTokenWithStatus<'a>>,
629}
630
631impl<'a> OriginTrial<'a> {
632 pub fn builder(trial_name: impl Into<Cow<'a, str>>, status: impl Into<OriginTrialStatus>, tokens_with_status: Vec<OriginTrialTokenWithStatus<'a>>) -> OriginTrialBuilder<'a> {
637 OriginTrialBuilder {
638 trial_name: trial_name.into(),
639 status: status.into(),
640 tokens_with_status: tokens_with_status,
641 }
642 }
643 pub fn trial_name(&self) -> &str { self.trial_name.as_ref() }
644 pub fn status(&self) -> &OriginTrialStatus { &self.status }
645 pub fn tokens_with_status(&self) -> &[OriginTrialTokenWithStatus<'a>] { &self.tokens_with_status }
646}
647
648
649pub struct OriginTrialBuilder<'a> {
650 trial_name: Cow<'a, str>,
651 status: OriginTrialStatus,
652 tokens_with_status: Vec<OriginTrialTokenWithStatus<'a>>,
653}
654
655impl<'a> OriginTrialBuilder<'a> {
656 pub fn build(self) -> OriginTrial<'a> {
657 OriginTrial {
658 trial_name: self.trial_name,
659 status: self.status,
660 tokens_with_status: self.tokens_with_status,
661 }
662 }
663}
664
665#[derive(Debug, Clone, Serialize, Deserialize, Default)]
668#[serde(rename_all = "camelCase")]
669pub struct SecurityOriginDetails {
670 #[serde(rename = "isLocalhost")]
674 is_localhost: bool,
675}
676
677impl SecurityOriginDetails {
678 pub fn builder(is_localhost: bool) -> SecurityOriginDetailsBuilder {
681 SecurityOriginDetailsBuilder {
682 is_localhost: is_localhost,
683 }
684 }
685 pub fn is_localhost(&self) -> bool { self.is_localhost }
689}
690
691
692pub struct SecurityOriginDetailsBuilder {
693 is_localhost: bool,
694}
695
696impl SecurityOriginDetailsBuilder {
697 pub fn build(self) -> SecurityOriginDetails {
698 SecurityOriginDetails {
699 is_localhost: self.is_localhost,
700 }
701 }
702}
703
704#[derive(Debug, Clone, Serialize, Deserialize, Default)]
707#[serde(rename_all = "camelCase")]
708pub struct Frame<'a> {
709 id: FrameId<'a>,
711 #[serde(skip_serializing_if = "Option::is_none", rename = "parentId")]
713 parent_id: Option<FrameId<'a>>,
714 #[serde(rename = "loaderId")]
716 loader_id: crate::network::LoaderId<'a>,
717 #[serde(skip_serializing_if = "Option::is_none")]
719 name: Option<Cow<'a, str>>,
720 url: Cow<'a, str>,
722 #[serde(skip_serializing_if = "Option::is_none", rename = "urlFragment")]
724 url_fragment: Option<Cow<'a, str>>,
725 #[serde(rename = "domainAndRegistry")]
730 domain_and_registry: Cow<'a, str>,
731 #[serde(rename = "securityOrigin")]
733 security_origin: Cow<'a, str>,
734 #[serde(skip_serializing_if = "Option::is_none", rename = "securityOriginDetails")]
736 security_origin_details: Option<SecurityOriginDetails>,
737 #[serde(rename = "mimeType")]
739 mime_type: Cow<'a, str>,
740 #[serde(skip_serializing_if = "Option::is_none", rename = "unreachableUrl")]
742 unreachable_url: Option<Cow<'a, str>>,
743 #[serde(skip_serializing_if = "Option::is_none", rename = "adFrameStatus")]
745 ad_frame_status: Option<AdFrameStatus>,
746 #[serde(rename = "secureContextType")]
748 secure_context_type: SecureContextType,
749 #[serde(rename = "crossOriginIsolatedContextType")]
751 cross_origin_isolated_context_type: CrossOriginIsolatedContextType,
752 #[serde(rename = "gatedAPIFeatures")]
754 gated_api_features: Vec<GatedAPIFeatures>,
755}
756
757impl<'a> Frame<'a> {
758 pub fn builder(id: impl Into<FrameId<'a>>, loader_id: crate::network::LoaderId<'a>, url: impl Into<Cow<'a, str>>, domain_and_registry: impl Into<Cow<'a, str>>, security_origin: impl Into<Cow<'a, str>>, mime_type: impl Into<Cow<'a, str>>, secure_context_type: impl Into<SecureContextType>, cross_origin_isolated_context_type: impl Into<CrossOriginIsolatedContextType>, gated_api_features: Vec<GatedAPIFeatures>) -> FrameBuilder<'a> {
769 FrameBuilder {
770 id: id.into(),
771 parent_id: None,
772 loader_id: loader_id,
773 name: None,
774 url: url.into(),
775 url_fragment: None,
776 domain_and_registry: domain_and_registry.into(),
777 security_origin: security_origin.into(),
778 security_origin_details: None,
779 mime_type: mime_type.into(),
780 unreachable_url: None,
781 ad_frame_status: None,
782 secure_context_type: secure_context_type.into(),
783 cross_origin_isolated_context_type: cross_origin_isolated_context_type.into(),
784 gated_api_features: gated_api_features,
785 }
786 }
787 pub fn id(&self) -> &FrameId<'a> { &self.id }
789 pub fn parent_id(&self) -> Option<&FrameId<'a>> { self.parent_id.as_ref() }
791 pub fn loader_id(&self) -> &crate::network::LoaderId<'a> { &self.loader_id }
793 pub fn name(&self) -> Option<&str> { self.name.as_deref() }
795 pub fn url(&self) -> &str { self.url.as_ref() }
797 pub fn url_fragment(&self) -> Option<&str> { self.url_fragment.as_deref() }
799 pub fn domain_and_registry(&self) -> &str { self.domain_and_registry.as_ref() }
804 pub fn security_origin(&self) -> &str { self.security_origin.as_ref() }
806 pub fn security_origin_details(&self) -> Option<&SecurityOriginDetails> { self.security_origin_details.as_ref() }
808 pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
810 pub fn unreachable_url(&self) -> Option<&str> { self.unreachable_url.as_deref() }
812 pub fn ad_frame_status(&self) -> Option<&AdFrameStatus> { self.ad_frame_status.as_ref() }
814 pub fn secure_context_type(&self) -> &SecureContextType { &self.secure_context_type }
816 pub fn cross_origin_isolated_context_type(&self) -> &CrossOriginIsolatedContextType { &self.cross_origin_isolated_context_type }
818 pub fn gated_api_features(&self) -> &[GatedAPIFeatures] { &self.gated_api_features }
820}
821
822
823pub struct FrameBuilder<'a> {
824 id: FrameId<'a>,
825 parent_id: Option<FrameId<'a>>,
826 loader_id: crate::network::LoaderId<'a>,
827 name: Option<Cow<'a, str>>,
828 url: Cow<'a, str>,
829 url_fragment: Option<Cow<'a, str>>,
830 domain_and_registry: Cow<'a, str>,
831 security_origin: Cow<'a, str>,
832 security_origin_details: Option<SecurityOriginDetails>,
833 mime_type: Cow<'a, str>,
834 unreachable_url: Option<Cow<'a, str>>,
835 ad_frame_status: Option<AdFrameStatus>,
836 secure_context_type: SecureContextType,
837 cross_origin_isolated_context_type: CrossOriginIsolatedContextType,
838 gated_api_features: Vec<GatedAPIFeatures>,
839}
840
841impl<'a> FrameBuilder<'a> {
842 pub fn parent_id(mut self, parent_id: impl Into<FrameId<'a>>) -> Self { self.parent_id = Some(parent_id.into()); self }
844 pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
846 pub fn url_fragment(mut self, url_fragment: impl Into<Cow<'a, str>>) -> Self { self.url_fragment = Some(url_fragment.into()); self }
848 pub fn security_origin_details(mut self, security_origin_details: SecurityOriginDetails) -> Self { self.security_origin_details = Some(security_origin_details); self }
850 pub fn unreachable_url(mut self, unreachable_url: impl Into<Cow<'a, str>>) -> Self { self.unreachable_url = Some(unreachable_url.into()); self }
852 pub fn ad_frame_status(mut self, ad_frame_status: AdFrameStatus) -> Self { self.ad_frame_status = Some(ad_frame_status); self }
854 pub fn build(self) -> Frame<'a> {
855 Frame {
856 id: self.id,
857 parent_id: self.parent_id,
858 loader_id: self.loader_id,
859 name: self.name,
860 url: self.url,
861 url_fragment: self.url_fragment,
862 domain_and_registry: self.domain_and_registry,
863 security_origin: self.security_origin,
864 security_origin_details: self.security_origin_details,
865 mime_type: self.mime_type,
866 unreachable_url: self.unreachable_url,
867 ad_frame_status: self.ad_frame_status,
868 secure_context_type: self.secure_context_type,
869 cross_origin_isolated_context_type: self.cross_origin_isolated_context_type,
870 gated_api_features: self.gated_api_features,
871 }
872 }
873}
874
875#[derive(Debug, Clone, Serialize, Deserialize, Default)]
878#[serde(rename_all = "camelCase")]
879pub struct FrameResource<'a> {
880 url: Cow<'a, str>,
882 #[serde(rename = "type")]
884 type_: crate::network::ResourceType,
885 #[serde(rename = "mimeType")]
887 mime_type: Cow<'a, str>,
888 #[serde(skip_serializing_if = "Option::is_none", rename = "lastModified")]
890 last_modified: Option<crate::network::TimeSinceEpoch>,
891 #[serde(skip_serializing_if = "Option::is_none", rename = "contentSize")]
893 content_size: Option<f64>,
894 #[serde(skip_serializing_if = "Option::is_none")]
896 failed: Option<bool>,
897 #[serde(skip_serializing_if = "Option::is_none")]
899 canceled: Option<bool>,
900}
901
902impl<'a> FrameResource<'a> {
903 pub fn builder(url: impl Into<Cow<'a, str>>, type_: crate::network::ResourceType, mime_type: impl Into<Cow<'a, str>>) -> FrameResourceBuilder<'a> {
908 FrameResourceBuilder {
909 url: url.into(),
910 type_: type_,
911 mime_type: mime_type.into(),
912 last_modified: None,
913 content_size: None,
914 failed: None,
915 canceled: None,
916 }
917 }
918 pub fn url(&self) -> &str { self.url.as_ref() }
920 pub fn type_(&self) -> &crate::network::ResourceType { &self.type_ }
922 pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
924 pub fn last_modified(&self) -> Option<&crate::network::TimeSinceEpoch> { self.last_modified.as_ref() }
926 pub fn content_size(&self) -> Option<f64> { self.content_size }
928 pub fn failed(&self) -> Option<bool> { self.failed }
930 pub fn canceled(&self) -> Option<bool> { self.canceled }
932}
933
934
935pub struct FrameResourceBuilder<'a> {
936 url: Cow<'a, str>,
937 type_: crate::network::ResourceType,
938 mime_type: Cow<'a, str>,
939 last_modified: Option<crate::network::TimeSinceEpoch>,
940 content_size: Option<f64>,
941 failed: Option<bool>,
942 canceled: Option<bool>,
943}
944
945impl<'a> FrameResourceBuilder<'a> {
946 pub fn last_modified(mut self, last_modified: crate::network::TimeSinceEpoch) -> Self { self.last_modified = Some(last_modified); self }
948 pub fn content_size(mut self, content_size: f64) -> Self { self.content_size = Some(content_size); self }
950 pub fn failed(mut self, failed: bool) -> Self { self.failed = Some(failed); self }
952 pub fn canceled(mut self, canceled: bool) -> Self { self.canceled = Some(canceled); self }
954 pub fn build(self) -> FrameResource<'a> {
955 FrameResource {
956 url: self.url,
957 type_: self.type_,
958 mime_type: self.mime_type,
959 last_modified: self.last_modified,
960 content_size: self.content_size,
961 failed: self.failed,
962 canceled: self.canceled,
963 }
964 }
965}
966
967#[derive(Debug, Clone, Serialize, Deserialize, Default)]
970#[serde(rename_all = "camelCase")]
971pub struct FrameResourceTree<'a> {
972 frame: Frame<'a>,
974 #[serde(skip_serializing_if = "Option::is_none", rename = "childFrames")]
976 child_frames: Option<Vec<Box<FrameResourceTree<'a>>>>,
977 resources: Vec<FrameResource<'a>>,
979}
980
981impl<'a> FrameResourceTree<'a> {
982 pub fn builder(frame: Frame<'a>, resources: Vec<FrameResource<'a>>) -> FrameResourceTreeBuilder<'a> {
986 FrameResourceTreeBuilder {
987 frame: frame,
988 child_frames: None,
989 resources: resources,
990 }
991 }
992 pub fn frame(&self) -> &Frame<'a> { &self.frame }
994 pub fn child_frames(&self) -> Option<&[Box<FrameResourceTree<'a>>]> { self.child_frames.as_deref() }
996 pub fn resources(&self) -> &[FrameResource<'a>] { &self.resources }
998}
999
1000
1001pub struct FrameResourceTreeBuilder<'a> {
1002 frame: Frame<'a>,
1003 child_frames: Option<Vec<Box<FrameResourceTree<'a>>>>,
1004 resources: Vec<FrameResource<'a>>,
1005}
1006
1007impl<'a> FrameResourceTreeBuilder<'a> {
1008 pub fn child_frames(mut self, child_frames: Vec<Box<FrameResourceTree<'a>>>) -> Self { self.child_frames = Some(child_frames); self }
1010 pub fn build(self) -> FrameResourceTree<'a> {
1011 FrameResourceTree {
1012 frame: self.frame,
1013 child_frames: self.child_frames,
1014 resources: self.resources,
1015 }
1016 }
1017}
1018
1019#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1022#[serde(rename_all = "camelCase")]
1023pub struct FrameTree<'a> {
1024 frame: Frame<'a>,
1026 #[serde(skip_serializing_if = "Option::is_none", rename = "childFrames")]
1028 child_frames: Option<Vec<Box<FrameTree<'a>>>>,
1029}
1030
1031impl<'a> FrameTree<'a> {
1032 pub fn builder(frame: Frame<'a>) -> FrameTreeBuilder<'a> {
1035 FrameTreeBuilder {
1036 frame: frame,
1037 child_frames: None,
1038 }
1039 }
1040 pub fn frame(&self) -> &Frame<'a> { &self.frame }
1042 pub fn child_frames(&self) -> Option<&[Box<FrameTree<'a>>]> { self.child_frames.as_deref() }
1044}
1045
1046
1047pub struct FrameTreeBuilder<'a> {
1048 frame: Frame<'a>,
1049 child_frames: Option<Vec<Box<FrameTree<'a>>>>,
1050}
1051
1052impl<'a> FrameTreeBuilder<'a> {
1053 pub fn child_frames(mut self, child_frames: Vec<Box<FrameTree<'a>>>) -> Self { self.child_frames = Some(child_frames); self }
1055 pub fn build(self) -> FrameTree<'a> {
1056 FrameTree {
1057 frame: self.frame,
1058 child_frames: self.child_frames,
1059 }
1060 }
1061}
1062
1063pub type ScriptIdentifier<'a> = Cow<'a, str>;
1066
1067#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1070pub enum TransitionType {
1071 #[default]
1072 #[serde(rename = "link")]
1073 Link,
1074 #[serde(rename = "typed")]
1075 Typed,
1076 #[serde(rename = "address_bar")]
1077 AddressBar,
1078 #[serde(rename = "auto_bookmark")]
1079 AutoBookmark,
1080 #[serde(rename = "auto_subframe")]
1081 AutoSubframe,
1082 #[serde(rename = "manual_subframe")]
1083 ManualSubframe,
1084 #[serde(rename = "generated")]
1085 Generated,
1086 #[serde(rename = "auto_toplevel")]
1087 AutoToplevel,
1088 #[serde(rename = "form_submit")]
1089 FormSubmit,
1090 #[serde(rename = "reload")]
1091 Reload,
1092 #[serde(rename = "keyword")]
1093 Keyword,
1094 #[serde(rename = "keyword_generated")]
1095 KeywordGenerated,
1096 #[serde(rename = "other")]
1097 Other,
1098}
1099
1100#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1103#[serde(rename_all = "camelCase")]
1104pub struct NavigationEntry<'a> {
1105 id: u64,
1107 url: Cow<'a, str>,
1109 #[serde(rename = "userTypedURL")]
1111 user_typed_url: Cow<'a, str>,
1112 title: Cow<'a, str>,
1114 #[serde(rename = "transitionType")]
1116 transition_type: TransitionType,
1117}
1118
1119impl<'a> NavigationEntry<'a> {
1120 pub fn builder(id: u64, url: impl Into<Cow<'a, str>>, user_typed_url: impl Into<Cow<'a, str>>, title: impl Into<Cow<'a, str>>, transition_type: impl Into<TransitionType>) -> NavigationEntryBuilder<'a> {
1127 NavigationEntryBuilder {
1128 id: id,
1129 url: url.into(),
1130 user_typed_url: user_typed_url.into(),
1131 title: title.into(),
1132 transition_type: transition_type.into(),
1133 }
1134 }
1135 pub fn id(&self) -> u64 { self.id }
1137 pub fn url(&self) -> &str { self.url.as_ref() }
1139 pub fn user_typed_url(&self) -> &str { self.user_typed_url.as_ref() }
1141 pub fn title(&self) -> &str { self.title.as_ref() }
1143 pub fn transition_type(&self) -> &TransitionType { &self.transition_type }
1145}
1146
1147
1148pub struct NavigationEntryBuilder<'a> {
1149 id: u64,
1150 url: Cow<'a, str>,
1151 user_typed_url: Cow<'a, str>,
1152 title: Cow<'a, str>,
1153 transition_type: TransitionType,
1154}
1155
1156impl<'a> NavigationEntryBuilder<'a> {
1157 pub fn build(self) -> NavigationEntry<'a> {
1158 NavigationEntry {
1159 id: self.id,
1160 url: self.url,
1161 user_typed_url: self.user_typed_url,
1162 title: self.title,
1163 transition_type: self.transition_type,
1164 }
1165 }
1166}
1167
1168#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1171#[serde(rename_all = "camelCase")]
1172pub struct ScreencastFrameMetadata {
1173 #[serde(rename = "offsetTop")]
1175 offset_top: f64,
1176 #[serde(rename = "pageScaleFactor")]
1178 page_scale_factor: f64,
1179 #[serde(rename = "deviceWidth")]
1181 device_width: f64,
1182 #[serde(rename = "deviceHeight")]
1184 device_height: f64,
1185 #[serde(rename = "scrollOffsetX")]
1187 scroll_offset_x: f64,
1188 #[serde(rename = "scrollOffsetY")]
1190 scroll_offset_y: f64,
1191 #[serde(skip_serializing_if = "Option::is_none")]
1193 timestamp: Option<crate::network::TimeSinceEpoch>,
1194}
1195
1196impl ScreencastFrameMetadata {
1197 pub fn builder(offset_top: f64, page_scale_factor: f64, device_width: f64, device_height: f64, scroll_offset_x: f64, scroll_offset_y: f64) -> ScreencastFrameMetadataBuilder {
1205 ScreencastFrameMetadataBuilder {
1206 offset_top: offset_top,
1207 page_scale_factor: page_scale_factor,
1208 device_width: device_width,
1209 device_height: device_height,
1210 scroll_offset_x: scroll_offset_x,
1211 scroll_offset_y: scroll_offset_y,
1212 timestamp: None,
1213 }
1214 }
1215 pub fn offset_top(&self) -> f64 { self.offset_top }
1217 pub fn page_scale_factor(&self) -> f64 { self.page_scale_factor }
1219 pub fn device_width(&self) -> f64 { self.device_width }
1221 pub fn device_height(&self) -> f64 { self.device_height }
1223 pub fn scroll_offset_x(&self) -> f64 { self.scroll_offset_x }
1225 pub fn scroll_offset_y(&self) -> f64 { self.scroll_offset_y }
1227 pub fn timestamp(&self) -> Option<&crate::network::TimeSinceEpoch> { self.timestamp.as_ref() }
1229}
1230
1231
1232pub struct ScreencastFrameMetadataBuilder {
1233 offset_top: f64,
1234 page_scale_factor: f64,
1235 device_width: f64,
1236 device_height: f64,
1237 scroll_offset_x: f64,
1238 scroll_offset_y: f64,
1239 timestamp: Option<crate::network::TimeSinceEpoch>,
1240}
1241
1242impl ScreencastFrameMetadataBuilder {
1243 pub fn timestamp(mut self, timestamp: crate::network::TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
1245 pub fn build(self) -> ScreencastFrameMetadata {
1246 ScreencastFrameMetadata {
1247 offset_top: self.offset_top,
1248 page_scale_factor: self.page_scale_factor,
1249 device_width: self.device_width,
1250 device_height: self.device_height,
1251 scroll_offset_x: self.scroll_offset_x,
1252 scroll_offset_y: self.scroll_offset_y,
1253 timestamp: self.timestamp,
1254 }
1255 }
1256}
1257
1258#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1261pub enum DialogType {
1262 #[default]
1263 #[serde(rename = "alert")]
1264 Alert,
1265 #[serde(rename = "confirm")]
1266 Confirm,
1267 #[serde(rename = "prompt")]
1268 Prompt,
1269 #[serde(rename = "beforeunload")]
1270 Beforeunload,
1271}
1272
1273#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1276#[serde(rename_all = "camelCase")]
1277pub struct AppManifestError<'a> {
1278 message: Cow<'a, str>,
1280 critical: i64,
1282 line: i64,
1284 column: i64,
1286}
1287
1288impl<'a> AppManifestError<'a> {
1289 pub fn builder(message: impl Into<Cow<'a, str>>, critical: i64, line: i64, column: i64) -> AppManifestErrorBuilder<'a> {
1295 AppManifestErrorBuilder {
1296 message: message.into(),
1297 critical: critical,
1298 line: line,
1299 column: column,
1300 }
1301 }
1302 pub fn message(&self) -> &str { self.message.as_ref() }
1304 pub fn critical(&self) -> i64 { self.critical }
1306 pub fn line(&self) -> i64 { self.line }
1308 pub fn column(&self) -> i64 { self.column }
1310}
1311
1312
1313pub struct AppManifestErrorBuilder<'a> {
1314 message: Cow<'a, str>,
1315 critical: i64,
1316 line: i64,
1317 column: i64,
1318}
1319
1320impl<'a> AppManifestErrorBuilder<'a> {
1321 pub fn build(self) -> AppManifestError<'a> {
1322 AppManifestError {
1323 message: self.message,
1324 critical: self.critical,
1325 line: self.line,
1326 column: self.column,
1327 }
1328 }
1329}
1330
1331#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1334#[serde(rename_all = "camelCase")]
1335pub struct AppManifestParsedProperties<'a> {
1336 scope: Cow<'a, str>,
1338}
1339
1340impl<'a> AppManifestParsedProperties<'a> {
1341 pub fn builder(scope: impl Into<Cow<'a, str>>) -> AppManifestParsedPropertiesBuilder<'a> {
1344 AppManifestParsedPropertiesBuilder {
1345 scope: scope.into(),
1346 }
1347 }
1348 pub fn scope(&self) -> &str { self.scope.as_ref() }
1350}
1351
1352
1353pub struct AppManifestParsedPropertiesBuilder<'a> {
1354 scope: Cow<'a, str>,
1355}
1356
1357impl<'a> AppManifestParsedPropertiesBuilder<'a> {
1358 pub fn build(self) -> AppManifestParsedProperties<'a> {
1359 AppManifestParsedProperties {
1360 scope: self.scope,
1361 }
1362 }
1363}
1364
1365#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1368#[serde(rename_all = "camelCase")]
1369pub struct LayoutViewport {
1370 #[serde(rename = "pageX")]
1372 page_x: i64,
1373 #[serde(rename = "pageY")]
1375 page_y: i64,
1376 #[serde(rename = "clientWidth")]
1378 client_width: u64,
1379 #[serde(rename = "clientHeight")]
1381 client_height: i64,
1382}
1383
1384impl LayoutViewport {
1385 pub fn builder(page_x: i64, page_y: i64, client_width: u64, client_height: i64) -> LayoutViewportBuilder {
1391 LayoutViewportBuilder {
1392 page_x: page_x,
1393 page_y: page_y,
1394 client_width: client_width,
1395 client_height: client_height,
1396 }
1397 }
1398 pub fn page_x(&self) -> i64 { self.page_x }
1400 pub fn page_y(&self) -> i64 { self.page_y }
1402 pub fn client_width(&self) -> u64 { self.client_width }
1404 pub fn client_height(&self) -> i64 { self.client_height }
1406}
1407
1408
1409pub struct LayoutViewportBuilder {
1410 page_x: i64,
1411 page_y: i64,
1412 client_width: u64,
1413 client_height: i64,
1414}
1415
1416impl LayoutViewportBuilder {
1417 pub fn build(self) -> LayoutViewport {
1418 LayoutViewport {
1419 page_x: self.page_x,
1420 page_y: self.page_y,
1421 client_width: self.client_width,
1422 client_height: self.client_height,
1423 }
1424 }
1425}
1426
1427#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1430#[serde(rename_all = "camelCase")]
1431pub struct VisualViewport {
1432 #[serde(rename = "offsetX")]
1434 offset_x: f64,
1435 #[serde(rename = "offsetY")]
1437 offset_y: f64,
1438 #[serde(rename = "pageX")]
1440 page_x: f64,
1441 #[serde(rename = "pageY")]
1443 page_y: f64,
1444 #[serde(rename = "clientWidth")]
1446 client_width: f64,
1447 #[serde(rename = "clientHeight")]
1449 client_height: f64,
1450 scale: f64,
1452 #[serde(skip_serializing_if = "Option::is_none")]
1454 zoom: Option<f64>,
1455}
1456
1457impl VisualViewport {
1458 pub fn builder(offset_x: f64, offset_y: f64, page_x: f64, page_y: f64, client_width: f64, client_height: f64, scale: f64) -> VisualViewportBuilder {
1467 VisualViewportBuilder {
1468 offset_x: offset_x,
1469 offset_y: offset_y,
1470 page_x: page_x,
1471 page_y: page_y,
1472 client_width: client_width,
1473 client_height: client_height,
1474 scale: scale,
1475 zoom: None,
1476 }
1477 }
1478 pub fn offset_x(&self) -> f64 { self.offset_x }
1480 pub fn offset_y(&self) -> f64 { self.offset_y }
1482 pub fn page_x(&self) -> f64 { self.page_x }
1484 pub fn page_y(&self) -> f64 { self.page_y }
1486 pub fn client_width(&self) -> f64 { self.client_width }
1488 pub fn client_height(&self) -> f64 { self.client_height }
1490 pub fn scale(&self) -> f64 { self.scale }
1492 pub fn zoom(&self) -> Option<f64> { self.zoom }
1494}
1495
1496
1497pub struct VisualViewportBuilder {
1498 offset_x: f64,
1499 offset_y: f64,
1500 page_x: f64,
1501 page_y: f64,
1502 client_width: f64,
1503 client_height: f64,
1504 scale: f64,
1505 zoom: Option<f64>,
1506}
1507
1508impl VisualViewportBuilder {
1509 pub fn zoom(mut self, zoom: f64) -> Self { self.zoom = Some(zoom); self }
1511 pub fn build(self) -> VisualViewport {
1512 VisualViewport {
1513 offset_x: self.offset_x,
1514 offset_y: self.offset_y,
1515 page_x: self.page_x,
1516 page_y: self.page_y,
1517 client_width: self.client_width,
1518 client_height: self.client_height,
1519 scale: self.scale,
1520 zoom: self.zoom,
1521 }
1522 }
1523}
1524
1525#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1528#[serde(rename_all = "camelCase")]
1529pub struct Viewport {
1530 x: f64,
1532 y: f64,
1534 width: f64,
1536 height: f64,
1538 scale: f64,
1540}
1541
1542impl Viewport {
1543 pub fn builder(x: f64, y: f64, width: f64, height: f64, scale: f64) -> ViewportBuilder {
1550 ViewportBuilder {
1551 x: x,
1552 y: y,
1553 width: width,
1554 height: height,
1555 scale: scale,
1556 }
1557 }
1558 pub fn x(&self) -> f64 { self.x }
1560 pub fn y(&self) -> f64 { self.y }
1562 pub fn width(&self) -> f64 { self.width }
1564 pub fn height(&self) -> f64 { self.height }
1566 pub fn scale(&self) -> f64 { self.scale }
1568}
1569
1570
1571pub struct ViewportBuilder {
1572 x: f64,
1573 y: f64,
1574 width: f64,
1575 height: f64,
1576 scale: f64,
1577}
1578
1579impl ViewportBuilder {
1580 pub fn build(self) -> Viewport {
1581 Viewport {
1582 x: self.x,
1583 y: self.y,
1584 width: self.width,
1585 height: self.height,
1586 scale: self.scale,
1587 }
1588 }
1589}
1590
1591#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1594#[serde(rename_all = "camelCase")]
1595pub struct FontFamilies<'a> {
1596 #[serde(skip_serializing_if = "Option::is_none")]
1598 standard: Option<Cow<'a, str>>,
1599 #[serde(skip_serializing_if = "Option::is_none")]
1601 fixed: Option<Cow<'a, str>>,
1602 #[serde(skip_serializing_if = "Option::is_none")]
1604 serif: Option<Cow<'a, str>>,
1605 #[serde(skip_serializing_if = "Option::is_none", rename = "sansSerif")]
1607 sans_serif: Option<Cow<'a, str>>,
1608 #[serde(skip_serializing_if = "Option::is_none")]
1610 cursive: Option<Cow<'a, str>>,
1611 #[serde(skip_serializing_if = "Option::is_none")]
1613 fantasy: Option<Cow<'a, str>>,
1614 #[serde(skip_serializing_if = "Option::is_none")]
1616 math: Option<Cow<'a, str>>,
1617}
1618
1619impl<'a> FontFamilies<'a> {
1620 pub fn builder() -> FontFamiliesBuilder<'a> {
1622 FontFamiliesBuilder {
1623 standard: None,
1624 fixed: None,
1625 serif: None,
1626 sans_serif: None,
1627 cursive: None,
1628 fantasy: None,
1629 math: None,
1630 }
1631 }
1632 pub fn standard(&self) -> Option<&str> { self.standard.as_deref() }
1634 pub fn fixed(&self) -> Option<&str> { self.fixed.as_deref() }
1636 pub fn serif(&self) -> Option<&str> { self.serif.as_deref() }
1638 pub fn sans_serif(&self) -> Option<&str> { self.sans_serif.as_deref() }
1640 pub fn cursive(&self) -> Option<&str> { self.cursive.as_deref() }
1642 pub fn fantasy(&self) -> Option<&str> { self.fantasy.as_deref() }
1644 pub fn math(&self) -> Option<&str> { self.math.as_deref() }
1646}
1647
1648#[derive(Default)]
1649pub struct FontFamiliesBuilder<'a> {
1650 standard: Option<Cow<'a, str>>,
1651 fixed: Option<Cow<'a, str>>,
1652 serif: Option<Cow<'a, str>>,
1653 sans_serif: Option<Cow<'a, str>>,
1654 cursive: Option<Cow<'a, str>>,
1655 fantasy: Option<Cow<'a, str>>,
1656 math: Option<Cow<'a, str>>,
1657}
1658
1659impl<'a> FontFamiliesBuilder<'a> {
1660 pub fn standard(mut self, standard: impl Into<Cow<'a, str>>) -> Self { self.standard = Some(standard.into()); self }
1662 pub fn fixed(mut self, fixed: impl Into<Cow<'a, str>>) -> Self { self.fixed = Some(fixed.into()); self }
1664 pub fn serif(mut self, serif: impl Into<Cow<'a, str>>) -> Self { self.serif = Some(serif.into()); self }
1666 pub fn sans_serif(mut self, sans_serif: impl Into<Cow<'a, str>>) -> Self { self.sans_serif = Some(sans_serif.into()); self }
1668 pub fn cursive(mut self, cursive: impl Into<Cow<'a, str>>) -> Self { self.cursive = Some(cursive.into()); self }
1670 pub fn fantasy(mut self, fantasy: impl Into<Cow<'a, str>>) -> Self { self.fantasy = Some(fantasy.into()); self }
1672 pub fn math(mut self, math: impl Into<Cow<'a, str>>) -> Self { self.math = Some(math.into()); self }
1674 pub fn build(self) -> FontFamilies<'a> {
1675 FontFamilies {
1676 standard: self.standard,
1677 fixed: self.fixed,
1678 serif: self.serif,
1679 sans_serif: self.sans_serif,
1680 cursive: self.cursive,
1681 fantasy: self.fantasy,
1682 math: self.math,
1683 }
1684 }
1685}
1686
1687#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1690#[serde(rename_all = "camelCase")]
1691pub struct ScriptFontFamilies<'a> {
1692 script: Cow<'a, str>,
1694 #[serde(rename = "fontFamilies")]
1696 font_families: FontFamilies<'a>,
1697}
1698
1699impl<'a> ScriptFontFamilies<'a> {
1700 pub fn builder(script: impl Into<Cow<'a, str>>, font_families: FontFamilies<'a>) -> ScriptFontFamiliesBuilder<'a> {
1704 ScriptFontFamiliesBuilder {
1705 script: script.into(),
1706 font_families: font_families,
1707 }
1708 }
1709 pub fn script(&self) -> &str { self.script.as_ref() }
1711 pub fn font_families(&self) -> &FontFamilies<'a> { &self.font_families }
1713}
1714
1715
1716pub struct ScriptFontFamiliesBuilder<'a> {
1717 script: Cow<'a, str>,
1718 font_families: FontFamilies<'a>,
1719}
1720
1721impl<'a> ScriptFontFamiliesBuilder<'a> {
1722 pub fn build(self) -> ScriptFontFamilies<'a> {
1723 ScriptFontFamilies {
1724 script: self.script,
1725 font_families: self.font_families,
1726 }
1727 }
1728}
1729
1730#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1733#[serde(rename_all = "camelCase")]
1734pub struct FontSizes {
1735 #[serde(skip_serializing_if = "Option::is_none")]
1737 standard: Option<i64>,
1738 #[serde(skip_serializing_if = "Option::is_none")]
1740 fixed: Option<i64>,
1741}
1742
1743impl FontSizes {
1744 pub fn builder() -> FontSizesBuilder {
1746 FontSizesBuilder {
1747 standard: None,
1748 fixed: None,
1749 }
1750 }
1751 pub fn standard(&self) -> Option<i64> { self.standard }
1753 pub fn fixed(&self) -> Option<i64> { self.fixed }
1755}
1756
1757#[derive(Default)]
1758pub struct FontSizesBuilder {
1759 standard: Option<i64>,
1760 fixed: Option<i64>,
1761}
1762
1763impl FontSizesBuilder {
1764 pub fn standard(mut self, standard: i64) -> Self { self.standard = Some(standard); self }
1766 pub fn fixed(mut self, fixed: i64) -> Self { self.fixed = Some(fixed); self }
1768 pub fn build(self) -> FontSizes {
1769 FontSizes {
1770 standard: self.standard,
1771 fixed: self.fixed,
1772 }
1773 }
1774}
1775
1776
1777#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1778pub enum ClientNavigationReason {
1779 #[default]
1780 #[serde(rename = "anchorClick")]
1781 AnchorClick,
1782 #[serde(rename = "formSubmissionGet")]
1783 FormSubmissionGet,
1784 #[serde(rename = "formSubmissionPost")]
1785 FormSubmissionPost,
1786 #[serde(rename = "httpHeaderRefresh")]
1787 HttpHeaderRefresh,
1788 #[serde(rename = "initialFrameNavigation")]
1789 InitialFrameNavigation,
1790 #[serde(rename = "metaTagRefresh")]
1791 MetaTagRefresh,
1792 #[serde(rename = "other")]
1793 Other,
1794 #[serde(rename = "pageBlockInterstitial")]
1795 PageBlockInterstitial,
1796 #[serde(rename = "reload")]
1797 Reload,
1798 #[serde(rename = "scriptInitiated")]
1799 ScriptInitiated,
1800}
1801
1802
1803#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1804pub enum ClientNavigationDisposition {
1805 #[default]
1806 #[serde(rename = "currentTab")]
1807 CurrentTab,
1808 #[serde(rename = "newTab")]
1809 NewTab,
1810 #[serde(rename = "newWindow")]
1811 NewWindow,
1812 #[serde(rename = "download")]
1813 Download,
1814}
1815
1816
1817#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1818#[serde(rename_all = "camelCase")]
1819pub struct InstallabilityErrorArgument<'a> {
1820 name: Cow<'a, str>,
1822 value: Cow<'a, str>,
1824}
1825
1826impl<'a> InstallabilityErrorArgument<'a> {
1827 pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> InstallabilityErrorArgumentBuilder<'a> {
1831 InstallabilityErrorArgumentBuilder {
1832 name: name.into(),
1833 value: value.into(),
1834 }
1835 }
1836 pub fn name(&self) -> &str { self.name.as_ref() }
1838 pub fn value(&self) -> &str { self.value.as_ref() }
1840}
1841
1842
1843pub struct InstallabilityErrorArgumentBuilder<'a> {
1844 name: Cow<'a, str>,
1845 value: Cow<'a, str>,
1846}
1847
1848impl<'a> InstallabilityErrorArgumentBuilder<'a> {
1849 pub fn build(self) -> InstallabilityErrorArgument<'a> {
1850 InstallabilityErrorArgument {
1851 name: self.name,
1852 value: self.value,
1853 }
1854 }
1855}
1856
1857#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1860#[serde(rename_all = "camelCase")]
1861pub struct InstallabilityError<'a> {
1862 #[serde(rename = "errorId")]
1864 error_id: Cow<'a, str>,
1865 #[serde(rename = "errorArguments")]
1867 error_arguments: Vec<InstallabilityErrorArgument<'a>>,
1868}
1869
1870impl<'a> InstallabilityError<'a> {
1871 pub fn builder(error_id: impl Into<Cow<'a, str>>, error_arguments: Vec<InstallabilityErrorArgument<'a>>) -> InstallabilityErrorBuilder<'a> {
1875 InstallabilityErrorBuilder {
1876 error_id: error_id.into(),
1877 error_arguments: error_arguments,
1878 }
1879 }
1880 pub fn error_id(&self) -> &str { self.error_id.as_ref() }
1882 pub fn error_arguments(&self) -> &[InstallabilityErrorArgument<'a>] { &self.error_arguments }
1884}
1885
1886
1887pub struct InstallabilityErrorBuilder<'a> {
1888 error_id: Cow<'a, str>,
1889 error_arguments: Vec<InstallabilityErrorArgument<'a>>,
1890}
1891
1892impl<'a> InstallabilityErrorBuilder<'a> {
1893 pub fn build(self) -> InstallabilityError<'a> {
1894 InstallabilityError {
1895 error_id: self.error_id,
1896 error_arguments: self.error_arguments,
1897 }
1898 }
1899}
1900
1901#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1904pub enum ReferrerPolicy {
1905 #[default]
1906 #[serde(rename = "noReferrer")]
1907 NoReferrer,
1908 #[serde(rename = "noReferrerWhenDowngrade")]
1909 NoReferrerWhenDowngrade,
1910 #[serde(rename = "origin")]
1911 Origin,
1912 #[serde(rename = "originWhenCrossOrigin")]
1913 OriginWhenCrossOrigin,
1914 #[serde(rename = "sameOrigin")]
1915 SameOrigin,
1916 #[serde(rename = "strictOrigin")]
1917 StrictOrigin,
1918 #[serde(rename = "strictOriginWhenCrossOrigin")]
1919 StrictOriginWhenCrossOrigin,
1920 #[serde(rename = "unsafeUrl")]
1921 UnsafeUrl,
1922}
1923
1924#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1927#[serde(rename_all = "camelCase")]
1928pub struct CompilationCacheParams<'a> {
1929 url: Cow<'a, str>,
1931 #[serde(skip_serializing_if = "Option::is_none")]
1934 eager: Option<bool>,
1935}
1936
1937impl<'a> CompilationCacheParams<'a> {
1938 pub fn builder(url: impl Into<Cow<'a, str>>) -> CompilationCacheParamsBuilder<'a> {
1941 CompilationCacheParamsBuilder {
1942 url: url.into(),
1943 eager: None,
1944 }
1945 }
1946 pub fn url(&self) -> &str { self.url.as_ref() }
1948 pub fn eager(&self) -> Option<bool> { self.eager }
1951}
1952
1953
1954pub struct CompilationCacheParamsBuilder<'a> {
1955 url: Cow<'a, str>,
1956 eager: Option<bool>,
1957}
1958
1959impl<'a> CompilationCacheParamsBuilder<'a> {
1960 pub fn eager(mut self, eager: bool) -> Self { self.eager = Some(eager); self }
1963 pub fn build(self) -> CompilationCacheParams<'a> {
1964 CompilationCacheParams {
1965 url: self.url,
1966 eager: self.eager,
1967 }
1968 }
1969}
1970
1971
1972#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1973#[serde(rename_all = "camelCase")]
1974pub struct FileFilter<'a> {
1975 #[serde(skip_serializing_if = "Option::is_none")]
1976 name: Option<Cow<'a, str>>,
1977 #[serde(skip_serializing_if = "Option::is_none")]
1978 accepts: Option<Vec<Cow<'a, str>>>,
1979}
1980
1981impl<'a> FileFilter<'a> {
1982 pub fn builder() -> FileFilterBuilder<'a> {
1984 FileFilterBuilder {
1985 name: None,
1986 accepts: None,
1987 }
1988 }
1989 pub fn name(&self) -> Option<&str> { self.name.as_deref() }
1990 pub fn accepts(&self) -> Option<&[Cow<'a, str>]> { self.accepts.as_deref() }
1991}
1992
1993#[derive(Default)]
1994pub struct FileFilterBuilder<'a> {
1995 name: Option<Cow<'a, str>>,
1996 accepts: Option<Vec<Cow<'a, str>>>,
1997}
1998
1999impl<'a> FileFilterBuilder<'a> {
2000 pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
2001 pub fn accepts(mut self, accepts: Vec<Cow<'a, str>>) -> Self { self.accepts = Some(accepts); self }
2002 pub fn build(self) -> FileFilter<'a> {
2003 FileFilter {
2004 name: self.name,
2005 accepts: self.accepts,
2006 }
2007 }
2008}
2009
2010
2011#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2012#[serde(rename_all = "camelCase")]
2013pub struct FileHandler<'a> {
2014 action: Cow<'a, str>,
2015 name: Cow<'a, str>,
2016 #[serde(skip_serializing_if = "Option::is_none")]
2017 icons: Option<Vec<ImageResource<'a>>>,
2018 #[serde(skip_serializing_if = "Option::is_none")]
2020 accepts: Option<Vec<FileFilter<'a>>>,
2021 #[serde(rename = "launchType")]
2024 launch_type: Cow<'a, str>,
2025}
2026
2027impl<'a> FileHandler<'a> {
2028 pub fn builder(action: impl Into<Cow<'a, str>>, name: impl Into<Cow<'a, str>>, launch_type: impl Into<Cow<'a, str>>) -> FileHandlerBuilder<'a> {
2033 FileHandlerBuilder {
2034 action: action.into(),
2035 name: name.into(),
2036 icons: None,
2037 accepts: None,
2038 launch_type: launch_type.into(),
2039 }
2040 }
2041 pub fn action(&self) -> &str { self.action.as_ref() }
2042 pub fn name(&self) -> &str { self.name.as_ref() }
2043 pub fn icons(&self) -> Option<&[ImageResource<'a>]> { self.icons.as_deref() }
2044 pub fn accepts(&self) -> Option<&[FileFilter<'a>]> { self.accepts.as_deref() }
2046 pub fn launch_type(&self) -> &str { self.launch_type.as_ref() }
2049}
2050
2051
2052pub struct FileHandlerBuilder<'a> {
2053 action: Cow<'a, str>,
2054 name: Cow<'a, str>,
2055 icons: Option<Vec<ImageResource<'a>>>,
2056 accepts: Option<Vec<FileFilter<'a>>>,
2057 launch_type: Cow<'a, str>,
2058}
2059
2060impl<'a> FileHandlerBuilder<'a> {
2061 pub fn icons(mut self, icons: Vec<ImageResource<'a>>) -> Self { self.icons = Some(icons); self }
2062 pub fn accepts(mut self, accepts: Vec<FileFilter<'a>>) -> Self { self.accepts = Some(accepts); self }
2064 pub fn build(self) -> FileHandler<'a> {
2065 FileHandler {
2066 action: self.action,
2067 name: self.name,
2068 icons: self.icons,
2069 accepts: self.accepts,
2070 launch_type: self.launch_type,
2071 }
2072 }
2073}
2074
2075#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2078#[serde(rename_all = "camelCase")]
2079pub struct ImageResource<'a> {
2080 url: Cow<'a, str>,
2083 #[serde(skip_serializing_if = "Option::is_none")]
2084 sizes: Option<Cow<'a, str>>,
2085 #[serde(skip_serializing_if = "Option::is_none", rename = "type")]
2086 type_: Option<Cow<'a, str>>,
2087}
2088
2089impl<'a> ImageResource<'a> {
2090 pub fn builder(url: impl Into<Cow<'a, str>>) -> ImageResourceBuilder<'a> {
2093 ImageResourceBuilder {
2094 url: url.into(),
2095 sizes: None,
2096 type_: None,
2097 }
2098 }
2099 pub fn url(&self) -> &str { self.url.as_ref() }
2102 pub fn sizes(&self) -> Option<&str> { self.sizes.as_deref() }
2103 pub fn type_(&self) -> Option<&str> { self.type_.as_deref() }
2104}
2105
2106
2107pub struct ImageResourceBuilder<'a> {
2108 url: Cow<'a, str>,
2109 sizes: Option<Cow<'a, str>>,
2110 type_: Option<Cow<'a, str>>,
2111}
2112
2113impl<'a> ImageResourceBuilder<'a> {
2114 pub fn sizes(mut self, sizes: impl Into<Cow<'a, str>>) -> Self { self.sizes = Some(sizes.into()); self }
2115 pub fn type_(mut self, type_: impl Into<Cow<'a, str>>) -> Self { self.type_ = Some(type_.into()); self }
2116 pub fn build(self) -> ImageResource<'a> {
2117 ImageResource {
2118 url: self.url,
2119 sizes: self.sizes,
2120 type_: self.type_,
2121 }
2122 }
2123}
2124
2125
2126#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2127#[serde(rename_all = "camelCase")]
2128pub struct LaunchHandler<'a> {
2129 #[serde(rename = "clientMode")]
2130 client_mode: Cow<'a, str>,
2131}
2132
2133impl<'a> LaunchHandler<'a> {
2134 pub fn builder(client_mode: impl Into<Cow<'a, str>>) -> LaunchHandlerBuilder<'a> {
2137 LaunchHandlerBuilder {
2138 client_mode: client_mode.into(),
2139 }
2140 }
2141 pub fn client_mode(&self) -> &str { self.client_mode.as_ref() }
2142}
2143
2144
2145pub struct LaunchHandlerBuilder<'a> {
2146 client_mode: Cow<'a, str>,
2147}
2148
2149impl<'a> LaunchHandlerBuilder<'a> {
2150 pub fn build(self) -> LaunchHandler<'a> {
2151 LaunchHandler {
2152 client_mode: self.client_mode,
2153 }
2154 }
2155}
2156
2157
2158#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2159#[serde(rename_all = "camelCase")]
2160pub struct ProtocolHandler<'a> {
2161 protocol: Cow<'a, str>,
2162 url: Cow<'a, str>,
2163}
2164
2165impl<'a> ProtocolHandler<'a> {
2166 pub fn builder(protocol: impl Into<Cow<'a, str>>, url: impl Into<Cow<'a, str>>) -> ProtocolHandlerBuilder<'a> {
2170 ProtocolHandlerBuilder {
2171 protocol: protocol.into(),
2172 url: url.into(),
2173 }
2174 }
2175 pub fn protocol(&self) -> &str { self.protocol.as_ref() }
2176 pub fn url(&self) -> &str { self.url.as_ref() }
2177}
2178
2179
2180pub struct ProtocolHandlerBuilder<'a> {
2181 protocol: Cow<'a, str>,
2182 url: Cow<'a, str>,
2183}
2184
2185impl<'a> ProtocolHandlerBuilder<'a> {
2186 pub fn build(self) -> ProtocolHandler<'a> {
2187 ProtocolHandler {
2188 protocol: self.protocol,
2189 url: self.url,
2190 }
2191 }
2192}
2193
2194
2195#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2196#[serde(rename_all = "camelCase")]
2197pub struct RelatedApplication<'a> {
2198 #[serde(skip_serializing_if = "Option::is_none")]
2199 id: Option<Cow<'a, str>>,
2200 url: Cow<'a, str>,
2201}
2202
2203impl<'a> RelatedApplication<'a> {
2204 pub fn builder(url: impl Into<Cow<'a, str>>) -> RelatedApplicationBuilder<'a> {
2207 RelatedApplicationBuilder {
2208 id: None,
2209 url: url.into(),
2210 }
2211 }
2212 pub fn id(&self) -> Option<&str> { self.id.as_deref() }
2213 pub fn url(&self) -> &str { self.url.as_ref() }
2214}
2215
2216
2217pub struct RelatedApplicationBuilder<'a> {
2218 id: Option<Cow<'a, str>>,
2219 url: Cow<'a, str>,
2220}
2221
2222impl<'a> RelatedApplicationBuilder<'a> {
2223 pub fn id(mut self, id: impl Into<Cow<'a, str>>) -> Self { self.id = Some(id.into()); self }
2224 pub fn build(self) -> RelatedApplication<'a> {
2225 RelatedApplication {
2226 id: self.id,
2227 url: self.url,
2228 }
2229 }
2230}
2231
2232
2233#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2234#[serde(rename_all = "camelCase")]
2235pub struct ScopeExtension<'a> {
2236 origin: Cow<'a, str>,
2239 #[serde(rename = "hasOriginWildcard")]
2240 has_origin_wildcard: bool,
2241}
2242
2243impl<'a> ScopeExtension<'a> {
2244 pub fn builder(origin: impl Into<Cow<'a, str>>, has_origin_wildcard: bool) -> ScopeExtensionBuilder<'a> {
2248 ScopeExtensionBuilder {
2249 origin: origin.into(),
2250 has_origin_wildcard: has_origin_wildcard,
2251 }
2252 }
2253 pub fn origin(&self) -> &str { self.origin.as_ref() }
2256 pub fn has_origin_wildcard(&self) -> bool { self.has_origin_wildcard }
2257}
2258
2259
2260pub struct ScopeExtensionBuilder<'a> {
2261 origin: Cow<'a, str>,
2262 has_origin_wildcard: bool,
2263}
2264
2265impl<'a> ScopeExtensionBuilder<'a> {
2266 pub fn build(self) -> ScopeExtension<'a> {
2267 ScopeExtension {
2268 origin: self.origin,
2269 has_origin_wildcard: self.has_origin_wildcard,
2270 }
2271 }
2272}
2273
2274
2275#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2276#[serde(rename_all = "camelCase")]
2277pub struct Screenshot<'a> {
2278 image: ImageResource<'a>,
2279 #[serde(rename = "formFactor")]
2280 form_factor: Cow<'a, str>,
2281 #[serde(skip_serializing_if = "Option::is_none")]
2282 label: Option<Cow<'a, str>>,
2283}
2284
2285impl<'a> Screenshot<'a> {
2286 pub fn builder(image: ImageResource<'a>, form_factor: impl Into<Cow<'a, str>>) -> ScreenshotBuilder<'a> {
2290 ScreenshotBuilder {
2291 image: image,
2292 form_factor: form_factor.into(),
2293 label: None,
2294 }
2295 }
2296 pub fn image(&self) -> &ImageResource<'a> { &self.image }
2297 pub fn form_factor(&self) -> &str { self.form_factor.as_ref() }
2298 pub fn label(&self) -> Option<&str> { self.label.as_deref() }
2299}
2300
2301
2302pub struct ScreenshotBuilder<'a> {
2303 image: ImageResource<'a>,
2304 form_factor: Cow<'a, str>,
2305 label: Option<Cow<'a, str>>,
2306}
2307
2308impl<'a> ScreenshotBuilder<'a> {
2309 pub fn label(mut self, label: impl Into<Cow<'a, str>>) -> Self { self.label = Some(label.into()); self }
2310 pub fn build(self) -> Screenshot<'a> {
2311 Screenshot {
2312 image: self.image,
2313 form_factor: self.form_factor,
2314 label: self.label,
2315 }
2316 }
2317}
2318
2319
2320#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2321#[serde(rename_all = "camelCase")]
2322pub struct ShareTarget<'a> {
2323 action: Cow<'a, str>,
2324 method: Cow<'a, str>,
2325 enctype: Cow<'a, str>,
2326 #[serde(skip_serializing_if = "Option::is_none")]
2328 title: Option<Cow<'a, str>>,
2329 #[serde(skip_serializing_if = "Option::is_none")]
2330 text: Option<Cow<'a, str>>,
2331 #[serde(skip_serializing_if = "Option::is_none")]
2332 url: Option<Cow<'a, str>>,
2333 #[serde(skip_serializing_if = "Option::is_none")]
2334 files: Option<Vec<FileFilter<'a>>>,
2335}
2336
2337impl<'a> ShareTarget<'a> {
2338 pub fn builder(action: impl Into<Cow<'a, str>>, method: impl Into<Cow<'a, str>>, enctype: impl Into<Cow<'a, str>>) -> ShareTargetBuilder<'a> {
2343 ShareTargetBuilder {
2344 action: action.into(),
2345 method: method.into(),
2346 enctype: enctype.into(),
2347 title: None,
2348 text: None,
2349 url: None,
2350 files: None,
2351 }
2352 }
2353 pub fn action(&self) -> &str { self.action.as_ref() }
2354 pub fn method(&self) -> &str { self.method.as_ref() }
2355 pub fn enctype(&self) -> &str { self.enctype.as_ref() }
2356 pub fn title(&self) -> Option<&str> { self.title.as_deref() }
2358 pub fn text(&self) -> Option<&str> { self.text.as_deref() }
2359 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
2360 pub fn files(&self) -> Option<&[FileFilter<'a>]> { self.files.as_deref() }
2361}
2362
2363
2364pub struct ShareTargetBuilder<'a> {
2365 action: Cow<'a, str>,
2366 method: Cow<'a, str>,
2367 enctype: Cow<'a, str>,
2368 title: Option<Cow<'a, str>>,
2369 text: Option<Cow<'a, str>>,
2370 url: Option<Cow<'a, str>>,
2371 files: Option<Vec<FileFilter<'a>>>,
2372}
2373
2374impl<'a> ShareTargetBuilder<'a> {
2375 pub fn title(mut self, title: impl Into<Cow<'a, str>>) -> Self { self.title = Some(title.into()); self }
2377 pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
2378 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
2379 pub fn files(mut self, files: Vec<FileFilter<'a>>) -> Self { self.files = Some(files); self }
2380 pub fn build(self) -> ShareTarget<'a> {
2381 ShareTarget {
2382 action: self.action,
2383 method: self.method,
2384 enctype: self.enctype,
2385 title: self.title,
2386 text: self.text,
2387 url: self.url,
2388 files: self.files,
2389 }
2390 }
2391}
2392
2393
2394#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2395#[serde(rename_all = "camelCase")]
2396pub struct Shortcut<'a> {
2397 name: Cow<'a, str>,
2398 url: Cow<'a, str>,
2399}
2400
2401impl<'a> Shortcut<'a> {
2402 pub fn builder(name: impl Into<Cow<'a, str>>, url: impl Into<Cow<'a, str>>) -> ShortcutBuilder<'a> {
2406 ShortcutBuilder {
2407 name: name.into(),
2408 url: url.into(),
2409 }
2410 }
2411 pub fn name(&self) -> &str { self.name.as_ref() }
2412 pub fn url(&self) -> &str { self.url.as_ref() }
2413}
2414
2415
2416pub struct ShortcutBuilder<'a> {
2417 name: Cow<'a, str>,
2418 url: Cow<'a, str>,
2419}
2420
2421impl<'a> ShortcutBuilder<'a> {
2422 pub fn build(self) -> Shortcut<'a> {
2423 Shortcut {
2424 name: self.name,
2425 url: self.url,
2426 }
2427 }
2428}
2429
2430
2431#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2432#[serde(rename_all = "camelCase")]
2433pub struct WebAppManifest<'a> {
2434 #[serde(skip_serializing_if = "Option::is_none", rename = "backgroundColor")]
2435 background_color: Option<Cow<'a, str>>,
2436 #[serde(skip_serializing_if = "Option::is_none")]
2438 description: Option<Cow<'a, str>>,
2439 #[serde(skip_serializing_if = "Option::is_none")]
2440 dir: Option<Cow<'a, str>>,
2441 #[serde(skip_serializing_if = "Option::is_none")]
2442 display: Option<Cow<'a, str>>,
2443 #[serde(skip_serializing_if = "Option::is_none", rename = "displayOverrides")]
2445 display_overrides: Option<Vec<Cow<'a, str>>>,
2446 #[serde(skip_serializing_if = "Option::is_none", rename = "fileHandlers")]
2448 file_handlers: Option<Vec<FileHandler<'a>>>,
2449 #[serde(skip_serializing_if = "Option::is_none")]
2450 icons: Option<Vec<ImageResource<'a>>>,
2451 #[serde(skip_serializing_if = "Option::is_none")]
2452 id: Option<Cow<'a, str>>,
2453 #[serde(skip_serializing_if = "Option::is_none")]
2454 lang: Option<Cow<'a, str>>,
2455 #[serde(skip_serializing_if = "Option::is_none", rename = "launchHandler")]
2459 launch_handler: Option<LaunchHandler<'a>>,
2460 #[serde(skip_serializing_if = "Option::is_none")]
2461 name: Option<Cow<'a, str>>,
2462 #[serde(skip_serializing_if = "Option::is_none")]
2463 orientation: Option<Cow<'a, str>>,
2464 #[serde(skip_serializing_if = "Option::is_none", rename = "preferRelatedApplications")]
2465 prefer_related_applications: Option<bool>,
2466 #[serde(skip_serializing_if = "Option::is_none", rename = "protocolHandlers")]
2468 protocol_handlers: Option<Vec<ProtocolHandler<'a>>>,
2469 #[serde(skip_serializing_if = "Option::is_none", rename = "relatedApplications")]
2470 related_applications: Option<Vec<RelatedApplication<'a>>>,
2471 #[serde(skip_serializing_if = "Option::is_none")]
2472 scope: Option<Cow<'a, str>>,
2473 #[serde(skip_serializing_if = "Option::is_none", rename = "scopeExtensions")]
2476 scope_extensions: Option<Vec<ScopeExtension<'a>>>,
2477 #[serde(skip_serializing_if = "Option::is_none")]
2479 screenshots: Option<Vec<Screenshot<'a>>>,
2480 #[serde(skip_serializing_if = "Option::is_none", rename = "shareTarget")]
2481 share_target: Option<ShareTarget<'a>>,
2482 #[serde(skip_serializing_if = "Option::is_none", rename = "shortName")]
2483 short_name: Option<Cow<'a, str>>,
2484 #[serde(skip_serializing_if = "Option::is_none")]
2485 shortcuts: Option<Vec<Shortcut<'a>>>,
2486 #[serde(skip_serializing_if = "Option::is_none", rename = "startUrl")]
2487 start_url: Option<Cow<'a, str>>,
2488 #[serde(skip_serializing_if = "Option::is_none", rename = "themeColor")]
2489 theme_color: Option<Cow<'a, str>>,
2490}
2491
2492impl<'a> WebAppManifest<'a> {
2493 pub fn builder() -> WebAppManifestBuilder<'a> {
2495 WebAppManifestBuilder {
2496 background_color: None,
2497 description: None,
2498 dir: None,
2499 display: None,
2500 display_overrides: None,
2501 file_handlers: None,
2502 icons: None,
2503 id: None,
2504 lang: None,
2505 launch_handler: None,
2506 name: None,
2507 orientation: None,
2508 prefer_related_applications: None,
2509 protocol_handlers: None,
2510 related_applications: None,
2511 scope: None,
2512 scope_extensions: None,
2513 screenshots: None,
2514 share_target: None,
2515 short_name: None,
2516 shortcuts: None,
2517 start_url: None,
2518 theme_color: None,
2519 }
2520 }
2521 pub fn background_color(&self) -> Option<&str> { self.background_color.as_deref() }
2522 pub fn description(&self) -> Option<&str> { self.description.as_deref() }
2524 pub fn dir(&self) -> Option<&str> { self.dir.as_deref() }
2525 pub fn display(&self) -> Option<&str> { self.display.as_deref() }
2526 pub fn display_overrides(&self) -> Option<&[Cow<'a, str>]> { self.display_overrides.as_deref() }
2528 pub fn file_handlers(&self) -> Option<&[FileHandler<'a>]> { self.file_handlers.as_deref() }
2530 pub fn icons(&self) -> Option<&[ImageResource<'a>]> { self.icons.as_deref() }
2531 pub fn id(&self) -> Option<&str> { self.id.as_deref() }
2532 pub fn lang(&self) -> Option<&str> { self.lang.as_deref() }
2533 pub fn launch_handler(&self) -> Option<&LaunchHandler<'a>> { self.launch_handler.as_ref() }
2537 pub fn name(&self) -> Option<&str> { self.name.as_deref() }
2538 pub fn orientation(&self) -> Option<&str> { self.orientation.as_deref() }
2539 pub fn prefer_related_applications(&self) -> Option<bool> { self.prefer_related_applications }
2540 pub fn protocol_handlers(&self) -> Option<&[ProtocolHandler<'a>]> { self.protocol_handlers.as_deref() }
2542 pub fn related_applications(&self) -> Option<&[RelatedApplication<'a>]> { self.related_applications.as_deref() }
2543 pub fn scope(&self) -> Option<&str> { self.scope.as_deref() }
2544 pub fn scope_extensions(&self) -> Option<&[ScopeExtension<'a>]> { self.scope_extensions.as_deref() }
2547 pub fn screenshots(&self) -> Option<&[Screenshot<'a>]> { self.screenshots.as_deref() }
2549 pub fn share_target(&self) -> Option<&ShareTarget<'a>> { self.share_target.as_ref() }
2550 pub fn short_name(&self) -> Option<&str> { self.short_name.as_deref() }
2551 pub fn shortcuts(&self) -> Option<&[Shortcut<'a>]> { self.shortcuts.as_deref() }
2552 pub fn start_url(&self) -> Option<&str> { self.start_url.as_deref() }
2553 pub fn theme_color(&self) -> Option<&str> { self.theme_color.as_deref() }
2554}
2555
2556#[derive(Default)]
2557pub struct WebAppManifestBuilder<'a> {
2558 background_color: Option<Cow<'a, str>>,
2559 description: Option<Cow<'a, str>>,
2560 dir: Option<Cow<'a, str>>,
2561 display: Option<Cow<'a, str>>,
2562 display_overrides: Option<Vec<Cow<'a, str>>>,
2563 file_handlers: Option<Vec<FileHandler<'a>>>,
2564 icons: Option<Vec<ImageResource<'a>>>,
2565 id: Option<Cow<'a, str>>,
2566 lang: Option<Cow<'a, str>>,
2567 launch_handler: Option<LaunchHandler<'a>>,
2568 name: Option<Cow<'a, str>>,
2569 orientation: Option<Cow<'a, str>>,
2570 prefer_related_applications: Option<bool>,
2571 protocol_handlers: Option<Vec<ProtocolHandler<'a>>>,
2572 related_applications: Option<Vec<RelatedApplication<'a>>>,
2573 scope: Option<Cow<'a, str>>,
2574 scope_extensions: Option<Vec<ScopeExtension<'a>>>,
2575 screenshots: Option<Vec<Screenshot<'a>>>,
2576 share_target: Option<ShareTarget<'a>>,
2577 short_name: Option<Cow<'a, str>>,
2578 shortcuts: Option<Vec<Shortcut<'a>>>,
2579 start_url: Option<Cow<'a, str>>,
2580 theme_color: Option<Cow<'a, str>>,
2581}
2582
2583impl<'a> WebAppManifestBuilder<'a> {
2584 pub fn background_color(mut self, background_color: impl Into<Cow<'a, str>>) -> Self { self.background_color = Some(background_color.into()); self }
2585 pub fn description(mut self, description: impl Into<Cow<'a, str>>) -> Self { self.description = Some(description.into()); self }
2587 pub fn dir(mut self, dir: impl Into<Cow<'a, str>>) -> Self { self.dir = Some(dir.into()); self }
2588 pub fn display(mut self, display: impl Into<Cow<'a, str>>) -> Self { self.display = Some(display.into()); self }
2589 pub fn display_overrides(mut self, display_overrides: Vec<Cow<'a, str>>) -> Self { self.display_overrides = Some(display_overrides); self }
2591 pub fn file_handlers(mut self, file_handlers: Vec<FileHandler<'a>>) -> Self { self.file_handlers = Some(file_handlers); self }
2593 pub fn icons(mut self, icons: Vec<ImageResource<'a>>) -> Self { self.icons = Some(icons); self }
2594 pub fn id(mut self, id: impl Into<Cow<'a, str>>) -> Self { self.id = Some(id.into()); self }
2595 pub fn lang(mut self, lang: impl Into<Cow<'a, str>>) -> Self { self.lang = Some(lang.into()); self }
2596 pub fn launch_handler(mut self, launch_handler: LaunchHandler<'a>) -> Self { self.launch_handler = Some(launch_handler); self }
2600 pub fn name(mut self, name: impl Into<Cow<'a, str>>) -> Self { self.name = Some(name.into()); self }
2601 pub fn orientation(mut self, orientation: impl Into<Cow<'a, str>>) -> Self { self.orientation = Some(orientation.into()); self }
2602 pub fn prefer_related_applications(mut self, prefer_related_applications: bool) -> Self { self.prefer_related_applications = Some(prefer_related_applications); self }
2603 pub fn protocol_handlers(mut self, protocol_handlers: Vec<ProtocolHandler<'a>>) -> Self { self.protocol_handlers = Some(protocol_handlers); self }
2605 pub fn related_applications(mut self, related_applications: Vec<RelatedApplication<'a>>) -> Self { self.related_applications = Some(related_applications); self }
2606 pub fn scope(mut self, scope: impl Into<Cow<'a, str>>) -> Self { self.scope = Some(scope.into()); self }
2607 pub fn scope_extensions(mut self, scope_extensions: Vec<ScopeExtension<'a>>) -> Self { self.scope_extensions = Some(scope_extensions); self }
2610 pub fn screenshots(mut self, screenshots: Vec<Screenshot<'a>>) -> Self { self.screenshots = Some(screenshots); self }
2612 pub fn share_target(mut self, share_target: ShareTarget<'a>) -> Self { self.share_target = Some(share_target); self }
2613 pub fn short_name(mut self, short_name: impl Into<Cow<'a, str>>) -> Self { self.short_name = Some(short_name.into()); self }
2614 pub fn shortcuts(mut self, shortcuts: Vec<Shortcut<'a>>) -> Self { self.shortcuts = Some(shortcuts); self }
2615 pub fn start_url(mut self, start_url: impl Into<Cow<'a, str>>) -> Self { self.start_url = Some(start_url.into()); self }
2616 pub fn theme_color(mut self, theme_color: impl Into<Cow<'a, str>>) -> Self { self.theme_color = Some(theme_color.into()); self }
2617 pub fn build(self) -> WebAppManifest<'a> {
2618 WebAppManifest {
2619 background_color: self.background_color,
2620 description: self.description,
2621 dir: self.dir,
2622 display: self.display,
2623 display_overrides: self.display_overrides,
2624 file_handlers: self.file_handlers,
2625 icons: self.icons,
2626 id: self.id,
2627 lang: self.lang,
2628 launch_handler: self.launch_handler,
2629 name: self.name,
2630 orientation: self.orientation,
2631 prefer_related_applications: self.prefer_related_applications,
2632 protocol_handlers: self.protocol_handlers,
2633 related_applications: self.related_applications,
2634 scope: self.scope,
2635 scope_extensions: self.scope_extensions,
2636 screenshots: self.screenshots,
2637 share_target: self.share_target,
2638 short_name: self.short_name,
2639 shortcuts: self.shortcuts,
2640 start_url: self.start_url,
2641 theme_color: self.theme_color,
2642 }
2643 }
2644}
2645
2646#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2649pub enum NavigationType {
2650 #[default]
2651 #[serde(rename = "Navigation")]
2652 Navigation,
2653 #[serde(rename = "BackForwardCacheRestore")]
2654 BackForwardCacheRestore,
2655}
2656
2657#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2660pub enum BackForwardCacheNotRestoredReason {
2661 #[default]
2662 #[serde(rename = "NotPrimaryMainFrame")]
2663 NotPrimaryMainFrame,
2664 #[serde(rename = "BackForwardCacheDisabled")]
2665 BackForwardCacheDisabled,
2666 #[serde(rename = "RelatedActiveContentsExist")]
2667 RelatedActiveContentsExist,
2668 #[serde(rename = "HTTPStatusNotOK")]
2669 HTTPStatusNotOK,
2670 #[serde(rename = "SchemeNotHTTPOrHTTPS")]
2671 SchemeNotHTTPOrHTTPS,
2672 #[serde(rename = "Loading")]
2673 Loading,
2674 #[serde(rename = "WasGrantedMediaAccess")]
2675 WasGrantedMediaAccess,
2676 #[serde(rename = "DisableForRenderFrameHostCalled")]
2677 DisableForRenderFrameHostCalled,
2678 #[serde(rename = "DomainNotAllowed")]
2679 DomainNotAllowed,
2680 #[serde(rename = "HTTPMethodNotGET")]
2681 HTTPMethodNotGET,
2682 #[serde(rename = "SubframeIsNavigating")]
2683 SubframeIsNavigating,
2684 #[serde(rename = "Timeout")]
2685 Timeout,
2686 #[serde(rename = "CacheLimit")]
2687 CacheLimit,
2688 #[serde(rename = "JavaScriptExecution")]
2689 JavaScriptExecution,
2690 #[serde(rename = "RendererProcessKilled")]
2691 RendererProcessKilled,
2692 #[serde(rename = "RendererProcessCrashed")]
2693 RendererProcessCrashed,
2694 #[serde(rename = "SchedulerTrackedFeatureUsed")]
2695 SchedulerTrackedFeatureUsed,
2696 #[serde(rename = "ConflictingBrowsingInstance")]
2697 ConflictingBrowsingInstance,
2698 #[serde(rename = "CacheFlushed")]
2699 CacheFlushed,
2700 #[serde(rename = "ServiceWorkerVersionActivation")]
2701 ServiceWorkerVersionActivation,
2702 #[serde(rename = "SessionRestored")]
2703 SessionRestored,
2704 #[serde(rename = "ServiceWorkerPostMessage")]
2705 ServiceWorkerPostMessage,
2706 #[serde(rename = "EnteredBackForwardCacheBeforeServiceWorkerHostAdded")]
2707 EnteredBackForwardCacheBeforeServiceWorkerHostAdded,
2708 #[serde(rename = "RenderFrameHostReused_SameSite")]
2709 RenderFrameHostReusedSameSite,
2710 #[serde(rename = "RenderFrameHostReused_CrossSite")]
2711 RenderFrameHostReusedCrossSite,
2712 #[serde(rename = "ServiceWorkerClaim")]
2713 ServiceWorkerClaim,
2714 #[serde(rename = "IgnoreEventAndEvict")]
2715 IgnoreEventAndEvict,
2716 #[serde(rename = "HaveInnerContents")]
2717 HaveInnerContents,
2718 #[serde(rename = "TimeoutPuttingInCache")]
2719 TimeoutPuttingInCache,
2720 #[serde(rename = "BackForwardCacheDisabledByLowMemory")]
2721 BackForwardCacheDisabledByLowMemory,
2722 #[serde(rename = "BackForwardCacheDisabledByCommandLine")]
2723 BackForwardCacheDisabledByCommandLine,
2724 #[serde(rename = "NetworkRequestDatapipeDrainedAsBytesConsumer")]
2725 NetworkRequestDatapipeDrainedAsBytesConsumer,
2726 #[serde(rename = "NetworkRequestRedirected")]
2727 NetworkRequestRedirected,
2728 #[serde(rename = "NetworkRequestTimeout")]
2729 NetworkRequestTimeout,
2730 #[serde(rename = "NetworkExceedsBufferLimit")]
2731 NetworkExceedsBufferLimit,
2732 #[serde(rename = "NavigationCancelledWhileRestoring")]
2733 NavigationCancelledWhileRestoring,
2734 #[serde(rename = "NotMostRecentNavigationEntry")]
2735 NotMostRecentNavigationEntry,
2736 #[serde(rename = "BackForwardCacheDisabledForPrerender")]
2737 BackForwardCacheDisabledForPrerender,
2738 #[serde(rename = "UserAgentOverrideDiffers")]
2739 UserAgentOverrideDiffers,
2740 #[serde(rename = "ForegroundCacheLimit")]
2741 ForegroundCacheLimit,
2742 #[serde(rename = "ForwardCacheDisabled")]
2743 ForwardCacheDisabled,
2744 #[serde(rename = "BrowsingInstanceNotSwapped")]
2745 BrowsingInstanceNotSwapped,
2746 #[serde(rename = "BackForwardCacheDisabledForDelegate")]
2747 BackForwardCacheDisabledForDelegate,
2748 #[serde(rename = "UnloadHandlerExistsInMainFrame")]
2749 UnloadHandlerExistsInMainFrame,
2750 #[serde(rename = "UnloadHandlerExistsInSubFrame")]
2751 UnloadHandlerExistsInSubFrame,
2752 #[serde(rename = "ServiceWorkerUnregistration")]
2753 ServiceWorkerUnregistration,
2754 #[serde(rename = "CacheControlNoStore")]
2755 CacheControlNoStore,
2756 #[serde(rename = "CacheControlNoStoreCookieModified")]
2757 CacheControlNoStoreCookieModified,
2758 #[serde(rename = "CacheControlNoStoreHTTPOnlyCookieModified")]
2759 CacheControlNoStoreHTTPOnlyCookieModified,
2760 #[serde(rename = "NoResponseHead")]
2761 NoResponseHead,
2762 #[serde(rename = "Unknown")]
2763 Unknown,
2764 #[serde(rename = "ActivationNavigationsDisallowedForBug1234857")]
2765 ActivationNavigationsDisallowedForBug1234857,
2766 #[serde(rename = "ErrorDocument")]
2767 ErrorDocument,
2768 #[serde(rename = "FencedFramesEmbedder")]
2769 FencedFramesEmbedder,
2770 #[serde(rename = "CookieDisabled")]
2771 CookieDisabled,
2772 #[serde(rename = "HTTPAuthRequired")]
2773 HTTPAuthRequired,
2774 #[serde(rename = "CookieFlushed")]
2775 CookieFlushed,
2776 #[serde(rename = "BroadcastChannelOnMessage")]
2777 BroadcastChannelOnMessage,
2778 #[serde(rename = "WebViewSettingsChanged")]
2779 WebViewSettingsChanged,
2780 #[serde(rename = "WebViewJavaScriptObjectChanged")]
2781 WebViewJavaScriptObjectChanged,
2782 #[serde(rename = "WebViewMessageListenerInjected")]
2783 WebViewMessageListenerInjected,
2784 #[serde(rename = "WebViewSafeBrowsingAllowlistChanged")]
2785 WebViewSafeBrowsingAllowlistChanged,
2786 #[serde(rename = "WebViewDocumentStartJavascriptChanged")]
2787 WebViewDocumentStartJavascriptChanged,
2788 #[serde(rename = "WebSocket")]
2789 WebSocket,
2790 #[serde(rename = "WebTransport")]
2791 WebTransport,
2792 #[serde(rename = "WebRTC")]
2793 WebRTC,
2794 #[serde(rename = "MainResourceHasCacheControlNoStore")]
2795 MainResourceHasCacheControlNoStore,
2796 #[serde(rename = "MainResourceHasCacheControlNoCache")]
2797 MainResourceHasCacheControlNoCache,
2798 #[serde(rename = "SubresourceHasCacheControlNoStore")]
2799 SubresourceHasCacheControlNoStore,
2800 #[serde(rename = "SubresourceHasCacheControlNoCache")]
2801 SubresourceHasCacheControlNoCache,
2802 #[serde(rename = "ContainsPlugins")]
2803 ContainsPlugins,
2804 #[serde(rename = "DocumentLoaded")]
2805 DocumentLoaded,
2806 #[serde(rename = "OutstandingNetworkRequestOthers")]
2807 OutstandingNetworkRequestOthers,
2808 #[serde(rename = "RequestedMIDIPermission")]
2809 RequestedMIDIPermission,
2810 #[serde(rename = "RequestedAudioCapturePermission")]
2811 RequestedAudioCapturePermission,
2812 #[serde(rename = "RequestedVideoCapturePermission")]
2813 RequestedVideoCapturePermission,
2814 #[serde(rename = "RequestedBackForwardCacheBlockedSensors")]
2815 RequestedBackForwardCacheBlockedSensors,
2816 #[serde(rename = "RequestedBackgroundWorkPermission")]
2817 RequestedBackgroundWorkPermission,
2818 #[serde(rename = "BroadcastChannel")]
2819 BroadcastChannel,
2820 #[serde(rename = "WebXR")]
2821 WebXR,
2822 #[serde(rename = "SharedWorker")]
2823 SharedWorker,
2824 #[serde(rename = "SharedWorkerMessage")]
2825 SharedWorkerMessage,
2826 #[serde(rename = "SharedWorkerWithNoActiveClient")]
2827 SharedWorkerWithNoActiveClient,
2828 #[serde(rename = "WebLocks")]
2829 WebLocks,
2830 #[serde(rename = "WebLocksContention")]
2831 WebLocksContention,
2832 #[serde(rename = "WebHID")]
2833 WebHID,
2834 #[serde(rename = "WebBluetooth")]
2835 WebBluetooth,
2836 #[serde(rename = "WebShare")]
2837 WebShare,
2838 #[serde(rename = "RequestedStorageAccessGrant")]
2839 RequestedStorageAccessGrant,
2840 #[serde(rename = "WebNfc")]
2841 WebNfc,
2842 #[serde(rename = "OutstandingNetworkRequestFetch")]
2843 OutstandingNetworkRequestFetch,
2844 #[serde(rename = "OutstandingNetworkRequestXHR")]
2845 OutstandingNetworkRequestXHR,
2846 #[serde(rename = "AppBanner")]
2847 AppBanner,
2848 #[serde(rename = "Printing")]
2849 Printing,
2850 #[serde(rename = "WebDatabase")]
2851 WebDatabase,
2852 #[serde(rename = "PictureInPicture")]
2853 PictureInPicture,
2854 #[serde(rename = "SpeechRecognizer")]
2855 SpeechRecognizer,
2856 #[serde(rename = "IdleManager")]
2857 IdleManager,
2858 #[serde(rename = "PaymentManager")]
2859 PaymentManager,
2860 #[serde(rename = "SpeechSynthesis")]
2861 SpeechSynthesis,
2862 #[serde(rename = "KeyboardLock")]
2863 KeyboardLock,
2864 #[serde(rename = "WebOTPService")]
2865 WebOTPService,
2866 #[serde(rename = "OutstandingNetworkRequestDirectSocket")]
2867 OutstandingNetworkRequestDirectSocket,
2868 #[serde(rename = "InjectedJavascript")]
2869 InjectedJavascript,
2870 #[serde(rename = "InjectedStyleSheet")]
2871 InjectedStyleSheet,
2872 #[serde(rename = "KeepaliveRequest")]
2873 KeepaliveRequest,
2874 #[serde(rename = "IndexedDBEvent")]
2875 IndexedDBEvent,
2876 #[serde(rename = "Dummy")]
2877 Dummy,
2878 #[serde(rename = "JsNetworkRequestReceivedCacheControlNoStoreResource")]
2879 JsNetworkRequestReceivedCacheControlNoStoreResource,
2880 #[serde(rename = "WebRTCUsedWithCCNS")]
2881 WebRTCUsedWithCCNS,
2882 #[serde(rename = "WebTransportUsedWithCCNS")]
2883 WebTransportUsedWithCCNS,
2884 #[serde(rename = "WebSocketUsedWithCCNS")]
2885 WebSocketUsedWithCCNS,
2886 #[serde(rename = "SmartCard")]
2887 SmartCard,
2888 #[serde(rename = "LiveMediaStreamTrack")]
2889 LiveMediaStreamTrack,
2890 #[serde(rename = "UnloadHandler")]
2891 UnloadHandler,
2892 #[serde(rename = "ParserAborted")]
2893 ParserAborted,
2894 #[serde(rename = "ContentSecurityHandler")]
2895 ContentSecurityHandler,
2896 #[serde(rename = "ContentWebAuthenticationAPI")]
2897 ContentWebAuthenticationAPI,
2898 #[serde(rename = "ContentFileChooser")]
2899 ContentFileChooser,
2900 #[serde(rename = "ContentSerial")]
2901 ContentSerial,
2902 #[serde(rename = "ContentFileSystemAccess")]
2903 ContentFileSystemAccess,
2904 #[serde(rename = "ContentMediaDevicesDispatcherHost")]
2905 ContentMediaDevicesDispatcherHost,
2906 #[serde(rename = "ContentWebBluetooth")]
2907 ContentWebBluetooth,
2908 #[serde(rename = "ContentWebUSB")]
2909 ContentWebUSB,
2910 #[serde(rename = "ContentMediaSessionService")]
2911 ContentMediaSessionService,
2912 #[serde(rename = "ContentScreenReader")]
2913 ContentScreenReader,
2914 #[serde(rename = "ContentDiscarded")]
2915 ContentDiscarded,
2916 #[serde(rename = "EmbedderPopupBlockerTabHelper")]
2917 EmbedderPopupBlockerTabHelper,
2918 #[serde(rename = "EmbedderSafeBrowsingTriggeredPopupBlocker")]
2919 EmbedderSafeBrowsingTriggeredPopupBlocker,
2920 #[serde(rename = "EmbedderSafeBrowsingThreatDetails")]
2921 EmbedderSafeBrowsingThreatDetails,
2922 #[serde(rename = "EmbedderAppBannerManager")]
2923 EmbedderAppBannerManager,
2924 #[serde(rename = "EmbedderDomDistillerViewerSource")]
2925 EmbedderDomDistillerViewerSource,
2926 #[serde(rename = "EmbedderDomDistillerSelfDeletingRequestDelegate")]
2927 EmbedderDomDistillerSelfDeletingRequestDelegate,
2928 #[serde(rename = "EmbedderOomInterventionTabHelper")]
2929 EmbedderOomInterventionTabHelper,
2930 #[serde(rename = "EmbedderOfflinePage")]
2931 EmbedderOfflinePage,
2932 #[serde(rename = "EmbedderChromePasswordManagerClientBindCredentialManager")]
2933 EmbedderChromePasswordManagerClientBindCredentialManager,
2934 #[serde(rename = "EmbedderPermissionRequestManager")]
2935 EmbedderPermissionRequestManager,
2936 #[serde(rename = "EmbedderModalDialog")]
2937 EmbedderModalDialog,
2938 #[serde(rename = "EmbedderExtensions")]
2939 EmbedderExtensions,
2940 #[serde(rename = "EmbedderExtensionMessaging")]
2941 EmbedderExtensionMessaging,
2942 #[serde(rename = "EmbedderExtensionMessagingForOpenPort")]
2943 EmbedderExtensionMessagingForOpenPort,
2944 #[serde(rename = "EmbedderExtensionSentMessageToCachedFrame")]
2945 EmbedderExtensionSentMessageToCachedFrame,
2946 #[serde(rename = "EmbedderExtensionFrame")]
2947 EmbedderExtensionFrame,
2948 #[serde(rename = "RequestedByWebViewClient")]
2949 RequestedByWebViewClient,
2950 #[serde(rename = "PostMessageByWebViewClient")]
2951 PostMessageByWebViewClient,
2952 #[serde(rename = "CacheControlNoStoreDeviceBoundSessionTerminated")]
2953 CacheControlNoStoreDeviceBoundSessionTerminated,
2954 #[serde(rename = "CacheLimitPrunedOnModerateMemoryPressure")]
2955 CacheLimitPrunedOnModerateMemoryPressure,
2956 #[serde(rename = "CacheLimitPrunedOnCriticalMemoryPressure")]
2957 CacheLimitPrunedOnCriticalMemoryPressure,
2958}
2959
2960#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2963pub enum BackForwardCacheNotRestoredReasonType {
2964 #[default]
2965 #[serde(rename = "SupportPending")]
2966 SupportPending,
2967 #[serde(rename = "PageSupportNeeded")]
2968 PageSupportNeeded,
2969 #[serde(rename = "Circumstantial")]
2970 Circumstantial,
2971}
2972
2973
2974#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2975#[serde(rename_all = "camelCase")]
2976pub struct BackForwardCacheBlockingDetails<'a> {
2977 #[serde(skip_serializing_if = "Option::is_none")]
2979 url: Option<Cow<'a, str>>,
2980 #[serde(skip_serializing_if = "Option::is_none")]
2982 function: Option<Cow<'a, str>>,
2983 #[serde(rename = "lineNumber")]
2985 line_number: i64,
2986 #[serde(rename = "columnNumber")]
2988 column_number: i64,
2989}
2990
2991impl<'a> BackForwardCacheBlockingDetails<'a> {
2992 pub fn builder(line_number: i64, column_number: i64) -> BackForwardCacheBlockingDetailsBuilder<'a> {
2996 BackForwardCacheBlockingDetailsBuilder {
2997 url: None,
2998 function: None,
2999 line_number: line_number,
3000 column_number: column_number,
3001 }
3002 }
3003 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
3005 pub fn function(&self) -> Option<&str> { self.function.as_deref() }
3007 pub fn line_number(&self) -> i64 { self.line_number }
3009 pub fn column_number(&self) -> i64 { self.column_number }
3011}
3012
3013
3014pub struct BackForwardCacheBlockingDetailsBuilder<'a> {
3015 url: Option<Cow<'a, str>>,
3016 function: Option<Cow<'a, str>>,
3017 line_number: i64,
3018 column_number: i64,
3019}
3020
3021impl<'a> BackForwardCacheBlockingDetailsBuilder<'a> {
3022 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
3024 pub fn function(mut self, function: impl Into<Cow<'a, str>>) -> Self { self.function = Some(function.into()); self }
3026 pub fn build(self) -> BackForwardCacheBlockingDetails<'a> {
3027 BackForwardCacheBlockingDetails {
3028 url: self.url,
3029 function: self.function,
3030 line_number: self.line_number,
3031 column_number: self.column_number,
3032 }
3033 }
3034}
3035
3036
3037#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3038#[serde(rename_all = "camelCase")]
3039pub struct BackForwardCacheNotRestoredExplanation<'a> {
3040 #[serde(rename = "type")]
3042 type_: BackForwardCacheNotRestoredReasonType,
3043 reason: BackForwardCacheNotRestoredReason,
3045 #[serde(skip_serializing_if = "Option::is_none")]
3049 context: Option<Cow<'a, str>>,
3050 #[serde(skip_serializing_if = "Option::is_none")]
3051 details: Option<Vec<BackForwardCacheBlockingDetails<'a>>>,
3052}
3053
3054impl<'a> BackForwardCacheNotRestoredExplanation<'a> {
3055 pub fn builder(type_: impl Into<BackForwardCacheNotRestoredReasonType>, reason: impl Into<BackForwardCacheNotRestoredReason>) -> BackForwardCacheNotRestoredExplanationBuilder<'a> {
3059 BackForwardCacheNotRestoredExplanationBuilder {
3060 type_: type_.into(),
3061 reason: reason.into(),
3062 context: None,
3063 details: None,
3064 }
3065 }
3066 pub fn type_(&self) -> &BackForwardCacheNotRestoredReasonType { &self.type_ }
3068 pub fn reason(&self) -> &BackForwardCacheNotRestoredReason { &self.reason }
3070 pub fn context(&self) -> Option<&str> { self.context.as_deref() }
3074 pub fn details(&self) -> Option<&[BackForwardCacheBlockingDetails<'a>]> { self.details.as_deref() }
3075}
3076
3077
3078pub struct BackForwardCacheNotRestoredExplanationBuilder<'a> {
3079 type_: BackForwardCacheNotRestoredReasonType,
3080 reason: BackForwardCacheNotRestoredReason,
3081 context: Option<Cow<'a, str>>,
3082 details: Option<Vec<BackForwardCacheBlockingDetails<'a>>>,
3083}
3084
3085impl<'a> BackForwardCacheNotRestoredExplanationBuilder<'a> {
3086 pub fn context(mut self, context: impl Into<Cow<'a, str>>) -> Self { self.context = Some(context.into()); self }
3090 pub fn details(mut self, details: Vec<BackForwardCacheBlockingDetails<'a>>) -> Self { self.details = Some(details); self }
3091 pub fn build(self) -> BackForwardCacheNotRestoredExplanation<'a> {
3092 BackForwardCacheNotRestoredExplanation {
3093 type_: self.type_,
3094 reason: self.reason,
3095 context: self.context,
3096 details: self.details,
3097 }
3098 }
3099}
3100
3101
3102#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3103#[serde(rename_all = "camelCase")]
3104pub struct BackForwardCacheNotRestoredExplanationTree<'a> {
3105 url: Cow<'a, str>,
3107 explanations: Vec<BackForwardCacheNotRestoredExplanation<'a>>,
3109 children: Vec<Box<BackForwardCacheNotRestoredExplanationTree<'a>>>,
3111}
3112
3113impl<'a> BackForwardCacheNotRestoredExplanationTree<'a> {
3114 pub fn builder(url: impl Into<Cow<'a, str>>, explanations: Vec<BackForwardCacheNotRestoredExplanation<'a>>, children: Vec<Box<BackForwardCacheNotRestoredExplanationTree<'a>>>) -> BackForwardCacheNotRestoredExplanationTreeBuilder<'a> {
3119 BackForwardCacheNotRestoredExplanationTreeBuilder {
3120 url: url.into(),
3121 explanations: explanations,
3122 children: children,
3123 }
3124 }
3125 pub fn url(&self) -> &str { self.url.as_ref() }
3127 pub fn explanations(&self) -> &[BackForwardCacheNotRestoredExplanation<'a>] { &self.explanations }
3129 pub fn children(&self) -> &[Box<BackForwardCacheNotRestoredExplanationTree<'a>>] { &self.children }
3131}
3132
3133
3134pub struct BackForwardCacheNotRestoredExplanationTreeBuilder<'a> {
3135 url: Cow<'a, str>,
3136 explanations: Vec<BackForwardCacheNotRestoredExplanation<'a>>,
3137 children: Vec<Box<BackForwardCacheNotRestoredExplanationTree<'a>>>,
3138}
3139
3140impl<'a> BackForwardCacheNotRestoredExplanationTreeBuilder<'a> {
3141 pub fn build(self) -> BackForwardCacheNotRestoredExplanationTree<'a> {
3142 BackForwardCacheNotRestoredExplanationTree {
3143 url: self.url,
3144 explanations: self.explanations,
3145 children: self.children,
3146 }
3147 }
3148}
3149
3150#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3153#[serde(rename_all = "camelCase")]
3154pub struct AddScriptToEvaluateOnLoadParams<'a> {
3155 #[serde(rename = "scriptSource")]
3156 script_source: Cow<'a, str>,
3157}
3158
3159impl<'a> AddScriptToEvaluateOnLoadParams<'a> {
3160 pub fn builder(script_source: impl Into<Cow<'a, str>>) -> AddScriptToEvaluateOnLoadParamsBuilder<'a> {
3163 AddScriptToEvaluateOnLoadParamsBuilder {
3164 script_source: script_source.into(),
3165 }
3166 }
3167 pub fn script_source(&self) -> &str { self.script_source.as_ref() }
3168}
3169
3170
3171pub struct AddScriptToEvaluateOnLoadParamsBuilder<'a> {
3172 script_source: Cow<'a, str>,
3173}
3174
3175impl<'a> AddScriptToEvaluateOnLoadParamsBuilder<'a> {
3176 pub fn build(self) -> AddScriptToEvaluateOnLoadParams<'a> {
3177 AddScriptToEvaluateOnLoadParams {
3178 script_source: self.script_source,
3179 }
3180 }
3181}
3182
3183#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3186#[serde(rename_all = "camelCase")]
3187pub struct AddScriptToEvaluateOnLoadReturns<'a> {
3188 identifier: ScriptIdentifier<'a>,
3190}
3191
3192impl<'a> AddScriptToEvaluateOnLoadReturns<'a> {
3193 pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> AddScriptToEvaluateOnLoadReturnsBuilder<'a> {
3196 AddScriptToEvaluateOnLoadReturnsBuilder {
3197 identifier: identifier.into(),
3198 }
3199 }
3200 pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
3202}
3203
3204
3205pub struct AddScriptToEvaluateOnLoadReturnsBuilder<'a> {
3206 identifier: ScriptIdentifier<'a>,
3207}
3208
3209impl<'a> AddScriptToEvaluateOnLoadReturnsBuilder<'a> {
3210 pub fn build(self) -> AddScriptToEvaluateOnLoadReturns<'a> {
3211 AddScriptToEvaluateOnLoadReturns {
3212 identifier: self.identifier,
3213 }
3214 }
3215}
3216
3217impl<'a> AddScriptToEvaluateOnLoadParams<'a> { pub const METHOD: &'static str = "Page.addScriptToEvaluateOnLoad"; }
3218
3219impl<'a> crate::CdpCommand<'a> for AddScriptToEvaluateOnLoadParams<'a> {
3220 const METHOD: &'static str = "Page.addScriptToEvaluateOnLoad";
3221 type Response = AddScriptToEvaluateOnLoadReturns<'a>;
3222}
3223
3224#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3227#[serde(rename_all = "camelCase")]
3228pub struct AddScriptToEvaluateOnNewDocumentParams<'a> {
3229 source: Cow<'a, str>,
3230 #[serde(skip_serializing_if = "Option::is_none", rename = "worldName")]
3234 world_name: Option<Cow<'a, str>>,
3235 #[serde(skip_serializing_if = "Option::is_none", rename = "includeCommandLineAPI")]
3238 include_command_line_api: Option<bool>,
3239 #[serde(skip_serializing_if = "Option::is_none", rename = "runImmediately")]
3242 run_immediately: Option<bool>,
3243}
3244
3245impl<'a> AddScriptToEvaluateOnNewDocumentParams<'a> {
3246 pub fn builder(source: impl Into<Cow<'a, str>>) -> AddScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
3249 AddScriptToEvaluateOnNewDocumentParamsBuilder {
3250 source: source.into(),
3251 world_name: None,
3252 include_command_line_api: None,
3253 run_immediately: None,
3254 }
3255 }
3256 pub fn source(&self) -> &str { self.source.as_ref() }
3257 pub fn world_name(&self) -> Option<&str> { self.world_name.as_deref() }
3261 pub fn include_command_line_api(&self) -> Option<bool> { self.include_command_line_api }
3264 pub fn run_immediately(&self) -> Option<bool> { self.run_immediately }
3267}
3268
3269
3270pub struct AddScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
3271 source: Cow<'a, str>,
3272 world_name: Option<Cow<'a, str>>,
3273 include_command_line_api: Option<bool>,
3274 run_immediately: Option<bool>,
3275}
3276
3277impl<'a> AddScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
3278 pub fn world_name(mut self, world_name: impl Into<Cow<'a, str>>) -> Self { self.world_name = Some(world_name.into()); self }
3282 pub fn include_command_line_api(mut self, include_command_line_api: bool) -> Self { self.include_command_line_api = Some(include_command_line_api); self }
3285 pub fn run_immediately(mut self, run_immediately: bool) -> Self { self.run_immediately = Some(run_immediately); self }
3288 pub fn build(self) -> AddScriptToEvaluateOnNewDocumentParams<'a> {
3289 AddScriptToEvaluateOnNewDocumentParams {
3290 source: self.source,
3291 world_name: self.world_name,
3292 include_command_line_api: self.include_command_line_api,
3293 run_immediately: self.run_immediately,
3294 }
3295 }
3296}
3297
3298#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3301#[serde(rename_all = "camelCase")]
3302pub struct AddScriptToEvaluateOnNewDocumentReturns<'a> {
3303 identifier: ScriptIdentifier<'a>,
3305}
3306
3307impl<'a> AddScriptToEvaluateOnNewDocumentReturns<'a> {
3308 pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> AddScriptToEvaluateOnNewDocumentReturnsBuilder<'a> {
3311 AddScriptToEvaluateOnNewDocumentReturnsBuilder {
3312 identifier: identifier.into(),
3313 }
3314 }
3315 pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
3317}
3318
3319
3320pub struct AddScriptToEvaluateOnNewDocumentReturnsBuilder<'a> {
3321 identifier: ScriptIdentifier<'a>,
3322}
3323
3324impl<'a> AddScriptToEvaluateOnNewDocumentReturnsBuilder<'a> {
3325 pub fn build(self) -> AddScriptToEvaluateOnNewDocumentReturns<'a> {
3326 AddScriptToEvaluateOnNewDocumentReturns {
3327 identifier: self.identifier,
3328 }
3329 }
3330}
3331
3332impl<'a> AddScriptToEvaluateOnNewDocumentParams<'a> { pub const METHOD: &'static str = "Page.addScriptToEvaluateOnNewDocument"; }
3333
3334impl<'a> crate::CdpCommand<'a> for AddScriptToEvaluateOnNewDocumentParams<'a> {
3335 const METHOD: &'static str = "Page.addScriptToEvaluateOnNewDocument";
3336 type Response = AddScriptToEvaluateOnNewDocumentReturns<'a>;
3337}
3338
3339#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3340pub struct BringToFrontParams {}
3341
3342impl BringToFrontParams { pub const METHOD: &'static str = "Page.bringToFront"; }
3343
3344impl<'a> crate::CdpCommand<'a> for BringToFrontParams {
3345 const METHOD: &'static str = "Page.bringToFront";
3346 type Response = crate::EmptyReturns;
3347}
3348
3349#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3352#[serde(rename_all = "camelCase")]
3353pub struct CaptureScreenshotParams<'a> {
3354 #[serde(skip_serializing_if = "Option::is_none")]
3356 format: Option<Cow<'a, str>>,
3357 #[serde(skip_serializing_if = "Option::is_none")]
3359 quality: Option<i64>,
3360 #[serde(skip_serializing_if = "Option::is_none")]
3362 clip: Option<Viewport>,
3363 #[serde(skip_serializing_if = "Option::is_none", rename = "fromSurface")]
3365 from_surface: Option<bool>,
3366 #[serde(skip_serializing_if = "Option::is_none", rename = "captureBeyondViewport")]
3368 capture_beyond_viewport: Option<bool>,
3369 #[serde(skip_serializing_if = "Option::is_none", rename = "optimizeForSpeed")]
3371 optimize_for_speed: Option<bool>,
3372}
3373
3374impl<'a> CaptureScreenshotParams<'a> {
3375 pub fn builder() -> CaptureScreenshotParamsBuilder<'a> {
3377 CaptureScreenshotParamsBuilder {
3378 format: None,
3379 quality: None,
3380 clip: None,
3381 from_surface: None,
3382 capture_beyond_viewport: None,
3383 optimize_for_speed: None,
3384 }
3385 }
3386 pub fn format(&self) -> Option<&str> { self.format.as_deref() }
3388 pub fn quality(&self) -> Option<i64> { self.quality }
3390 pub fn clip(&self) -> Option<&Viewport> { self.clip.as_ref() }
3392 pub fn from_surface(&self) -> Option<bool> { self.from_surface }
3394 pub fn capture_beyond_viewport(&self) -> Option<bool> { self.capture_beyond_viewport }
3396 pub fn optimize_for_speed(&self) -> Option<bool> { self.optimize_for_speed }
3398}
3399
3400#[derive(Default)]
3401pub struct CaptureScreenshotParamsBuilder<'a> {
3402 format: Option<Cow<'a, str>>,
3403 quality: Option<i64>,
3404 clip: Option<Viewport>,
3405 from_surface: Option<bool>,
3406 capture_beyond_viewport: Option<bool>,
3407 optimize_for_speed: Option<bool>,
3408}
3409
3410impl<'a> CaptureScreenshotParamsBuilder<'a> {
3411 pub fn format(mut self, format: impl Into<Cow<'a, str>>) -> Self { self.format = Some(format.into()); self }
3413 pub fn quality(mut self, quality: i64) -> Self { self.quality = Some(quality); self }
3415 pub fn clip(mut self, clip: Viewport) -> Self { self.clip = Some(clip); self }
3417 pub fn from_surface(mut self, from_surface: bool) -> Self { self.from_surface = Some(from_surface); self }
3419 pub fn capture_beyond_viewport(mut self, capture_beyond_viewport: bool) -> Self { self.capture_beyond_viewport = Some(capture_beyond_viewport); self }
3421 pub fn optimize_for_speed(mut self, optimize_for_speed: bool) -> Self { self.optimize_for_speed = Some(optimize_for_speed); self }
3423 pub fn build(self) -> CaptureScreenshotParams<'a> {
3424 CaptureScreenshotParams {
3425 format: self.format,
3426 quality: self.quality,
3427 clip: self.clip,
3428 from_surface: self.from_surface,
3429 capture_beyond_viewport: self.capture_beyond_viewport,
3430 optimize_for_speed: self.optimize_for_speed,
3431 }
3432 }
3433}
3434
3435#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3438#[serde(rename_all = "camelCase")]
3439pub struct CaptureScreenshotReturns<'a> {
3440 data: Cow<'a, str>,
3442}
3443
3444impl<'a> CaptureScreenshotReturns<'a> {
3445 pub fn builder(data: impl Into<Cow<'a, str>>) -> CaptureScreenshotReturnsBuilder<'a> {
3448 CaptureScreenshotReturnsBuilder {
3449 data: data.into(),
3450 }
3451 }
3452 pub fn data(&self) -> &str { self.data.as_ref() }
3454}
3455
3456
3457pub struct CaptureScreenshotReturnsBuilder<'a> {
3458 data: Cow<'a, str>,
3459}
3460
3461impl<'a> CaptureScreenshotReturnsBuilder<'a> {
3462 pub fn build(self) -> CaptureScreenshotReturns<'a> {
3463 CaptureScreenshotReturns {
3464 data: self.data,
3465 }
3466 }
3467}
3468
3469impl<'a> CaptureScreenshotParams<'a> { pub const METHOD: &'static str = "Page.captureScreenshot"; }
3470
3471impl<'a> crate::CdpCommand<'a> for CaptureScreenshotParams<'a> {
3472 const METHOD: &'static str = "Page.captureScreenshot";
3473 type Response = CaptureScreenshotReturns<'a>;
3474}
3475
3476#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3480#[serde(rename_all = "camelCase")]
3481pub struct CaptureSnapshotParams<'a> {
3482 #[serde(skip_serializing_if = "Option::is_none")]
3484 format: Option<Cow<'a, str>>,
3485}
3486
3487impl<'a> CaptureSnapshotParams<'a> {
3488 pub fn builder() -> CaptureSnapshotParamsBuilder<'a> {
3490 CaptureSnapshotParamsBuilder {
3491 format: None,
3492 }
3493 }
3494 pub fn format(&self) -> Option<&str> { self.format.as_deref() }
3496}
3497
3498#[derive(Default)]
3499pub struct CaptureSnapshotParamsBuilder<'a> {
3500 format: Option<Cow<'a, str>>,
3501}
3502
3503impl<'a> CaptureSnapshotParamsBuilder<'a> {
3504 pub fn format(mut self, format: impl Into<Cow<'a, str>>) -> Self { self.format = Some(format.into()); self }
3506 pub fn build(self) -> CaptureSnapshotParams<'a> {
3507 CaptureSnapshotParams {
3508 format: self.format,
3509 }
3510 }
3511}
3512
3513#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3517#[serde(rename_all = "camelCase")]
3518pub struct CaptureSnapshotReturns<'a> {
3519 data: Cow<'a, str>,
3521}
3522
3523impl<'a> CaptureSnapshotReturns<'a> {
3524 pub fn builder(data: impl Into<Cow<'a, str>>) -> CaptureSnapshotReturnsBuilder<'a> {
3527 CaptureSnapshotReturnsBuilder {
3528 data: data.into(),
3529 }
3530 }
3531 pub fn data(&self) -> &str { self.data.as_ref() }
3533}
3534
3535
3536pub struct CaptureSnapshotReturnsBuilder<'a> {
3537 data: Cow<'a, str>,
3538}
3539
3540impl<'a> CaptureSnapshotReturnsBuilder<'a> {
3541 pub fn build(self) -> CaptureSnapshotReturns<'a> {
3542 CaptureSnapshotReturns {
3543 data: self.data,
3544 }
3545 }
3546}
3547
3548impl<'a> CaptureSnapshotParams<'a> { pub const METHOD: &'static str = "Page.captureSnapshot"; }
3549
3550impl<'a> crate::CdpCommand<'a> for CaptureSnapshotParams<'a> {
3551 const METHOD: &'static str = "Page.captureSnapshot";
3552 type Response = CaptureSnapshotReturns<'a>;
3553}
3554
3555#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3556pub struct ClearDeviceMetricsOverrideParams {}
3557
3558impl ClearDeviceMetricsOverrideParams { pub const METHOD: &'static str = "Page.clearDeviceMetricsOverride"; }
3559
3560impl<'a> crate::CdpCommand<'a> for ClearDeviceMetricsOverrideParams {
3561 const METHOD: &'static str = "Page.clearDeviceMetricsOverride";
3562 type Response = crate::EmptyReturns;
3563}
3564
3565#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3566pub struct ClearDeviceOrientationOverrideParams {}
3567
3568impl ClearDeviceOrientationOverrideParams { pub const METHOD: &'static str = "Page.clearDeviceOrientationOverride"; }
3569
3570impl<'a> crate::CdpCommand<'a> for ClearDeviceOrientationOverrideParams {
3571 const METHOD: &'static str = "Page.clearDeviceOrientationOverride";
3572 type Response = crate::EmptyReturns;
3573}
3574
3575#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3576pub struct ClearGeolocationOverrideParams {}
3577
3578impl ClearGeolocationOverrideParams { pub const METHOD: &'static str = "Page.clearGeolocationOverride"; }
3579
3580impl<'a> crate::CdpCommand<'a> for ClearGeolocationOverrideParams {
3581 const METHOD: &'static str = "Page.clearGeolocationOverride";
3582 type Response = crate::EmptyReturns;
3583}
3584
3585#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3588#[serde(rename_all = "camelCase")]
3589pub struct CreateIsolatedWorldParams<'a> {
3590 #[serde(rename = "frameId")]
3592 frame_id: FrameId<'a>,
3593 #[serde(skip_serializing_if = "Option::is_none", rename = "worldName")]
3595 world_name: Option<Cow<'a, str>>,
3596 #[serde(skip_serializing_if = "Option::is_none", rename = "grantUniveralAccess")]
3599 grant_univeral_access: Option<bool>,
3600}
3601
3602impl<'a> CreateIsolatedWorldParams<'a> {
3603 pub fn builder(frame_id: impl Into<FrameId<'a>>) -> CreateIsolatedWorldParamsBuilder<'a> {
3606 CreateIsolatedWorldParamsBuilder {
3607 frame_id: frame_id.into(),
3608 world_name: None,
3609 grant_univeral_access: None,
3610 }
3611 }
3612 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
3614 pub fn world_name(&self) -> Option<&str> { self.world_name.as_deref() }
3616 pub fn grant_univeral_access(&self) -> Option<bool> { self.grant_univeral_access }
3619}
3620
3621
3622pub struct CreateIsolatedWorldParamsBuilder<'a> {
3623 frame_id: FrameId<'a>,
3624 world_name: Option<Cow<'a, str>>,
3625 grant_univeral_access: Option<bool>,
3626}
3627
3628impl<'a> CreateIsolatedWorldParamsBuilder<'a> {
3629 pub fn world_name(mut self, world_name: impl Into<Cow<'a, str>>) -> Self { self.world_name = Some(world_name.into()); self }
3631 pub fn grant_univeral_access(mut self, grant_univeral_access: bool) -> Self { self.grant_univeral_access = Some(grant_univeral_access); self }
3634 pub fn build(self) -> CreateIsolatedWorldParams<'a> {
3635 CreateIsolatedWorldParams {
3636 frame_id: self.frame_id,
3637 world_name: self.world_name,
3638 grant_univeral_access: self.grant_univeral_access,
3639 }
3640 }
3641}
3642
3643#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3646#[serde(rename_all = "camelCase")]
3647pub struct CreateIsolatedWorldReturns {
3648 #[serde(rename = "executionContextId")]
3650 execution_context_id: crate::runtime::ExecutionContextId,
3651}
3652
3653impl CreateIsolatedWorldReturns {
3654 pub fn builder(execution_context_id: crate::runtime::ExecutionContextId) -> CreateIsolatedWorldReturnsBuilder {
3657 CreateIsolatedWorldReturnsBuilder {
3658 execution_context_id: execution_context_id,
3659 }
3660 }
3661 pub fn execution_context_id(&self) -> &crate::runtime::ExecutionContextId { &self.execution_context_id }
3663}
3664
3665
3666pub struct CreateIsolatedWorldReturnsBuilder {
3667 execution_context_id: crate::runtime::ExecutionContextId,
3668}
3669
3670impl CreateIsolatedWorldReturnsBuilder {
3671 pub fn build(self) -> CreateIsolatedWorldReturns {
3672 CreateIsolatedWorldReturns {
3673 execution_context_id: self.execution_context_id,
3674 }
3675 }
3676}
3677
3678impl<'a> CreateIsolatedWorldParams<'a> { pub const METHOD: &'static str = "Page.createIsolatedWorld"; }
3679
3680impl<'a> crate::CdpCommand<'a> for CreateIsolatedWorldParams<'a> {
3681 const METHOD: &'static str = "Page.createIsolatedWorld";
3682 type Response = CreateIsolatedWorldReturns;
3683}
3684
3685#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3688#[serde(rename_all = "camelCase")]
3689pub struct DeleteCookieParams<'a> {
3690 #[serde(rename = "cookieName")]
3692 cookie_name: Cow<'a, str>,
3693 url: Cow<'a, str>,
3695}
3696
3697impl<'a> DeleteCookieParams<'a> {
3698 pub fn builder(cookie_name: impl Into<Cow<'a, str>>, url: impl Into<Cow<'a, str>>) -> DeleteCookieParamsBuilder<'a> {
3702 DeleteCookieParamsBuilder {
3703 cookie_name: cookie_name.into(),
3704 url: url.into(),
3705 }
3706 }
3707 pub fn cookie_name(&self) -> &str { self.cookie_name.as_ref() }
3709 pub fn url(&self) -> &str { self.url.as_ref() }
3711}
3712
3713
3714pub struct DeleteCookieParamsBuilder<'a> {
3715 cookie_name: Cow<'a, str>,
3716 url: Cow<'a, str>,
3717}
3718
3719impl<'a> DeleteCookieParamsBuilder<'a> {
3720 pub fn build(self) -> DeleteCookieParams<'a> {
3721 DeleteCookieParams {
3722 cookie_name: self.cookie_name,
3723 url: self.url,
3724 }
3725 }
3726}
3727
3728impl<'a> DeleteCookieParams<'a> { pub const METHOD: &'static str = "Page.deleteCookie"; }
3729
3730impl<'a> crate::CdpCommand<'a> for DeleteCookieParams<'a> {
3731 const METHOD: &'static str = "Page.deleteCookie";
3732 type Response = crate::EmptyReturns;
3733}
3734
3735#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3736pub struct DisableParams {}
3737
3738impl DisableParams { pub const METHOD: &'static str = "Page.disable"; }
3739
3740impl<'a> crate::CdpCommand<'a> for DisableParams {
3741 const METHOD: &'static str = "Page.disable";
3742 type Response = crate::EmptyReturns;
3743}
3744
3745#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3748#[serde(rename_all = "camelCase")]
3749pub struct EnableParams {
3750 #[serde(skip_serializing_if = "Option::is_none", rename = "enableFileChooserOpenedEvent")]
3753 enable_file_chooser_opened_event: Option<bool>,
3754}
3755
3756impl EnableParams {
3757 pub fn builder() -> EnableParamsBuilder {
3759 EnableParamsBuilder {
3760 enable_file_chooser_opened_event: None,
3761 }
3762 }
3763 pub fn enable_file_chooser_opened_event(&self) -> Option<bool> { self.enable_file_chooser_opened_event }
3766}
3767
3768#[derive(Default)]
3769pub struct EnableParamsBuilder {
3770 enable_file_chooser_opened_event: Option<bool>,
3771}
3772
3773impl EnableParamsBuilder {
3774 pub fn enable_file_chooser_opened_event(mut self, enable_file_chooser_opened_event: bool) -> Self { self.enable_file_chooser_opened_event = Some(enable_file_chooser_opened_event); self }
3777 pub fn build(self) -> EnableParams {
3778 EnableParams {
3779 enable_file_chooser_opened_event: self.enable_file_chooser_opened_event,
3780 }
3781 }
3782}
3783
3784impl EnableParams { pub const METHOD: &'static str = "Page.enable"; }
3785
3786impl<'a> crate::CdpCommand<'a> for EnableParams {
3787 const METHOD: &'static str = "Page.enable";
3788 type Response = crate::EmptyReturns;
3789}
3790
3791#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3798#[serde(rename_all = "camelCase")]
3799pub struct GetAppManifestParams<'a> {
3800 #[serde(skip_serializing_if = "Option::is_none", rename = "manifestId")]
3801 manifest_id: Option<Cow<'a, str>>,
3802}
3803
3804impl<'a> GetAppManifestParams<'a> {
3805 pub fn builder() -> GetAppManifestParamsBuilder<'a> {
3807 GetAppManifestParamsBuilder {
3808 manifest_id: None,
3809 }
3810 }
3811 pub fn manifest_id(&self) -> Option<&str> { self.manifest_id.as_deref() }
3812}
3813
3814#[derive(Default)]
3815pub struct GetAppManifestParamsBuilder<'a> {
3816 manifest_id: Option<Cow<'a, str>>,
3817}
3818
3819impl<'a> GetAppManifestParamsBuilder<'a> {
3820 pub fn manifest_id(mut self, manifest_id: impl Into<Cow<'a, str>>) -> Self { self.manifest_id = Some(manifest_id.into()); self }
3821 pub fn build(self) -> GetAppManifestParams<'a> {
3822 GetAppManifestParams {
3823 manifest_id: self.manifest_id,
3824 }
3825 }
3826}
3827
3828#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3835#[serde(rename_all = "camelCase")]
3836pub struct GetAppManifestReturns<'a> {
3837 url: Cow<'a, str>,
3839 errors: Vec<AppManifestError<'a>>,
3840 #[serde(skip_serializing_if = "Option::is_none")]
3842 data: Option<Cow<'a, str>>,
3843 #[serde(skip_serializing_if = "Option::is_none")]
3845 parsed: Option<AppManifestParsedProperties<'a>>,
3846 manifest: WebAppManifest<'a>,
3847}
3848
3849impl<'a> GetAppManifestReturns<'a> {
3850 pub fn builder(url: impl Into<Cow<'a, str>>, errors: Vec<AppManifestError<'a>>, manifest: WebAppManifest<'a>) -> GetAppManifestReturnsBuilder<'a> {
3855 GetAppManifestReturnsBuilder {
3856 url: url.into(),
3857 errors: errors,
3858 data: None,
3859 parsed: None,
3860 manifest: manifest,
3861 }
3862 }
3863 pub fn url(&self) -> &str { self.url.as_ref() }
3865 pub fn errors(&self) -> &[AppManifestError<'a>] { &self.errors }
3866 pub fn data(&self) -> Option<&str> { self.data.as_deref() }
3868 pub fn parsed(&self) -> Option<&AppManifestParsedProperties<'a>> { self.parsed.as_ref() }
3870 pub fn manifest(&self) -> &WebAppManifest<'a> { &self.manifest }
3871}
3872
3873
3874pub struct GetAppManifestReturnsBuilder<'a> {
3875 url: Cow<'a, str>,
3876 errors: Vec<AppManifestError<'a>>,
3877 data: Option<Cow<'a, str>>,
3878 parsed: Option<AppManifestParsedProperties<'a>>,
3879 manifest: WebAppManifest<'a>,
3880}
3881
3882impl<'a> GetAppManifestReturnsBuilder<'a> {
3883 pub fn data(mut self, data: impl Into<Cow<'a, str>>) -> Self { self.data = Some(data.into()); self }
3885 pub fn parsed(mut self, parsed: AppManifestParsedProperties<'a>) -> Self { self.parsed = Some(parsed); self }
3887 pub fn build(self) -> GetAppManifestReturns<'a> {
3888 GetAppManifestReturns {
3889 url: self.url,
3890 errors: self.errors,
3891 data: self.data,
3892 parsed: self.parsed,
3893 manifest: self.manifest,
3894 }
3895 }
3896}
3897
3898impl<'a> GetAppManifestParams<'a> { pub const METHOD: &'static str = "Page.getAppManifest"; }
3899
3900impl<'a> crate::CdpCommand<'a> for GetAppManifestParams<'a> {
3901 const METHOD: &'static str = "Page.getAppManifest";
3902 type Response = GetAppManifestReturns<'a>;
3903}
3904
3905
3906#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3907#[serde(rename_all = "camelCase")]
3908pub struct GetInstallabilityErrorsReturns<'a> {
3909 #[serde(rename = "installabilityErrors")]
3910 installability_errors: Vec<InstallabilityError<'a>>,
3911}
3912
3913impl<'a> GetInstallabilityErrorsReturns<'a> {
3914 pub fn builder(installability_errors: Vec<InstallabilityError<'a>>) -> GetInstallabilityErrorsReturnsBuilder<'a> {
3917 GetInstallabilityErrorsReturnsBuilder {
3918 installability_errors: installability_errors,
3919 }
3920 }
3921 pub fn installability_errors(&self) -> &[InstallabilityError<'a>] { &self.installability_errors }
3922}
3923
3924
3925pub struct GetInstallabilityErrorsReturnsBuilder<'a> {
3926 installability_errors: Vec<InstallabilityError<'a>>,
3927}
3928
3929impl<'a> GetInstallabilityErrorsReturnsBuilder<'a> {
3930 pub fn build(self) -> GetInstallabilityErrorsReturns<'a> {
3931 GetInstallabilityErrorsReturns {
3932 installability_errors: self.installability_errors,
3933 }
3934 }
3935}
3936
3937#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3938pub struct GetInstallabilityErrorsParams {}
3939
3940impl GetInstallabilityErrorsParams { pub const METHOD: &'static str = "Page.getInstallabilityErrors"; }
3941
3942impl<'a> crate::CdpCommand<'a> for GetInstallabilityErrorsParams {
3943 const METHOD: &'static str = "Page.getInstallabilityErrors";
3944 type Response = GetInstallabilityErrorsReturns<'a>;
3945}
3946
3947#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3950#[serde(rename_all = "camelCase")]
3951pub struct GetManifestIconsReturns<'a> {
3952 #[serde(skip_serializing_if = "Option::is_none", rename = "primaryIcon")]
3953 primary_icon: Option<Cow<'a, str>>,
3954}
3955
3956impl<'a> GetManifestIconsReturns<'a> {
3957 pub fn builder() -> GetManifestIconsReturnsBuilder<'a> {
3959 GetManifestIconsReturnsBuilder {
3960 primary_icon: None,
3961 }
3962 }
3963 pub fn primary_icon(&self) -> Option<&str> { self.primary_icon.as_deref() }
3964}
3965
3966#[derive(Default)]
3967pub struct GetManifestIconsReturnsBuilder<'a> {
3968 primary_icon: Option<Cow<'a, str>>,
3969}
3970
3971impl<'a> GetManifestIconsReturnsBuilder<'a> {
3972 pub fn primary_icon(mut self, primary_icon: impl Into<Cow<'a, str>>) -> Self { self.primary_icon = Some(primary_icon.into()); self }
3973 pub fn build(self) -> GetManifestIconsReturns<'a> {
3974 GetManifestIconsReturns {
3975 primary_icon: self.primary_icon,
3976 }
3977 }
3978}
3979
3980#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3981pub struct GetManifestIconsParams {}
3982
3983impl GetManifestIconsParams { pub const METHOD: &'static str = "Page.getManifestIcons"; }
3984
3985impl<'a> crate::CdpCommand<'a> for GetManifestIconsParams {
3986 const METHOD: &'static str = "Page.getManifestIcons";
3987 type Response = GetManifestIconsReturns<'a>;
3988}
3989
3990#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3994#[serde(rename_all = "camelCase")]
3995pub struct GetAppIdReturns<'a> {
3996 #[serde(skip_serializing_if = "Option::is_none", rename = "appId")]
3998 app_id: Option<Cow<'a, str>>,
3999 #[serde(skip_serializing_if = "Option::is_none", rename = "recommendedId")]
4001 recommended_id: Option<Cow<'a, str>>,
4002}
4003
4004impl<'a> GetAppIdReturns<'a> {
4005 pub fn builder() -> GetAppIdReturnsBuilder<'a> {
4007 GetAppIdReturnsBuilder {
4008 app_id: None,
4009 recommended_id: None,
4010 }
4011 }
4012 pub fn app_id(&self) -> Option<&str> { self.app_id.as_deref() }
4014 pub fn recommended_id(&self) -> Option<&str> { self.recommended_id.as_deref() }
4016}
4017
4018#[derive(Default)]
4019pub struct GetAppIdReturnsBuilder<'a> {
4020 app_id: Option<Cow<'a, str>>,
4021 recommended_id: Option<Cow<'a, str>>,
4022}
4023
4024impl<'a> GetAppIdReturnsBuilder<'a> {
4025 pub fn app_id(mut self, app_id: impl Into<Cow<'a, str>>) -> Self { self.app_id = Some(app_id.into()); self }
4027 pub fn recommended_id(mut self, recommended_id: impl Into<Cow<'a, str>>) -> Self { self.recommended_id = Some(recommended_id.into()); self }
4029 pub fn build(self) -> GetAppIdReturns<'a> {
4030 GetAppIdReturns {
4031 app_id: self.app_id,
4032 recommended_id: self.recommended_id,
4033 }
4034 }
4035}
4036
4037#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4038pub struct GetAppIdParams {}
4039
4040impl GetAppIdParams { pub const METHOD: &'static str = "Page.getAppId"; }
4041
4042impl<'a> crate::CdpCommand<'a> for GetAppIdParams {
4043 const METHOD: &'static str = "Page.getAppId";
4044 type Response = GetAppIdReturns<'a>;
4045}
4046
4047
4048#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4049#[serde(rename_all = "camelCase")]
4050pub struct GetAdScriptAncestryParams<'a> {
4051 #[serde(rename = "frameId")]
4052 frame_id: FrameId<'a>,
4053}
4054
4055impl<'a> GetAdScriptAncestryParams<'a> {
4056 pub fn builder(frame_id: impl Into<FrameId<'a>>) -> GetAdScriptAncestryParamsBuilder<'a> {
4059 GetAdScriptAncestryParamsBuilder {
4060 frame_id: frame_id.into(),
4061 }
4062 }
4063 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
4064}
4065
4066
4067pub struct GetAdScriptAncestryParamsBuilder<'a> {
4068 frame_id: FrameId<'a>,
4069}
4070
4071impl<'a> GetAdScriptAncestryParamsBuilder<'a> {
4072 pub fn build(self) -> GetAdScriptAncestryParams<'a> {
4073 GetAdScriptAncestryParams {
4074 frame_id: self.frame_id,
4075 }
4076 }
4077}
4078
4079
4080#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4081#[serde(rename_all = "camelCase")]
4082pub struct GetAdScriptAncestryReturns<'a> {
4083 #[serde(skip_serializing_if = "Option::is_none", rename = "adScriptAncestry")]
4089 ad_script_ancestry: Option<crate::network::AdAncestry<'a>>,
4090}
4091
4092impl<'a> GetAdScriptAncestryReturns<'a> {
4093 pub fn builder() -> GetAdScriptAncestryReturnsBuilder<'a> {
4095 GetAdScriptAncestryReturnsBuilder {
4096 ad_script_ancestry: None,
4097 }
4098 }
4099 pub fn ad_script_ancestry(&self) -> Option<&crate::network::AdAncestry<'a>> { self.ad_script_ancestry.as_ref() }
4105}
4106
4107#[derive(Default)]
4108pub struct GetAdScriptAncestryReturnsBuilder<'a> {
4109 ad_script_ancestry: Option<crate::network::AdAncestry<'a>>,
4110}
4111
4112impl<'a> GetAdScriptAncestryReturnsBuilder<'a> {
4113 pub fn ad_script_ancestry(mut self, ad_script_ancestry: crate::network::AdAncestry<'a>) -> Self { self.ad_script_ancestry = Some(ad_script_ancestry); self }
4119 pub fn build(self) -> GetAdScriptAncestryReturns<'a> {
4120 GetAdScriptAncestryReturns {
4121 ad_script_ancestry: self.ad_script_ancestry,
4122 }
4123 }
4124}
4125
4126impl<'a> GetAdScriptAncestryParams<'a> { pub const METHOD: &'static str = "Page.getAdScriptAncestry"; }
4127
4128impl<'a> crate::CdpCommand<'a> for GetAdScriptAncestryParams<'a> {
4129 const METHOD: &'static str = "Page.getAdScriptAncestry";
4130 type Response = GetAdScriptAncestryReturns<'a>;
4131}
4132
4133#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4136#[serde(rename_all = "camelCase")]
4137pub struct GetFrameTreeReturns<'a> {
4138 #[serde(rename = "frameTree")]
4140 frame_tree: FrameTree<'a>,
4141}
4142
4143impl<'a> GetFrameTreeReturns<'a> {
4144 pub fn builder(frame_tree: FrameTree<'a>) -> GetFrameTreeReturnsBuilder<'a> {
4147 GetFrameTreeReturnsBuilder {
4148 frame_tree: frame_tree,
4149 }
4150 }
4151 pub fn frame_tree(&self) -> &FrameTree<'a> { &self.frame_tree }
4153}
4154
4155
4156pub struct GetFrameTreeReturnsBuilder<'a> {
4157 frame_tree: FrameTree<'a>,
4158}
4159
4160impl<'a> GetFrameTreeReturnsBuilder<'a> {
4161 pub fn build(self) -> GetFrameTreeReturns<'a> {
4162 GetFrameTreeReturns {
4163 frame_tree: self.frame_tree,
4164 }
4165 }
4166}
4167
4168#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4169pub struct GetFrameTreeParams {}
4170
4171impl GetFrameTreeParams { pub const METHOD: &'static str = "Page.getFrameTree"; }
4172
4173impl<'a> crate::CdpCommand<'a> for GetFrameTreeParams {
4174 const METHOD: &'static str = "Page.getFrameTree";
4175 type Response = GetFrameTreeReturns<'a>;
4176}
4177
4178#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4181#[serde(rename_all = "camelCase")]
4182pub struct GetLayoutMetricsReturns {
4183 #[serde(rename = "layoutViewport")]
4185 layout_viewport: LayoutViewport,
4186 #[serde(rename = "visualViewport")]
4188 visual_viewport: VisualViewport,
4189 #[serde(rename = "contentSize")]
4191 content_size: crate::dom::Rect,
4192 #[serde(rename = "cssLayoutViewport")]
4194 css_layout_viewport: LayoutViewport,
4195 #[serde(rename = "cssVisualViewport")]
4197 css_visual_viewport: VisualViewport,
4198 #[serde(rename = "cssContentSize")]
4200 css_content_size: crate::dom::Rect,
4201}
4202
4203impl GetLayoutMetricsReturns {
4204 pub fn builder(layout_viewport: LayoutViewport, visual_viewport: VisualViewport, content_size: crate::dom::Rect, css_layout_viewport: LayoutViewport, css_visual_viewport: VisualViewport, css_content_size: crate::dom::Rect) -> GetLayoutMetricsReturnsBuilder {
4212 GetLayoutMetricsReturnsBuilder {
4213 layout_viewport: layout_viewport,
4214 visual_viewport: visual_viewport,
4215 content_size: content_size,
4216 css_layout_viewport: css_layout_viewport,
4217 css_visual_viewport: css_visual_viewport,
4218 css_content_size: css_content_size,
4219 }
4220 }
4221 pub fn layout_viewport(&self) -> &LayoutViewport { &self.layout_viewport }
4223 pub fn visual_viewport(&self) -> &VisualViewport { &self.visual_viewport }
4225 pub fn content_size(&self) -> &crate::dom::Rect { &self.content_size }
4227 pub fn css_layout_viewport(&self) -> &LayoutViewport { &self.css_layout_viewport }
4229 pub fn css_visual_viewport(&self) -> &VisualViewport { &self.css_visual_viewport }
4231 pub fn css_content_size(&self) -> &crate::dom::Rect { &self.css_content_size }
4233}
4234
4235
4236pub struct GetLayoutMetricsReturnsBuilder {
4237 layout_viewport: LayoutViewport,
4238 visual_viewport: VisualViewport,
4239 content_size: crate::dom::Rect,
4240 css_layout_viewport: LayoutViewport,
4241 css_visual_viewport: VisualViewport,
4242 css_content_size: crate::dom::Rect,
4243}
4244
4245impl GetLayoutMetricsReturnsBuilder {
4246 pub fn build(self) -> GetLayoutMetricsReturns {
4247 GetLayoutMetricsReturns {
4248 layout_viewport: self.layout_viewport,
4249 visual_viewport: self.visual_viewport,
4250 content_size: self.content_size,
4251 css_layout_viewport: self.css_layout_viewport,
4252 css_visual_viewport: self.css_visual_viewport,
4253 css_content_size: self.css_content_size,
4254 }
4255 }
4256}
4257
4258#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4259pub struct GetLayoutMetricsParams {}
4260
4261impl GetLayoutMetricsParams { pub const METHOD: &'static str = "Page.getLayoutMetrics"; }
4262
4263impl<'a> crate::CdpCommand<'a> for GetLayoutMetricsParams {
4264 const METHOD: &'static str = "Page.getLayoutMetrics";
4265 type Response = GetLayoutMetricsReturns;
4266}
4267
4268#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4271#[serde(rename_all = "camelCase")]
4272pub struct GetNavigationHistoryReturns<'a> {
4273 #[serde(rename = "currentIndex")]
4275 current_index: u64,
4276 entries: Vec<NavigationEntry<'a>>,
4278}
4279
4280impl<'a> GetNavigationHistoryReturns<'a> {
4281 pub fn builder(current_index: u64, entries: Vec<NavigationEntry<'a>>) -> GetNavigationHistoryReturnsBuilder<'a> {
4285 GetNavigationHistoryReturnsBuilder {
4286 current_index: current_index,
4287 entries: entries,
4288 }
4289 }
4290 pub fn current_index(&self) -> u64 { self.current_index }
4292 pub fn entries(&self) -> &[NavigationEntry<'a>] { &self.entries }
4294}
4295
4296
4297pub struct GetNavigationHistoryReturnsBuilder<'a> {
4298 current_index: u64,
4299 entries: Vec<NavigationEntry<'a>>,
4300}
4301
4302impl<'a> GetNavigationHistoryReturnsBuilder<'a> {
4303 pub fn build(self) -> GetNavigationHistoryReturns<'a> {
4304 GetNavigationHistoryReturns {
4305 current_index: self.current_index,
4306 entries: self.entries,
4307 }
4308 }
4309}
4310
4311#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4312pub struct GetNavigationHistoryParams {}
4313
4314impl GetNavigationHistoryParams { pub const METHOD: &'static str = "Page.getNavigationHistory"; }
4315
4316impl<'a> crate::CdpCommand<'a> for GetNavigationHistoryParams {
4317 const METHOD: &'static str = "Page.getNavigationHistory";
4318 type Response = GetNavigationHistoryReturns<'a>;
4319}
4320
4321#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4322pub struct ResetNavigationHistoryParams {}
4323
4324impl ResetNavigationHistoryParams { pub const METHOD: &'static str = "Page.resetNavigationHistory"; }
4325
4326impl<'a> crate::CdpCommand<'a> for ResetNavigationHistoryParams {
4327 const METHOD: &'static str = "Page.resetNavigationHistory";
4328 type Response = crate::EmptyReturns;
4329}
4330
4331#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4334#[serde(rename_all = "camelCase")]
4335pub struct GetResourceContentParams<'a> {
4336 #[serde(rename = "frameId")]
4338 frame_id: FrameId<'a>,
4339 url: Cow<'a, str>,
4341}
4342
4343impl<'a> GetResourceContentParams<'a> {
4344 pub fn builder(frame_id: impl Into<FrameId<'a>>, url: impl Into<Cow<'a, str>>) -> GetResourceContentParamsBuilder<'a> {
4348 GetResourceContentParamsBuilder {
4349 frame_id: frame_id.into(),
4350 url: url.into(),
4351 }
4352 }
4353 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
4355 pub fn url(&self) -> &str { self.url.as_ref() }
4357}
4358
4359
4360pub struct GetResourceContentParamsBuilder<'a> {
4361 frame_id: FrameId<'a>,
4362 url: Cow<'a, str>,
4363}
4364
4365impl<'a> GetResourceContentParamsBuilder<'a> {
4366 pub fn build(self) -> GetResourceContentParams<'a> {
4367 GetResourceContentParams {
4368 frame_id: self.frame_id,
4369 url: self.url,
4370 }
4371 }
4372}
4373
4374#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4377#[serde(rename_all = "camelCase")]
4378pub struct GetResourceContentReturns<'a> {
4379 content: Cow<'a, str>,
4381 #[serde(rename = "base64Encoded")]
4383 base64_encoded: bool,
4384}
4385
4386impl<'a> GetResourceContentReturns<'a> {
4387 pub fn builder(content: impl Into<Cow<'a, str>>, base64_encoded: bool) -> GetResourceContentReturnsBuilder<'a> {
4391 GetResourceContentReturnsBuilder {
4392 content: content.into(),
4393 base64_encoded: base64_encoded,
4394 }
4395 }
4396 pub fn content(&self) -> &str { self.content.as_ref() }
4398 pub fn base64_encoded(&self) -> bool { self.base64_encoded }
4400}
4401
4402
4403pub struct GetResourceContentReturnsBuilder<'a> {
4404 content: Cow<'a, str>,
4405 base64_encoded: bool,
4406}
4407
4408impl<'a> GetResourceContentReturnsBuilder<'a> {
4409 pub fn build(self) -> GetResourceContentReturns<'a> {
4410 GetResourceContentReturns {
4411 content: self.content,
4412 base64_encoded: self.base64_encoded,
4413 }
4414 }
4415}
4416
4417impl<'a> GetResourceContentParams<'a> { pub const METHOD: &'static str = "Page.getResourceContent"; }
4418
4419impl<'a> crate::CdpCommand<'a> for GetResourceContentParams<'a> {
4420 const METHOD: &'static str = "Page.getResourceContent";
4421 type Response = GetResourceContentReturns<'a>;
4422}
4423
4424#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4427#[serde(rename_all = "camelCase")]
4428pub struct GetResourceTreeReturns<'a> {
4429 #[serde(rename = "frameTree")]
4431 frame_tree: FrameResourceTree<'a>,
4432}
4433
4434impl<'a> GetResourceTreeReturns<'a> {
4435 pub fn builder(frame_tree: FrameResourceTree<'a>) -> GetResourceTreeReturnsBuilder<'a> {
4438 GetResourceTreeReturnsBuilder {
4439 frame_tree: frame_tree,
4440 }
4441 }
4442 pub fn frame_tree(&self) -> &FrameResourceTree<'a> { &self.frame_tree }
4444}
4445
4446
4447pub struct GetResourceTreeReturnsBuilder<'a> {
4448 frame_tree: FrameResourceTree<'a>,
4449}
4450
4451impl<'a> GetResourceTreeReturnsBuilder<'a> {
4452 pub fn build(self) -> GetResourceTreeReturns<'a> {
4453 GetResourceTreeReturns {
4454 frame_tree: self.frame_tree,
4455 }
4456 }
4457}
4458
4459#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4460pub struct GetResourceTreeParams {}
4461
4462impl GetResourceTreeParams { pub const METHOD: &'static str = "Page.getResourceTree"; }
4463
4464impl<'a> crate::CdpCommand<'a> for GetResourceTreeParams {
4465 const METHOD: &'static str = "Page.getResourceTree";
4466 type Response = GetResourceTreeReturns<'a>;
4467}
4468
4469#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4472#[serde(rename_all = "camelCase")]
4473pub struct HandleJavaScriptDialogParams<'a> {
4474 accept: bool,
4476 #[serde(skip_serializing_if = "Option::is_none", rename = "promptText")]
4479 prompt_text: Option<Cow<'a, str>>,
4480}
4481
4482impl<'a> HandleJavaScriptDialogParams<'a> {
4483 pub fn builder(accept: bool) -> HandleJavaScriptDialogParamsBuilder<'a> {
4486 HandleJavaScriptDialogParamsBuilder {
4487 accept: accept,
4488 prompt_text: None,
4489 }
4490 }
4491 pub fn accept(&self) -> bool { self.accept }
4493 pub fn prompt_text(&self) -> Option<&str> { self.prompt_text.as_deref() }
4496}
4497
4498
4499pub struct HandleJavaScriptDialogParamsBuilder<'a> {
4500 accept: bool,
4501 prompt_text: Option<Cow<'a, str>>,
4502}
4503
4504impl<'a> HandleJavaScriptDialogParamsBuilder<'a> {
4505 pub fn prompt_text(mut self, prompt_text: impl Into<Cow<'a, str>>) -> Self { self.prompt_text = Some(prompt_text.into()); self }
4508 pub fn build(self) -> HandleJavaScriptDialogParams<'a> {
4509 HandleJavaScriptDialogParams {
4510 accept: self.accept,
4511 prompt_text: self.prompt_text,
4512 }
4513 }
4514}
4515
4516impl<'a> HandleJavaScriptDialogParams<'a> { pub const METHOD: &'static str = "Page.handleJavaScriptDialog"; }
4517
4518impl<'a> crate::CdpCommand<'a> for HandleJavaScriptDialogParams<'a> {
4519 const METHOD: &'static str = "Page.handleJavaScriptDialog";
4520 type Response = crate::EmptyReturns;
4521}
4522
4523#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4526#[serde(rename_all = "camelCase")]
4527pub struct NavigateParams<'a> {
4528 url: Cow<'a, str>,
4530 #[serde(skip_serializing_if = "Option::is_none")]
4532 referrer: Option<Cow<'a, str>>,
4533 #[serde(skip_serializing_if = "Option::is_none", rename = "transitionType")]
4535 transition_type: Option<TransitionType>,
4536 #[serde(skip_serializing_if = "Option::is_none", rename = "frameId")]
4538 frame_id: Option<FrameId<'a>>,
4539 #[serde(skip_serializing_if = "Option::is_none", rename = "referrerPolicy")]
4541 referrer_policy: Option<ReferrerPolicy>,
4542}
4543
4544impl<'a> NavigateParams<'a> {
4545 pub fn builder(url: impl Into<Cow<'a, str>>) -> NavigateParamsBuilder<'a> {
4548 NavigateParamsBuilder {
4549 url: url.into(),
4550 referrer: None,
4551 transition_type: None,
4552 frame_id: None,
4553 referrer_policy: None,
4554 }
4555 }
4556 pub fn url(&self) -> &str { self.url.as_ref() }
4558 pub fn referrer(&self) -> Option<&str> { self.referrer.as_deref() }
4560 pub fn transition_type(&self) -> Option<&TransitionType> { self.transition_type.as_ref() }
4562 pub fn frame_id(&self) -> Option<&FrameId<'a>> { self.frame_id.as_ref() }
4564 pub fn referrer_policy(&self) -> Option<&ReferrerPolicy> { self.referrer_policy.as_ref() }
4566}
4567
4568
4569pub struct NavigateParamsBuilder<'a> {
4570 url: Cow<'a, str>,
4571 referrer: Option<Cow<'a, str>>,
4572 transition_type: Option<TransitionType>,
4573 frame_id: Option<FrameId<'a>>,
4574 referrer_policy: Option<ReferrerPolicy>,
4575}
4576
4577impl<'a> NavigateParamsBuilder<'a> {
4578 pub fn referrer(mut self, referrer: impl Into<Cow<'a, str>>) -> Self { self.referrer = Some(referrer.into()); self }
4580 pub fn transition_type(mut self, transition_type: impl Into<TransitionType>) -> Self { self.transition_type = Some(transition_type.into()); self }
4582 pub fn frame_id(mut self, frame_id: impl Into<FrameId<'a>>) -> Self { self.frame_id = Some(frame_id.into()); self }
4584 pub fn referrer_policy(mut self, referrer_policy: impl Into<ReferrerPolicy>) -> Self { self.referrer_policy = Some(referrer_policy.into()); self }
4586 pub fn build(self) -> NavigateParams<'a> {
4587 NavigateParams {
4588 url: self.url,
4589 referrer: self.referrer,
4590 transition_type: self.transition_type,
4591 frame_id: self.frame_id,
4592 referrer_policy: self.referrer_policy,
4593 }
4594 }
4595}
4596
4597#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4600#[serde(rename_all = "camelCase")]
4601pub struct NavigateReturns<'a> {
4602 #[serde(rename = "frameId")]
4604 frame_id: FrameId<'a>,
4605 #[serde(skip_serializing_if = "Option::is_none", rename = "loaderId")]
4608 loader_id: Option<crate::network::LoaderId<'a>>,
4609 #[serde(skip_serializing_if = "Option::is_none", rename = "errorText")]
4611 error_text: Option<Cow<'a, str>>,
4612 #[serde(skip_serializing_if = "Option::is_none", rename = "isDownload")]
4614 is_download: Option<bool>,
4615}
4616
4617impl<'a> NavigateReturns<'a> {
4618 pub fn builder(frame_id: impl Into<FrameId<'a>>) -> NavigateReturnsBuilder<'a> {
4621 NavigateReturnsBuilder {
4622 frame_id: frame_id.into(),
4623 loader_id: None,
4624 error_text: None,
4625 is_download: None,
4626 }
4627 }
4628 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
4630 pub fn loader_id(&self) -> Option<&crate::network::LoaderId<'a>> { self.loader_id.as_ref() }
4633 pub fn error_text(&self) -> Option<&str> { self.error_text.as_deref() }
4635 pub fn is_download(&self) -> Option<bool> { self.is_download }
4637}
4638
4639
4640pub struct NavigateReturnsBuilder<'a> {
4641 frame_id: FrameId<'a>,
4642 loader_id: Option<crate::network::LoaderId<'a>>,
4643 error_text: Option<Cow<'a, str>>,
4644 is_download: Option<bool>,
4645}
4646
4647impl<'a> NavigateReturnsBuilder<'a> {
4648 pub fn loader_id(mut self, loader_id: crate::network::LoaderId<'a>) -> Self { self.loader_id = Some(loader_id); self }
4651 pub fn error_text(mut self, error_text: impl Into<Cow<'a, str>>) -> Self { self.error_text = Some(error_text.into()); self }
4653 pub fn is_download(mut self, is_download: bool) -> Self { self.is_download = Some(is_download); self }
4655 pub fn build(self) -> NavigateReturns<'a> {
4656 NavigateReturns {
4657 frame_id: self.frame_id,
4658 loader_id: self.loader_id,
4659 error_text: self.error_text,
4660 is_download: self.is_download,
4661 }
4662 }
4663}
4664
4665impl<'a> NavigateParams<'a> { pub const METHOD: &'static str = "Page.navigate"; }
4666
4667impl<'a> crate::CdpCommand<'a> for NavigateParams<'a> {
4668 const METHOD: &'static str = "Page.navigate";
4669 type Response = NavigateReturns<'a>;
4670}
4671
4672#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4675#[serde(rename_all = "camelCase")]
4676pub struct NavigateToHistoryEntryParams {
4677 #[serde(rename = "entryId")]
4679 entry_id: u64,
4680}
4681
4682impl NavigateToHistoryEntryParams {
4683 pub fn builder(entry_id: u64) -> NavigateToHistoryEntryParamsBuilder {
4686 NavigateToHistoryEntryParamsBuilder {
4687 entry_id: entry_id,
4688 }
4689 }
4690 pub fn entry_id(&self) -> u64 { self.entry_id }
4692}
4693
4694
4695pub struct NavigateToHistoryEntryParamsBuilder {
4696 entry_id: u64,
4697}
4698
4699impl NavigateToHistoryEntryParamsBuilder {
4700 pub fn build(self) -> NavigateToHistoryEntryParams {
4701 NavigateToHistoryEntryParams {
4702 entry_id: self.entry_id,
4703 }
4704 }
4705}
4706
4707impl NavigateToHistoryEntryParams { pub const METHOD: &'static str = "Page.navigateToHistoryEntry"; }
4708
4709impl<'a> crate::CdpCommand<'a> for NavigateToHistoryEntryParams {
4710 const METHOD: &'static str = "Page.navigateToHistoryEntry";
4711 type Response = crate::EmptyReturns;
4712}
4713
4714#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4717#[serde(rename_all = "camelCase")]
4718pub struct PrintToPDFParams<'a> {
4719 #[serde(skip_serializing_if = "Option::is_none")]
4721 landscape: Option<bool>,
4722 #[serde(skip_serializing_if = "Option::is_none", rename = "displayHeaderFooter")]
4724 display_header_footer: Option<bool>,
4725 #[serde(skip_serializing_if = "Option::is_none", rename = "printBackground")]
4727 print_background: Option<bool>,
4728 #[serde(skip_serializing_if = "Option::is_none")]
4730 scale: Option<f64>,
4731 #[serde(skip_serializing_if = "Option::is_none", rename = "paperWidth")]
4733 paper_width: Option<f64>,
4734 #[serde(skip_serializing_if = "Option::is_none", rename = "paperHeight")]
4736 paper_height: Option<f64>,
4737 #[serde(skip_serializing_if = "Option::is_none", rename = "marginTop")]
4739 margin_top: Option<f64>,
4740 #[serde(skip_serializing_if = "Option::is_none", rename = "marginBottom")]
4742 margin_bottom: Option<f64>,
4743 #[serde(skip_serializing_if = "Option::is_none", rename = "marginLeft")]
4745 margin_left: Option<f64>,
4746 #[serde(skip_serializing_if = "Option::is_none", rename = "marginRight")]
4748 margin_right: Option<f64>,
4749 #[serde(skip_serializing_if = "Option::is_none", rename = "pageRanges")]
4758 page_ranges: Option<Cow<'a, str>>,
4759 #[serde(skip_serializing_if = "Option::is_none", rename = "headerTemplate")]
4769 header_template: Option<Cow<'a, str>>,
4770 #[serde(skip_serializing_if = "Option::is_none", rename = "footerTemplate")]
4772 footer_template: Option<Cow<'a, str>>,
4773 #[serde(skip_serializing_if = "Option::is_none", rename = "preferCSSPageSize")]
4776 prefer_css_page_size: Option<bool>,
4777 #[serde(skip_serializing_if = "Option::is_none", rename = "transferMode")]
4779 transfer_mode: Option<Cow<'a, str>>,
4780 #[serde(skip_serializing_if = "Option::is_none", rename = "generateTaggedPDF")]
4782 generate_tagged_pdf: Option<bool>,
4783 #[serde(skip_serializing_if = "Option::is_none", rename = "generateDocumentOutline")]
4785 generate_document_outline: Option<bool>,
4786}
4787
4788impl<'a> PrintToPDFParams<'a> {
4789 pub fn builder() -> PrintToPDFParamsBuilder<'a> {
4791 PrintToPDFParamsBuilder {
4792 landscape: None,
4793 display_header_footer: None,
4794 print_background: None,
4795 scale: None,
4796 paper_width: None,
4797 paper_height: None,
4798 margin_top: None,
4799 margin_bottom: None,
4800 margin_left: None,
4801 margin_right: None,
4802 page_ranges: None,
4803 header_template: None,
4804 footer_template: None,
4805 prefer_css_page_size: None,
4806 transfer_mode: None,
4807 generate_tagged_pdf: None,
4808 generate_document_outline: None,
4809 }
4810 }
4811 pub fn landscape(&self) -> Option<bool> { self.landscape }
4813 pub fn display_header_footer(&self) -> Option<bool> { self.display_header_footer }
4815 pub fn print_background(&self) -> Option<bool> { self.print_background }
4817 pub fn scale(&self) -> Option<f64> { self.scale }
4819 pub fn paper_width(&self) -> Option<f64> { self.paper_width }
4821 pub fn paper_height(&self) -> Option<f64> { self.paper_height }
4823 pub fn margin_top(&self) -> Option<f64> { self.margin_top }
4825 pub fn margin_bottom(&self) -> Option<f64> { self.margin_bottom }
4827 pub fn margin_left(&self) -> Option<f64> { self.margin_left }
4829 pub fn margin_right(&self) -> Option<f64> { self.margin_right }
4831 pub fn page_ranges(&self) -> Option<&str> { self.page_ranges.as_deref() }
4840 pub fn header_template(&self) -> Option<&str> { self.header_template.as_deref() }
4850 pub fn footer_template(&self) -> Option<&str> { self.footer_template.as_deref() }
4852 pub fn prefer_css_page_size(&self) -> Option<bool> { self.prefer_css_page_size }
4855 pub fn transfer_mode(&self) -> Option<&str> { self.transfer_mode.as_deref() }
4857 pub fn generate_tagged_pdf(&self) -> Option<bool> { self.generate_tagged_pdf }
4859 pub fn generate_document_outline(&self) -> Option<bool> { self.generate_document_outline }
4861}
4862
4863#[derive(Default)]
4864pub struct PrintToPDFParamsBuilder<'a> {
4865 landscape: Option<bool>,
4866 display_header_footer: Option<bool>,
4867 print_background: Option<bool>,
4868 scale: Option<f64>,
4869 paper_width: Option<f64>,
4870 paper_height: Option<f64>,
4871 margin_top: Option<f64>,
4872 margin_bottom: Option<f64>,
4873 margin_left: Option<f64>,
4874 margin_right: Option<f64>,
4875 page_ranges: Option<Cow<'a, str>>,
4876 header_template: Option<Cow<'a, str>>,
4877 footer_template: Option<Cow<'a, str>>,
4878 prefer_css_page_size: Option<bool>,
4879 transfer_mode: Option<Cow<'a, str>>,
4880 generate_tagged_pdf: Option<bool>,
4881 generate_document_outline: Option<bool>,
4882}
4883
4884impl<'a> PrintToPDFParamsBuilder<'a> {
4885 pub fn landscape(mut self, landscape: bool) -> Self { self.landscape = Some(landscape); self }
4887 pub fn display_header_footer(mut self, display_header_footer: bool) -> Self { self.display_header_footer = Some(display_header_footer); self }
4889 pub fn print_background(mut self, print_background: bool) -> Self { self.print_background = Some(print_background); self }
4891 pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
4893 pub fn paper_width(mut self, paper_width: f64) -> Self { self.paper_width = Some(paper_width); self }
4895 pub fn paper_height(mut self, paper_height: f64) -> Self { self.paper_height = Some(paper_height); self }
4897 pub fn margin_top(mut self, margin_top: f64) -> Self { self.margin_top = Some(margin_top); self }
4899 pub fn margin_bottom(mut self, margin_bottom: f64) -> Self { self.margin_bottom = Some(margin_bottom); self }
4901 pub fn margin_left(mut self, margin_left: f64) -> Self { self.margin_left = Some(margin_left); self }
4903 pub fn margin_right(mut self, margin_right: f64) -> Self { self.margin_right = Some(margin_right); self }
4905 pub fn page_ranges(mut self, page_ranges: impl Into<Cow<'a, str>>) -> Self { self.page_ranges = Some(page_ranges.into()); self }
4914 pub fn header_template(mut self, header_template: impl Into<Cow<'a, str>>) -> Self { self.header_template = Some(header_template.into()); self }
4924 pub fn footer_template(mut self, footer_template: impl Into<Cow<'a, str>>) -> Self { self.footer_template = Some(footer_template.into()); self }
4926 pub fn prefer_css_page_size(mut self, prefer_css_page_size: bool) -> Self { self.prefer_css_page_size = Some(prefer_css_page_size); self }
4929 pub fn transfer_mode(mut self, transfer_mode: impl Into<Cow<'a, str>>) -> Self { self.transfer_mode = Some(transfer_mode.into()); self }
4931 pub fn generate_tagged_pdf(mut self, generate_tagged_pdf: bool) -> Self { self.generate_tagged_pdf = Some(generate_tagged_pdf); self }
4933 pub fn generate_document_outline(mut self, generate_document_outline: bool) -> Self { self.generate_document_outline = Some(generate_document_outline); self }
4935 pub fn build(self) -> PrintToPDFParams<'a> {
4936 PrintToPDFParams {
4937 landscape: self.landscape,
4938 display_header_footer: self.display_header_footer,
4939 print_background: self.print_background,
4940 scale: self.scale,
4941 paper_width: self.paper_width,
4942 paper_height: self.paper_height,
4943 margin_top: self.margin_top,
4944 margin_bottom: self.margin_bottom,
4945 margin_left: self.margin_left,
4946 margin_right: self.margin_right,
4947 page_ranges: self.page_ranges,
4948 header_template: self.header_template,
4949 footer_template: self.footer_template,
4950 prefer_css_page_size: self.prefer_css_page_size,
4951 transfer_mode: self.transfer_mode,
4952 generate_tagged_pdf: self.generate_tagged_pdf,
4953 generate_document_outline: self.generate_document_outline,
4954 }
4955 }
4956}
4957
4958#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4961#[serde(rename_all = "camelCase")]
4962pub struct PrintToPDFReturns<'a> {
4963 data: Cow<'a, str>,
4965 #[serde(skip_serializing_if = "Option::is_none")]
4967 stream: Option<crate::io::StreamHandle<'a>>,
4968}
4969
4970impl<'a> PrintToPDFReturns<'a> {
4971 pub fn builder(data: impl Into<Cow<'a, str>>) -> PrintToPDFReturnsBuilder<'a> {
4974 PrintToPDFReturnsBuilder {
4975 data: data.into(),
4976 stream: None,
4977 }
4978 }
4979 pub fn data(&self) -> &str { self.data.as_ref() }
4981 pub fn stream(&self) -> Option<&crate::io::StreamHandle<'a>> { self.stream.as_ref() }
4983}
4984
4985
4986pub struct PrintToPDFReturnsBuilder<'a> {
4987 data: Cow<'a, str>,
4988 stream: Option<crate::io::StreamHandle<'a>>,
4989}
4990
4991impl<'a> PrintToPDFReturnsBuilder<'a> {
4992 pub fn stream(mut self, stream: crate::io::StreamHandle<'a>) -> Self { self.stream = Some(stream); self }
4994 pub fn build(self) -> PrintToPDFReturns<'a> {
4995 PrintToPDFReturns {
4996 data: self.data,
4997 stream: self.stream,
4998 }
4999 }
5000}
5001
5002impl<'a> PrintToPDFParams<'a> { pub const METHOD: &'static str = "Page.printToPDF"; }
5003
5004impl<'a> crate::CdpCommand<'a> for PrintToPDFParams<'a> {
5005 const METHOD: &'static str = "Page.printToPDF";
5006 type Response = PrintToPDFReturns<'a>;
5007}
5008
5009#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5012#[serde(rename_all = "camelCase")]
5013pub struct ReloadParams<'a> {
5014 #[serde(skip_serializing_if = "Option::is_none", rename = "ignoreCache")]
5016 ignore_cache: Option<bool>,
5017 #[serde(skip_serializing_if = "Option::is_none", rename = "scriptToEvaluateOnLoad")]
5020 script_to_evaluate_on_load: Option<Cow<'a, str>>,
5021 #[serde(skip_serializing_if = "Option::is_none", rename = "loaderId")]
5025 loader_id: Option<crate::network::LoaderId<'a>>,
5026}
5027
5028impl<'a> ReloadParams<'a> {
5029 pub fn builder() -> ReloadParamsBuilder<'a> {
5031 ReloadParamsBuilder {
5032 ignore_cache: None,
5033 script_to_evaluate_on_load: None,
5034 loader_id: None,
5035 }
5036 }
5037 pub fn ignore_cache(&self) -> Option<bool> { self.ignore_cache }
5039 pub fn script_to_evaluate_on_load(&self) -> Option<&str> { self.script_to_evaluate_on_load.as_deref() }
5042 pub fn loader_id(&self) -> Option<&crate::network::LoaderId<'a>> { self.loader_id.as_ref() }
5046}
5047
5048#[derive(Default)]
5049pub struct ReloadParamsBuilder<'a> {
5050 ignore_cache: Option<bool>,
5051 script_to_evaluate_on_load: Option<Cow<'a, str>>,
5052 loader_id: Option<crate::network::LoaderId<'a>>,
5053}
5054
5055impl<'a> ReloadParamsBuilder<'a> {
5056 pub fn ignore_cache(mut self, ignore_cache: bool) -> Self { self.ignore_cache = Some(ignore_cache); self }
5058 pub fn script_to_evaluate_on_load(mut self, script_to_evaluate_on_load: impl Into<Cow<'a, str>>) -> Self { self.script_to_evaluate_on_load = Some(script_to_evaluate_on_load.into()); self }
5061 pub fn loader_id(mut self, loader_id: crate::network::LoaderId<'a>) -> Self { self.loader_id = Some(loader_id); self }
5065 pub fn build(self) -> ReloadParams<'a> {
5066 ReloadParams {
5067 ignore_cache: self.ignore_cache,
5068 script_to_evaluate_on_load: self.script_to_evaluate_on_load,
5069 loader_id: self.loader_id,
5070 }
5071 }
5072}
5073
5074impl<'a> ReloadParams<'a> { pub const METHOD: &'static str = "Page.reload"; }
5075
5076impl<'a> crate::CdpCommand<'a> for ReloadParams<'a> {
5077 const METHOD: &'static str = "Page.reload";
5078 type Response = crate::EmptyReturns;
5079}
5080
5081#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5084#[serde(rename_all = "camelCase")]
5085pub struct RemoveScriptToEvaluateOnLoadParams<'a> {
5086 identifier: ScriptIdentifier<'a>,
5087}
5088
5089impl<'a> RemoveScriptToEvaluateOnLoadParams<'a> {
5090 pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> RemoveScriptToEvaluateOnLoadParamsBuilder<'a> {
5093 RemoveScriptToEvaluateOnLoadParamsBuilder {
5094 identifier: identifier.into(),
5095 }
5096 }
5097 pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
5098}
5099
5100
5101pub struct RemoveScriptToEvaluateOnLoadParamsBuilder<'a> {
5102 identifier: ScriptIdentifier<'a>,
5103}
5104
5105impl<'a> RemoveScriptToEvaluateOnLoadParamsBuilder<'a> {
5106 pub fn build(self) -> RemoveScriptToEvaluateOnLoadParams<'a> {
5107 RemoveScriptToEvaluateOnLoadParams {
5108 identifier: self.identifier,
5109 }
5110 }
5111}
5112
5113impl<'a> RemoveScriptToEvaluateOnLoadParams<'a> { pub const METHOD: &'static str = "Page.removeScriptToEvaluateOnLoad"; }
5114
5115impl<'a> crate::CdpCommand<'a> for RemoveScriptToEvaluateOnLoadParams<'a> {
5116 const METHOD: &'static str = "Page.removeScriptToEvaluateOnLoad";
5117 type Response = crate::EmptyReturns;
5118}
5119
5120#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5123#[serde(rename_all = "camelCase")]
5124pub struct RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5125 identifier: ScriptIdentifier<'a>,
5126}
5127
5128impl<'a> RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5129 pub fn builder(identifier: impl Into<ScriptIdentifier<'a>>) -> RemoveScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
5132 RemoveScriptToEvaluateOnNewDocumentParamsBuilder {
5133 identifier: identifier.into(),
5134 }
5135 }
5136 pub fn identifier(&self) -> &ScriptIdentifier<'a> { &self.identifier }
5137}
5138
5139
5140pub struct RemoveScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
5141 identifier: ScriptIdentifier<'a>,
5142}
5143
5144impl<'a> RemoveScriptToEvaluateOnNewDocumentParamsBuilder<'a> {
5145 pub fn build(self) -> RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5146 RemoveScriptToEvaluateOnNewDocumentParams {
5147 identifier: self.identifier,
5148 }
5149 }
5150}
5151
5152impl<'a> RemoveScriptToEvaluateOnNewDocumentParams<'a> { pub const METHOD: &'static str = "Page.removeScriptToEvaluateOnNewDocument"; }
5153
5154impl<'a> crate::CdpCommand<'a> for RemoveScriptToEvaluateOnNewDocumentParams<'a> {
5155 const METHOD: &'static str = "Page.removeScriptToEvaluateOnNewDocument";
5156 type Response = crate::EmptyReturns;
5157}
5158
5159#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5162#[serde(rename_all = "camelCase")]
5163pub struct ScreencastFrameAckParams {
5164 #[serde(rename = "sessionId")]
5166 session_id: u64,
5167}
5168
5169impl ScreencastFrameAckParams {
5170 pub fn builder(session_id: u64) -> ScreencastFrameAckParamsBuilder {
5173 ScreencastFrameAckParamsBuilder {
5174 session_id: session_id,
5175 }
5176 }
5177 pub fn session_id(&self) -> u64 { self.session_id }
5179}
5180
5181
5182pub struct ScreencastFrameAckParamsBuilder {
5183 session_id: u64,
5184}
5185
5186impl ScreencastFrameAckParamsBuilder {
5187 pub fn build(self) -> ScreencastFrameAckParams {
5188 ScreencastFrameAckParams {
5189 session_id: self.session_id,
5190 }
5191 }
5192}
5193
5194impl ScreencastFrameAckParams { pub const METHOD: &'static str = "Page.screencastFrameAck"; }
5195
5196impl<'a> crate::CdpCommand<'a> for ScreencastFrameAckParams {
5197 const METHOD: &'static str = "Page.screencastFrameAck";
5198 type Response = crate::EmptyReturns;
5199}
5200
5201#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5204#[serde(rename_all = "camelCase")]
5205pub struct SearchInResourceParams<'a> {
5206 #[serde(rename = "frameId")]
5208 frame_id: FrameId<'a>,
5209 url: Cow<'a, str>,
5211 query: Cow<'a, str>,
5213 #[serde(skip_serializing_if = "Option::is_none", rename = "caseSensitive")]
5215 case_sensitive: Option<bool>,
5216 #[serde(skip_serializing_if = "Option::is_none", rename = "isRegex")]
5218 is_regex: Option<bool>,
5219}
5220
5221impl<'a> SearchInResourceParams<'a> {
5222 pub fn builder(frame_id: impl Into<FrameId<'a>>, url: impl Into<Cow<'a, str>>, query: impl Into<Cow<'a, str>>) -> SearchInResourceParamsBuilder<'a> {
5227 SearchInResourceParamsBuilder {
5228 frame_id: frame_id.into(),
5229 url: url.into(),
5230 query: query.into(),
5231 case_sensitive: None,
5232 is_regex: None,
5233 }
5234 }
5235 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5237 pub fn url(&self) -> &str { self.url.as_ref() }
5239 pub fn query(&self) -> &str { self.query.as_ref() }
5241 pub fn case_sensitive(&self) -> Option<bool> { self.case_sensitive }
5243 pub fn is_regex(&self) -> Option<bool> { self.is_regex }
5245}
5246
5247
5248pub struct SearchInResourceParamsBuilder<'a> {
5249 frame_id: FrameId<'a>,
5250 url: Cow<'a, str>,
5251 query: Cow<'a, str>,
5252 case_sensitive: Option<bool>,
5253 is_regex: Option<bool>,
5254}
5255
5256impl<'a> SearchInResourceParamsBuilder<'a> {
5257 pub fn case_sensitive(mut self, case_sensitive: bool) -> Self { self.case_sensitive = Some(case_sensitive); self }
5259 pub fn is_regex(mut self, is_regex: bool) -> Self { self.is_regex = Some(is_regex); self }
5261 pub fn build(self) -> SearchInResourceParams<'a> {
5262 SearchInResourceParams {
5263 frame_id: self.frame_id,
5264 url: self.url,
5265 query: self.query,
5266 case_sensitive: self.case_sensitive,
5267 is_regex: self.is_regex,
5268 }
5269 }
5270}
5271
5272#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5275#[serde(rename_all = "camelCase")]
5276pub struct SearchInResourceReturns {
5277 result: Vec<crate::debugger::SearchMatch>,
5279}
5280
5281impl SearchInResourceReturns {
5282 pub fn builder(result: Vec<crate::debugger::SearchMatch>) -> SearchInResourceReturnsBuilder {
5285 SearchInResourceReturnsBuilder {
5286 result: result,
5287 }
5288 }
5289 pub fn result(&self) -> &[crate::debugger::SearchMatch] { &self.result }
5291}
5292
5293
5294pub struct SearchInResourceReturnsBuilder {
5295 result: Vec<crate::debugger::SearchMatch>,
5296}
5297
5298impl SearchInResourceReturnsBuilder {
5299 pub fn build(self) -> SearchInResourceReturns {
5300 SearchInResourceReturns {
5301 result: self.result,
5302 }
5303 }
5304}
5305
5306impl<'a> SearchInResourceParams<'a> { pub const METHOD: &'static str = "Page.searchInResource"; }
5307
5308impl<'a> crate::CdpCommand<'a> for SearchInResourceParams<'a> {
5309 const METHOD: &'static str = "Page.searchInResource";
5310 type Response = SearchInResourceReturns;
5311}
5312
5313#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5316#[serde(rename_all = "camelCase")]
5317pub struct SetAdBlockingEnabledParams {
5318 enabled: bool,
5320}
5321
5322impl SetAdBlockingEnabledParams {
5323 pub fn builder(enabled: bool) -> SetAdBlockingEnabledParamsBuilder {
5326 SetAdBlockingEnabledParamsBuilder {
5327 enabled: enabled,
5328 }
5329 }
5330 pub fn enabled(&self) -> bool { self.enabled }
5332}
5333
5334
5335pub struct SetAdBlockingEnabledParamsBuilder {
5336 enabled: bool,
5337}
5338
5339impl SetAdBlockingEnabledParamsBuilder {
5340 pub fn build(self) -> SetAdBlockingEnabledParams {
5341 SetAdBlockingEnabledParams {
5342 enabled: self.enabled,
5343 }
5344 }
5345}
5346
5347impl SetAdBlockingEnabledParams { pub const METHOD: &'static str = "Page.setAdBlockingEnabled"; }
5348
5349impl<'a> crate::CdpCommand<'a> for SetAdBlockingEnabledParams {
5350 const METHOD: &'static str = "Page.setAdBlockingEnabled";
5351 type Response = crate::EmptyReturns;
5352}
5353
5354#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5357#[serde(rename_all = "camelCase")]
5358pub struct SetBypassCSPParams {
5359 enabled: bool,
5361}
5362
5363impl SetBypassCSPParams {
5364 pub fn builder(enabled: bool) -> SetBypassCSPParamsBuilder {
5367 SetBypassCSPParamsBuilder {
5368 enabled: enabled,
5369 }
5370 }
5371 pub fn enabled(&self) -> bool { self.enabled }
5373}
5374
5375
5376pub struct SetBypassCSPParamsBuilder {
5377 enabled: bool,
5378}
5379
5380impl SetBypassCSPParamsBuilder {
5381 pub fn build(self) -> SetBypassCSPParams {
5382 SetBypassCSPParams {
5383 enabled: self.enabled,
5384 }
5385 }
5386}
5387
5388impl SetBypassCSPParams { pub const METHOD: &'static str = "Page.setBypassCSP"; }
5389
5390impl<'a> crate::CdpCommand<'a> for SetBypassCSPParams {
5391 const METHOD: &'static str = "Page.setBypassCSP";
5392 type Response = crate::EmptyReturns;
5393}
5394
5395#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5398#[serde(rename_all = "camelCase")]
5399pub struct GetPermissionsPolicyStateParams<'a> {
5400 #[serde(rename = "frameId")]
5401 frame_id: FrameId<'a>,
5402}
5403
5404impl<'a> GetPermissionsPolicyStateParams<'a> {
5405 pub fn builder(frame_id: impl Into<FrameId<'a>>) -> GetPermissionsPolicyStateParamsBuilder<'a> {
5408 GetPermissionsPolicyStateParamsBuilder {
5409 frame_id: frame_id.into(),
5410 }
5411 }
5412 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5413}
5414
5415
5416pub struct GetPermissionsPolicyStateParamsBuilder<'a> {
5417 frame_id: FrameId<'a>,
5418}
5419
5420impl<'a> GetPermissionsPolicyStateParamsBuilder<'a> {
5421 pub fn build(self) -> GetPermissionsPolicyStateParams<'a> {
5422 GetPermissionsPolicyStateParams {
5423 frame_id: self.frame_id,
5424 }
5425 }
5426}
5427
5428#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5431#[serde(rename_all = "camelCase")]
5432pub struct GetPermissionsPolicyStateReturns<'a> {
5433 states: Vec<PermissionsPolicyFeatureState<'a>>,
5434}
5435
5436impl<'a> GetPermissionsPolicyStateReturns<'a> {
5437 pub fn builder(states: Vec<PermissionsPolicyFeatureState<'a>>) -> GetPermissionsPolicyStateReturnsBuilder<'a> {
5440 GetPermissionsPolicyStateReturnsBuilder {
5441 states: states,
5442 }
5443 }
5444 pub fn states(&self) -> &[PermissionsPolicyFeatureState<'a>] { &self.states }
5445}
5446
5447
5448pub struct GetPermissionsPolicyStateReturnsBuilder<'a> {
5449 states: Vec<PermissionsPolicyFeatureState<'a>>,
5450}
5451
5452impl<'a> GetPermissionsPolicyStateReturnsBuilder<'a> {
5453 pub fn build(self) -> GetPermissionsPolicyStateReturns<'a> {
5454 GetPermissionsPolicyStateReturns {
5455 states: self.states,
5456 }
5457 }
5458}
5459
5460impl<'a> GetPermissionsPolicyStateParams<'a> { pub const METHOD: &'static str = "Page.getPermissionsPolicyState"; }
5461
5462impl<'a> crate::CdpCommand<'a> for GetPermissionsPolicyStateParams<'a> {
5463 const METHOD: &'static str = "Page.getPermissionsPolicyState";
5464 type Response = GetPermissionsPolicyStateReturns<'a>;
5465}
5466
5467#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5470#[serde(rename_all = "camelCase")]
5471pub struct GetOriginTrialsParams<'a> {
5472 #[serde(rename = "frameId")]
5473 frame_id: FrameId<'a>,
5474}
5475
5476impl<'a> GetOriginTrialsParams<'a> {
5477 pub fn builder(frame_id: impl Into<FrameId<'a>>) -> GetOriginTrialsParamsBuilder<'a> {
5480 GetOriginTrialsParamsBuilder {
5481 frame_id: frame_id.into(),
5482 }
5483 }
5484 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5485}
5486
5487
5488pub struct GetOriginTrialsParamsBuilder<'a> {
5489 frame_id: FrameId<'a>,
5490}
5491
5492impl<'a> GetOriginTrialsParamsBuilder<'a> {
5493 pub fn build(self) -> GetOriginTrialsParams<'a> {
5494 GetOriginTrialsParams {
5495 frame_id: self.frame_id,
5496 }
5497 }
5498}
5499
5500#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5503#[serde(rename_all = "camelCase")]
5504pub struct GetOriginTrialsReturns<'a> {
5505 #[serde(rename = "originTrials")]
5506 origin_trials: Vec<OriginTrial<'a>>,
5507}
5508
5509impl<'a> GetOriginTrialsReturns<'a> {
5510 pub fn builder(origin_trials: Vec<OriginTrial<'a>>) -> GetOriginTrialsReturnsBuilder<'a> {
5513 GetOriginTrialsReturnsBuilder {
5514 origin_trials: origin_trials,
5515 }
5516 }
5517 pub fn origin_trials(&self) -> &[OriginTrial<'a>] { &self.origin_trials }
5518}
5519
5520
5521pub struct GetOriginTrialsReturnsBuilder<'a> {
5522 origin_trials: Vec<OriginTrial<'a>>,
5523}
5524
5525impl<'a> GetOriginTrialsReturnsBuilder<'a> {
5526 pub fn build(self) -> GetOriginTrialsReturns<'a> {
5527 GetOriginTrialsReturns {
5528 origin_trials: self.origin_trials,
5529 }
5530 }
5531}
5532
5533impl<'a> GetOriginTrialsParams<'a> { pub const METHOD: &'static str = "Page.getOriginTrials"; }
5534
5535impl<'a> crate::CdpCommand<'a> for GetOriginTrialsParams<'a> {
5536 const METHOD: &'static str = "Page.getOriginTrials";
5537 type Response = GetOriginTrialsReturns<'a>;
5538}
5539
5540#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5545#[serde(rename_all = "camelCase")]
5546pub struct SetDeviceMetricsOverrideParams<'a> {
5547 width: u64,
5549 height: i64,
5551 #[serde(rename = "deviceScaleFactor")]
5553 device_scale_factor: f64,
5554 mobile: bool,
5557 #[serde(skip_serializing_if = "Option::is_none")]
5559 scale: Option<f64>,
5560 #[serde(skip_serializing_if = "Option::is_none", rename = "screenWidth")]
5562 screen_width: Option<u64>,
5563 #[serde(skip_serializing_if = "Option::is_none", rename = "screenHeight")]
5565 screen_height: Option<i64>,
5566 #[serde(skip_serializing_if = "Option::is_none", rename = "positionX")]
5568 position_x: Option<i64>,
5569 #[serde(skip_serializing_if = "Option::is_none", rename = "positionY")]
5571 position_y: Option<i64>,
5572 #[serde(skip_serializing_if = "Option::is_none", rename = "dontSetVisibleSize")]
5574 dont_set_visible_size: Option<bool>,
5575 #[serde(skip_serializing_if = "Option::is_none", rename = "screenOrientation")]
5577 screen_orientation: Option<crate::emulation::ScreenOrientation<'a>>,
5578 #[serde(skip_serializing_if = "Option::is_none")]
5580 viewport: Option<Viewport>,
5581}
5582
5583impl<'a> SetDeviceMetricsOverrideParams<'a> {
5584 pub fn builder(width: u64, height: i64, device_scale_factor: f64, mobile: bool) -> SetDeviceMetricsOverrideParamsBuilder<'a> {
5590 SetDeviceMetricsOverrideParamsBuilder {
5591 width: width,
5592 height: height,
5593 device_scale_factor: device_scale_factor,
5594 mobile: mobile,
5595 scale: None,
5596 screen_width: None,
5597 screen_height: None,
5598 position_x: None,
5599 position_y: None,
5600 dont_set_visible_size: None,
5601 screen_orientation: None,
5602 viewport: None,
5603 }
5604 }
5605 pub fn width(&self) -> u64 { self.width }
5607 pub fn height(&self) -> i64 { self.height }
5609 pub fn device_scale_factor(&self) -> f64 { self.device_scale_factor }
5611 pub fn mobile(&self) -> bool { self.mobile }
5614 pub fn scale(&self) -> Option<f64> { self.scale }
5616 pub fn screen_width(&self) -> Option<u64> { self.screen_width }
5618 pub fn screen_height(&self) -> Option<i64> { self.screen_height }
5620 pub fn position_x(&self) -> Option<i64> { self.position_x }
5622 pub fn position_y(&self) -> Option<i64> { self.position_y }
5624 pub fn dont_set_visible_size(&self) -> Option<bool> { self.dont_set_visible_size }
5626 pub fn screen_orientation(&self) -> Option<&crate::emulation::ScreenOrientation<'a>> { self.screen_orientation.as_ref() }
5628 pub fn viewport(&self) -> Option<&Viewport> { self.viewport.as_ref() }
5630}
5631
5632
5633pub struct SetDeviceMetricsOverrideParamsBuilder<'a> {
5634 width: u64,
5635 height: i64,
5636 device_scale_factor: f64,
5637 mobile: bool,
5638 scale: Option<f64>,
5639 screen_width: Option<u64>,
5640 screen_height: Option<i64>,
5641 position_x: Option<i64>,
5642 position_y: Option<i64>,
5643 dont_set_visible_size: Option<bool>,
5644 screen_orientation: Option<crate::emulation::ScreenOrientation<'a>>,
5645 viewport: Option<Viewport>,
5646}
5647
5648impl<'a> SetDeviceMetricsOverrideParamsBuilder<'a> {
5649 pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
5651 pub fn screen_width(mut self, screen_width: u64) -> Self { self.screen_width = Some(screen_width); self }
5653 pub fn screen_height(mut self, screen_height: i64) -> Self { self.screen_height = Some(screen_height); self }
5655 pub fn position_x(mut self, position_x: i64) -> Self { self.position_x = Some(position_x); self }
5657 pub fn position_y(mut self, position_y: i64) -> Self { self.position_y = Some(position_y); self }
5659 pub fn dont_set_visible_size(mut self, dont_set_visible_size: bool) -> Self { self.dont_set_visible_size = Some(dont_set_visible_size); self }
5661 pub fn screen_orientation(mut self, screen_orientation: crate::emulation::ScreenOrientation<'a>) -> Self { self.screen_orientation = Some(screen_orientation); self }
5663 pub fn viewport(mut self, viewport: Viewport) -> Self { self.viewport = Some(viewport); self }
5665 pub fn build(self) -> SetDeviceMetricsOverrideParams<'a> {
5666 SetDeviceMetricsOverrideParams {
5667 width: self.width,
5668 height: self.height,
5669 device_scale_factor: self.device_scale_factor,
5670 mobile: self.mobile,
5671 scale: self.scale,
5672 screen_width: self.screen_width,
5673 screen_height: self.screen_height,
5674 position_x: self.position_x,
5675 position_y: self.position_y,
5676 dont_set_visible_size: self.dont_set_visible_size,
5677 screen_orientation: self.screen_orientation,
5678 viewport: self.viewport,
5679 }
5680 }
5681}
5682
5683impl<'a> SetDeviceMetricsOverrideParams<'a> { pub const METHOD: &'static str = "Page.setDeviceMetricsOverride"; }
5684
5685impl<'a> crate::CdpCommand<'a> for SetDeviceMetricsOverrideParams<'a> {
5686 const METHOD: &'static str = "Page.setDeviceMetricsOverride";
5687 type Response = crate::EmptyReturns;
5688}
5689
5690#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5693#[serde(rename_all = "camelCase")]
5694pub struct SetDeviceOrientationOverrideParams {
5695 alpha: f64,
5697 beta: f64,
5699 gamma: f64,
5701}
5702
5703impl SetDeviceOrientationOverrideParams {
5704 pub fn builder(alpha: f64, beta: f64, gamma: f64) -> SetDeviceOrientationOverrideParamsBuilder {
5709 SetDeviceOrientationOverrideParamsBuilder {
5710 alpha: alpha,
5711 beta: beta,
5712 gamma: gamma,
5713 }
5714 }
5715 pub fn alpha(&self) -> f64 { self.alpha }
5717 pub fn beta(&self) -> f64 { self.beta }
5719 pub fn gamma(&self) -> f64 { self.gamma }
5721}
5722
5723
5724pub struct SetDeviceOrientationOverrideParamsBuilder {
5725 alpha: f64,
5726 beta: f64,
5727 gamma: f64,
5728}
5729
5730impl SetDeviceOrientationOverrideParamsBuilder {
5731 pub fn build(self) -> SetDeviceOrientationOverrideParams {
5732 SetDeviceOrientationOverrideParams {
5733 alpha: self.alpha,
5734 beta: self.beta,
5735 gamma: self.gamma,
5736 }
5737 }
5738}
5739
5740impl SetDeviceOrientationOverrideParams { pub const METHOD: &'static str = "Page.setDeviceOrientationOverride"; }
5741
5742impl<'a> crate::CdpCommand<'a> for SetDeviceOrientationOverrideParams {
5743 const METHOD: &'static str = "Page.setDeviceOrientationOverride";
5744 type Response = crate::EmptyReturns;
5745}
5746
5747#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5750#[serde(rename_all = "camelCase")]
5751pub struct SetFontFamiliesParams<'a> {
5752 #[serde(rename = "fontFamilies")]
5754 font_families: FontFamilies<'a>,
5755 #[serde(skip_serializing_if = "Option::is_none", rename = "forScripts")]
5757 for_scripts: Option<Vec<ScriptFontFamilies<'a>>>,
5758}
5759
5760impl<'a> SetFontFamiliesParams<'a> {
5761 pub fn builder(font_families: FontFamilies<'a>) -> SetFontFamiliesParamsBuilder<'a> {
5764 SetFontFamiliesParamsBuilder {
5765 font_families: font_families,
5766 for_scripts: None,
5767 }
5768 }
5769 pub fn font_families(&self) -> &FontFamilies<'a> { &self.font_families }
5771 pub fn for_scripts(&self) -> Option<&[ScriptFontFamilies<'a>]> { self.for_scripts.as_deref() }
5773}
5774
5775
5776pub struct SetFontFamiliesParamsBuilder<'a> {
5777 font_families: FontFamilies<'a>,
5778 for_scripts: Option<Vec<ScriptFontFamilies<'a>>>,
5779}
5780
5781impl<'a> SetFontFamiliesParamsBuilder<'a> {
5782 pub fn for_scripts(mut self, for_scripts: Vec<ScriptFontFamilies<'a>>) -> Self { self.for_scripts = Some(for_scripts); self }
5784 pub fn build(self) -> SetFontFamiliesParams<'a> {
5785 SetFontFamiliesParams {
5786 font_families: self.font_families,
5787 for_scripts: self.for_scripts,
5788 }
5789 }
5790}
5791
5792impl<'a> SetFontFamiliesParams<'a> { pub const METHOD: &'static str = "Page.setFontFamilies"; }
5793
5794impl<'a> crate::CdpCommand<'a> for SetFontFamiliesParams<'a> {
5795 const METHOD: &'static str = "Page.setFontFamilies";
5796 type Response = crate::EmptyReturns;
5797}
5798
5799#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5802#[serde(rename_all = "camelCase")]
5803pub struct SetFontSizesParams {
5804 #[serde(rename = "fontSizes")]
5806 font_sizes: FontSizes,
5807}
5808
5809impl SetFontSizesParams {
5810 pub fn builder(font_sizes: FontSizes) -> SetFontSizesParamsBuilder {
5813 SetFontSizesParamsBuilder {
5814 font_sizes: font_sizes,
5815 }
5816 }
5817 pub fn font_sizes(&self) -> &FontSizes { &self.font_sizes }
5819}
5820
5821
5822pub struct SetFontSizesParamsBuilder {
5823 font_sizes: FontSizes,
5824}
5825
5826impl SetFontSizesParamsBuilder {
5827 pub fn build(self) -> SetFontSizesParams {
5828 SetFontSizesParams {
5829 font_sizes: self.font_sizes,
5830 }
5831 }
5832}
5833
5834impl SetFontSizesParams { pub const METHOD: &'static str = "Page.setFontSizes"; }
5835
5836impl<'a> crate::CdpCommand<'a> for SetFontSizesParams {
5837 const METHOD: &'static str = "Page.setFontSizes";
5838 type Response = crate::EmptyReturns;
5839}
5840
5841#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5844#[serde(rename_all = "camelCase")]
5845pub struct SetDocumentContentParams<'a> {
5846 #[serde(rename = "frameId")]
5848 frame_id: FrameId<'a>,
5849 html: Cow<'a, str>,
5851}
5852
5853impl<'a> SetDocumentContentParams<'a> {
5854 pub fn builder(frame_id: impl Into<FrameId<'a>>, html: impl Into<Cow<'a, str>>) -> SetDocumentContentParamsBuilder<'a> {
5858 SetDocumentContentParamsBuilder {
5859 frame_id: frame_id.into(),
5860 html: html.into(),
5861 }
5862 }
5863 pub fn frame_id(&self) -> &FrameId<'a> { &self.frame_id }
5865 pub fn html(&self) -> &str { self.html.as_ref() }
5867}
5868
5869
5870pub struct SetDocumentContentParamsBuilder<'a> {
5871 frame_id: FrameId<'a>,
5872 html: Cow<'a, str>,
5873}
5874
5875impl<'a> SetDocumentContentParamsBuilder<'a> {
5876 pub fn build(self) -> SetDocumentContentParams<'a> {
5877 SetDocumentContentParams {
5878 frame_id: self.frame_id,
5879 html: self.html,
5880 }
5881 }
5882}
5883
5884impl<'a> SetDocumentContentParams<'a> { pub const METHOD: &'static str = "Page.setDocumentContent"; }
5885
5886impl<'a> crate::CdpCommand<'a> for SetDocumentContentParams<'a> {
5887 const METHOD: &'static str = "Page.setDocumentContent";
5888 type Response = crate::EmptyReturns;
5889}
5890
5891#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5894#[serde(rename_all = "camelCase")]
5895pub struct SetDownloadBehaviorParams<'a> {
5896 behavior: Cow<'a, str>,
5899 #[serde(skip_serializing_if = "Option::is_none", rename = "downloadPath")]
5901 download_path: Option<Cow<'a, str>>,
5902}
5903
5904impl<'a> SetDownloadBehaviorParams<'a> {
5905 pub fn builder(behavior: impl Into<Cow<'a, str>>) -> SetDownloadBehaviorParamsBuilder<'a> {
5908 SetDownloadBehaviorParamsBuilder {
5909 behavior: behavior.into(),
5910 download_path: None,
5911 }
5912 }
5913 pub fn behavior(&self) -> &str { self.behavior.as_ref() }
5916 pub fn download_path(&self) -> Option<&str> { self.download_path.as_deref() }
5918}
5919
5920
5921pub struct SetDownloadBehaviorParamsBuilder<'a> {
5922 behavior: Cow<'a, str>,
5923 download_path: Option<Cow<'a, str>>,
5924}
5925
5926impl<'a> SetDownloadBehaviorParamsBuilder<'a> {
5927 pub fn download_path(mut self, download_path: impl Into<Cow<'a, str>>) -> Self { self.download_path = Some(download_path.into()); self }
5929 pub fn build(self) -> SetDownloadBehaviorParams<'a> {
5930 SetDownloadBehaviorParams {
5931 behavior: self.behavior,
5932 download_path: self.download_path,
5933 }
5934 }
5935}
5936
5937impl<'a> SetDownloadBehaviorParams<'a> { pub const METHOD: &'static str = "Page.setDownloadBehavior"; }
5938
5939impl<'a> crate::CdpCommand<'a> for SetDownloadBehaviorParams<'a> {
5940 const METHOD: &'static str = "Page.setDownloadBehavior";
5941 type Response = crate::EmptyReturns;
5942}
5943
5944#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5948#[serde(rename_all = "camelCase")]
5949pub struct SetGeolocationOverrideParams {
5950 #[serde(skip_serializing_if = "Option::is_none")]
5952 latitude: Option<f64>,
5953 #[serde(skip_serializing_if = "Option::is_none")]
5955 longitude: Option<f64>,
5956 #[serde(skip_serializing_if = "Option::is_none")]
5958 accuracy: Option<f64>,
5959}
5960
5961impl SetGeolocationOverrideParams {
5962 pub fn builder() -> SetGeolocationOverrideParamsBuilder {
5964 SetGeolocationOverrideParamsBuilder {
5965 latitude: None,
5966 longitude: None,
5967 accuracy: None,
5968 }
5969 }
5970 pub fn latitude(&self) -> Option<f64> { self.latitude }
5972 pub fn longitude(&self) -> Option<f64> { self.longitude }
5974 pub fn accuracy(&self) -> Option<f64> { self.accuracy }
5976}
5977
5978#[derive(Default)]
5979pub struct SetGeolocationOverrideParamsBuilder {
5980 latitude: Option<f64>,
5981 longitude: Option<f64>,
5982 accuracy: Option<f64>,
5983}
5984
5985impl SetGeolocationOverrideParamsBuilder {
5986 pub fn latitude(mut self, latitude: f64) -> Self { self.latitude = Some(latitude); self }
5988 pub fn longitude(mut self, longitude: f64) -> Self { self.longitude = Some(longitude); self }
5990 pub fn accuracy(mut self, accuracy: f64) -> Self { self.accuracy = Some(accuracy); self }
5992 pub fn build(self) -> SetGeolocationOverrideParams {
5993 SetGeolocationOverrideParams {
5994 latitude: self.latitude,
5995 longitude: self.longitude,
5996 accuracy: self.accuracy,
5997 }
5998 }
5999}
6000
6001impl SetGeolocationOverrideParams { pub const METHOD: &'static str = "Page.setGeolocationOverride"; }
6002
6003impl<'a> crate::CdpCommand<'a> for SetGeolocationOverrideParams {
6004 const METHOD: &'static str = "Page.setGeolocationOverride";
6005 type Response = crate::EmptyReturns;
6006}
6007
6008#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6011#[serde(rename_all = "camelCase")]
6012pub struct SetLifecycleEventsEnabledParams {
6013 enabled: bool,
6015}
6016
6017impl SetLifecycleEventsEnabledParams {
6018 pub fn builder(enabled: bool) -> SetLifecycleEventsEnabledParamsBuilder {
6021 SetLifecycleEventsEnabledParamsBuilder {
6022 enabled: enabled,
6023 }
6024 }
6025 pub fn enabled(&self) -> bool { self.enabled }
6027}
6028
6029
6030pub struct SetLifecycleEventsEnabledParamsBuilder {
6031 enabled: bool,
6032}
6033
6034impl SetLifecycleEventsEnabledParamsBuilder {
6035 pub fn build(self) -> SetLifecycleEventsEnabledParams {
6036 SetLifecycleEventsEnabledParams {
6037 enabled: self.enabled,
6038 }
6039 }
6040}
6041
6042impl SetLifecycleEventsEnabledParams { pub const METHOD: &'static str = "Page.setLifecycleEventsEnabled"; }
6043
6044impl<'a> crate::CdpCommand<'a> for SetLifecycleEventsEnabledParams {
6045 const METHOD: &'static str = "Page.setLifecycleEventsEnabled";
6046 type Response = crate::EmptyReturns;
6047}
6048
6049#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6052#[serde(rename_all = "camelCase")]
6053pub struct SetTouchEmulationEnabledParams<'a> {
6054 enabled: bool,
6056 #[serde(skip_serializing_if = "Option::is_none")]
6058 configuration: Option<Cow<'a, str>>,
6059}
6060
6061impl<'a> SetTouchEmulationEnabledParams<'a> {
6062 pub fn builder(enabled: bool) -> SetTouchEmulationEnabledParamsBuilder<'a> {
6065 SetTouchEmulationEnabledParamsBuilder {
6066 enabled: enabled,
6067 configuration: None,
6068 }
6069 }
6070 pub fn enabled(&self) -> bool { self.enabled }
6072 pub fn configuration(&self) -> Option<&str> { self.configuration.as_deref() }
6074}
6075
6076
6077pub struct SetTouchEmulationEnabledParamsBuilder<'a> {
6078 enabled: bool,
6079 configuration: Option<Cow<'a, str>>,
6080}
6081
6082impl<'a> SetTouchEmulationEnabledParamsBuilder<'a> {
6083 pub fn configuration(mut self, configuration: impl Into<Cow<'a, str>>) -> Self { self.configuration = Some(configuration.into()); self }
6085 pub fn build(self) -> SetTouchEmulationEnabledParams<'a> {
6086 SetTouchEmulationEnabledParams {
6087 enabled: self.enabled,
6088 configuration: self.configuration,
6089 }
6090 }
6091}
6092
6093impl<'a> SetTouchEmulationEnabledParams<'a> { pub const METHOD: &'static str = "Page.setTouchEmulationEnabled"; }
6094
6095impl<'a> crate::CdpCommand<'a> for SetTouchEmulationEnabledParams<'a> {
6096 const METHOD: &'static str = "Page.setTouchEmulationEnabled";
6097 type Response = crate::EmptyReturns;
6098}
6099
6100#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6103#[serde(rename_all = "camelCase")]
6104pub struct StartScreencastParams<'a> {
6105 #[serde(skip_serializing_if = "Option::is_none")]
6107 format: Option<Cow<'a, str>>,
6108 #[serde(skip_serializing_if = "Option::is_none")]
6110 quality: Option<i64>,
6111 #[serde(skip_serializing_if = "Option::is_none", rename = "maxWidth")]
6113 max_width: Option<u64>,
6114 #[serde(skip_serializing_if = "Option::is_none", rename = "maxHeight")]
6116 max_height: Option<i64>,
6117 #[serde(skip_serializing_if = "Option::is_none", rename = "everyNthFrame")]
6119 every_nth_frame: Option<i64>,
6120}
6121
6122impl<'a> StartScreencastParams<'a> {
6123 pub fn builder() -> StartScreencastParamsBuilder<'a> {
6125 StartScreencastParamsBuilder {
6126 format: None,
6127 quality: None,
6128 max_width: None,
6129 max_height: None,
6130 every_nth_frame: None,
6131 }
6132 }
6133 pub fn format(&self) -> Option<&str> { self.format.as_deref() }
6135 pub fn quality(&self) -> Option<i64> { self.quality }
6137 pub fn max_width(&self) -> Option<u64> { self.max_width }
6139 pub fn max_height(&self) -> Option<i64> { self.max_height }
6141 pub fn every_nth_frame(&self) -> Option<i64> { self.every_nth_frame }
6143}
6144
6145#[derive(Default)]
6146pub struct StartScreencastParamsBuilder<'a> {
6147 format: Option<Cow<'a, str>>,
6148 quality: Option<i64>,
6149 max_width: Option<u64>,
6150 max_height: Option<i64>,
6151 every_nth_frame: Option<i64>,
6152}
6153
6154impl<'a> StartScreencastParamsBuilder<'a> {
6155 pub fn format(mut self, format: impl Into<Cow<'a, str>>) -> Self { self.format = Some(format.into()); self }
6157 pub fn quality(mut self, quality: i64) -> Self { self.quality = Some(quality); self }
6159 pub fn max_width(mut self, max_width: u64) -> Self { self.max_width = Some(max_width); self }
6161 pub fn max_height(mut self, max_height: i64) -> Self { self.max_height = Some(max_height); self }
6163 pub fn every_nth_frame(mut self, every_nth_frame: i64) -> Self { self.every_nth_frame = Some(every_nth_frame); self }
6165 pub fn build(self) -> StartScreencastParams<'a> {
6166 StartScreencastParams {
6167 format: self.format,
6168 quality: self.quality,
6169 max_width: self.max_width,
6170 max_height: self.max_height,
6171 every_nth_frame: self.every_nth_frame,
6172 }
6173 }
6174}
6175
6176impl<'a> StartScreencastParams<'a> { pub const METHOD: &'static str = "Page.startScreencast"; }
6177
6178impl<'a> crate::CdpCommand<'a> for StartScreencastParams<'a> {
6179 const METHOD: &'static str = "Page.startScreencast";
6180 type Response = crate::EmptyReturns;
6181}
6182
6183#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6184pub struct StopLoadingParams {}
6185
6186impl StopLoadingParams { pub const METHOD: &'static str = "Page.stopLoading"; }
6187
6188impl<'a> crate::CdpCommand<'a> for StopLoadingParams {
6189 const METHOD: &'static str = "Page.stopLoading";
6190 type Response = crate::EmptyReturns;
6191}
6192
6193#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6194pub struct CrashParams {}
6195
6196impl CrashParams { pub const METHOD: &'static str = "Page.crash"; }
6197
6198impl<'a> crate::CdpCommand<'a> for CrashParams {
6199 const METHOD: &'static str = "Page.crash";
6200 type Response = crate::EmptyReturns;
6201}
6202
6203#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6204pub struct CloseParams {}
6205
6206impl CloseParams { pub const METHOD: &'static str = "Page.close"; }
6207
6208impl<'a> crate::CdpCommand<'a> for CloseParams {
6209 const METHOD: &'static str = "Page.close";
6210 type Response = crate::EmptyReturns;
6211}
6212
6213#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6218#[serde(rename_all = "camelCase")]
6219pub struct SetWebLifecycleStateParams<'a> {
6220 state: Cow<'a, str>,
6222}
6223
6224impl<'a> SetWebLifecycleStateParams<'a> {
6225 pub fn builder(state: impl Into<Cow<'a, str>>) -> SetWebLifecycleStateParamsBuilder<'a> {
6228 SetWebLifecycleStateParamsBuilder {
6229 state: state.into(),
6230 }
6231 }
6232 pub fn state(&self) -> &str { self.state.as_ref() }
6234}
6235
6236
6237pub struct SetWebLifecycleStateParamsBuilder<'a> {
6238 state: Cow<'a, str>,
6239}
6240
6241impl<'a> SetWebLifecycleStateParamsBuilder<'a> {
6242 pub fn build(self) -> SetWebLifecycleStateParams<'a> {
6243 SetWebLifecycleStateParams {
6244 state: self.state,
6245 }
6246 }
6247}
6248
6249impl<'a> SetWebLifecycleStateParams<'a> { pub const METHOD: &'static str = "Page.setWebLifecycleState"; }
6250
6251impl<'a> crate::CdpCommand<'a> for SetWebLifecycleStateParams<'a> {
6252 const METHOD: &'static str = "Page.setWebLifecycleState";
6253 type Response = crate::EmptyReturns;
6254}
6255
6256#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6257pub struct StopScreencastParams {}
6258
6259impl StopScreencastParams { pub const METHOD: &'static str = "Page.stopScreencast"; }
6260
6261impl<'a> crate::CdpCommand<'a> for StopScreencastParams {
6262 const METHOD: &'static str = "Page.stopScreencast";
6263 type Response = crate::EmptyReturns;
6264}
6265
6266#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6274#[serde(rename_all = "camelCase")]
6275pub struct ProduceCompilationCacheParams<'a> {
6276 scripts: Vec<CompilationCacheParams<'a>>,
6277}
6278
6279impl<'a> ProduceCompilationCacheParams<'a> {
6280 pub fn builder(scripts: Vec<CompilationCacheParams<'a>>) -> ProduceCompilationCacheParamsBuilder<'a> {
6283 ProduceCompilationCacheParamsBuilder {
6284 scripts: scripts,
6285 }
6286 }
6287 pub fn scripts(&self) -> &[CompilationCacheParams<'a>] { &self.scripts }
6288}
6289
6290
6291pub struct ProduceCompilationCacheParamsBuilder<'a> {
6292 scripts: Vec<CompilationCacheParams<'a>>,
6293}
6294
6295impl<'a> ProduceCompilationCacheParamsBuilder<'a> {
6296 pub fn build(self) -> ProduceCompilationCacheParams<'a> {
6297 ProduceCompilationCacheParams {
6298 scripts: self.scripts,
6299 }
6300 }
6301}
6302
6303impl<'a> ProduceCompilationCacheParams<'a> { pub const METHOD: &'static str = "Page.produceCompilationCache"; }
6304
6305impl<'a> crate::CdpCommand<'a> for ProduceCompilationCacheParams<'a> {
6306 const METHOD: &'static str = "Page.produceCompilationCache";
6307 type Response = crate::EmptyReturns;
6308}
6309
6310#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6314#[serde(rename_all = "camelCase")]
6315pub struct AddCompilationCacheParams<'a> {
6316 url: Cow<'a, str>,
6317 data: Cow<'a, str>,
6319}
6320
6321impl<'a> AddCompilationCacheParams<'a> {
6322 pub fn builder(url: impl Into<Cow<'a, str>>, data: impl Into<Cow<'a, str>>) -> AddCompilationCacheParamsBuilder<'a> {
6326 AddCompilationCacheParamsBuilder {
6327 url: url.into(),
6328 data: data.into(),
6329 }
6330 }
6331 pub fn url(&self) -> &str { self.url.as_ref() }
6332 pub fn data(&self) -> &str { self.data.as_ref() }
6334}
6335
6336
6337pub struct AddCompilationCacheParamsBuilder<'a> {
6338 url: Cow<'a, str>,
6339 data: Cow<'a, str>,
6340}
6341
6342impl<'a> AddCompilationCacheParamsBuilder<'a> {
6343 pub fn build(self) -> AddCompilationCacheParams<'a> {
6344 AddCompilationCacheParams {
6345 url: self.url,
6346 data: self.data,
6347 }
6348 }
6349}
6350
6351impl<'a> AddCompilationCacheParams<'a> { pub const METHOD: &'static str = "Page.addCompilationCache"; }
6352
6353impl<'a> crate::CdpCommand<'a> for AddCompilationCacheParams<'a> {
6354 const METHOD: &'static str = "Page.addCompilationCache";
6355 type Response = crate::EmptyReturns;
6356}
6357
6358#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6359pub struct ClearCompilationCacheParams {}
6360
6361impl ClearCompilationCacheParams { pub const METHOD: &'static str = "Page.clearCompilationCache"; }
6362
6363impl<'a> crate::CdpCommand<'a> for ClearCompilationCacheParams {
6364 const METHOD: &'static str = "Page.clearCompilationCache";
6365 type Response = crate::EmptyReturns;
6366}
6367
6368#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6372#[serde(rename_all = "camelCase")]
6373pub struct SetSPCTransactionModeParams<'a> {
6374 mode: Cow<'a, str>,
6375}
6376
6377impl<'a> SetSPCTransactionModeParams<'a> {
6378 pub fn builder(mode: impl Into<Cow<'a, str>>) -> SetSPCTransactionModeParamsBuilder<'a> {
6381 SetSPCTransactionModeParamsBuilder {
6382 mode: mode.into(),
6383 }
6384 }
6385 pub fn mode(&self) -> &str { self.mode.as_ref() }
6386}
6387
6388
6389pub struct SetSPCTransactionModeParamsBuilder<'a> {
6390 mode: Cow<'a, str>,
6391}
6392
6393impl<'a> SetSPCTransactionModeParamsBuilder<'a> {
6394 pub fn build(self) -> SetSPCTransactionModeParams<'a> {
6395 SetSPCTransactionModeParams {
6396 mode: self.mode,
6397 }
6398 }
6399}
6400
6401impl<'a> SetSPCTransactionModeParams<'a> { pub const METHOD: &'static str = "Page.setSPCTransactionMode"; }
6402
6403impl<'a> crate::CdpCommand<'a> for SetSPCTransactionModeParams<'a> {
6404 const METHOD: &'static str = "Page.setSPCTransactionMode";
6405 type Response = crate::EmptyReturns;
6406}
6407
6408#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6412#[serde(rename_all = "camelCase")]
6413pub struct SetRPHRegistrationModeParams<'a> {
6414 mode: Cow<'a, str>,
6415}
6416
6417impl<'a> SetRPHRegistrationModeParams<'a> {
6418 pub fn builder(mode: impl Into<Cow<'a, str>>) -> SetRPHRegistrationModeParamsBuilder<'a> {
6421 SetRPHRegistrationModeParamsBuilder {
6422 mode: mode.into(),
6423 }
6424 }
6425 pub fn mode(&self) -> &str { self.mode.as_ref() }
6426}
6427
6428
6429pub struct SetRPHRegistrationModeParamsBuilder<'a> {
6430 mode: Cow<'a, str>,
6431}
6432
6433impl<'a> SetRPHRegistrationModeParamsBuilder<'a> {
6434 pub fn build(self) -> SetRPHRegistrationModeParams<'a> {
6435 SetRPHRegistrationModeParams {
6436 mode: self.mode,
6437 }
6438 }
6439}
6440
6441impl<'a> SetRPHRegistrationModeParams<'a> { pub const METHOD: &'static str = "Page.setRPHRegistrationMode"; }
6442
6443impl<'a> crate::CdpCommand<'a> for SetRPHRegistrationModeParams<'a> {
6444 const METHOD: &'static str = "Page.setRPHRegistrationMode";
6445 type Response = crate::EmptyReturns;
6446}
6447
6448#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6451#[serde(rename_all = "camelCase")]
6452pub struct GenerateTestReportParams<'a> {
6453 message: Cow<'a, str>,
6455 #[serde(skip_serializing_if = "Option::is_none")]
6457 group: Option<Cow<'a, str>>,
6458}
6459
6460impl<'a> GenerateTestReportParams<'a> {
6461 pub fn builder(message: impl Into<Cow<'a, str>>) -> GenerateTestReportParamsBuilder<'a> {
6464 GenerateTestReportParamsBuilder {
6465 message: message.into(),
6466 group: None,
6467 }
6468 }
6469 pub fn message(&self) -> &str { self.message.as_ref() }
6471 pub fn group(&self) -> Option<&str> { self.group.as_deref() }
6473}
6474
6475
6476pub struct GenerateTestReportParamsBuilder<'a> {
6477 message: Cow<'a, str>,
6478 group: Option<Cow<'a, str>>,
6479}
6480
6481impl<'a> GenerateTestReportParamsBuilder<'a> {
6482 pub fn group(mut self, group: impl Into<Cow<'a, str>>) -> Self { self.group = Some(group.into()); self }
6484 pub fn build(self) -> GenerateTestReportParams<'a> {
6485 GenerateTestReportParams {
6486 message: self.message,
6487 group: self.group,
6488 }
6489 }
6490}
6491
6492impl<'a> GenerateTestReportParams<'a> { pub const METHOD: &'static str = "Page.generateTestReport"; }
6493
6494impl<'a> crate::CdpCommand<'a> for GenerateTestReportParams<'a> {
6495 const METHOD: &'static str = "Page.generateTestReport";
6496 type Response = crate::EmptyReturns;
6497}
6498
6499#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6500pub struct WaitForDebuggerParams {}
6501
6502impl WaitForDebuggerParams { pub const METHOD: &'static str = "Page.waitForDebugger"; }
6503
6504impl<'a> crate::CdpCommand<'a> for WaitForDebuggerParams {
6505 const METHOD: &'static str = "Page.waitForDebugger";
6506 type Response = crate::EmptyReturns;
6507}
6508
6509#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6514#[serde(rename_all = "camelCase")]
6515pub struct SetInterceptFileChooserDialogParams {
6516 enabled: bool,
6517 #[serde(skip_serializing_if = "Option::is_none")]
6521 cancel: Option<bool>,
6522}
6523
6524impl SetInterceptFileChooserDialogParams {
6525 pub fn builder(enabled: bool) -> SetInterceptFileChooserDialogParamsBuilder {
6528 SetInterceptFileChooserDialogParamsBuilder {
6529 enabled: enabled,
6530 cancel: None,
6531 }
6532 }
6533 pub fn enabled(&self) -> bool { self.enabled }
6534 pub fn cancel(&self) -> Option<bool> { self.cancel }
6538}
6539
6540
6541pub struct SetInterceptFileChooserDialogParamsBuilder {
6542 enabled: bool,
6543 cancel: Option<bool>,
6544}
6545
6546impl SetInterceptFileChooserDialogParamsBuilder {
6547 pub fn cancel(mut self, cancel: bool) -> Self { self.cancel = Some(cancel); self }
6551 pub fn build(self) -> SetInterceptFileChooserDialogParams {
6552 SetInterceptFileChooserDialogParams {
6553 enabled: self.enabled,
6554 cancel: self.cancel,
6555 }
6556 }
6557}
6558
6559impl SetInterceptFileChooserDialogParams { pub const METHOD: &'static str = "Page.setInterceptFileChooserDialog"; }
6560
6561impl<'a> crate::CdpCommand<'a> for SetInterceptFileChooserDialogParams {
6562 const METHOD: &'static str = "Page.setInterceptFileChooserDialog";
6563 type Response = crate::EmptyReturns;
6564}
6565
6566#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6575#[serde(rename_all = "camelCase")]
6576pub struct SetPrerenderingAllowedParams {
6577 #[serde(rename = "isAllowed")]
6578 is_allowed: bool,
6579}
6580
6581impl SetPrerenderingAllowedParams {
6582 pub fn builder(is_allowed: bool) -> SetPrerenderingAllowedParamsBuilder {
6585 SetPrerenderingAllowedParamsBuilder {
6586 is_allowed: is_allowed,
6587 }
6588 }
6589 pub fn is_allowed(&self) -> bool { self.is_allowed }
6590}
6591
6592
6593pub struct SetPrerenderingAllowedParamsBuilder {
6594 is_allowed: bool,
6595}
6596
6597impl SetPrerenderingAllowedParamsBuilder {
6598 pub fn build(self) -> SetPrerenderingAllowedParams {
6599 SetPrerenderingAllowedParams {
6600 is_allowed: self.is_allowed,
6601 }
6602 }
6603}
6604
6605impl SetPrerenderingAllowedParams { pub const METHOD: &'static str = "Page.setPrerenderingAllowed"; }
6606
6607impl<'a> crate::CdpCommand<'a> for SetPrerenderingAllowedParams {
6608 const METHOD: &'static str = "Page.setPrerenderingAllowed";
6609 type Response = crate::EmptyReturns;
6610}
6611
6612#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6616#[serde(rename_all = "camelCase")]
6617pub struct GetAnnotatedPageContentParams {
6618 #[serde(skip_serializing_if = "Option::is_none", rename = "includeActionableInformation")]
6620 include_actionable_information: Option<bool>,
6621}
6622
6623impl GetAnnotatedPageContentParams {
6624 pub fn builder() -> GetAnnotatedPageContentParamsBuilder {
6626 GetAnnotatedPageContentParamsBuilder {
6627 include_actionable_information: None,
6628 }
6629 }
6630 pub fn include_actionable_information(&self) -> Option<bool> { self.include_actionable_information }
6632}
6633
6634#[derive(Default)]
6635pub struct GetAnnotatedPageContentParamsBuilder {
6636 include_actionable_information: Option<bool>,
6637}
6638
6639impl GetAnnotatedPageContentParamsBuilder {
6640 pub fn include_actionable_information(mut self, include_actionable_information: bool) -> Self { self.include_actionable_information = Some(include_actionable_information); self }
6642 pub fn build(self) -> GetAnnotatedPageContentParams {
6643 GetAnnotatedPageContentParams {
6644 include_actionable_information: self.include_actionable_information,
6645 }
6646 }
6647}
6648
6649#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6653#[serde(rename_all = "camelCase")]
6654pub struct GetAnnotatedPageContentReturns<'a> {
6655 content: Cow<'a, str>,
6659}
6660
6661impl<'a> GetAnnotatedPageContentReturns<'a> {
6662 pub fn builder(content: impl Into<Cow<'a, str>>) -> GetAnnotatedPageContentReturnsBuilder<'a> {
6665 GetAnnotatedPageContentReturnsBuilder {
6666 content: content.into(),
6667 }
6668 }
6669 pub fn content(&self) -> &str { self.content.as_ref() }
6673}
6674
6675
6676pub struct GetAnnotatedPageContentReturnsBuilder<'a> {
6677 content: Cow<'a, str>,
6678}
6679
6680impl<'a> GetAnnotatedPageContentReturnsBuilder<'a> {
6681 pub fn build(self) -> GetAnnotatedPageContentReturns<'a> {
6682 GetAnnotatedPageContentReturns {
6683 content: self.content,
6684 }
6685 }
6686}
6687
6688impl GetAnnotatedPageContentParams { pub const METHOD: &'static str = "Page.getAnnotatedPageContent"; }
6689
6690impl<'a> crate::CdpCommand<'a> for GetAnnotatedPageContentParams {
6691 const METHOD: &'static str = "Page.getAnnotatedPageContent";
6692 type Response = GetAnnotatedPageContentReturns<'a>;
6693}