Skip to main content

rustenium_cdp_definitions/browser_protocol/storage/
command_builders.rs

1use super::commands::*;
2impl GetStorageKey {
3    pub fn builder() -> GetStorageKeyBuilder {
4        <GetStorageKeyBuilder as Default>::default()
5    }
6}
7#[derive(Default, Clone)]
8pub struct GetStorageKeyBuilder {
9    frame_id: Option<crate::browser_protocol::page::types::FrameId>,
10}
11impl GetStorageKeyBuilder {
12    pub fn frame_id(
13        mut self,
14        frame_id: impl Into<crate::browser_protocol::page::types::FrameId>,
15    ) -> Self {
16        self.frame_id = Some(frame_id.into());
17        self
18    }
19    pub fn build(self) -> GetStorageKey {
20        GetStorageKey {
21            method: GetStorageKeyMethod::GetStorageKey,
22            params: GetStorageKeyParams {
23                frame_id: self.frame_id,
24            },
25        }
26    }
27}
28impl ClearDataForOrigin {
29    pub fn builder() -> ClearDataForOriginBuilder {
30        <ClearDataForOriginBuilder as Default>::default()
31    }
32}
33#[derive(Default, Clone)]
34pub struct ClearDataForOriginBuilder {
35    origin: Option<String>,
36    storage_types: Option<String>,
37}
38impl ClearDataForOriginBuilder {
39    pub fn origin(mut self, origin: impl Into<String>) -> Self {
40        self.origin = Some(origin.into());
41        self
42    }
43    pub fn storage_types(mut self, storage_types: impl Into<String>) -> Self {
44        self.storage_types = Some(storage_types.into());
45        self
46    }
47    pub fn build(self) -> Result<ClearDataForOrigin, String> {
48        Ok(ClearDataForOrigin {
49            method: ClearDataForOriginMethod::ClearDataForOrigin,
50            params: ClearDataForOriginParams {
51                origin: self
52                    .origin
53                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
54                storage_types: self.storage_types.ok_or_else(|| {
55                    format!("Field `{}` is mandatory.", std::stringify!(storage_types))
56                })?,
57            },
58        })
59    }
60}
61impl ClearDataForStorageKey {
62    pub fn builder() -> ClearDataForStorageKeyBuilder {
63        <ClearDataForStorageKeyBuilder as Default>::default()
64    }
65}
66#[derive(Default, Clone)]
67pub struct ClearDataForStorageKeyBuilder {
68    storage_key: Option<String>,
69    storage_types: Option<String>,
70}
71impl ClearDataForStorageKeyBuilder {
72    pub fn storage_key(mut self, storage_key: impl Into<String>) -> Self {
73        self.storage_key = Some(storage_key.into());
74        self
75    }
76    pub fn storage_types(mut self, storage_types: impl Into<String>) -> Self {
77        self.storage_types = Some(storage_types.into());
78        self
79    }
80    pub fn build(self) -> Result<ClearDataForStorageKey, String> {
81        Ok(ClearDataForStorageKey {
82            method: ClearDataForStorageKeyMethod::ClearDataForStorageKey,
83            params: ClearDataForStorageKeyParams {
84                storage_key: self.storage_key.ok_or_else(|| {
85                    format!("Field `{}` is mandatory.", std::stringify!(storage_key))
86                })?,
87                storage_types: self.storage_types.ok_or_else(|| {
88                    format!("Field `{}` is mandatory.", std::stringify!(storage_types))
89                })?,
90            },
91        })
92    }
93}
94impl GetCookies {
95    pub fn builder() -> GetCookiesBuilder {
96        <GetCookiesBuilder as Default>::default()
97    }
98}
99#[derive(Default, Clone)]
100pub struct GetCookiesBuilder {
101    browser_context_id: Option<crate::browser_protocol::browser::types::BrowserContextId>,
102}
103impl GetCookiesBuilder {
104    pub fn browser_context_id(
105        mut self,
106        browser_context_id: impl Into<crate::browser_protocol::browser::types::BrowserContextId>,
107    ) -> Self {
108        self.browser_context_id = Some(browser_context_id.into());
109        self
110    }
111    pub fn build(self) -> GetCookies {
112        GetCookies {
113            method: GetCookiesMethod::GetCookies,
114            params: GetCookiesParams {
115                browser_context_id: self.browser_context_id,
116            },
117        }
118    }
119}
120impl SetCookies {
121    pub fn builder() -> SetCookiesBuilder {
122        <SetCookiesBuilder as Default>::default()
123    }
124}
125#[derive(Default, Clone)]
126pub struct SetCookiesBuilder {
127    cookies: Option<Vec<crate::browser_protocol::network::types::CookieParam>>,
128    browser_context_id: Option<crate::browser_protocol::browser::types::BrowserContextId>,
129}
130impl SetCookiesBuilder {
131    pub fn cookie(
132        mut self,
133        cookie: impl Into<crate::browser_protocol::network::types::CookieParam>,
134    ) -> Self {
135        let v = self.cookies.get_or_insert(Vec::new());
136        v.push(cookie.into());
137        self
138    }
139    pub fn cookies<I, S>(mut self, cookies: I) -> Self
140    where
141        I: IntoIterator<Item = S>,
142        S: Into<crate::browser_protocol::network::types::CookieParam>,
143    {
144        let v = self.cookies.get_or_insert(Vec::new());
145        for val in cookies {
146            v.push(val.into());
147        }
148        self
149    }
150    pub fn browser_context_id(
151        mut self,
152        browser_context_id: impl Into<crate::browser_protocol::browser::types::BrowserContextId>,
153    ) -> Self {
154        self.browser_context_id = Some(browser_context_id.into());
155        self
156    }
157    pub fn build(self) -> Result<SetCookies, String> {
158        Ok(SetCookies {
159            method: SetCookiesMethod::SetCookies,
160            params: SetCookiesParams {
161                cookies: self
162                    .cookies
163                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(cookies)))?,
164                browser_context_id: self.browser_context_id,
165            },
166        })
167    }
168}
169impl ClearCookies {
170    pub fn builder() -> ClearCookiesBuilder {
171        <ClearCookiesBuilder as Default>::default()
172    }
173}
174#[derive(Default, Clone)]
175pub struct ClearCookiesBuilder {
176    browser_context_id: Option<crate::browser_protocol::browser::types::BrowserContextId>,
177}
178impl ClearCookiesBuilder {
179    pub fn browser_context_id(
180        mut self,
181        browser_context_id: impl Into<crate::browser_protocol::browser::types::BrowserContextId>,
182    ) -> Self {
183        self.browser_context_id = Some(browser_context_id.into());
184        self
185    }
186    pub fn build(self) -> ClearCookies {
187        ClearCookies {
188            method: ClearCookiesMethod::ClearCookies,
189            params: ClearCookiesParams {
190                browser_context_id: self.browser_context_id,
191            },
192        }
193    }
194}
195impl GetUsageAndQuota {
196    pub fn builder() -> GetUsageAndQuotaBuilder {
197        <GetUsageAndQuotaBuilder as Default>::default()
198    }
199}
200#[derive(Default, Clone)]
201pub struct GetUsageAndQuotaBuilder {
202    origin: Option<String>,
203}
204impl GetUsageAndQuotaBuilder {
205    pub fn origin(mut self, origin: impl Into<String>) -> Self {
206        self.origin = Some(origin.into());
207        self
208    }
209    pub fn build(self) -> Result<GetUsageAndQuota, String> {
210        Ok(GetUsageAndQuota {
211            method: GetUsageAndQuotaMethod::GetUsageAndQuota,
212            params: GetUsageAndQuotaParams {
213                origin: self
214                    .origin
215                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
216            },
217        })
218    }
219}
220impl OverrideQuotaForOrigin {
221    pub fn builder() -> OverrideQuotaForOriginBuilder {
222        <OverrideQuotaForOriginBuilder as Default>::default()
223    }
224}
225#[derive(Default, Clone)]
226pub struct OverrideQuotaForOriginBuilder {
227    origin: Option<String>,
228    quota_size: Option<f64>,
229}
230impl OverrideQuotaForOriginBuilder {
231    pub fn origin(mut self, origin: impl Into<String>) -> Self {
232        self.origin = Some(origin.into());
233        self
234    }
235    pub fn quota_size(mut self, quota_size: impl Into<f64>) -> Self {
236        self.quota_size = Some(quota_size.into());
237        self
238    }
239    pub fn build(self) -> Result<OverrideQuotaForOrigin, String> {
240        Ok(OverrideQuotaForOrigin {
241            method: OverrideQuotaForOriginMethod::OverrideQuotaForOrigin,
242            params: OverrideQuotaForOriginParams {
243                origin: self
244                    .origin
245                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
246                quota_size: self.quota_size,
247            },
248        })
249    }
250}
251impl TrackCacheStorageForOrigin {
252    pub fn builder() -> TrackCacheStorageForOriginBuilder {
253        <TrackCacheStorageForOriginBuilder as Default>::default()
254    }
255}
256#[derive(Default, Clone)]
257pub struct TrackCacheStorageForOriginBuilder {
258    origin: Option<String>,
259}
260impl TrackCacheStorageForOriginBuilder {
261    pub fn origin(mut self, origin: impl Into<String>) -> Self {
262        self.origin = Some(origin.into());
263        self
264    }
265    pub fn build(self) -> Result<TrackCacheStorageForOrigin, String> {
266        Ok(TrackCacheStorageForOrigin {
267            method: TrackCacheStorageForOriginMethod::TrackCacheStorageForOrigin,
268            params: TrackCacheStorageForOriginParams {
269                origin: self
270                    .origin
271                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
272            },
273        })
274    }
275}
276impl TrackCacheStorageForStorageKey {
277    pub fn builder() -> TrackCacheStorageForStorageKeyBuilder {
278        <TrackCacheStorageForStorageKeyBuilder as Default>::default()
279    }
280}
281#[derive(Default, Clone)]
282pub struct TrackCacheStorageForStorageKeyBuilder {
283    storage_key: Option<String>,
284}
285impl TrackCacheStorageForStorageKeyBuilder {
286    pub fn storage_key(mut self, storage_key: impl Into<String>) -> Self {
287        self.storage_key = Some(storage_key.into());
288        self
289    }
290    pub fn build(self) -> Result<TrackCacheStorageForStorageKey, String> {
291        Ok(TrackCacheStorageForStorageKey {
292            method: TrackCacheStorageForStorageKeyMethod::TrackCacheStorageForStorageKey,
293            params: TrackCacheStorageForStorageKeyParams {
294                storage_key: self.storage_key.ok_or_else(|| {
295                    format!("Field `{}` is mandatory.", std::stringify!(storage_key))
296                })?,
297            },
298        })
299    }
300}
301impl TrackIndexedDbForOrigin {
302    pub fn builder() -> TrackIndexedDbForOriginBuilder {
303        <TrackIndexedDbForOriginBuilder as Default>::default()
304    }
305}
306#[derive(Default, Clone)]
307pub struct TrackIndexedDbForOriginBuilder {
308    origin: Option<String>,
309}
310impl TrackIndexedDbForOriginBuilder {
311    pub fn origin(mut self, origin: impl Into<String>) -> Self {
312        self.origin = Some(origin.into());
313        self
314    }
315    pub fn build(self) -> Result<TrackIndexedDbForOrigin, String> {
316        Ok(TrackIndexedDbForOrigin {
317            method: TrackIndexedDbForOriginMethod::TrackIndexedDbForOrigin,
318            params: TrackIndexedDbForOriginParams {
319                origin: self
320                    .origin
321                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
322            },
323        })
324    }
325}
326impl TrackIndexedDbForStorageKey {
327    pub fn builder() -> TrackIndexedDbForStorageKeyBuilder {
328        <TrackIndexedDbForStorageKeyBuilder as Default>::default()
329    }
330}
331#[derive(Default, Clone)]
332pub struct TrackIndexedDbForStorageKeyBuilder {
333    storage_key: Option<String>,
334}
335impl TrackIndexedDbForStorageKeyBuilder {
336    pub fn storage_key(mut self, storage_key: impl Into<String>) -> Self {
337        self.storage_key = Some(storage_key.into());
338        self
339    }
340    pub fn build(self) -> Result<TrackIndexedDbForStorageKey, String> {
341        Ok(TrackIndexedDbForStorageKey {
342            method: TrackIndexedDbForStorageKeyMethod::TrackIndexedDbForStorageKey,
343            params: TrackIndexedDbForStorageKeyParams {
344                storage_key: self.storage_key.ok_or_else(|| {
345                    format!("Field `{}` is mandatory.", std::stringify!(storage_key))
346                })?,
347            },
348        })
349    }
350}
351impl UntrackCacheStorageForOrigin {
352    pub fn builder() -> UntrackCacheStorageForOriginBuilder {
353        <UntrackCacheStorageForOriginBuilder as Default>::default()
354    }
355}
356#[derive(Default, Clone)]
357pub struct UntrackCacheStorageForOriginBuilder {
358    origin: Option<String>,
359}
360impl UntrackCacheStorageForOriginBuilder {
361    pub fn origin(mut self, origin: impl Into<String>) -> Self {
362        self.origin = Some(origin.into());
363        self
364    }
365    pub fn build(self) -> Result<UntrackCacheStorageForOrigin, String> {
366        Ok(UntrackCacheStorageForOrigin {
367            method: UntrackCacheStorageForOriginMethod::UntrackCacheStorageForOrigin,
368            params: UntrackCacheStorageForOriginParams {
369                origin: self
370                    .origin
371                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
372            },
373        })
374    }
375}
376impl UntrackCacheStorageForStorageKey {
377    pub fn builder() -> UntrackCacheStorageForStorageKeyBuilder {
378        <UntrackCacheStorageForStorageKeyBuilder as Default>::default()
379    }
380}
381#[derive(Default, Clone)]
382pub struct UntrackCacheStorageForStorageKeyBuilder {
383    storage_key: Option<String>,
384}
385impl UntrackCacheStorageForStorageKeyBuilder {
386    pub fn storage_key(mut self, storage_key: impl Into<String>) -> Self {
387        self.storage_key = Some(storage_key.into());
388        self
389    }
390    pub fn build(self) -> Result<UntrackCacheStorageForStorageKey, String> {
391        Ok(UntrackCacheStorageForStorageKey {
392            method: UntrackCacheStorageForStorageKeyMethod::UntrackCacheStorageForStorageKey,
393            params: UntrackCacheStorageForStorageKeyParams {
394                storage_key: self.storage_key.ok_or_else(|| {
395                    format!("Field `{}` is mandatory.", std::stringify!(storage_key))
396                })?,
397            },
398        })
399    }
400}
401impl UntrackIndexedDbForOrigin {
402    pub fn builder() -> UntrackIndexedDbForOriginBuilder {
403        <UntrackIndexedDbForOriginBuilder as Default>::default()
404    }
405}
406#[derive(Default, Clone)]
407pub struct UntrackIndexedDbForOriginBuilder {
408    origin: Option<String>,
409}
410impl UntrackIndexedDbForOriginBuilder {
411    pub fn origin(mut self, origin: impl Into<String>) -> Self {
412        self.origin = Some(origin.into());
413        self
414    }
415    pub fn build(self) -> Result<UntrackIndexedDbForOrigin, String> {
416        Ok(UntrackIndexedDbForOrigin {
417            method: UntrackIndexedDbForOriginMethod::UntrackIndexedDbForOrigin,
418            params: UntrackIndexedDbForOriginParams {
419                origin: self
420                    .origin
421                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
422            },
423        })
424    }
425}
426impl UntrackIndexedDbForStorageKey {
427    pub fn builder() -> UntrackIndexedDbForStorageKeyBuilder {
428        <UntrackIndexedDbForStorageKeyBuilder as Default>::default()
429    }
430}
431#[derive(Default, Clone)]
432pub struct UntrackIndexedDbForStorageKeyBuilder {
433    storage_key: Option<String>,
434}
435impl UntrackIndexedDbForStorageKeyBuilder {
436    pub fn storage_key(mut self, storage_key: impl Into<String>) -> Self {
437        self.storage_key = Some(storage_key.into());
438        self
439    }
440    pub fn build(self) -> Result<UntrackIndexedDbForStorageKey, String> {
441        Ok(UntrackIndexedDbForStorageKey {
442            method: UntrackIndexedDbForStorageKeyMethod::UntrackIndexedDbForStorageKey,
443            params: UntrackIndexedDbForStorageKeyParams {
444                storage_key: self.storage_key.ok_or_else(|| {
445                    format!("Field `{}` is mandatory.", std::stringify!(storage_key))
446                })?,
447            },
448        })
449    }
450}
451#[derive(Debug, Clone, Default)]
452pub struct GetTrustTokensBuilder;
453impl GetTrustTokensBuilder {
454    pub fn new() -> Self {
455        Self
456    }
457    pub fn build(self) -> GetTrustTokens {
458        GetTrustTokens {
459            method: GetTrustTokensMethod::GetTrustTokens,
460            params: GetTrustTokensParams {},
461        }
462    }
463}
464impl GetTrustTokens {
465    pub fn builder() -> GetTrustTokensBuilder {
466        GetTrustTokensBuilder
467    }
468}
469impl ClearTrustTokens {
470    pub fn builder() -> ClearTrustTokensBuilder {
471        <ClearTrustTokensBuilder as Default>::default()
472    }
473}
474#[derive(Default, Clone)]
475pub struct ClearTrustTokensBuilder {
476    issuer_origin: Option<String>,
477}
478impl ClearTrustTokensBuilder {
479    pub fn issuer_origin(mut self, issuer_origin: impl Into<String>) -> Self {
480        self.issuer_origin = Some(issuer_origin.into());
481        self
482    }
483    pub fn build(self) -> Result<ClearTrustTokens, String> {
484        Ok(ClearTrustTokens {
485            method: ClearTrustTokensMethod::ClearTrustTokens,
486            params: ClearTrustTokensParams {
487                issuer_origin: self.issuer_origin.ok_or_else(|| {
488                    format!("Field `{}` is mandatory.", std::stringify!(issuer_origin))
489                })?,
490            },
491        })
492    }
493}
494impl GetInterestGroupDetails {
495    pub fn builder() -> GetInterestGroupDetailsBuilder {
496        <GetInterestGroupDetailsBuilder as Default>::default()
497    }
498}
499#[derive(Default, Clone)]
500pub struct GetInterestGroupDetailsBuilder {
501    owner_origin: Option<String>,
502    name: Option<String>,
503}
504impl GetInterestGroupDetailsBuilder {
505    pub fn owner_origin(mut self, owner_origin: impl Into<String>) -> Self {
506        self.owner_origin = Some(owner_origin.into());
507        self
508    }
509    pub fn name(mut self, name: impl Into<String>) -> Self {
510        self.name = Some(name.into());
511        self
512    }
513    pub fn build(self) -> Result<GetInterestGroupDetails, String> {
514        Ok(GetInterestGroupDetails {
515            method: GetInterestGroupDetailsMethod::GetInterestGroupDetails,
516            params: GetInterestGroupDetailsParams {
517                owner_origin: self.owner_origin.ok_or_else(|| {
518                    format!("Field `{}` is mandatory.", std::stringify!(owner_origin))
519                })?,
520                name: self
521                    .name
522                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(name)))?,
523            },
524        })
525    }
526}
527impl SetInterestGroupTracking {
528    pub fn builder() -> SetInterestGroupTrackingBuilder {
529        <SetInterestGroupTrackingBuilder as Default>::default()
530    }
531}
532#[derive(Default, Clone)]
533pub struct SetInterestGroupTrackingBuilder {
534    enable: Option<bool>,
535}
536impl SetInterestGroupTrackingBuilder {
537    pub fn enable(mut self, enable: impl Into<bool>) -> Self {
538        self.enable = Some(enable.into());
539        self
540    }
541    pub fn build(self) -> Result<SetInterestGroupTracking, String> {
542        Ok(SetInterestGroupTracking {
543            method: SetInterestGroupTrackingMethod::SetInterestGroupTracking,
544            params: SetInterestGroupTrackingParams {
545                enable: self
546                    .enable
547                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
548            },
549        })
550    }
551}
552impl SetInterestGroupAuctionTracking {
553    pub fn builder() -> SetInterestGroupAuctionTrackingBuilder {
554        <SetInterestGroupAuctionTrackingBuilder as Default>::default()
555    }
556}
557#[derive(Default, Clone)]
558pub struct SetInterestGroupAuctionTrackingBuilder {
559    enable: Option<bool>,
560}
561impl SetInterestGroupAuctionTrackingBuilder {
562    pub fn enable(mut self, enable: impl Into<bool>) -> Self {
563        self.enable = Some(enable.into());
564        self
565    }
566    pub fn build(self) -> Result<SetInterestGroupAuctionTracking, String> {
567        Ok(SetInterestGroupAuctionTracking {
568            method: SetInterestGroupAuctionTrackingMethod::SetInterestGroupAuctionTracking,
569            params: SetInterestGroupAuctionTrackingParams {
570                enable: self
571                    .enable
572                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
573            },
574        })
575    }
576}
577impl GetSharedStorageMetadata {
578    pub fn builder() -> GetSharedStorageMetadataBuilder {
579        <GetSharedStorageMetadataBuilder as Default>::default()
580    }
581}
582#[derive(Default, Clone)]
583pub struct GetSharedStorageMetadataBuilder {
584    owner_origin: Option<String>,
585}
586impl GetSharedStorageMetadataBuilder {
587    pub fn owner_origin(mut self, owner_origin: impl Into<String>) -> Self {
588        self.owner_origin = Some(owner_origin.into());
589        self
590    }
591    pub fn build(self) -> Result<GetSharedStorageMetadata, String> {
592        Ok(GetSharedStorageMetadata {
593            method: GetSharedStorageMetadataMethod::GetSharedStorageMetadata,
594            params: GetSharedStorageMetadataParams {
595                owner_origin: self.owner_origin.ok_or_else(|| {
596                    format!("Field `{}` is mandatory.", std::stringify!(owner_origin))
597                })?,
598            },
599        })
600    }
601}
602impl GetSharedStorageEntries {
603    pub fn builder() -> GetSharedStorageEntriesBuilder {
604        <GetSharedStorageEntriesBuilder as Default>::default()
605    }
606}
607#[derive(Default, Clone)]
608pub struct GetSharedStorageEntriesBuilder {
609    owner_origin: Option<String>,
610}
611impl GetSharedStorageEntriesBuilder {
612    pub fn owner_origin(mut self, owner_origin: impl Into<String>) -> Self {
613        self.owner_origin = Some(owner_origin.into());
614        self
615    }
616    pub fn build(self) -> Result<GetSharedStorageEntries, String> {
617        Ok(GetSharedStorageEntries {
618            method: GetSharedStorageEntriesMethod::GetSharedStorageEntries,
619            params: GetSharedStorageEntriesParams {
620                owner_origin: self.owner_origin.ok_or_else(|| {
621                    format!("Field `{}` is mandatory.", std::stringify!(owner_origin))
622                })?,
623            },
624        })
625    }
626}
627impl SetSharedStorageEntry {
628    pub fn builder() -> SetSharedStorageEntryBuilder {
629        <SetSharedStorageEntryBuilder as Default>::default()
630    }
631}
632#[derive(Default, Clone)]
633pub struct SetSharedStorageEntryBuilder {
634    owner_origin: Option<String>,
635    key: Option<String>,
636    value: Option<String>,
637    ignore_if_present: Option<bool>,
638}
639impl SetSharedStorageEntryBuilder {
640    pub fn owner_origin(mut self, owner_origin: impl Into<String>) -> Self {
641        self.owner_origin = Some(owner_origin.into());
642        self
643    }
644    pub fn key(mut self, key: impl Into<String>) -> Self {
645        self.key = Some(key.into());
646        self
647    }
648    pub fn value(mut self, value: impl Into<String>) -> Self {
649        self.value = Some(value.into());
650        self
651    }
652    pub fn ignore_if_present(mut self, ignore_if_present: impl Into<bool>) -> Self {
653        self.ignore_if_present = Some(ignore_if_present.into());
654        self
655    }
656    pub fn build(self) -> Result<SetSharedStorageEntry, String> {
657        Ok(SetSharedStorageEntry {
658            method: SetSharedStorageEntryMethod::SetSharedStorageEntry,
659            params: SetSharedStorageEntryParams {
660                owner_origin: self.owner_origin.ok_or_else(|| {
661                    format!("Field `{}` is mandatory.", std::stringify!(owner_origin))
662                })?,
663                key: self
664                    .key
665                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(key)))?,
666                value: self
667                    .value
668                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(value)))?,
669                ignore_if_present: self.ignore_if_present,
670            },
671        })
672    }
673}
674impl DeleteSharedStorageEntry {
675    pub fn builder() -> DeleteSharedStorageEntryBuilder {
676        <DeleteSharedStorageEntryBuilder as Default>::default()
677    }
678}
679#[derive(Default, Clone)]
680pub struct DeleteSharedStorageEntryBuilder {
681    owner_origin: Option<String>,
682    key: Option<String>,
683}
684impl DeleteSharedStorageEntryBuilder {
685    pub fn owner_origin(mut self, owner_origin: impl Into<String>) -> Self {
686        self.owner_origin = Some(owner_origin.into());
687        self
688    }
689    pub fn key(mut self, key: impl Into<String>) -> Self {
690        self.key = Some(key.into());
691        self
692    }
693    pub fn build(self) -> Result<DeleteSharedStorageEntry, String> {
694        Ok(DeleteSharedStorageEntry {
695            method: DeleteSharedStorageEntryMethod::DeleteSharedStorageEntry,
696            params: DeleteSharedStorageEntryParams {
697                owner_origin: self.owner_origin.ok_or_else(|| {
698                    format!("Field `{}` is mandatory.", std::stringify!(owner_origin))
699                })?,
700                key: self
701                    .key
702                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(key)))?,
703            },
704        })
705    }
706}
707impl ClearSharedStorageEntries {
708    pub fn builder() -> ClearSharedStorageEntriesBuilder {
709        <ClearSharedStorageEntriesBuilder as Default>::default()
710    }
711}
712#[derive(Default, Clone)]
713pub struct ClearSharedStorageEntriesBuilder {
714    owner_origin: Option<String>,
715}
716impl ClearSharedStorageEntriesBuilder {
717    pub fn owner_origin(mut self, owner_origin: impl Into<String>) -> Self {
718        self.owner_origin = Some(owner_origin.into());
719        self
720    }
721    pub fn build(self) -> Result<ClearSharedStorageEntries, String> {
722        Ok(ClearSharedStorageEntries {
723            method: ClearSharedStorageEntriesMethod::ClearSharedStorageEntries,
724            params: ClearSharedStorageEntriesParams {
725                owner_origin: self.owner_origin.ok_or_else(|| {
726                    format!("Field `{}` is mandatory.", std::stringify!(owner_origin))
727                })?,
728            },
729        })
730    }
731}
732impl ResetSharedStorageBudget {
733    pub fn builder() -> ResetSharedStorageBudgetBuilder {
734        <ResetSharedStorageBudgetBuilder as Default>::default()
735    }
736}
737#[derive(Default, Clone)]
738pub struct ResetSharedStorageBudgetBuilder {
739    owner_origin: Option<String>,
740}
741impl ResetSharedStorageBudgetBuilder {
742    pub fn owner_origin(mut self, owner_origin: impl Into<String>) -> Self {
743        self.owner_origin = Some(owner_origin.into());
744        self
745    }
746    pub fn build(self) -> Result<ResetSharedStorageBudget, String> {
747        Ok(ResetSharedStorageBudget {
748            method: ResetSharedStorageBudgetMethod::ResetSharedStorageBudget,
749            params: ResetSharedStorageBudgetParams {
750                owner_origin: self.owner_origin.ok_or_else(|| {
751                    format!("Field `{}` is mandatory.", std::stringify!(owner_origin))
752                })?,
753            },
754        })
755    }
756}
757impl SetSharedStorageTracking {
758    pub fn builder() -> SetSharedStorageTrackingBuilder {
759        <SetSharedStorageTrackingBuilder as Default>::default()
760    }
761}
762#[derive(Default, Clone)]
763pub struct SetSharedStorageTrackingBuilder {
764    enable: Option<bool>,
765}
766impl SetSharedStorageTrackingBuilder {
767    pub fn enable(mut self, enable: impl Into<bool>) -> Self {
768        self.enable = Some(enable.into());
769        self
770    }
771    pub fn build(self) -> Result<SetSharedStorageTracking, String> {
772        Ok(SetSharedStorageTracking {
773            method: SetSharedStorageTrackingMethod::SetSharedStorageTracking,
774            params: SetSharedStorageTrackingParams {
775                enable: self
776                    .enable
777                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
778            },
779        })
780    }
781}
782impl SetStorageBucketTracking {
783    pub fn builder() -> SetStorageBucketTrackingBuilder {
784        <SetStorageBucketTrackingBuilder as Default>::default()
785    }
786}
787#[derive(Default, Clone)]
788pub struct SetStorageBucketTrackingBuilder {
789    storage_key: Option<String>,
790    enable: Option<bool>,
791}
792impl SetStorageBucketTrackingBuilder {
793    pub fn storage_key(mut self, storage_key: impl Into<String>) -> Self {
794        self.storage_key = Some(storage_key.into());
795        self
796    }
797    pub fn enable(mut self, enable: impl Into<bool>) -> Self {
798        self.enable = Some(enable.into());
799        self
800    }
801    pub fn build(self) -> Result<SetStorageBucketTracking, String> {
802        Ok(SetStorageBucketTracking {
803            method: SetStorageBucketTrackingMethod::SetStorageBucketTracking,
804            params: SetStorageBucketTrackingParams {
805                storage_key: self.storage_key.ok_or_else(|| {
806                    format!("Field `{}` is mandatory.", std::stringify!(storage_key))
807                })?,
808                enable: self
809                    .enable
810                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
811            },
812        })
813    }
814}
815impl DeleteStorageBucket {
816    pub fn builder() -> DeleteStorageBucketBuilder {
817        <DeleteStorageBucketBuilder as Default>::default()
818    }
819}
820#[derive(Default, Clone)]
821pub struct DeleteStorageBucketBuilder {
822    bucket: Option<super::types::StorageBucket>,
823}
824impl DeleteStorageBucketBuilder {
825    pub fn bucket(mut self, bucket: impl Into<super::types::StorageBucket>) -> Self {
826        self.bucket = Some(bucket.into());
827        self
828    }
829    pub fn build(self) -> Result<DeleteStorageBucket, String> {
830        Ok(DeleteStorageBucket {
831            method: DeleteStorageBucketMethod::DeleteStorageBucket,
832            params: DeleteStorageBucketParams {
833                bucket: self
834                    .bucket
835                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(bucket)))?,
836            },
837        })
838    }
839}
840#[derive(Debug, Clone, Default)]
841pub struct RunBounceTrackingMitigationsBuilder;
842impl RunBounceTrackingMitigationsBuilder {
843    pub fn new() -> Self {
844        Self
845    }
846    pub fn build(self) -> RunBounceTrackingMitigations {
847        RunBounceTrackingMitigations {
848            method: RunBounceTrackingMitigationsMethod::RunBounceTrackingMitigations,
849            params: RunBounceTrackingMitigationsParams {},
850        }
851    }
852}
853impl RunBounceTrackingMitigations {
854    pub fn builder() -> RunBounceTrackingMitigationsBuilder {
855        RunBounceTrackingMitigationsBuilder
856    }
857}
858impl SetAttributionReportingLocalTestingMode {
859    pub fn builder() -> SetAttributionReportingLocalTestingModeBuilder {
860        <SetAttributionReportingLocalTestingModeBuilder as Default>::default()
861    }
862}
863#[derive(Default, Clone)]
864pub struct SetAttributionReportingLocalTestingModeBuilder {
865    enabled: Option<bool>,
866}
867impl SetAttributionReportingLocalTestingModeBuilder {
868    pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
869        self.enabled = Some(enabled.into());
870        self
871    }
872    pub fn build(self) -> Result<SetAttributionReportingLocalTestingMode, String> {
873        Ok (SetAttributionReportingLocalTestingMode { method : SetAttributionReportingLocalTestingModeMethod :: SetAttributionReportingLocalTestingMode , params : SetAttributionReportingLocalTestingModeParams { enabled : self . enabled . ok_or_else (|| format ! ("Field `{}` is mandatory." , std :: stringify ! (enabled))) ? , } , })
874    }
875}
876impl SetAttributionReportingTracking {
877    pub fn builder() -> SetAttributionReportingTrackingBuilder {
878        <SetAttributionReportingTrackingBuilder as Default>::default()
879    }
880}
881#[derive(Default, Clone)]
882pub struct SetAttributionReportingTrackingBuilder {
883    enable: Option<bool>,
884}
885impl SetAttributionReportingTrackingBuilder {
886    pub fn enable(mut self, enable: impl Into<bool>) -> Self {
887        self.enable = Some(enable.into());
888        self
889    }
890    pub fn build(self) -> Result<SetAttributionReportingTracking, String> {
891        Ok(SetAttributionReportingTracking {
892            method: SetAttributionReportingTrackingMethod::SetAttributionReportingTracking,
893            params: SetAttributionReportingTrackingParams {
894                enable: self
895                    .enable
896                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
897            },
898        })
899    }
900}
901#[derive(Debug, Clone, Default)]
902pub struct SendPendingAttributionReportsBuilder;
903impl SendPendingAttributionReportsBuilder {
904    pub fn new() -> Self {
905        Self
906    }
907    pub fn build(self) -> SendPendingAttributionReports {
908        SendPendingAttributionReports {
909            method: SendPendingAttributionReportsMethod::SendPendingAttributionReports,
910            params: SendPendingAttributionReportsParams {},
911        }
912    }
913}
914impl SendPendingAttributionReports {
915    pub fn builder() -> SendPendingAttributionReportsBuilder {
916        SendPendingAttributionReportsBuilder
917    }
918}
919#[derive(Debug, Clone, Default)]
920pub struct GetRelatedWebsiteSetsBuilder;
921impl GetRelatedWebsiteSetsBuilder {
922    pub fn new() -> Self {
923        Self
924    }
925    pub fn build(self) -> GetRelatedWebsiteSets {
926        GetRelatedWebsiteSets {
927            method: GetRelatedWebsiteSetsMethod::GetRelatedWebsiteSets,
928            params: GetRelatedWebsiteSetsParams {},
929        }
930    }
931}
932impl GetRelatedWebsiteSets {
933    pub fn builder() -> GetRelatedWebsiteSetsBuilder {
934        GetRelatedWebsiteSetsBuilder
935    }
936}
937impl GetAffectedUrlsForThirdPartyCookieMetadata {
938    pub fn builder() -> GetAffectedUrlsForThirdPartyCookieMetadataBuilder {
939        <GetAffectedUrlsForThirdPartyCookieMetadataBuilder as Default>::default()
940    }
941}
942#[derive(Default, Clone)]
943pub struct GetAffectedUrlsForThirdPartyCookieMetadataBuilder {
944    first_party_url: Option<String>,
945    third_party_urls: Option<Vec<String>>,
946}
947impl GetAffectedUrlsForThirdPartyCookieMetadataBuilder {
948    pub fn first_party_url(mut self, first_party_url: impl Into<String>) -> Self {
949        self.first_party_url = Some(first_party_url.into());
950        self
951    }
952    pub fn third_party_url(mut self, third_party_url: impl Into<String>) -> Self {
953        let v = self.third_party_urls.get_or_insert(Vec::new());
954        v.push(third_party_url.into());
955        self
956    }
957    pub fn third_party_urls<I, S>(mut self, third_party_urls: I) -> Self
958    where
959        I: IntoIterator<Item = S>,
960        S: Into<String>,
961    {
962        let v = self.third_party_urls.get_or_insert(Vec::new());
963        for val in third_party_urls {
964            v.push(val.into());
965        }
966        self
967    }
968    pub fn build(self) -> Result<GetAffectedUrlsForThirdPartyCookieMetadata, String> {
969        Ok (GetAffectedUrlsForThirdPartyCookieMetadata { method : GetAffectedUrlsForThirdPartyCookieMetadataMethod :: GetAffectedUrlsForThirdPartyCookieMetadata , params : GetAffectedUrlsForThirdPartyCookieMetadataParams { first_party_url : self . first_party_url . ok_or_else (|| format ! ("Field `{}` is mandatory." , std :: stringify ! (first_party_url))) ? , third_party_urls : self . third_party_urls . ok_or_else (|| format ! ("Field `{}` is mandatory." , std :: stringify ! (third_party_urls))) ? , } , })
970    }
971}
972impl SetProtectedAudienceKAnonymity {
973    pub fn builder() -> SetProtectedAudienceKAnonymityBuilder {
974        <SetProtectedAudienceKAnonymityBuilder as Default>::default()
975    }
976}
977#[derive(Default, Clone)]
978pub struct SetProtectedAudienceKAnonymityBuilder {
979    owner: Option<String>,
980    name: Option<String>,
981    hashes: Option<Vec<crate::Binary>>,
982}
983impl SetProtectedAudienceKAnonymityBuilder {
984    pub fn owner(mut self, owner: impl Into<String>) -> Self {
985        self.owner = Some(owner.into());
986        self
987    }
988    pub fn name(mut self, name: impl Into<String>) -> Self {
989        self.name = Some(name.into());
990        self
991    }
992    pub fn hashe(mut self, hashe: impl Into<crate::Binary>) -> Self {
993        let v = self.hashes.get_or_insert(Vec::new());
994        v.push(hashe.into());
995        self
996    }
997    pub fn hashes<I, S>(mut self, hashes: I) -> Self
998    where
999        I: IntoIterator<Item = S>,
1000        S: Into<crate::Binary>,
1001    {
1002        let v = self.hashes.get_or_insert(Vec::new());
1003        for val in hashes {
1004            v.push(val.into());
1005        }
1006        self
1007    }
1008    pub fn build(self) -> Result<SetProtectedAudienceKAnonymity, String> {
1009        Ok(SetProtectedAudienceKAnonymity {
1010            method: SetProtectedAudienceKAnonymityMethod::SetProtectedAudienceKAnonymity,
1011            params: SetProtectedAudienceKAnonymityParams {
1012                owner: self
1013                    .owner
1014                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(owner)))?,
1015                name: self
1016                    .name
1017                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(name)))?,
1018                hashes: self
1019                    .hashes
1020                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(hashes)))?,
1021            },
1022        })
1023    }
1024}