Skip to main content

ghl_sdk/services/
ad_manager.rs

1// @generated by xtask/generate_services.py — do not edit by hand.
2//! `ad-manager` — typed methods for all 94 API v2 operations
3//! in this module.
4//!
5//! Access via [`Ghl::ad_manager`](crate::Ghl::ad_manager).
6//!
7//! Request and response types come from [`ghl_models::v2::ad_manager`](https://docs.rs/ghl-models/latest/ghl_models/v2/ad_manager/); every endpoint is also documented in the
8//! [`ad-manager` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/ad-manager.md).
9//!
10//! Enable with `features = ["ad-manager"]`.
11
12#![allow(clippy::too_many_arguments)]
13
14use crate::client::Ghl;
15use crate::error::Result;
16use ghl_models::v2::ad_manager as models;
17
18/// Typed access to the `ad-manager` API v2 surface (94 operations). Obtained via
19/// [`Ghl::ad_manager`](crate::Ghl::ad_manager).
20#[derive(Debug, Clone)]
21pub struct AdManagerService {
22    pub(crate) client: Ghl,
23}
24
25impl AdManagerService {
26    pub(crate) fn new(client: Ghl) -> Self {
27        Self { client }
28    }
29}
30
31/// Query parameters for [`AdManagerService::get_ad_accounts`].
32#[derive(Debug, Clone, Default)]
33pub struct GetAdAccountsParams {
34    /// Location identifier
35    /// Required by the API.
36    pub location_id: String,
37    /// Account source type
38    pub type_: Option<String>,
39    /// Pagination cursor
40    pub next: Option<String>,
41    /// Fetch all accounts
42    pub fetch_all: Option<String>,
43    /// Results page limit
44    pub limit: Option<String>,
45}
46
47impl GetAdAccountsParams {
48    /// Start from the parameters the API requires.
49    pub fn new(location_id: impl Into<String>) -> Self {
50        Self {
51            location_id: location_id.into(),
52            ..Default::default()
53        }
54    }
55
56    /// Account source type
57    pub fn type_(mut self, v: impl Into<String>) -> Self {
58        self.type_ = Some(v.into());
59        self
60    }
61
62    /// Pagination cursor
63    pub fn next(mut self, v: impl Into<String>) -> Self {
64        self.next = Some(v.into());
65        self
66    }
67
68    /// Fetch all accounts
69    pub fn fetch_all(mut self, v: impl Into<String>) -> Self {
70        self.fetch_all = Some(v.into());
71        self
72    }
73
74    /// Results page limit
75    pub fn limit(mut self, v: impl Into<String>) -> Self {
76        self.limit = Some(v.into());
77        self
78    }
79
80    fn to_query(&self) -> Vec<(String, String)> {
81        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
82        if let Some(v) = &self.type_ {
83            q.push(("type".into(), v.to_string()));
84        }
85        if let Some(v) = &self.next {
86            q.push(("next".into(), v.to_string()));
87        }
88        if let Some(v) = &self.fetch_all {
89            q.push(("fetchAll".into(), v.to_string()));
90        }
91        if let Some(v) = &self.limit {
92            q.push(("limit".into(), v.to_string()));
93        }
94        q
95    }
96}
97
98/// Query parameters for [`AdManagerService::get_ad_account_details`].
99#[derive(Debug, Clone, Default)]
100pub struct GetAdAccountDetailsParams {
101    /// Location identifier
102    /// Required by the API.
103    pub location_id: String,
104}
105
106impl GetAdAccountDetailsParams {
107    /// Start from the parameters the API requires.
108    pub fn new(location_id: impl Into<String>) -> Self {
109        Self {
110            location_id: location_id.into(),
111        }
112    }
113
114    fn to_query(&self) -> Vec<(String, String)> {
115        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
116        q
117    }
118}
119
120/// Query parameters for [`AdManagerService::get_campaign_with_linked_entities`].
121#[derive(Debug, Clone, Default)]
122pub struct GetCampaignWithLinkedEntitiesParams {
123    /// Location identifier
124    /// Required by the API.
125    pub location_id: String,
126    /// Comma-separated field names
127    pub fields: Option<String>,
128    /// Campaign data source
129    pub source: Option<String>,
130}
131
132impl GetCampaignWithLinkedEntitiesParams {
133    /// Start from the parameters the API requires.
134    pub fn new(location_id: impl Into<String>) -> Self {
135        Self {
136            location_id: location_id.into(),
137            ..Default::default()
138        }
139    }
140
141    /// Comma-separated field names
142    pub fn fields(mut self, v: impl Into<String>) -> Self {
143        self.fields = Some(v.into());
144        self
145    }
146
147    /// Campaign data source
148    pub fn source(mut self, v: impl Into<String>) -> Self {
149        self.source = Some(v.into());
150        self
151    }
152
153    fn to_query(&self) -> Vec<(String, String)> {
154        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
155        if let Some(v) = &self.fields {
156            q.push(("fields".into(), v.to_string()));
157        }
158        if let Some(v) = &self.source {
159            q.push(("source".into(), v.to_string()));
160        }
161        q
162    }
163}
164
165/// Query parameters for [`AdManagerService::get_conversation_forms`].
166#[derive(Debug, Clone, Default)]
167pub struct GetConversationFormsParams {
168    /// Location identifier
169    /// Required by the API.
170    pub location_id: String,
171}
172
173impl GetConversationFormsParams {
174    /// Start from the parameters the API requires.
175    pub fn new(location_id: impl Into<String>) -> Self {
176        Self {
177            location_id: location_id.into(),
178        }
179    }
180
181    fn to_query(&self) -> Vec<(String, String)> {
182        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
183        q
184    }
185}
186
187/// Query parameters for [`AdManagerService::get_custom_audiences`].
188#[derive(Debug, Clone, Default)]
189pub struct GetCustomAudiencesParams {
190    /// Location identifier
191    /// Required by the API.
192    pub location_id: String,
193    /// Audience list type
194    /// Allowed values: `lookalike`, `custom`, `all`.
195    /// Required by the API.
196    pub type_: String,
197    /// Audience data source
198    /// Allowed values: `ad_manager`, `integration`.
199    pub source: Option<String>,
200    /// Ad account identifier
201    /// Required by the API.
202    pub ad_account_id: String,
203}
204
205impl GetCustomAudiencesParams {
206    /// Start from the parameters the API requires.
207    pub fn new(
208        location_id: impl Into<String>,
209        type_: impl Into<String>,
210        ad_account_id: impl Into<String>,
211    ) -> Self {
212        Self {
213            location_id: location_id.into(),
214            type_: type_.into(),
215            ad_account_id: ad_account_id.into(),
216            ..Default::default()
217        }
218    }
219
220    /// Audience data source
221    pub fn source(mut self, v: impl Into<String>) -> Self {
222        self.source = Some(v.into());
223        self
224    }
225
226    fn to_query(&self) -> Vec<(String, String)> {
227        let mut q: Vec<(String, String)> = vec![
228            ("locationId".into(), self.location_id.clone()),
229            ("type".into(), self.type_.clone()),
230            ("adAccountId".into(), self.ad_account_id.clone()),
231        ];
232        if let Some(v) = &self.source {
233            q.push(("source".into(), v.to_string()));
234        }
235        q
236    }
237}
238
239/// Query parameters for [`AdManagerService::delete_custom_audience`].
240#[derive(Debug, Clone, Default)]
241pub struct DeleteCustomAudienceParams {
242    /// Location identifier
243    /// Required by the API.
244    pub location_id: String,
245}
246
247impl DeleteCustomAudienceParams {
248    /// Start from the parameters the API requires.
249    pub fn new(location_id: impl Into<String>) -> Self {
250        Self {
251            location_id: location_id.into(),
252        }
253    }
254
255    fn to_query(&self) -> Vec<(String, String)> {
256        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
257        q
258    }
259}
260
261/// Query parameters for [`AdManagerService::get_custom_audience_by_id`].
262#[derive(Debug, Clone, Default)]
263pub struct GetCustomAudienceByIdParams {
264    /// Location identifier
265    /// Required by the API.
266    pub location_id: String,
267}
268
269impl GetCustomAudienceByIdParams {
270    /// Start from the parameters the API requires.
271    pub fn new(location_id: impl Into<String>) -> Self {
272        Self {
273            location_id: location_id.into(),
274        }
275    }
276
277    fn to_query(&self) -> Vec<(String, String)> {
278        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
279        q
280    }
281}
282
283/// Query parameters for [`AdManagerService::get_entities`].
284#[derive(Debug, Clone, Default)]
285pub struct GetEntitiesParams {
286    /// Location identifier
287    /// Required by the API.
288    pub location_id: String,
289    /// Integration source type
290    /// Allowed values: `AD_MANAGER`, `INTEGRATION`.
291    /// Required by the API.
292    pub type_: String,
293    /// Pagination cursor
294    pub next: Option<String>,
295    /// Fetch all entities
296    pub fetch_all: Option<String>,
297    /// Campaign identifier
298    pub campaign_id: Option<String>,
299    /// Ad set identifier
300    pub ad_set_id: Option<String>,
301    /// Entity type to fetch
302    /// Allowed values: `CAMPAIGN`, `ADSET`, `AD`.
303    /// Required by the API.
304    pub entity_type: String,
305    /// Search identifier
306    pub search_id: Option<String>,
307    /// Selected ad account ID
308    pub selected_ad_account_id: Option<String>,
309}
310
311impl GetEntitiesParams {
312    /// Start from the parameters the API requires.
313    pub fn new(
314        location_id: impl Into<String>,
315        type_: impl Into<String>,
316        entity_type: impl Into<String>,
317    ) -> Self {
318        Self {
319            location_id: location_id.into(),
320            type_: type_.into(),
321            entity_type: entity_type.into(),
322            ..Default::default()
323        }
324    }
325
326    /// Pagination cursor
327    pub fn next(mut self, v: impl Into<String>) -> Self {
328        self.next = Some(v.into());
329        self
330    }
331
332    /// Fetch all entities
333    pub fn fetch_all(mut self, v: impl Into<String>) -> Self {
334        self.fetch_all = Some(v.into());
335        self
336    }
337
338    /// Campaign identifier
339    pub fn campaign_id(mut self, v: impl Into<String>) -> Self {
340        self.campaign_id = Some(v.into());
341        self
342    }
343
344    /// Ad set identifier
345    pub fn ad_set_id(mut self, v: impl Into<String>) -> Self {
346        self.ad_set_id = Some(v.into());
347        self
348    }
349
350    /// Search identifier
351    pub fn search_id(mut self, v: impl Into<String>) -> Self {
352        self.search_id = Some(v.into());
353        self
354    }
355
356    /// Selected ad account ID
357    pub fn selected_ad_account_id(mut self, v: impl Into<String>) -> Self {
358        self.selected_ad_account_id = Some(v.into());
359        self
360    }
361
362    fn to_query(&self) -> Vec<(String, String)> {
363        let mut q: Vec<(String, String)> = vec![
364            ("locationId".into(), self.location_id.clone()),
365            ("type".into(), self.type_.clone()),
366            ("entityType".into(), self.entity_type.clone()),
367        ];
368        if let Some(v) = &self.next {
369            q.push(("next".into(), v.to_string()));
370        }
371        if let Some(v) = &self.fetch_all {
372            q.push(("fetchAll".into(), v.to_string()));
373        }
374        if let Some(v) = &self.campaign_id {
375            q.push(("campaignId".into(), v.to_string()));
376        }
377        if let Some(v) = &self.ad_set_id {
378            q.push(("adSetId".into(), v.to_string()));
379        }
380        if let Some(v) = &self.search_id {
381            q.push(("searchId".into(), v.to_string()));
382        }
383        if let Some(v) = &self.selected_ad_account_id {
384            q.push(("selectedAdAccountId".into(), v.to_string()));
385        }
386        q
387    }
388}
389
390/// Query parameters for [`AdManagerService::get_facebook_integration`].
391#[derive(Debug, Clone, Default)]
392pub struct GetFacebookIntegrationParams {
393    /// Location identifier
394    /// Required by the API.
395    pub location_id: String,
396}
397
398impl GetFacebookIntegrationParams {
399    /// Start from the parameters the API requires.
400    pub fn new(location_id: impl Into<String>) -> Self {
401        Self {
402            location_id: location_id.into(),
403        }
404    }
405
406    fn to_query(&self) -> Vec<(String, String)> {
407        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
408        q
409    }
410}
411
412/// Query parameters for [`AdManagerService::get_lead_form_by_id`].
413#[derive(Debug, Clone, Default)]
414pub struct GetLeadFormByIdParams {
415    /// Location identifier
416    /// Required by the API.
417    pub location_id: String,
418}
419
420impl GetLeadFormByIdParams {
421    /// Start from the parameters the API requires.
422    pub fn new(location_id: impl Into<String>) -> Self {
423        Self {
424            location_id: location_id.into(),
425        }
426    }
427
428    fn to_query(&self) -> Vec<(String, String)> {
429        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
430        q
431    }
432}
433
434/// Query parameters for [`AdManagerService::get_current_facebook_user`].
435#[derive(Debug, Clone, Default)]
436pub struct GetCurrentFacebookUserParams {
437    /// Location identifier
438    /// Required by the API.
439    pub location_id: String,
440}
441
442impl GetCurrentFacebookUserParams {
443    /// Start from the parameters the API requires.
444    pub fn new(location_id: impl Into<String>) -> Self {
445        Self {
446            location_id: location_id.into(),
447        }
448    }
449
450    fn to_query(&self) -> Vec<(String, String)> {
451        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
452        q
453    }
454}
455
456/// Query parameters for [`AdManagerService::delete_page_connection`].
457#[derive(Debug, Clone, Default)]
458pub struct DeletePageConnectionParams {
459    /// Location identifier
460    /// Required by the API.
461    pub location_id: String,
462    /// Facebook page ID
463    /// Required by the API.
464    pub page_id: String,
465}
466
467impl DeletePageConnectionParams {
468    /// Start from the parameters the API requires.
469    pub fn new(location_id: impl Into<String>, page_id: impl Into<String>) -> Self {
470        Self {
471            location_id: location_id.into(),
472            page_id: page_id.into(),
473        }
474    }
475
476    fn to_query(&self) -> Vec<(String, String)> {
477        let q: Vec<(String, String)> = vec![
478            ("locationId".into(), self.location_id.clone()),
479            ("pageId".into(), self.page_id.clone()),
480        ];
481        q
482    }
483}
484
485/// Query parameters for [`AdManagerService::set_default_page`].
486#[derive(Debug, Clone, Default)]
487pub struct SetDefaultPageParams {
488    /// Location identifier
489    /// Required by the API.
490    pub location_id: String,
491}
492
493impl SetDefaultPageParams {
494    /// Start from the parameters the API requires.
495    pub fn new(location_id: impl Into<String>) -> Self {
496        Self {
497            location_id: location_id.into(),
498        }
499    }
500
501    fn to_query(&self) -> Vec<(String, String)> {
502        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
503        q
504    }
505}
506
507/// Query parameters for [`AdManagerService::get_page_lead_forms`].
508#[derive(Debug, Clone, Default)]
509pub struct GetPageLeadFormsParams {
510    /// Location identifier
511    /// Required by the API.
512    pub location_id: String,
513}
514
515impl GetPageLeadFormsParams {
516    /// Start from the parameters the API requires.
517    pub fn new(location_id: impl Into<String>) -> Self {
518        Self {
519            location_id: location_id.into(),
520        }
521    }
522
523    fn to_query(&self) -> Vec<(String, String)> {
524        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
525        q
526    }
527}
528
529/// Query parameters for [`AdManagerService::get_instagram_accounts_for_page`].
530#[derive(Debug, Clone, Default)]
531pub struct GetInstagramAccountsForPageParams {
532    /// Location identifier
533    /// Required by the API.
534    pub location_id: String,
535    /// Integration type
536    /// Allowed values: `INTEGRATION`, `AD_MANAGER`.
537    pub type_: Option<String>,
538}
539
540impl GetInstagramAccountsForPageParams {
541    /// Start from the parameters the API requires.
542    pub fn new(location_id: impl Into<String>) -> Self {
543        Self {
544            location_id: location_id.into(),
545            ..Default::default()
546        }
547    }
548
549    /// Integration type
550    pub fn type_(mut self, v: impl Into<String>) -> Self {
551        self.type_ = Some(v.into());
552        self
553    }
554
555    fn to_query(&self) -> Vec<(String, String)> {
556        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
557        if let Some(v) = &self.type_ {
558            q.push(("type".into(), v.to_string()));
559        }
560        q
561    }
562}
563
564/// Query parameters for [`AdManagerService::get_facebook_pages`].
565#[derive(Debug, Clone, Default)]
566pub struct GetFacebookPagesParams {
567    /// Location identifier
568    /// Required by the API.
569    pub location_id: String,
570    /// Fetch existing pages flag
571    pub fetch_existing: Option<String>,
572}
573
574impl GetFacebookPagesParams {
575    /// Start from the parameters the API requires.
576    pub fn new(location_id: impl Into<String>) -> Self {
577        Self {
578            location_id: location_id.into(),
579            ..Default::default()
580        }
581    }
582
583    /// Fetch existing pages flag
584    pub fn fetch_existing(mut self, v: impl Into<String>) -> Self {
585        self.fetch_existing = Some(v.into());
586        self
587    }
588
589    fn to_query(&self) -> Vec<(String, String)> {
590        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
591        if let Some(v) = &self.fetch_existing {
592            q.push(("fetchExisting".into(), v.to_string()));
593        }
594        q
595    }
596}
597
598/// Query parameters for [`AdManagerService::get_conversion_pixels`].
599#[derive(Debug, Clone, Default)]
600pub struct GetConversionPixelsParams {
601    /// Location identifier
602    /// Required by the API.
603    pub location_id: String,
604    /// Channel type
605    pub channel: Option<String>,
606    /// Facebook page ID
607    pub page_id: Option<String>,
608    /// Instagram user ID
609    pub ig_user_id: Option<String>,
610}
611
612impl GetConversionPixelsParams {
613    /// Start from the parameters the API requires.
614    pub fn new(location_id: impl Into<String>) -> Self {
615        Self {
616            location_id: location_id.into(),
617            ..Default::default()
618        }
619    }
620
621    /// Channel type
622    pub fn channel(mut self, v: impl Into<String>) -> Self {
623        self.channel = Some(v.into());
624        self
625    }
626
627    /// Facebook page ID
628    pub fn page_id(mut self, v: impl Into<String>) -> Self {
629        self.page_id = Some(v.into());
630        self
631    }
632
633    /// Instagram user ID
634    pub fn ig_user_id(mut self, v: impl Into<String>) -> Self {
635        self.ig_user_id = Some(v.into());
636        self
637    }
638
639    fn to_query(&self) -> Vec<(String, String)> {
640        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
641        if let Some(v) = &self.channel {
642            q.push(("channel".into(), v.to_string()));
643        }
644        if let Some(v) = &self.page_id {
645            q.push(("pageId".into(), v.to_string()));
646        }
647        if let Some(v) = &self.ig_user_id {
648            q.push(("igUserId".into(), v.to_string()));
649        }
650        q
651    }
652}
653
654/// Query parameters for [`AdManagerService::get_reporting_data`].
655#[derive(Debug, Clone, Default)]
656pub struct GetReportingDataParams {
657    /// Location identifier
658    /// Required by the API.
659    pub location_id: String,
660    /// Time grouping interval
661    /// Allowed values: `day`, `week`, `month`.
662    /// Required by the API.
663    pub group_by: String,
664    /// Report start date
665    /// Required by the API.
666    pub start_date: String,
667    /// Report end date
668    /// Required by the API.
669    pub end_date: String,
670    /// Integration source type
671    /// Allowed values: `AD_MANAGER`, `INTEGRATION`.
672    /// Required by the API.
673    pub type_: String,
674    /// Comma-separated reporting fields
675    /// Required by the API.
676    pub fields: String,
677}
678
679impl GetReportingDataParams {
680    /// Start from the parameters the API requires.
681    pub fn new(
682        location_id: impl Into<String>,
683        group_by: impl Into<String>,
684        start_date: impl Into<String>,
685        end_date: impl Into<String>,
686        type_: impl Into<String>,
687        fields: impl Into<String>,
688    ) -> Self {
689        Self {
690            location_id: location_id.into(),
691            group_by: group_by.into(),
692            start_date: start_date.into(),
693            end_date: end_date.into(),
694            type_: type_.into(),
695            fields: fields.into(),
696        }
697    }
698
699    fn to_query(&self) -> Vec<(String, String)> {
700        let q: Vec<(String, String)> = vec![
701            ("locationId".into(), self.location_id.clone()),
702            ("groupBy".into(), self.group_by.clone()),
703            ("startDate".into(), self.start_date.clone()),
704            ("endDate".into(), self.end_date.clone()),
705            ("type".into(), self.type_.clone()),
706            ("fields".into(), self.fields.clone()),
707        ];
708        q
709    }
710}
711
712/// Query parameters for [`AdManagerService::get_campaign_reporting`].
713#[derive(Debug, Clone, Default)]
714pub struct GetCampaignReportingParams {
715    /// Location identifier
716    /// Required by the API.
717    pub location_id: String,
718    /// Report start date
719    /// Required by the API.
720    pub start_date: String,
721    /// Report end date
722    /// Required by the API.
723    pub end_date: String,
724}
725
726impl GetCampaignReportingParams {
727    /// Start from the parameters the API requires.
728    pub fn new(
729        location_id: impl Into<String>,
730        start_date: impl Into<String>,
731        end_date: impl Into<String>,
732    ) -> Self {
733        Self {
734            location_id: location_id.into(),
735            start_date: start_date.into(),
736            end_date: end_date.into(),
737        }
738    }
739
740    fn to_query(&self) -> Vec<(String, String)> {
741        let q: Vec<(String, String)> = vec![
742            ("locationId".into(), self.location_id.clone()),
743            ("startDate".into(), self.start_date.clone()),
744            ("endDate".into(), self.end_date.clone()),
745        ];
746        q
747    }
748}
749
750/// Query parameters for [`AdManagerService::get_reporting_list`].
751#[derive(Debug, Clone, Default)]
752pub struct GetReportingListParams {
753    /// Location identifier
754    /// Required by the API.
755    pub location_id: String,
756    /// Reporting list type
757    /// Required by the API.
758    pub list_type: String,
759    /// Report start date
760    /// Required by the API.
761    pub start_date: String,
762    /// Report end date
763    /// Required by the API.
764    pub end_date: String,
765    /// Campaign identifier
766    /// Required by the API.
767    pub campaign_id: String,
768    /// Integration source type
769    /// Allowed values: `AD_MANAGER`, `INTEGRATION`.
770    /// Required by the API.
771    pub type_: String,
772}
773
774impl GetReportingListParams {
775    /// Start from the parameters the API requires.
776    pub fn new(
777        location_id: impl Into<String>,
778        list_type: impl Into<String>,
779        start_date: impl Into<String>,
780        end_date: impl Into<String>,
781        campaign_id: impl Into<String>,
782        type_: impl Into<String>,
783    ) -> Self {
784        Self {
785            location_id: location_id.into(),
786            list_type: list_type.into(),
787            start_date: start_date.into(),
788            end_date: end_date.into(),
789            campaign_id: campaign_id.into(),
790            type_: type_.into(),
791        }
792    }
793
794    fn to_query(&self) -> Vec<(String, String)> {
795        let q: Vec<(String, String)> = vec![
796            ("locationId".into(), self.location_id.clone()),
797            ("listType".into(), self.list_type.clone()),
798            ("startDate".into(), self.start_date.clone()),
799            ("endDate".into(), self.end_date.clone()),
800            ("campaignId".into(), self.campaign_id.clone()),
801            ("type".into(), self.type_.clone()),
802        ];
803        q
804    }
805}
806
807/// Query parameters for [`AdManagerService::search_targeting_options`].
808#[derive(Debug, Clone, Default)]
809pub struct SearchTargetingOptionsParams {
810    /// Targeting search type
811    /// Required by the API.
812    pub type_: String,
813    /// Search query string
814    /// Required by the API.
815    pub query: String,
816    /// Specific search subtype
817    pub search_type: Option<String>,
818}
819
820impl SearchTargetingOptionsParams {
821    /// Start from the parameters the API requires.
822    pub fn new(type_: impl Into<String>, query: impl Into<String>) -> Self {
823        Self {
824            type_: type_.into(),
825            query: query.into(),
826            ..Default::default()
827        }
828    }
829
830    /// Specific search subtype
831    pub fn search_type(mut self, v: impl Into<String>) -> Self {
832        self.search_type = Some(v.into());
833        self
834    }
835
836    fn to_query(&self) -> Vec<(String, String)> {
837        let mut q: Vec<(String, String)> = vec![
838            ("type".into(), self.type_.clone()),
839            ("query".into(), self.query.clone()),
840        ];
841        if let Some(v) = &self.search_type {
842            q.push(("searchType".into(), v.to_string()));
843        }
844        q
845    }
846}
847
848/// Query parameters for [`AdManagerService::get_google_ad_accounts`].
849#[derive(Debug, Clone, Default)]
850pub struct GetGoogleAdAccountsParams {
851    /// Location identifier
852    /// Required by the API.
853    pub location_id: String,
854    /// Account type
855    /// Allowed values: `INTEGRATION`, `AD_MANAGER`.
856    pub type_: Option<String>,
857}
858
859impl GetGoogleAdAccountsParams {
860    /// Start from the parameters the API requires.
861    pub fn new(location_id: impl Into<String>) -> Self {
862        Self {
863            location_id: location_id.into(),
864            ..Default::default()
865        }
866    }
867
868    /// Account type
869    pub fn type_(mut self, v: impl Into<String>) -> Self {
870        self.type_ = Some(v.into());
871        self
872    }
873
874    fn to_query(&self) -> Vec<(String, String)> {
875        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
876        if let Some(v) = &self.type_ {
877            q.push(("type".into(), v.to_string()));
878        }
879        q
880    }
881}
882
883/// Query parameters for [`AdManagerService::get_ad_account_details_op`].
884#[derive(Debug, Clone, Default)]
885pub struct GetAdAccountDetailsOpParams {
886    /// Location identifier
887    /// Required by the API.
888    pub location_id: String,
889}
890
891impl GetAdAccountDetailsOpParams {
892    /// Start from the parameters the API requires.
893    pub fn new(location_id: impl Into<String>) -> Self {
894        Self {
895            location_id: location_id.into(),
896        }
897    }
898
899    fn to_query(&self) -> Vec<(String, String)> {
900        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
901        q
902    }
903}
904
905/// Query parameters for [`AdManagerService::get_google_campaign_by_id`].
906#[derive(Debug, Clone, Default)]
907pub struct GetGoogleCampaignByIdParams {
908    /// Location identifier
909    /// Required by the API.
910    pub location_id: String,
911}
912
913impl GetGoogleCampaignByIdParams {
914    /// Start from the parameters the API requires.
915    pub fn new(location_id: impl Into<String>) -> Self {
916        Self {
917            location_id: location_id.into(),
918        }
919    }
920
921    fn to_query(&self) -> Vec<(String, String)> {
922        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
923        q
924    }
925}
926
927/// Query parameters for [`AdManagerService::get_assets`].
928#[derive(Debug, Clone, Default)]
929pub struct GetAssetsParams {
930    /// Location identifier
931    /// Required by the API.
932    pub location_id: String,
933    /// Asset type to retrieve
934    /// Allowed values: `CALL`, `SITELINK`, `LEAD_FORM`, `IMAGE`, `TEXT`.
935    /// Required by the API.
936    pub type_: String,
937    /// Asset identifier
938    pub id: Option<String>,
939    /// Advertiser only flag
940    pub advertiser_only: Option<String>,
941}
942
943impl GetAssetsParams {
944    /// Start from the parameters the API requires.
945    pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
946        Self {
947            location_id: location_id.into(),
948            type_: type_.into(),
949            ..Default::default()
950        }
951    }
952
953    /// Asset identifier
954    pub fn id(mut self, v: impl Into<String>) -> Self {
955        self.id = Some(v.into());
956        self
957    }
958
959    /// Advertiser only flag
960    pub fn advertiser_only(mut self, v: impl Into<String>) -> Self {
961        self.advertiser_only = Some(v.into());
962        self
963    }
964
965    fn to_query(&self) -> Vec<(String, String)> {
966        let mut q: Vec<(String, String)> = vec![
967            ("locationId".into(), self.location_id.clone()),
968            ("type".into(), self.type_.clone()),
969        ];
970        if let Some(v) = &self.id {
971            q.push(("id".into(), v.to_string()));
972        }
973        if let Some(v) = &self.advertiser_only {
974            q.push(("advertiserOnly".into(), v.to_string()));
975        }
976        q
977    }
978}
979
980/// Query parameters for [`AdManagerService::get_audiences`].
981#[derive(Debug, Clone, Default)]
982pub struct GetAudiencesParams {
983    /// Location identifier
984    /// Required by the API.
985    pub location_id: String,
986}
987
988impl GetAudiencesParams {
989    /// Start from the parameters the API requires.
990    pub fn new(location_id: impl Into<String>) -> Self {
991        Self {
992            location_id: location_id.into(),
993        }
994    }
995
996    fn to_query(&self) -> Vec<(String, String)> {
997        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
998        q
999    }
1000}
1001
1002/// Query parameters for [`AdManagerService::get_audience_by_id`].
1003#[derive(Debug, Clone, Default)]
1004pub struct GetAudienceByIdParams {
1005    /// Location identifier
1006    /// Required by the API.
1007    pub location_id: String,
1008}
1009
1010impl GetAudienceByIdParams {
1011    /// Start from the parameters the API requires.
1012    pub fn new(location_id: impl Into<String>) -> Self {
1013        Self {
1014            location_id: location_id.into(),
1015        }
1016    }
1017
1018    fn to_query(&self) -> Vec<(String, String)> {
1019        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1020        q
1021    }
1022}
1023
1024/// Query parameters for [`AdManagerService::get_conversion_goals`].
1025#[derive(Debug, Clone, Default)]
1026pub struct GetConversionGoalsParams {
1027    /// Location identifier
1028    /// Required by the API.
1029    pub location_id: String,
1030}
1031
1032impl GetConversionGoalsParams {
1033    /// Start from the parameters the API requires.
1034    pub fn new(location_id: impl Into<String>) -> Self {
1035        Self {
1036            location_id: location_id.into(),
1037        }
1038    }
1039
1040    fn to_query(&self) -> Vec<(String, String)> {
1041        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1042        q
1043    }
1044}
1045
1046/// Query parameters for [`AdManagerService::get_conversions`].
1047#[derive(Debug, Clone, Default)]
1048pub struct GetConversionsParams {
1049    /// Location identifier
1050    /// Required by the API.
1051    pub location_id: String,
1052    /// Integration type
1053    /// Allowed values: `AD_MANAGER`, `AD_WORDS`.
1054    pub type_: Option<String>,
1055    /// Conversion type
1056    pub conversion_type: Option<String>,
1057    /// Conversion category
1058    pub category: Option<String>,
1059    /// Filter start date
1060    pub start_date: Option<String>,
1061    /// Filter end date
1062    pub end_date: Option<String>,
1063}
1064
1065impl GetConversionsParams {
1066    /// Start from the parameters the API requires.
1067    pub fn new(location_id: impl Into<String>) -> Self {
1068        Self {
1069            location_id: location_id.into(),
1070            ..Default::default()
1071        }
1072    }
1073
1074    /// Integration type
1075    pub fn type_(mut self, v: impl Into<String>) -> Self {
1076        self.type_ = Some(v.into());
1077        self
1078    }
1079
1080    /// Conversion type
1081    pub fn conversion_type(mut self, v: impl Into<String>) -> Self {
1082        self.conversion_type = Some(v.into());
1083        self
1084    }
1085
1086    /// Conversion category
1087    pub fn category(mut self, v: impl Into<String>) -> Self {
1088        self.category = Some(v.into());
1089        self
1090    }
1091
1092    /// Filter start date
1093    pub fn start_date(mut self, v: impl Into<String>) -> Self {
1094        self.start_date = Some(v.into());
1095        self
1096    }
1097
1098    /// Filter end date
1099    pub fn end_date(mut self, v: impl Into<String>) -> Self {
1100        self.end_date = Some(v.into());
1101        self
1102    }
1103
1104    fn to_query(&self) -> Vec<(String, String)> {
1105        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1106        if let Some(v) = &self.type_ {
1107            q.push(("type".into(), v.to_string()));
1108        }
1109        if let Some(v) = &self.conversion_type {
1110            q.push(("conversionType".into(), v.to_string()));
1111        }
1112        if let Some(v) = &self.category {
1113            q.push(("category".into(), v.to_string()));
1114        }
1115        if let Some(v) = &self.start_date {
1116            q.push(("startDate".into(), v.to_string()));
1117        }
1118        if let Some(v) = &self.end_date {
1119            q.push(("endDate".into(), v.to_string()));
1120        }
1121        q
1122    }
1123}
1124
1125/// Query parameters for [`AdManagerService::delete_conversion`].
1126#[derive(Debug, Clone, Default)]
1127pub struct DeleteConversionParams {
1128    /// Location identifier
1129    /// Required by the API.
1130    pub location_id: String,
1131}
1132
1133impl DeleteConversionParams {
1134    /// Start from the parameters the API requires.
1135    pub fn new(location_id: impl Into<String>) -> Self {
1136        Self {
1137            location_id: location_id.into(),
1138        }
1139    }
1140
1141    fn to_query(&self) -> Vec<(String, String)> {
1142        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1143        q
1144    }
1145}
1146
1147/// Query parameters for [`AdManagerService::get_conversion_by_id`].
1148#[derive(Debug, Clone, Default)]
1149pub struct GetConversionByIdParams {
1150    /// Location identifier
1151    /// Required by the API.
1152    pub location_id: String,
1153}
1154
1155impl GetConversionByIdParams {
1156    /// Start from the parameters the API requires.
1157    pub fn new(location_id: impl Into<String>) -> Self {
1158        Self {
1159            location_id: location_id.into(),
1160        }
1161    }
1162
1163    fn to_query(&self) -> Vec<(String, String)> {
1164        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1165        q
1166    }
1167}
1168
1169/// Query parameters for [`AdManagerService::get_entities_op`].
1170#[derive(Debug, Clone, Default)]
1171pub struct GetEntitiesOpParams {
1172    /// Location identifier
1173    /// Required by the API.
1174    pub location_id: String,
1175    /// Integration type
1176    /// Allowed values: `AD_MANAGER`, `INTEGRATION`.
1177    /// Required by the API.
1178    pub type_: String,
1179    /// Campaign identifier
1180    pub campaign_id: Option<String>,
1181    /// Ad group identifier
1182    pub ad_group_id: Option<String>,
1183    /// Entity type
1184    /// Allowed values: `CAMPAIGN`, `ADGROUP`, `AD`.
1185    /// Required by the API.
1186    pub entity_type: String,
1187    /// Search identifier
1188    pub search_id: Option<String>,
1189    /// Filter start date
1190    pub start_date: Option<String>,
1191    /// Filter end date
1192    pub end_date: Option<String>,
1193    /// Selected ad account ID
1194    pub selected_ad_account_id: Option<String>,
1195}
1196
1197impl GetEntitiesOpParams {
1198    /// Start from the parameters the API requires.
1199    pub fn new(
1200        location_id: impl Into<String>,
1201        type_: impl Into<String>,
1202        entity_type: impl Into<String>,
1203    ) -> Self {
1204        Self {
1205            location_id: location_id.into(),
1206            type_: type_.into(),
1207            entity_type: entity_type.into(),
1208            ..Default::default()
1209        }
1210    }
1211
1212    /// Campaign identifier
1213    pub fn campaign_id(mut self, v: impl Into<String>) -> Self {
1214        self.campaign_id = Some(v.into());
1215        self
1216    }
1217
1218    /// Ad group identifier
1219    pub fn ad_group_id(mut self, v: impl Into<String>) -> Self {
1220        self.ad_group_id = Some(v.into());
1221        self
1222    }
1223
1224    /// Search identifier
1225    pub fn search_id(mut self, v: impl Into<String>) -> Self {
1226        self.search_id = Some(v.into());
1227        self
1228    }
1229
1230    /// Filter start date
1231    pub fn start_date(mut self, v: impl Into<String>) -> Self {
1232        self.start_date = Some(v.into());
1233        self
1234    }
1235
1236    /// Filter end date
1237    pub fn end_date(mut self, v: impl Into<String>) -> Self {
1238        self.end_date = Some(v.into());
1239        self
1240    }
1241
1242    /// Selected ad account ID
1243    pub fn selected_ad_account_id(mut self, v: impl Into<String>) -> Self {
1244        self.selected_ad_account_id = Some(v.into());
1245        self
1246    }
1247
1248    fn to_query(&self) -> Vec<(String, String)> {
1249        let mut q: Vec<(String, String)> = vec![
1250            ("locationId".into(), self.location_id.clone()),
1251            ("type".into(), self.type_.clone()),
1252            ("entityType".into(), self.entity_type.clone()),
1253        ];
1254        if let Some(v) = &self.campaign_id {
1255            q.push(("campaignId".into(), v.to_string()));
1256        }
1257        if let Some(v) = &self.ad_group_id {
1258            q.push(("adGroupId".into(), v.to_string()));
1259        }
1260        if let Some(v) = &self.search_id {
1261            q.push(("searchId".into(), v.to_string()));
1262        }
1263        if let Some(v) = &self.start_date {
1264            q.push(("startDate".into(), v.to_string()));
1265        }
1266        if let Some(v) = &self.end_date {
1267            q.push(("endDate".into(), v.to_string()));
1268        }
1269        if let Some(v) = &self.selected_ad_account_id {
1270            q.push(("selectedAdAccountId".into(), v.to_string()));
1271        }
1272        q
1273    }
1274}
1275
1276/// Query parameters for [`AdManagerService::get_google_integration`].
1277#[derive(Debug, Clone, Default)]
1278pub struct GetGoogleIntegrationParams {
1279    /// Location identifier
1280    /// Required by the API.
1281    pub location_id: String,
1282}
1283
1284impl GetGoogleIntegrationParams {
1285    /// Start from the parameters the API requires.
1286    pub fn new(location_id: impl Into<String>) -> Self {
1287        Self {
1288            location_id: location_id.into(),
1289        }
1290    }
1291
1292    fn to_query(&self) -> Vec<(String, String)> {
1293        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1294        q
1295    }
1296}
1297
1298/// Query parameters for [`AdManagerService::get_keyword_ideas`].
1299#[derive(Debug, Clone, Default)]
1300pub struct GetKeywordIdeasParams {
1301    /// Location identifier
1302    /// Required by the API.
1303    pub location_id: String,
1304}
1305
1306impl GetKeywordIdeasParams {
1307    /// Start from the parameters the API requires.
1308    pub fn new(location_id: impl Into<String>) -> Self {
1309        Self {
1310            location_id: location_id.into(),
1311        }
1312    }
1313
1314    fn to_query(&self) -> Vec<(String, String)> {
1315        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1316        q
1317    }
1318}
1319
1320/// Query parameters for [`AdManagerService::get_current_google_user`].
1321#[derive(Debug, Clone, Default)]
1322pub struct GetCurrentGoogleUserParams {
1323    /// Location identifier
1324    /// Required by the API.
1325    pub location_id: String,
1326}
1327
1328impl GetCurrentGoogleUserParams {
1329    /// Start from the parameters the API requires.
1330    pub fn new(location_id: impl Into<String>) -> Self {
1331        Self {
1332            location_id: location_id.into(),
1333        }
1334    }
1335
1336    fn to_query(&self) -> Vec<(String, String)> {
1337        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1338        q
1339    }
1340}
1341
1342/// Query parameters for [`AdManagerService::get_reporting_data_op`].
1343#[derive(Debug, Clone, Default)]
1344pub struct GetReportingDataOpParams {
1345    /// Location identifier
1346    /// Required by the API.
1347    pub location_id: String,
1348    /// Group by period
1349    /// Allowed values: `date`, `week`, `month`.
1350    pub group_by: Option<String>,
1351    /// Report start date
1352    /// Required by the API.
1353    pub start_date: String,
1354    /// Report end date
1355    /// Required by the API.
1356    pub end_date: String,
1357    /// Integration type
1358    /// Allowed values: `AD_MANAGER`, `INTEGRATION`.
1359    /// Required by the API.
1360    pub type_: String,
1361    /// Comma-separated reporting fields
1362    /// Required by the API.
1363    pub fields: String,
1364}
1365
1366impl GetReportingDataOpParams {
1367    /// Start from the parameters the API requires.
1368    pub fn new(
1369        location_id: impl Into<String>,
1370        start_date: impl Into<String>,
1371        end_date: impl Into<String>,
1372        type_: impl Into<String>,
1373        fields: impl Into<String>,
1374    ) -> Self {
1375        Self {
1376            location_id: location_id.into(),
1377            start_date: start_date.into(),
1378            end_date: end_date.into(),
1379            type_: type_.into(),
1380            fields: fields.into(),
1381            ..Default::default()
1382        }
1383    }
1384
1385    /// Group by period
1386    pub fn group_by(mut self, v: impl Into<String>) -> Self {
1387        self.group_by = Some(v.into());
1388        self
1389    }
1390
1391    fn to_query(&self) -> Vec<(String, String)> {
1392        let mut q: Vec<(String, String)> = vec![
1393            ("locationId".into(), self.location_id.clone()),
1394            ("startDate".into(), self.start_date.clone()),
1395            ("endDate".into(), self.end_date.clone()),
1396            ("type".into(), self.type_.clone()),
1397            ("fields".into(), self.fields.clone()),
1398        ];
1399        if let Some(v) = &self.group_by {
1400            q.push(("groupBy".into(), v.to_string()));
1401        }
1402        q
1403    }
1404}
1405
1406/// Query parameters for [`AdManagerService::get_campaign_reporting_op`].
1407#[derive(Debug, Clone, Default)]
1408pub struct GetCampaignReportingOpParams {
1409    /// Location identifier
1410    /// Required by the API.
1411    pub location_id: String,
1412    /// Report start date
1413    /// Required by the API.
1414    pub start_date: String,
1415    /// Report end date
1416    /// Required by the API.
1417    pub end_date: String,
1418}
1419
1420impl GetCampaignReportingOpParams {
1421    /// Start from the parameters the API requires.
1422    pub fn new(
1423        location_id: impl Into<String>,
1424        start_date: impl Into<String>,
1425        end_date: impl Into<String>,
1426    ) -> Self {
1427        Self {
1428            location_id: location_id.into(),
1429            start_date: start_date.into(),
1430            end_date: end_date.into(),
1431        }
1432    }
1433
1434    fn to_query(&self) -> Vec<(String, String)> {
1435        let q: Vec<(String, String)> = vec![
1436            ("locationId".into(), self.location_id.clone()),
1437            ("startDate".into(), self.start_date.clone()),
1438            ("endDate".into(), self.end_date.clone()),
1439        ];
1440        q
1441    }
1442}
1443
1444/// Query parameters for [`AdManagerService::get_reporting_list_op`].
1445#[derive(Debug, Clone, Default)]
1446pub struct GetReportingListOpParams {
1447    /// Location identifier
1448    /// Required by the API.
1449    pub location_id: String,
1450    /// Report list type
1451    /// Required by the API.
1452    pub list_type: String,
1453    /// Report start date
1454    /// Required by the API.
1455    pub start_date: String,
1456    /// Report end date
1457    /// Required by the API.
1458    pub end_date: String,
1459    /// Campaign identifier
1460    pub campaign_id: Option<String>,
1461    /// Integration type
1462    /// Allowed values: `AD_MANAGER`, `INTEGRATION`.
1463    /// Required by the API.
1464    pub type_: String,
1465}
1466
1467impl GetReportingListOpParams {
1468    /// Start from the parameters the API requires.
1469    pub fn new(
1470        location_id: impl Into<String>,
1471        list_type: impl Into<String>,
1472        start_date: impl Into<String>,
1473        end_date: impl Into<String>,
1474        type_: impl Into<String>,
1475    ) -> Self {
1476        Self {
1477            location_id: location_id.into(),
1478            list_type: list_type.into(),
1479            start_date: start_date.into(),
1480            end_date: end_date.into(),
1481            type_: type_.into(),
1482            ..Default::default()
1483        }
1484    }
1485
1486    /// Campaign identifier
1487    pub fn campaign_id(mut self, v: impl Into<String>) -> Self {
1488        self.campaign_id = Some(v.into());
1489        self
1490    }
1491
1492    fn to_query(&self) -> Vec<(String, String)> {
1493        let mut q: Vec<(String, String)> = vec![
1494            ("locationId".into(), self.location_id.clone()),
1495            ("listType".into(), self.list_type.clone()),
1496            ("startDate".into(), self.start_date.clone()),
1497            ("endDate".into(), self.end_date.clone()),
1498            ("type".into(), self.type_.clone()),
1499        ];
1500        if let Some(v) = &self.campaign_id {
1501            q.push(("campaignId".into(), v.to_string()));
1502        }
1503        q
1504    }
1505}
1506
1507/// Query parameters for [`AdManagerService::get_segments`].
1508#[derive(Debug, Clone, Default)]
1509pub struct GetSegmentsParams {
1510    /// Location identifier
1511    /// Required by the API.
1512    pub location_id: String,
1513    /// Segment type
1514    pub type_: Option<String>,
1515}
1516
1517impl GetSegmentsParams {
1518    /// Start from the parameters the API requires.
1519    pub fn new(location_id: impl Into<String>) -> Self {
1520        Self {
1521            location_id: location_id.into(),
1522            ..Default::default()
1523        }
1524    }
1525
1526    /// Segment type
1527    pub fn type_(mut self, v: impl Into<String>) -> Self {
1528        self.type_ = Some(v.into());
1529        self
1530    }
1531
1532    fn to_query(&self) -> Vec<(String, String)> {
1533        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1534        if let Some(v) = &self.type_ {
1535            q.push(("type".into(), v.to_string()));
1536        }
1537        q
1538    }
1539}
1540
1541/// Query parameters for [`AdManagerService::upsert_segment`].
1542#[derive(Debug, Clone, Default)]
1543pub struct UpsertSegmentParams {
1544    /// Location identifier
1545    /// Required by the API.
1546    pub location_id: String,
1547    /// Segment type
1548    /// Allowed values: `CUSTOM_SEGMENTS`, `WEBSITE_VISITOR`, `CUSTOMER_MATCH`, `LOOKALIKE`.
1549    /// Required by the API.
1550    pub type_: String,
1551}
1552
1553impl UpsertSegmentParams {
1554    /// Start from the parameters the API requires.
1555    pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
1556        Self {
1557            location_id: location_id.into(),
1558            type_: type_.into(),
1559        }
1560    }
1561
1562    fn to_query(&self) -> Vec<(String, String)> {
1563        let q: Vec<(String, String)> = vec![
1564            ("locationId".into(), self.location_id.clone()),
1565            ("type".into(), self.type_.clone()),
1566        ];
1567        q
1568    }
1569}
1570
1571/// Query parameters for [`AdManagerService::delete_segment`].
1572#[derive(Debug, Clone, Default)]
1573pub struct DeleteSegmentParams {
1574    /// Location identifier
1575    /// Required by the API.
1576    pub location_id: String,
1577    /// Segment type
1578    /// Allowed values: `CUSTOM_SEGMENTS`, `DATA_SEGMENTS`.
1579    /// Required by the API.
1580    pub type_: String,
1581}
1582
1583impl DeleteSegmentParams {
1584    /// Start from the parameters the API requires.
1585    pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
1586        Self {
1587            location_id: location_id.into(),
1588            type_: type_.into(),
1589        }
1590    }
1591
1592    fn to_query(&self) -> Vec<(String, String)> {
1593        let q: Vec<(String, String)> = vec![
1594            ("locationId".into(), self.location_id.clone()),
1595            ("type".into(), self.type_.clone()),
1596        ];
1597        q
1598    }
1599}
1600
1601/// Query parameters for [`AdManagerService::get_segment_by_id`].
1602#[derive(Debug, Clone, Default)]
1603pub struct GetSegmentByIdParams {
1604    /// Location identifier
1605    /// Required by the API.
1606    pub location_id: String,
1607    /// Segment type
1608    /// Allowed values: `CUSTOM_SEGMENTS`, `DATA_SEGMENTS`.
1609    /// Required by the API.
1610    pub type_: String,
1611}
1612
1613impl GetSegmentByIdParams {
1614    /// Start from the parameters the API requires.
1615    pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
1616        Self {
1617            location_id: location_id.into(),
1618            type_: type_.into(),
1619        }
1620    }
1621
1622    fn to_query(&self) -> Vec<(String, String)> {
1623        let q: Vec<(String, String)> = vec![
1624            ("locationId".into(), self.location_id.clone()),
1625            ("type".into(), self.type_.clone()),
1626        ];
1627        q
1628    }
1629}
1630
1631/// Query parameters for [`AdManagerService::get_target_interests`].
1632#[derive(Debug, Clone, Default)]
1633pub struct GetTargetInterestsParams {
1634    /// Location identifier
1635    /// Required by the API.
1636    pub location_id: String,
1637    /// Interest type
1638    /// Allowed values: `AFFINITY`, `IN_MARKET`.
1639    /// Required by the API.
1640    pub type_: String,
1641    /// Channel type
1642    /// Required by the API.
1643    pub advertising_channel_type: String,
1644}
1645
1646impl GetTargetInterestsParams {
1647    /// Start from the parameters the API requires.
1648    pub fn new(
1649        location_id: impl Into<String>,
1650        type_: impl Into<String>,
1651        advertising_channel_type: impl Into<String>,
1652    ) -> Self {
1653        Self {
1654            location_id: location_id.into(),
1655            type_: type_.into(),
1656            advertising_channel_type: advertising_channel_type.into(),
1657        }
1658    }
1659
1660    fn to_query(&self) -> Vec<(String, String)> {
1661        let q: Vec<(String, String)> = vec![
1662            ("locationId".into(), self.location_id.clone()),
1663            ("type".into(), self.type_.clone()),
1664            (
1665                "advertisingChannelType".into(),
1666                self.advertising_channel_type.clone(),
1667            ),
1668        ];
1669        q
1670    }
1671}
1672
1673/// Query parameters for [`AdManagerService::search_targeting_options_op`].
1674#[derive(Debug, Clone, Default)]
1675pub struct SearchTargetingOptionsOpParams {
1676    /// Search type
1677    /// Required by the API.
1678    pub type_: String,
1679    /// Search query
1680    pub query: Option<String>,
1681    /// Location identifier
1682    /// Required by the API.
1683    pub location_id: String,
1684}
1685
1686impl SearchTargetingOptionsOpParams {
1687    /// Start from the parameters the API requires.
1688    pub fn new(type_: impl Into<String>, location_id: impl Into<String>) -> Self {
1689        Self {
1690            type_: type_.into(),
1691            location_id: location_id.into(),
1692            ..Default::default()
1693        }
1694    }
1695
1696    /// Search query
1697    pub fn query(mut self, v: impl Into<String>) -> Self {
1698        self.query = Some(v.into());
1699        self
1700    }
1701
1702    fn to_query(&self) -> Vec<(String, String)> {
1703        let mut q: Vec<(String, String)> = vec![
1704            ("type".into(), self.type_.clone()),
1705            ("locationId".into(), self.location_id.clone()),
1706        ];
1707        if let Some(v) = &self.query {
1708            q.push(("query".into(), v.to_string()));
1709        }
1710        q
1711    }
1712}
1713
1714/// Query parameters for [`AdManagerService::delete_ad_account_op2`].
1715#[derive(Debug, Clone, Default)]
1716pub struct DeleteAdAccountOp2Params {
1717    /// Location identifier
1718    /// Required by the API.
1719    pub location_id: String,
1720    /// Ad account identifier
1721    /// Required by the API.
1722    pub ad_account_id: String,
1723}
1724
1725impl DeleteAdAccountOp2Params {
1726    /// Start from the parameters the API requires.
1727    pub fn new(location_id: impl Into<String>, ad_account_id: impl Into<String>) -> Self {
1728        Self {
1729            location_id: location_id.into(),
1730            ad_account_id: ad_account_id.into(),
1731        }
1732    }
1733
1734    fn to_query(&self) -> Vec<(String, String)> {
1735        let q: Vec<(String, String)> = vec![
1736            ("locationId".into(), self.location_id.clone()),
1737            ("adAccountId".into(), self.ad_account_id.clone()),
1738        ];
1739        q
1740    }
1741}
1742
1743/// Query parameters for [`AdManagerService::get_ad_account_details_op2`].
1744#[derive(Debug, Clone, Default)]
1745pub struct GetAdAccountDetailsOp2Params {
1746    /// Location identifier
1747    /// Required by the API.
1748    pub location_id: String,
1749    /// Ad account identifier
1750    /// Required by the API.
1751    pub ad_account_id: String,
1752}
1753
1754impl GetAdAccountDetailsOp2Params {
1755    /// Start from the parameters the API requires.
1756    pub fn new(location_id: impl Into<String>, ad_account_id: impl Into<String>) -> Self {
1757        Self {
1758            location_id: location_id.into(),
1759            ad_account_id: ad_account_id.into(),
1760        }
1761    }
1762
1763    fn to_query(&self) -> Vec<(String, String)> {
1764        let q: Vec<(String, String)> = vec![
1765            ("locationId".into(), self.location_id.clone()),
1766            ("adAccountId".into(), self.ad_account_id.clone()),
1767        ];
1768        q
1769    }
1770}
1771
1772/// Query parameters for [`AdManagerService::get_linked_in_ad_accounts`].
1773#[derive(Debug, Clone, Default)]
1774pub struct GetLinkedInAdAccountsParams {
1775    /// Location identifier
1776    /// Required by the API.
1777    pub location_id: String,
1778}
1779
1780impl GetLinkedInAdAccountsParams {
1781    /// Start from the parameters the API requires.
1782    pub fn new(location_id: impl Into<String>) -> Self {
1783        Self {
1784            location_id: location_id.into(),
1785        }
1786    }
1787
1788    fn to_query(&self) -> Vec<(String, String)> {
1789        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1790        q
1791    }
1792}
1793
1794/// Query parameters for [`AdManagerService::get_ad_campaign_group`].
1795#[derive(Debug, Clone, Default)]
1796pub struct GetAdCampaignGroupParams {
1797    /// Location identifier
1798    /// Required by the API.
1799    pub location_id: String,
1800}
1801
1802impl GetAdCampaignGroupParams {
1803    /// Start from the parameters the API requires.
1804    pub fn new(location_id: impl Into<String>) -> Self {
1805        Self {
1806            location_id: location_id.into(),
1807        }
1808    }
1809
1810    fn to_query(&self) -> Vec<(String, String)> {
1811        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1812        q
1813    }
1814}
1815
1816/// Query parameters for [`AdManagerService::get_linked_in_integration`].
1817#[derive(Debug, Clone, Default)]
1818pub struct GetLinkedInIntegrationParams {
1819    /// Location identifier
1820    /// Required by the API.
1821    pub location_id: String,
1822}
1823
1824impl GetLinkedInIntegrationParams {
1825    /// Start from the parameters the API requires.
1826    pub fn new(location_id: impl Into<String>) -> Self {
1827        Self {
1828            location_id: location_id.into(),
1829        }
1830    }
1831
1832    fn to_query(&self) -> Vec<(String, String)> {
1833        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1834        q
1835    }
1836}
1837
1838/// Query parameters for [`AdManagerService::get_current_linked_in_user`].
1839#[derive(Debug, Clone, Default)]
1840pub struct GetCurrentLinkedInUserParams {
1841    /// Location identifier
1842    /// Required by the API.
1843    pub location_id: String,
1844}
1845
1846impl GetCurrentLinkedInUserParams {
1847    /// Start from the parameters the API requires.
1848    pub fn new(location_id: impl Into<String>) -> Self {
1849        Self {
1850            location_id: location_id.into(),
1851        }
1852    }
1853
1854    fn to_query(&self) -> Vec<(String, String)> {
1855        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
1856        q
1857    }
1858}
1859
1860/// Query parameters for [`AdManagerService::get_ad_analytics`].
1861#[derive(Debug, Clone, Default)]
1862pub struct GetAdAnalyticsParams {
1863    /// Location ID
1864    /// Required by the API.
1865    pub location_id: String,
1866    /// Analytics pivot type
1867    /// Allowed values: `ACCOUNT`, `CAMPAIGN`, `CAMPAIGN_GROUP`, `CREATIVE`.
1868    pub pivot: Option<String>,
1869    /// Time granularity for analytics
1870    /// Allowed values: `day`, `month`, `year`.
1871    pub group_by: Option<String>,
1872    /// Start date in yyyy-mm-dd format
1873    /// Required by the API.
1874    pub start_date: String,
1875    /// End date in yyyy-mm-dd format
1876    /// Required by the API.
1877    pub end_date: String,
1878    /// Comma-separated list of entity URNs
1879    pub entity_urns: Option<String>,
1880    /// Comma-separated list of fields to retrieve
1881    pub fields: Option<String>,
1882}
1883
1884impl GetAdAnalyticsParams {
1885    /// Start from the parameters the API requires.
1886    pub fn new(
1887        location_id: impl Into<String>,
1888        start_date: impl Into<String>,
1889        end_date: impl Into<String>,
1890    ) -> Self {
1891        Self {
1892            location_id: location_id.into(),
1893            start_date: start_date.into(),
1894            end_date: end_date.into(),
1895            ..Default::default()
1896        }
1897    }
1898
1899    /// Analytics pivot type
1900    pub fn pivot(mut self, v: impl Into<String>) -> Self {
1901        self.pivot = Some(v.into());
1902        self
1903    }
1904
1905    /// Time granularity for analytics
1906    pub fn group_by(mut self, v: impl Into<String>) -> Self {
1907        self.group_by = Some(v.into());
1908        self
1909    }
1910
1911    /// Comma-separated list of entity URNs
1912    pub fn entity_urns(mut self, v: impl Into<String>) -> Self {
1913        self.entity_urns = Some(v.into());
1914        self
1915    }
1916
1917    /// Comma-separated list of fields to retrieve
1918    pub fn fields(mut self, v: impl Into<String>) -> Self {
1919        self.fields = Some(v.into());
1920        self
1921    }
1922
1923    fn to_query(&self) -> Vec<(String, String)> {
1924        let mut q: Vec<(String, String)> = vec![
1925            ("locationId".into(), self.location_id.clone()),
1926            ("startDate".into(), self.start_date.clone()),
1927            ("endDate".into(), self.end_date.clone()),
1928        ];
1929        if let Some(v) = &self.pivot {
1930            q.push(("pivot".into(), v.to_string()));
1931        }
1932        if let Some(v) = &self.group_by {
1933            q.push(("groupBy".into(), v.to_string()));
1934        }
1935        if let Some(v) = &self.entity_urns {
1936            q.push(("entityUrns".into(), v.to_string()));
1937        }
1938        if let Some(v) = &self.fields {
1939            q.push(("fields".into(), v.to_string()));
1940        }
1941        q
1942    }
1943}
1944
1945/// Query parameters for [`AdManagerService::get_campaign_group_reporting`].
1946#[derive(Debug, Clone, Default)]
1947pub struct GetCampaignGroupReportingParams {
1948    /// Location ID
1949    /// Required by the API.
1950    pub location_id: String,
1951    /// Start date in yyyy-mm-dd format
1952    /// Required by the API.
1953    pub start_date: String,
1954    /// End date in yyyy-mm-dd format
1955    /// Required by the API.
1956    pub end_date: String,
1957    /// Comma-separated list of fields to retrieve
1958    pub fields: Option<String>,
1959    /// Campaign group ID
1960    pub campaign_group_id: Option<String>,
1961}
1962
1963impl GetCampaignGroupReportingParams {
1964    /// Start from the parameters the API requires.
1965    pub fn new(
1966        location_id: impl Into<String>,
1967        start_date: impl Into<String>,
1968        end_date: impl Into<String>,
1969    ) -> Self {
1970        Self {
1971            location_id: location_id.into(),
1972            start_date: start_date.into(),
1973            end_date: end_date.into(),
1974            ..Default::default()
1975        }
1976    }
1977
1978    /// Comma-separated list of fields to retrieve
1979    pub fn fields(mut self, v: impl Into<String>) -> Self {
1980        self.fields = Some(v.into());
1981        self
1982    }
1983
1984    /// Campaign group ID
1985    pub fn campaign_group_id(mut self, v: impl Into<String>) -> Self {
1986        self.campaign_group_id = Some(v.into());
1987        self
1988    }
1989
1990    fn to_query(&self) -> Vec<(String, String)> {
1991        let mut q: Vec<(String, String)> = vec![
1992            ("locationId".into(), self.location_id.clone()),
1993            ("startDate".into(), self.start_date.clone()),
1994            ("endDate".into(), self.end_date.clone()),
1995        ];
1996        if let Some(v) = &self.fields {
1997            q.push(("fields".into(), v.to_string()));
1998        }
1999        if let Some(v) = &self.campaign_group_id {
2000            q.push(("campaignGroupId".into(), v.to_string()));
2001        }
2002        q
2003    }
2004}
2005
2006/// Query parameters for [`AdManagerService::get_reporting_list_op2`].
2007#[derive(Debug, Clone, Default)]
2008pub struct GetReportingListOp2Params {
2009    /// Location ID
2010    /// Required by the API.
2011    pub location_id: String,
2012    /// List type
2013    /// Required by the API.
2014    pub list_type: String,
2015    /// Campaign ID
2016    /// Required by the API.
2017    pub campaign_id: String,
2018    /// Campaign group ID
2019    /// Required by the API.
2020    pub campaign_group_id: String,
2021    /// Start date in yyyy-mm-dd format
2022    /// Required by the API.
2023    pub start_date: String,
2024    /// End date in yyyy-mm-dd format
2025    /// Required by the API.
2026    pub end_date: String,
2027    /// Comma-separated list of fields to retrieve
2028    pub fields: Option<String>,
2029}
2030
2031impl GetReportingListOp2Params {
2032    /// Start from the parameters the API requires.
2033    pub fn new(
2034        location_id: impl Into<String>,
2035        list_type: impl Into<String>,
2036        campaign_id: impl Into<String>,
2037        campaign_group_id: impl Into<String>,
2038        start_date: impl Into<String>,
2039        end_date: impl Into<String>,
2040    ) -> Self {
2041        Self {
2042            location_id: location_id.into(),
2043            list_type: list_type.into(),
2044            campaign_id: campaign_id.into(),
2045            campaign_group_id: campaign_group_id.into(),
2046            start_date: start_date.into(),
2047            end_date: end_date.into(),
2048            ..Default::default()
2049        }
2050    }
2051
2052    /// Comma-separated list of fields to retrieve
2053    pub fn fields(mut self, v: impl Into<String>) -> Self {
2054        self.fields = Some(v.into());
2055        self
2056    }
2057
2058    fn to_query(&self) -> Vec<(String, String)> {
2059        let mut q: Vec<(String, String)> = vec![
2060            ("locationId".into(), self.location_id.clone()),
2061            ("listType".into(), self.list_type.clone()),
2062            ("campaignId".into(), self.campaign_id.clone()),
2063            ("campaignGroupId".into(), self.campaign_group_id.clone()),
2064            ("startDate".into(), self.start_date.clone()),
2065            ("endDate".into(), self.end_date.clone()),
2066        ];
2067        if let Some(v) = &self.fields {
2068            q.push(("fields".into(), v.to_string()));
2069        }
2070        q
2071    }
2072}
2073
2074/// Query parameters for [`AdManagerService::search_targeting_options_op2`].
2075#[derive(Debug, Clone, Default)]
2076pub struct SearchTargetingOptionsOp2Params {
2077    /// Location identifier
2078    /// Required by the API.
2079    pub location_id: String,
2080    /// Targeting facet
2081    /// Required by the API.
2082    pub facet: String,
2083    /// Search query
2084    pub query: Option<String>,
2085    /// Query parameter
2086    pub q: Option<String>,
2087}
2088
2089impl SearchTargetingOptionsOp2Params {
2090    /// Start from the parameters the API requires.
2091    pub fn new(location_id: impl Into<String>, facet: impl Into<String>) -> Self {
2092        Self {
2093            location_id: location_id.into(),
2094            facet: facet.into(),
2095            ..Default::default()
2096        }
2097    }
2098
2099    /// Search query
2100    pub fn query(mut self, v: impl Into<String>) -> Self {
2101        self.query = Some(v.into());
2102        self
2103    }
2104
2105    /// Query parameter
2106    pub fn q(mut self, v: impl Into<String>) -> Self {
2107        self.q = Some(v.into());
2108        self
2109    }
2110
2111    fn to_query(&self) -> Vec<(String, String)> {
2112        let mut q: Vec<(String, String)> = vec![
2113            ("locationId".into(), self.location_id.clone()),
2114            ("facet".into(), self.facet.clone()),
2115        ];
2116        if let Some(v) = &self.query {
2117            q.push(("query".into(), v.to_string()));
2118        }
2119        if let Some(v) = &self.q {
2120            q.push(("q".into(), v.to_string()));
2121        }
2122        q
2123    }
2124}
2125
2126/// Query parameters for [`AdManagerService::create_lead_form`].
2127#[derive(Debug, Clone, Default)]
2128pub struct CreateLeadFormParams {
2129    /// Location identifier
2130    /// Required by the API.
2131    pub location_id: String,
2132}
2133
2134impl CreateLeadFormParams {
2135    /// Start from the parameters the API requires.
2136    pub fn new(location_id: impl Into<String>) -> Self {
2137        Self {
2138            location_id: location_id.into(),
2139        }
2140    }
2141
2142    fn to_query(&self) -> Vec<(String, String)> {
2143        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
2144        q
2145    }
2146}
2147
2148/// Query parameters for [`AdManagerService::get_lead_forms`].
2149#[derive(Debug, Clone, Default)]
2150pub struct GetLeadFormsParams {
2151    /// Location identifier
2152    /// Required by the API.
2153    pub location_id: String,
2154}
2155
2156impl GetLeadFormsParams {
2157    /// Start from the parameters the API requires.
2158    pub fn new(location_id: impl Into<String>) -> Self {
2159        Self {
2160            location_id: location_id.into(),
2161        }
2162    }
2163
2164    fn to_query(&self) -> Vec<(String, String)> {
2165        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
2166        q
2167    }
2168}
2169
2170/// Query parameters for [`AdManagerService::update_ad_status`].
2171#[derive(Debug, Clone, Default)]
2172pub struct UpdateAdStatusParams {
2173    /// Location identifier
2174    /// Required by the API.
2175    pub location_id: String,
2176}
2177
2178impl UpdateAdStatusParams {
2179    /// Start from the parameters the API requires.
2180    pub fn new(location_id: impl Into<String>) -> Self {
2181        Self {
2182            location_id: location_id.into(),
2183        }
2184    }
2185
2186    fn to_query(&self) -> Vec<(String, String)> {
2187        let q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
2188        q
2189    }
2190}
2191
2192impl AdManagerService {
2193    /// Get ad accounts
2194    ///
2195    /// Retrieve Facebook ad accounts available for the connected user
2196    ///
2197    /// `GET /ad-publishing/facebook/ad-accounts`
2198    ///
2199    /// Requires scope: `adPublishing.readonly`.
2200    pub async fn get_ad_accounts(&self, params: &GetAdAccountsParams) -> Result<serde_json::Value> {
2201        let query = params.to_query();
2202        self.client
2203            .send_versioned(
2204                reqwest::Method::GET,
2205                "/ad-publishing/facebook/ad-accounts",
2206                &query,
2207                None::<&()>,
2208                Some("2021-07-28"),
2209            )
2210            .await
2211    }
2212
2213    /// Delete ad account
2214    ///
2215    /// Remove a Facebook ad account connection from a location
2216    ///
2217    /// `DELETE /ad-publishing/facebook/ad-accounts/{adAccountId}`
2218    ///
2219    /// Requires scope: `adPublishing.write`.
2220    pub async fn delete_ad_account(
2221        &self,
2222        ad_account_id: &str,
2223        body: &models::LocationIdBodyDTO,
2224    ) -> Result<serde_json::Value> {
2225        let path = format!(
2226            "/ad-publishing/facebook/ad-accounts/{}",
2227            crate::services::encode(ad_account_id)
2228        );
2229        let query = Vec::new();
2230        self.client
2231            .send_versioned(
2232                reqwest::Method::DELETE,
2233                &path,
2234                &query,
2235                Some(body),
2236                Some("2021-07-28"),
2237            )
2238            .await
2239    }
2240
2241    /// Get ad account details
2242    ///
2243    /// Retrieve details of a specific Facebook ad account
2244    ///
2245    /// `GET /ad-publishing/facebook/ad-accounts/{adAccountId}`
2246    ///
2247    /// Requires scope: `adPublishing.readonly`.
2248    pub async fn get_ad_account_details(
2249        &self,
2250        ad_account_id: &str,
2251        params: &GetAdAccountDetailsParams,
2252    ) -> Result<serde_json::Value> {
2253        let path = format!(
2254            "/ad-publishing/facebook/ad-accounts/{}",
2255            crate::services::encode(ad_account_id)
2256        );
2257        let query = params.to_query();
2258        self.client
2259            .send_versioned(
2260                reqwest::Method::GET,
2261                &path,
2262                &query,
2263                None::<&()>,
2264                Some("2021-07-28"),
2265            )
2266            .await
2267    }
2268
2269    /// Upsert ad
2270    ///
2271    /// Create or update a Facebook ad (v2)
2272    ///
2273    /// `PUT /ad-publishing/facebook/ads-v2`
2274    ///
2275    /// Requires scope: `adPublishing.write`.
2276    pub async fn upsert_ad(&self, body: &models::UpsertAdDTO) -> Result<serde_json::Value> {
2277        let query = Vec::new();
2278        self.client
2279            .send_versioned(
2280                reqwest::Method::PUT,
2281                "/ad-publishing/facebook/ads-v2",
2282                &query,
2283                Some(body),
2284                Some("2021-07-28"),
2285            )
2286            .await
2287    }
2288
2289    /// Delete ad
2290    ///
2291    /// Delete a Facebook ad by ID
2292    ///
2293    /// `DELETE /ad-publishing/facebook/ads/{adId}`
2294    ///
2295    /// Requires scope: `adPublishing.write`.
2296    pub async fn delete_ad(
2297        &self,
2298        ad_id: &str,
2299        body: &models::LocationIdBodyDTO,
2300    ) -> Result<serde_json::Value> {
2301        let path = format!(
2302            "/ad-publishing/facebook/ads/{}",
2303            crate::services::encode(ad_id)
2304        );
2305        let query = Vec::new();
2306        self.client
2307            .send_versioned(
2308                reqwest::Method::DELETE,
2309                &path,
2310                &query,
2311                Some(body),
2312                Some("2021-07-28"),
2313            )
2314            .await
2315    }
2316
2317    /// Duplicate ad
2318    ///
2319    /// Duplicate an existing Facebook ad
2320    ///
2321    /// `POST /ad-publishing/facebook/ads/{adId}/duplicate`
2322    ///
2323    /// Requires scope: `adPublishing.write`.
2324    pub async fn duplicate_ad(&self, ad_id: &str) -> Result<serde_json::Value> {
2325        let path = format!(
2326            "/ad-publishing/facebook/ads/{}/duplicate",
2327            crate::services::encode(ad_id)
2328        );
2329        let query = Vec::new();
2330        self.client
2331            .send_versioned(
2332                reqwest::Method::POST,
2333                &path,
2334                &query,
2335                None::<&()>,
2336                Some("2021-07-28"),
2337            )
2338            .await
2339    }
2340
2341    /// Pause ad
2342    ///
2343    /// Pause a running Facebook ad
2344    ///
2345    /// `POST /ad-publishing/facebook/ads/{adId}/pause`
2346    ///
2347    /// Requires scope: `adPublishing.write`.
2348    pub async fn pause_ad(
2349        &self,
2350        ad_id: &str,
2351        body: &models::LocationIdBodyDTO,
2352    ) -> Result<serde_json::Value> {
2353        let path = format!(
2354            "/ad-publishing/facebook/ads/{}/pause",
2355            crate::services::encode(ad_id)
2356        );
2357        let query = Vec::new();
2358        self.client
2359            .send_versioned(
2360                reqwest::Method::POST,
2361                &path,
2362                &query,
2363                Some(body),
2364                Some("2021-07-28"),
2365            )
2366            .await
2367    }
2368
2369    /// Resume ad
2370    ///
2371    /// Resume a paused Facebook ad
2372    ///
2373    /// `POST /ad-publishing/facebook/ads/{adId}/resume`
2374    ///
2375    /// Requires scope: `adPublishing.write`.
2376    pub async fn resume_ad(
2377        &self,
2378        ad_id: &str,
2379        body: &models::LocationIdBodyDTO,
2380    ) -> Result<serde_json::Value> {
2381        let path = format!(
2382            "/ad-publishing/facebook/ads/{}/resume",
2383            crate::services::encode(ad_id)
2384        );
2385        let query = Vec::new();
2386        self.client
2387            .send_versioned(
2388                reqwest::Method::POST,
2389                &path,
2390                &query,
2391                Some(body),
2392                Some("2021-07-28"),
2393            )
2394            .await
2395    }
2396
2397    /// Upsert adset
2398    ///
2399    /// Create or update a Facebook ad set
2400    ///
2401    /// `PUT /ad-publishing/facebook/adsets`
2402    ///
2403    /// Requires scope: `adPublishing.write`.
2404    pub async fn upsert_adset(&self, body: &models::UpsertAdsetDTO) -> Result<serde_json::Value> {
2405        let query = Vec::new();
2406        self.client
2407            .send_versioned(
2408                reqwest::Method::PUT,
2409                "/ad-publishing/facebook/adsets",
2410                &query,
2411                Some(body),
2412                Some("2021-07-28"),
2413            )
2414            .await
2415    }
2416
2417    /// Delete ad set
2418    ///
2419    /// Delete a Facebook ad set by ID
2420    ///
2421    /// `DELETE /ad-publishing/facebook/adsets/{adsetId}`
2422    ///
2423    /// Requires scope: `adPublishing.write`.
2424    pub async fn delete_ad_set(
2425        &self,
2426        adset_id: &str,
2427        body: &models::LocationIdBodyDTO,
2428    ) -> Result<serde_json::Value> {
2429        let path = format!(
2430            "/ad-publishing/facebook/adsets/{}",
2431            crate::services::encode(adset_id)
2432        );
2433        let query = Vec::new();
2434        self.client
2435            .send_versioned(
2436                reqwest::Method::DELETE,
2437                &path,
2438                &query,
2439                Some(body),
2440                Some("2021-07-28"),
2441            )
2442            .await
2443    }
2444
2445    /// Duplicate ad set
2446    ///
2447    /// Duplicate an existing Facebook ad set
2448    ///
2449    /// `POST /ad-publishing/facebook/adsets/{adsetId}/duplicate`
2450    ///
2451    /// Requires scope: `adPublishing.write`.
2452    pub async fn duplicate_ad_set(&self, adset_id: &str) -> Result<serde_json::Value> {
2453        let path = format!(
2454            "/ad-publishing/facebook/adsets/{}/duplicate",
2455            crate::services::encode(adset_id)
2456        );
2457        let query = Vec::new();
2458        self.client
2459            .send_versioned(
2460                reqwest::Method::POST,
2461                &path,
2462                &query,
2463                None::<&()>,
2464                Some("2021-07-28"),
2465            )
2466            .await
2467    }
2468
2469    /// Pause ad set
2470    ///
2471    /// Pause a running Facebook ad set
2472    ///
2473    /// `POST /ad-publishing/facebook/adsets/{adsetId}/pause`
2474    ///
2475    /// Requires scope: `adPublishing.write`.
2476    pub async fn pause_ad_set(
2477        &self,
2478        adset_id: &str,
2479        body: &models::LocationIdBodyDTO,
2480    ) -> Result<serde_json::Value> {
2481        let path = format!(
2482            "/ad-publishing/facebook/adsets/{}/pause",
2483            crate::services::encode(adset_id)
2484        );
2485        let query = Vec::new();
2486        self.client
2487            .send_versioned(
2488                reqwest::Method::POST,
2489                &path,
2490                &query,
2491                Some(body),
2492                Some("2021-07-28"),
2493            )
2494            .await
2495    }
2496
2497    /// Resume ad set
2498    ///
2499    /// Resume a paused Facebook ad set
2500    ///
2501    /// `POST /ad-publishing/facebook/adsets/{adsetId}/resume`
2502    ///
2503    /// Requires scope: `adPublishing.write`.
2504    pub async fn resume_ad_set(
2505        &self,
2506        adset_id: &str,
2507        body: &models::LocationIdBodyDTO,
2508    ) -> Result<serde_json::Value> {
2509        let path = format!(
2510            "/ad-publishing/facebook/adsets/{}/resume",
2511            crate::services::encode(adset_id)
2512        );
2513        let query = Vec::new();
2514        self.client
2515            .send_versioned(
2516                reqwest::Method::POST,
2517                &path,
2518                &query,
2519                Some(body),
2520                Some("2021-07-28"),
2521            )
2522            .await
2523    }
2524
2525    /// Get campaign with linked entities
2526    ///
2527    /// Retrieve a Facebook campaign with its linked adsets and ads
2528    ///
2529    /// `GET /ad-publishing/facebook/campaign/{campaignId}`
2530    ///
2531    /// Requires scope: `adPublishing.readonly`.
2532    pub async fn get_campaign_with_linked_entities(
2533        &self,
2534        campaign_id: &str,
2535        params: &GetCampaignWithLinkedEntitiesParams,
2536    ) -> Result<serde_json::Value> {
2537        let path = format!(
2538            "/ad-publishing/facebook/campaign/{}",
2539            crate::services::encode(campaign_id)
2540        );
2541        let query = params.to_query();
2542        self.client
2543            .send_versioned(
2544                reqwest::Method::GET,
2545                &path,
2546                &query,
2547                None::<&()>,
2548                Some("2021-07-28"),
2549            )
2550            .await
2551    }
2552
2553    /// Upsert campaign
2554    ///
2555    /// Create or update a Facebook campaign
2556    ///
2557    /// `PUT /ad-publishing/facebook/campaigns`
2558    ///
2559    /// Requires scope: `adPublishing.write`.
2560    pub async fn upsert_campaign(
2561        &self,
2562        body: &models::UpsertCampaignDTO,
2563    ) -> Result<serde_json::Value> {
2564        let query = Vec::new();
2565        self.client
2566            .send_versioned(
2567                reqwest::Method::PUT,
2568                "/ad-publishing/facebook/campaigns",
2569                &query,
2570                Some(body),
2571                Some("2021-07-28"),
2572            )
2573            .await
2574    }
2575
2576    /// Delete campaign
2577    ///
2578    /// Delete a Facebook campaign by ID
2579    ///
2580    /// `DELETE /ad-publishing/facebook/campaigns/{campaignId}`
2581    ///
2582    /// Requires scope: `adPublishing.write`.
2583    pub async fn delete_campaign(
2584        &self,
2585        campaign_id: &str,
2586        body: &models::LocationIdBodyDTO,
2587    ) -> Result<serde_json::Value> {
2588        let path = format!(
2589            "/ad-publishing/facebook/campaigns/{}",
2590            crate::services::encode(campaign_id)
2591        );
2592        let query = Vec::new();
2593        self.client
2594            .send_versioned(
2595                reqwest::Method::DELETE,
2596                &path,
2597                &query,
2598                Some(body),
2599                Some("2021-07-28"),
2600            )
2601            .await
2602    }
2603
2604    /// Duplicate campaign
2605    ///
2606    /// Duplicate an existing Facebook campaign
2607    ///
2608    /// `POST /ad-publishing/facebook/campaigns/{campaignId}/duplicate`
2609    ///
2610    /// Requires scope: `adPublishing.write`.
2611    pub async fn duplicate_campaign(
2612        &self,
2613        campaign_id: &str,
2614        body: &models::LocationIdBodyDTO,
2615    ) -> Result<serde_json::Value> {
2616        let path = format!(
2617            "/ad-publishing/facebook/campaigns/{}/duplicate",
2618            crate::services::encode(campaign_id)
2619        );
2620        let query = Vec::new();
2621        self.client
2622            .send_versioned(
2623                reqwest::Method::POST,
2624                &path,
2625                &query,
2626                Some(body),
2627                Some("2021-07-28"),
2628            )
2629            .await
2630    }
2631
2632    /// Pause campaign
2633    ///
2634    /// Pause a running Facebook campaign
2635    ///
2636    /// `POST /ad-publishing/facebook/campaigns/{campaignId}/pause`
2637    ///
2638    /// Requires scope: `adPublishing.write`.
2639    pub async fn pause_campaign(
2640        &self,
2641        campaign_id: &str,
2642        body: &models::LocationIdBodyDTO,
2643    ) -> Result<serde_json::Value> {
2644        let path = format!(
2645            "/ad-publishing/facebook/campaigns/{}/pause",
2646            crate::services::encode(campaign_id)
2647        );
2648        let query = Vec::new();
2649        self.client
2650            .send_versioned(
2651                reqwest::Method::POST,
2652                &path,
2653                &query,
2654                Some(body),
2655                Some("2021-07-28"),
2656            )
2657            .await
2658    }
2659
2660    /// Publish campaign
2661    ///
2662    /// Publish a Facebook campaign and push it live to Facebook
2663    ///
2664    /// `POST /ad-publishing/facebook/campaigns/{campaignId}/publish`
2665    ///
2666    /// Requires scope: `adPublishing.write`.
2667    pub async fn publish_campaign(
2668        &self,
2669        campaign_id: &str,
2670        body: &models::PublishAdDTO,
2671    ) -> Result<serde_json::Value> {
2672        let path = format!(
2673            "/ad-publishing/facebook/campaigns/{}/publish",
2674            crate::services::encode(campaign_id)
2675        );
2676        let query = Vec::new();
2677        self.client
2678            .send_versioned(
2679                reqwest::Method::POST,
2680                &path,
2681                &query,
2682                Some(body),
2683                Some("2021-07-28"),
2684            )
2685            .await
2686    }
2687
2688    /// Resume campaign
2689    ///
2690    /// Resume a paused Facebook campaign
2691    ///
2692    /// `POST /ad-publishing/facebook/campaigns/{campaignId}/resume`
2693    ///
2694    /// Requires scope: `adPublishing.write`.
2695    pub async fn resume_campaign(
2696        &self,
2697        campaign_id: &str,
2698        body: &models::LocationIdBodyDTO,
2699    ) -> Result<serde_json::Value> {
2700        let path = format!(
2701            "/ad-publishing/facebook/campaigns/{}/resume",
2702            crate::services::encode(campaign_id)
2703        );
2704        let query = Vec::new();
2705        self.client
2706            .send_versioned(
2707                reqwest::Method::POST,
2708                &path,
2709                &query,
2710                Some(body),
2711                Some("2021-07-28"),
2712            )
2713            .await
2714    }
2715
2716    /// Get conversation forms
2717    ///
2718    /// Retrieve Facebook conversation lead forms for a location
2719    ///
2720    /// `GET /ad-publishing/facebook/conversation-forms`
2721    ///
2722    /// Requires scope: `adPublishing.readonly`.
2723    pub async fn get_conversation_forms(
2724        &self,
2725        params: &GetConversationFormsParams,
2726    ) -> Result<serde_json::Value> {
2727        let query = params.to_query();
2728        self.client
2729            .send_versioned(
2730                reqwest::Method::GET,
2731                "/ad-publishing/facebook/conversation-forms",
2732                &query,
2733                None::<&()>,
2734                Some("2021-07-28"),
2735            )
2736            .await
2737    }
2738
2739    /// Create conversation form
2740    ///
2741    /// Create a new Facebook conversation lead form
2742    ///
2743    /// `POST /ad-publishing/facebook/conversation-forms`
2744    ///
2745    /// Requires scope: `adPublishing.write`.
2746    pub async fn create_conversation_form(
2747        &self,
2748        body: &models::CreateConversationFormDTO,
2749    ) -> Result<serde_json::Value> {
2750        let query = Vec::new();
2751        self.client
2752            .send_versioned(
2753                reqwest::Method::POST,
2754                "/ad-publishing/facebook/conversation-forms",
2755                &query,
2756                Some(body),
2757                Some("2021-07-28"),
2758            )
2759            .await
2760    }
2761
2762    /// Get custom audiences
2763    ///
2764    /// Retrieve Facebook custom audiences for a location
2765    ///
2766    /// `GET /ad-publishing/facebook/custom-audience`
2767    ///
2768    /// Requires scope: `adPublishing.readonly`.
2769    pub async fn get_custom_audiences(
2770        &self,
2771        params: &GetCustomAudiencesParams,
2772    ) -> Result<serde_json::Value> {
2773        let query = params.to_query();
2774        self.client
2775            .send_versioned(
2776                reqwest::Method::GET,
2777                "/ad-publishing/facebook/custom-audience",
2778                &query,
2779                None::<&()>,
2780                Some("2021-07-28"),
2781            )
2782            .await
2783    }
2784
2785    /// Delete custom audience
2786    ///
2787    /// Delete a Facebook custom audience by ID
2788    ///
2789    /// `DELETE /ad-publishing/facebook/custom-audience/{audienceId}`
2790    ///
2791    /// Requires scope: `adPublishing.write`.
2792    pub async fn delete_custom_audience(
2793        &self,
2794        audience_id: &str,
2795        params: &DeleteCustomAudienceParams,
2796    ) -> Result<serde_json::Value> {
2797        let path = format!(
2798            "/ad-publishing/facebook/custom-audience/{}",
2799            crate::services::encode(audience_id)
2800        );
2801        let query = params.to_query();
2802        self.client
2803            .send_versioned(
2804                reqwest::Method::DELETE,
2805                &path,
2806                &query,
2807                None::<&()>,
2808                Some("2021-07-28"),
2809            )
2810            .await
2811    }
2812
2813    /// Get custom audience by ID
2814    ///
2815    /// Retrieve a specific Facebook custom audience by its ID
2816    ///
2817    /// `GET /ad-publishing/facebook/custom-audience/{audienceId}`
2818    ///
2819    /// Requires scope: `adPublishing.readonly`.
2820    pub async fn get_custom_audience_by_id(
2821        &self,
2822        audience_id: &str,
2823        params: &GetCustomAudienceByIdParams,
2824    ) -> Result<serde_json::Value> {
2825        let path = format!(
2826            "/ad-publishing/facebook/custom-audience/{}",
2827            crate::services::encode(audience_id)
2828        );
2829        let query = params.to_query();
2830        self.client
2831            .send_versioned(
2832                reqwest::Method::GET,
2833                &path,
2834                &query,
2835                None::<&()>,
2836                Some("2021-07-28"),
2837            )
2838            .await
2839    }
2840
2841    /// Update custom audience
2842    ///
2843    /// Update name or description of a Facebook custom audience
2844    ///
2845    /// `PUT /ad-publishing/facebook/custom-audience/{audienceId}`
2846    ///
2847    /// Requires scope: `adPublishing.write`.
2848    pub async fn update_custom_audience(
2849        &self,
2850        audience_id: &str,
2851        body: &models::FbUpdateAudienceBodyDTO,
2852    ) -> Result<serde_json::Value> {
2853        let path = format!(
2854            "/ad-publishing/facebook/custom-audience/{}",
2855            crate::services::encode(audience_id)
2856        );
2857        let query = Vec::new();
2858        self.client
2859            .send_versioned(
2860                reqwest::Method::PUT,
2861                &path,
2862                &query,
2863                Some(body),
2864                Some("2021-07-28"),
2865            )
2866            .await
2867    }
2868
2869    /// Remove custom audience member
2870    ///
2871    /// Remove a member from a Facebook custom audience
2872    ///
2873    /// `DELETE /ad-publishing/facebook/custom-audience/{audienceId}/member`
2874    ///
2875    /// Requires scope: `adPublishing.write`.
2876    pub async fn remove_custom_audience_member(
2877        &self,
2878        audience_id: &str,
2879        body: &models::UpdateCustomAudienceDTO,
2880    ) -> Result<serde_json::Value> {
2881        let path = format!(
2882            "/ad-publishing/facebook/custom-audience/{}/member",
2883            crate::services::encode(audience_id)
2884        );
2885        let query = Vec::new();
2886        self.client
2887            .send_versioned(
2888                reqwest::Method::DELETE,
2889                &path,
2890                &query,
2891                Some(body),
2892                Some("2021-07-28"),
2893            )
2894            .await
2895    }
2896
2897    /// Add custom audience member
2898    ///
2899    /// Add a member to a Facebook custom audience
2900    ///
2901    /// `PUT /ad-publishing/facebook/custom-audience/{audienceId}/member`
2902    ///
2903    /// Requires scope: `adPublishing.write`.
2904    pub async fn add_custom_audience_member(
2905        &self,
2906        audience_id: &str,
2907        body: &models::UpdateCustomAudienceDTO,
2908    ) -> Result<serde_json::Value> {
2909        let path = format!(
2910            "/ad-publishing/facebook/custom-audience/{}/member",
2911            crate::services::encode(audience_id)
2912        );
2913        let query = Vec::new();
2914        self.client
2915            .send_versioned(
2916                reqwest::Method::PUT,
2917                &path,
2918                &query,
2919                Some(body),
2920                Some("2021-07-28"),
2921            )
2922            .await
2923    }
2924
2925    /// Batch update audience members
2926    ///
2927    /// Add or remove members in bulk from a Facebook custom audience via CSV or smart lists
2928    ///
2929    /// `PUT /ad-publishing/facebook/custom-audience/{audienceId}/member/batch`
2930    ///
2931    /// Requires scope: `adPublishing.write`.
2932    pub async fn batch_update_audience_members(
2933        &self,
2934        audience_id: &str,
2935        body: &models::UpdateCustomAudienceBatchDTO,
2936    ) -> Result<serde_json::Value> {
2937        let path = format!(
2938            "/ad-publishing/facebook/custom-audience/{}/member/batch",
2939            crate::services::encode(audience_id)
2940        );
2941        let query = Vec::new();
2942        self.client
2943            .send_versioned(
2944                reqwest::Method::PUT,
2945                &path,
2946                &query,
2947                Some(body),
2948                Some("2021-07-28"),
2949            )
2950            .await
2951    }
2952
2953    /// Get entities
2954    ///
2955    /// Retrieve Facebook campaigns, adsets, or ads based on entity type
2956    ///
2957    /// `GET /ad-publishing/facebook/entity`
2958    ///
2959    /// Requires scope: `adPublishing.readonly`.
2960    pub async fn get_entities(&self, params: &GetEntitiesParams) -> Result<serde_json::Value> {
2961        let query = params.to_query();
2962        self.client
2963            .send_versioned(
2964                reqwest::Method::GET,
2965                "/ad-publishing/facebook/entity",
2966                &query,
2967                None::<&()>,
2968                Some("2021-07-28"),
2969            )
2970            .await
2971    }
2972
2973    /// Delete Facebook integration
2974    ///
2975    /// Remove the Facebook ad integration from a location
2976    ///
2977    /// `DELETE /ad-publishing/facebook/integration`
2978    ///
2979    /// Requires scope: `adPublishing.write`.
2980    pub async fn delete_facebook_integration(
2981        &self,
2982        body: &models::LocationIdBodyDTO,
2983    ) -> Result<serde_json::Value> {
2984        let query = Vec::new();
2985        self.client
2986            .send_versioned(
2987                reqwest::Method::DELETE,
2988                "/ad-publishing/facebook/integration",
2989                &query,
2990                Some(body),
2991                Some("2021-07-28"),
2992            )
2993            .await
2994    }
2995
2996    /// Get Facebook integration
2997    ///
2998    /// Retrieve the Facebook ad integration details for a location
2999    ///
3000    /// `GET /ad-publishing/facebook/integration`
3001    ///
3002    /// Requires scope: `adPublishing.readonly`.
3003    pub async fn get_facebook_integration(
3004        &self,
3005        params: &GetFacebookIntegrationParams,
3006    ) -> Result<serde_json::Value> {
3007        let query = params.to_query();
3008        self.client
3009            .send_versioned(
3010                reqwest::Method::GET,
3011                "/ad-publishing/facebook/integration",
3012                &query,
3013                None::<&()>,
3014                Some("2021-07-28"),
3015            )
3016            .await
3017    }
3018
3019    /// Create Facebook integration
3020    ///
3021    /// Create a Facebook ad integration for a location with page and ad account
3022    ///
3023    /// `POST /ad-publishing/facebook/integration`
3024    ///
3025    /// Requires scope: `adPublishing.write`.
3026    pub async fn create_facebook_integration(
3027        &self,
3028        body: &models::CreateIntegrationDTO,
3029    ) -> Result<serde_json::Value> {
3030        let query = Vec::new();
3031        self.client
3032            .send_versioned(
3033                reqwest::Method::POST,
3034                "/ad-publishing/facebook/integration",
3035                &query,
3036                Some(body),
3037                Some("2021-07-28"),
3038            )
3039            .await
3040    }
3041
3042    /// Get lead form by ID
3043    ///
3044    /// Retrieve a specific Facebook lead form by its ID
3045    ///
3046    /// `GET /ad-publishing/facebook/lead-form/{leadFormId}`
3047    ///
3048    /// Requires scope: `adPublishing.readonly`.
3049    pub async fn get_lead_form_by_id(
3050        &self,
3051        lead_form_id: &str,
3052        params: &GetLeadFormByIdParams,
3053    ) -> Result<serde_json::Value> {
3054        let path = format!(
3055            "/ad-publishing/facebook/lead-form/{}",
3056            crate::services::encode(lead_form_id)
3057        );
3058        let query = params.to_query();
3059        self.client
3060            .send_versioned(
3061                reqwest::Method::GET,
3062                &path,
3063                &query,
3064                None::<&()>,
3065                Some("2021-07-28"),
3066            )
3067            .await
3068    }
3069
3070    /// Get current Facebook user
3071    ///
3072    /// Retrieve the authenticated Facebook user profile for a location
3073    ///
3074    /// `GET /ad-publishing/facebook/me`
3075    ///
3076    /// Requires scope: `adPublishing.readonly`.
3077    pub async fn get_current_facebook_user(
3078        &self,
3079        params: &GetCurrentFacebookUserParams,
3080    ) -> Result<serde_json::Value> {
3081        let query = params.to_query();
3082        self.client
3083            .send_versioned(
3084                reqwest::Method::GET,
3085                "/ad-publishing/facebook/me",
3086                &query,
3087                None::<&()>,
3088                Some("2021-07-28"),
3089            )
3090            .await
3091    }
3092
3093    /// Delete page connection
3094    ///
3095    /// Remove a Facebook page connection from a location
3096    ///
3097    /// `DELETE /ad-publishing/facebook/page`
3098    ///
3099    /// Requires scope: `adPublishing.write`.
3100    pub async fn delete_page_connection(
3101        &self,
3102        params: &DeletePageConnectionParams,
3103    ) -> Result<serde_json::Value> {
3104        let query = params.to_query();
3105        self.client
3106            .send_versioned(
3107                reqwest::Method::DELETE,
3108                "/ad-publishing/facebook/page",
3109                &query,
3110                None::<&()>,
3111                Some("2021-07-28"),
3112            )
3113            .await
3114    }
3115
3116    /// Set default page
3117    ///
3118    /// Set the default Facebook page for a location
3119    ///
3120    /// `PUT /ad-publishing/facebook/page/default`
3121    ///
3122    /// Requires scope: `adPublishing.write`.
3123    pub async fn set_default_page(
3124        &self,
3125        params: &SetDefaultPageParams,
3126        body: &models::FbSetDefaultPageBodyDTO,
3127    ) -> Result<serde_json::Value> {
3128        let query = params.to_query();
3129        self.client
3130            .send_versioned(
3131                reqwest::Method::PUT,
3132                "/ad-publishing/facebook/page/default",
3133                &query,
3134                Some(body),
3135                Some("2021-07-28"),
3136            )
3137            .await
3138    }
3139
3140    /// Get page lead forms
3141    ///
3142    /// Retrieve lead gen forms for a specific Facebook page
3143    ///
3144    /// `GET /ad-publishing/facebook/page/{pageId}/forms`
3145    ///
3146    /// Requires scope: `adPublishing.readonly`.
3147    pub async fn get_page_lead_forms(
3148        &self,
3149        page_id: &str,
3150        params: &GetPageLeadFormsParams,
3151    ) -> Result<serde_json::Value> {
3152        let path = format!(
3153            "/ad-publishing/facebook/page/{}/forms",
3154            crate::services::encode(page_id)
3155        );
3156        let query = params.to_query();
3157        self.client
3158            .send_versioned(
3159                reqwest::Method::GET,
3160                &path,
3161                &query,
3162                None::<&()>,
3163                Some("2021-07-28"),
3164            )
3165            .await
3166    }
3167
3168    /// Create page lead form
3169    ///
3170    /// Create a new lead gen form on a Facebook page
3171    ///
3172    /// `POST /ad-publishing/facebook/page/{pageId}/forms`
3173    ///
3174    /// Requires scope: `adPublishing.write`.
3175    pub async fn create_page_lead_form(
3176        &self,
3177        page_id: &str,
3178        body: &models::CreateLeadFormDTO,
3179    ) -> Result<serde_json::Value> {
3180        let path = format!(
3181            "/ad-publishing/facebook/page/{}/forms",
3182            crate::services::encode(page_id)
3183        );
3184        let query = Vec::new();
3185        self.client
3186            .send_versioned(
3187                reqwest::Method::POST,
3188                &path,
3189                &query,
3190                Some(body),
3191                Some("2021-07-28"),
3192            )
3193            .await
3194    }
3195
3196    /// Get Instagram accounts for page
3197    ///
3198    /// Retrieve Instagram accounts linked to a specific Facebook page
3199    ///
3200    /// `GET /ad-publishing/facebook/page/{pageId}/instagram`
3201    ///
3202    /// Requires scope: `adPublishing.readonly`.
3203    pub async fn get_instagram_accounts_for_page(
3204        &self,
3205        page_id: &str,
3206        params: &GetInstagramAccountsForPageParams,
3207    ) -> Result<serde_json::Value> {
3208        let path = format!(
3209            "/ad-publishing/facebook/page/{}/instagram",
3210            crate::services::encode(page_id)
3211        );
3212        let query = params.to_query();
3213        self.client
3214            .send_versioned(
3215                reqwest::Method::GET,
3216                &path,
3217                &query,
3218                None::<&()>,
3219                Some("2021-07-28"),
3220            )
3221            .await
3222    }
3223
3224    /// Get Facebook pages
3225    ///
3226    /// Retrieve Facebook pages associated with the connected account
3227    ///
3228    /// `GET /ad-publishing/facebook/pages`
3229    ///
3230    /// Requires scope: `adPublishing.readonly`.
3231    pub async fn get_facebook_pages(
3232        &self,
3233        params: &GetFacebookPagesParams,
3234    ) -> Result<serde_json::Value> {
3235        let query = params.to_query();
3236        self.client
3237            .send_versioned(
3238                reqwest::Method::GET,
3239                "/ad-publishing/facebook/pages",
3240                &query,
3241                None::<&()>,
3242                Some("2021-07-28"),
3243            )
3244            .await
3245    }
3246
3247    /// Get conversion pixels
3248    ///
3249    /// Retrieve Facebook conversion pixels for a location
3250    ///
3251    /// `GET /ad-publishing/facebook/pixels`
3252    ///
3253    /// Requires scope: `adPublishing.readonly`.
3254    pub async fn get_conversion_pixels(
3255        &self,
3256        params: &GetConversionPixelsParams,
3257    ) -> Result<serde_json::Value> {
3258        let query = params.to_query();
3259        self.client
3260            .send_versioned(
3261                reqwest::Method::GET,
3262                "/ad-publishing/facebook/pixels",
3263                &query,
3264                None::<&()>,
3265                Some("2021-07-28"),
3266            )
3267            .await
3268    }
3269
3270    /// Upsert conversion pixel
3271    ///
3272    /// Create or update a Facebook conversion pixel configuration
3273    ///
3274    /// `PUT /ad-publishing/facebook/pixels`
3275    ///
3276    /// Requires scope: `adPublishing.write`.
3277    pub async fn upsert_conversion_pixel(
3278        &self,
3279        body: &models::UpsertConversionPixelDTO,
3280    ) -> Result<serde_json::Value> {
3281        let query = Vec::new();
3282        self.client
3283            .send_versioned(
3284                reqwest::Method::PUT,
3285                "/ad-publishing/facebook/pixels",
3286                &query,
3287                Some(body),
3288                Some("2021-07-28"),
3289            )
3290            .await
3291    }
3292
3293    /// Get reporting data
3294    ///
3295    /// Retrieve aggregated Facebook ad reporting metrics for a location
3296    ///
3297    /// `GET /ad-publishing/facebook/reporting`
3298    ///
3299    /// Requires scope: `adPublishing.readonly`.
3300    pub async fn get_reporting_data(
3301        &self,
3302        params: &GetReportingDataParams,
3303    ) -> Result<serde_json::Value> {
3304        let query = params.to_query();
3305        self.client
3306            .send_versioned(
3307                reqwest::Method::GET,
3308                "/ad-publishing/facebook/reporting",
3309                &query,
3310                None::<&()>,
3311                Some("2021-07-28"),
3312            )
3313            .await
3314    }
3315
3316    /// Get campaign reporting
3317    ///
3318    /// Retrieve reporting metrics for a specific Facebook campaign
3319    ///
3320    /// `GET /ad-publishing/facebook/reporting/campaign/{campaignId}`
3321    ///
3322    /// Requires scope: `adPublishing.readonly`.
3323    pub async fn get_campaign_reporting(
3324        &self,
3325        campaign_id: &str,
3326        params: &GetCampaignReportingParams,
3327    ) -> Result<serde_json::Value> {
3328        let path = format!(
3329            "/ad-publishing/facebook/reporting/campaign/{}",
3330            crate::services::encode(campaign_id)
3331        );
3332        let query = params.to_query();
3333        self.client
3334            .send_versioned(
3335                reqwest::Method::GET,
3336                &path,
3337                &query,
3338                None::<&()>,
3339                Some("2021-07-28"),
3340            )
3341            .await
3342    }
3343
3344    /// Get reporting list
3345    ///
3346    /// Retrieve a list of Facebook campaigns, adsets, or ads with reporting data
3347    ///
3348    /// `GET /ad-publishing/facebook/reporting/list`
3349    ///
3350    /// Requires scope: `adPublishing.readonly`.
3351    pub async fn get_reporting_list(
3352        &self,
3353        params: &GetReportingListParams,
3354    ) -> Result<serde_json::Value> {
3355        let query = params.to_query();
3356        self.client
3357            .send_versioned(
3358                reqwest::Method::GET,
3359                "/ad-publishing/facebook/reporting/list",
3360                &query,
3361                None::<&()>,
3362                Some("2021-07-28"),
3363            )
3364            .await
3365    }
3366
3367    /// Search targeting options
3368    ///
3369    /// Search Facebook geo-locations and interests for ad targeting
3370    ///
3371    /// `GET /ad-publishing/facebook/targeting/search`
3372    pub async fn search_targeting_options(
3373        &self,
3374        params: &SearchTargetingOptionsParams,
3375    ) -> Result<serde_json::Value> {
3376        let query = params.to_query();
3377        self.client
3378            .send_versioned(
3379                reqwest::Method::GET,
3380                "/ad-publishing/facebook/targeting/search",
3381                &query,
3382                None::<&()>,
3383                Some("2021-07-28"),
3384            )
3385            .await
3386    }
3387
3388    /// Get Google ad accounts
3389    ///
3390    /// Retrieve Google Ads accounts available for the connected user
3391    ///
3392    /// `GET /ad-publishing/google/ad-accounts`
3393    ///
3394    /// Requires scope: `adPublishing.readonly`.
3395    pub async fn get_google_ad_accounts(
3396        &self,
3397        params: &GetGoogleAdAccountsParams,
3398    ) -> Result<serde_json::Value> {
3399        let query = params.to_query();
3400        self.client
3401            .send_versioned(
3402                reqwest::Method::GET,
3403                "/ad-publishing/google/ad-accounts",
3404                &query,
3405                None::<&()>,
3406                Some("2021-07-28"),
3407            )
3408            .await
3409    }
3410
3411    /// Delete ad account
3412    ///
3413    /// Remove a Google Ads account connection from a location
3414    ///
3415    /// `DELETE /ad-publishing/google/ad-accounts/{adAccountId}`
3416    ///
3417    /// Requires scope: `adPublishing.write`.
3418    pub async fn delete_ad_account_op(
3419        &self,
3420        ad_account_id: &str,
3421        body: &models::LocationIdBodyDTO,
3422    ) -> Result<serde_json::Value> {
3423        let path = format!(
3424            "/ad-publishing/google/ad-accounts/{}",
3425            crate::services::encode(ad_account_id)
3426        );
3427        let query = Vec::new();
3428        self.client
3429            .send_versioned(
3430                reqwest::Method::DELETE,
3431                &path,
3432                &query,
3433                Some(body),
3434                Some("2021-07-28"),
3435            )
3436            .await
3437    }
3438
3439    /// Get ad account details
3440    ///
3441    /// Retrieve details of a specific Google Ads account
3442    ///
3443    /// `GET /ad-publishing/google/ad-accounts/{adAccountId}`
3444    ///
3445    /// Requires scope: `adPublishing.readonly`.
3446    pub async fn get_ad_account_details_op(
3447        &self,
3448        ad_account_id: &str,
3449        params: &GetAdAccountDetailsOpParams,
3450    ) -> Result<serde_json::Value> {
3451        let path = format!(
3452            "/ad-publishing/google/ad-accounts/{}",
3453            crate::services::encode(ad_account_id)
3454        );
3455        let query = params.to_query();
3456        self.client
3457            .send_versioned(
3458                reqwest::Method::GET,
3459                &path,
3460                &query,
3461                None::<&()>,
3462                Some("2021-07-28"),
3463            )
3464            .await
3465    }
3466
3467    /// Upsert Google campaign
3468    ///
3469    /// Create or update a full Google Ads campaign structure
3470    ///
3471    /// `PUT /ad-publishing/google/ads`
3472    ///
3473    /// Requires scope: `adPublishing.write`.
3474    pub async fn upsert_google_campaign(
3475        &self,
3476        body: &models::CampaignDTO,
3477    ) -> Result<serde_json::Value> {
3478        let query = Vec::new();
3479        self.client
3480            .send_versioned(
3481                reqwest::Method::PUT,
3482                "/ad-publishing/google/ads",
3483                &query,
3484                Some(body),
3485                Some("2021-07-28"),
3486            )
3487            .await
3488    }
3489
3490    /// Get Google campaign by ID
3491    ///
3492    /// Retrieve a specific Google Ads campaign by ID
3493    ///
3494    /// `GET /ad-publishing/google/ads/{adId}`
3495    ///
3496    /// Requires scope: `adPublishing.readonly`.
3497    pub async fn get_google_campaign_by_id(
3498        &self,
3499        ad_id: &str,
3500        params: &GetGoogleCampaignByIdParams,
3501    ) -> Result<serde_json::Value> {
3502        let path = format!(
3503            "/ad-publishing/google/ads/{}",
3504            crate::services::encode(ad_id)
3505        );
3506        let query = params.to_query();
3507        self.client
3508            .send_versioned(
3509                reqwest::Method::GET,
3510                &path,
3511                &query,
3512                None::<&()>,
3513                Some("2021-07-28"),
3514            )
3515            .await
3516    }
3517
3518    /// Publish ad
3519    ///
3520    /// Publish a Google ad and push it live
3521    ///
3522    /// `POST /ad-publishing/google/ads/{adId}/publish`
3523    ///
3524    /// Requires scope: `adPublishing.write`.
3525    pub async fn publish_ad(&self, ad_id: &str) -> Result<serde_json::Value> {
3526        let path = format!(
3527            "/ad-publishing/google/ads/{}/publish",
3528            crate::services::encode(ad_id)
3529        );
3530        let query = Vec::new();
3531        self.client
3532            .send_versioned(
3533                reqwest::Method::POST,
3534                &path,
3535                &query,
3536                None::<&()>,
3537                Some("2021-07-28"),
3538            )
3539            .await
3540    }
3541
3542    /// Get assets
3543    ///
3544    /// Retrieve Google Ads creative assets for a location
3545    ///
3546    /// `GET /ad-publishing/google/assets`
3547    ///
3548    /// Requires scope: `adPublishing.readonly`.
3549    pub async fn get_assets(&self, params: &GetAssetsParams) -> Result<serde_json::Value> {
3550        let query = params.to_query();
3551        self.client
3552            .send_versioned(
3553                reqwest::Method::GET,
3554                "/ad-publishing/google/assets",
3555                &query,
3556                None::<&()>,
3557                Some("2021-07-28"),
3558            )
3559            .await
3560    }
3561
3562    /// Upsert assets
3563    ///
3564    /// Create or update Google Ads creative assets
3565    ///
3566    /// `POST /ad-publishing/google/assets`
3567    ///
3568    /// Requires scope: `adPublishing.write`.
3569    pub async fn upsert_assets(&self, body: &models::UpsertAssetsDTO) -> Result<serde_json::Value> {
3570        let query = Vec::new();
3571        self.client
3572            .send_versioned(
3573                reqwest::Method::POST,
3574                "/ad-publishing/google/assets",
3575                &query,
3576                Some(body),
3577                Some("2021-07-28"),
3578            )
3579            .await
3580    }
3581
3582    /// Get audiences
3583    ///
3584    /// Retrieve Google Ads combined audiences for a location
3585    ///
3586    /// `GET /ad-publishing/google/audiences`
3587    ///
3588    /// Requires scope: `adPublishing.readonly`.
3589    pub async fn get_audiences(&self, params: &GetAudiencesParams) -> Result<serde_json::Value> {
3590        let query = params.to_query();
3591        self.client
3592            .send_versioned(
3593                reqwest::Method::GET,
3594                "/ad-publishing/google/audiences",
3595                &query,
3596                None::<&()>,
3597                Some("2021-07-28"),
3598            )
3599            .await
3600    }
3601
3602    /// Upsert audience
3603    ///
3604    /// Create or update a Google Ads combined audience
3605    ///
3606    /// `PUT /ad-publishing/google/audiences`
3607    ///
3608    /// Requires scope: `adPublishing.write`.
3609    pub async fn upsert_audience(
3610        &self,
3611        body: &models::UpsertAudienceDTO,
3612    ) -> Result<serde_json::Value> {
3613        let query = Vec::new();
3614        self.client
3615            .send_versioned(
3616                reqwest::Method::PUT,
3617                "/ad-publishing/google/audiences",
3618                &query,
3619                Some(body),
3620                Some("2021-07-28"),
3621            )
3622            .await
3623    }
3624
3625    /// Get audience by ID
3626    ///
3627    /// Retrieve a specific Google Ads combined audience by ID
3628    ///
3629    /// `GET /ad-publishing/google/audiences/{audienceId}`
3630    ///
3631    /// Requires scope: `adPublishing.readonly`.
3632    pub async fn get_audience_by_id(
3633        &self,
3634        audience_id: &str,
3635        params: &GetAudienceByIdParams,
3636    ) -> Result<serde_json::Value> {
3637        let path = format!(
3638            "/ad-publishing/google/audiences/{}",
3639            crate::services::encode(audience_id)
3640        );
3641        let query = params.to_query();
3642        self.client
3643            .send_versioned(
3644                reqwest::Method::GET,
3645                &path,
3646                &query,
3647                None::<&()>,
3648                Some("2021-07-28"),
3649            )
3650            .await
3651    }
3652
3653    /// Get conversion goals
3654    ///
3655    /// Retrieve Google Ads conversion goals for a location
3656    ///
3657    /// `GET /ad-publishing/google/conversion-goals`
3658    ///
3659    /// Requires scope: `adPublishing.readonly`.
3660    pub async fn get_conversion_goals(
3661        &self,
3662        params: &GetConversionGoalsParams,
3663    ) -> Result<serde_json::Value> {
3664        let query = params.to_query();
3665        self.client
3666            .send_versioned(
3667                reqwest::Method::GET,
3668                "/ad-publishing/google/conversion-goals",
3669                &query,
3670                None::<&()>,
3671                Some("2021-07-28"),
3672            )
3673            .await
3674    }
3675
3676    /// Get conversions
3677    ///
3678    /// Retrieve Google Ads conversion actions for a location
3679    ///
3680    /// `GET /ad-publishing/google/conversions`
3681    ///
3682    /// Requires scope: `adPublishing.readonly`.
3683    pub async fn get_conversions(
3684        &self,
3685        params: &GetConversionsParams,
3686    ) -> Result<serde_json::Value> {
3687        let query = params.to_query();
3688        self.client
3689            .send_versioned(
3690                reqwest::Method::GET,
3691                "/ad-publishing/google/conversions",
3692                &query,
3693                None::<&()>,
3694                Some("2021-07-28"),
3695            )
3696            .await
3697    }
3698
3699    /// Upsert conversion
3700    ///
3701    /// Create or update a Google Ads conversion action
3702    ///
3703    /// `PUT /ad-publishing/google/conversions`
3704    ///
3705    /// Requires scope: `adPublishing.write`.
3706    pub async fn upsert_conversion(
3707        &self,
3708        body: &models::UpsertConversionDTO,
3709    ) -> Result<serde_json::Value> {
3710        let query = Vec::new();
3711        self.client
3712            .send_versioned(
3713                reqwest::Method::PUT,
3714                "/ad-publishing/google/conversions",
3715                &query,
3716                Some(body),
3717                Some("2021-07-28"),
3718            )
3719            .await
3720    }
3721
3722    /// Delete conversion
3723    ///
3724    /// Delete a Google Ads conversion action by ID
3725    ///
3726    /// `DELETE /ad-publishing/google/conversions/{conversionId}`
3727    ///
3728    /// Requires scope: `adPublishing.write`.
3729    pub async fn delete_conversion(
3730        &self,
3731        conversion_id: &str,
3732        params: &DeleteConversionParams,
3733    ) -> Result<serde_json::Value> {
3734        let path = format!(
3735            "/ad-publishing/google/conversions/{}",
3736            crate::services::encode(conversion_id)
3737        );
3738        let query = params.to_query();
3739        self.client
3740            .send_versioned(
3741                reqwest::Method::DELETE,
3742                &path,
3743                &query,
3744                None::<&()>,
3745                Some("2021-07-28"),
3746            )
3747            .await
3748    }
3749
3750    /// Get conversion by ID
3751    ///
3752    /// Retrieve a specific Google Ads conversion action by ID
3753    ///
3754    /// `GET /ad-publishing/google/conversions/{conversionId}`
3755    ///
3756    /// Requires scope: `adPublishing.readonly`.
3757    pub async fn get_conversion_by_id(
3758        &self,
3759        conversion_id: &str,
3760        params: &GetConversionByIdParams,
3761    ) -> Result<serde_json::Value> {
3762        let path = format!(
3763            "/ad-publishing/google/conversions/{}",
3764            crate::services::encode(conversion_id)
3765        );
3766        let query = params.to_query();
3767        self.client
3768            .send_versioned(
3769                reqwest::Method::GET,
3770                &path,
3771                &query,
3772                None::<&()>,
3773                Some("2021-07-28"),
3774            )
3775            .await
3776    }
3777
3778    /// Get entities
3779    ///
3780    /// Retrieve Google campaigns, ad groups, or ads based on entity type
3781    ///
3782    /// `GET /ad-publishing/google/entity`
3783    ///
3784    /// Requires scope: `adPublishing.readonly`.
3785    pub async fn get_entities_op(&self, params: &GetEntitiesOpParams) -> Result<serde_json::Value> {
3786        let query = params.to_query();
3787        self.client
3788            .send_versioned(
3789                reqwest::Method::GET,
3790                "/ad-publishing/google/entity",
3791                &query,
3792                None::<&()>,
3793                Some("2021-07-28"),
3794            )
3795            .await
3796    }
3797
3798    /// Get Google integration
3799    ///
3800    /// Retrieve the Google Ads integration details for a location
3801    ///
3802    /// `GET /ad-publishing/google/integration`
3803    ///
3804    /// Requires scope: `adPublishing.readonly`.
3805    pub async fn get_google_integration(
3806        &self,
3807        params: &GetGoogleIntegrationParams,
3808    ) -> Result<serde_json::Value> {
3809        let query = params.to_query();
3810        self.client
3811            .send_versioned(
3812                reqwest::Method::GET,
3813                "/ad-publishing/google/integration",
3814                &query,
3815                None::<&()>,
3816                Some("2021-07-28"),
3817            )
3818            .await
3819    }
3820
3821    /// Create Google integration
3822    ///
3823    /// Create a Google Ads integration for a location
3824    ///
3825    /// `POST /ad-publishing/google/integration`
3826    ///
3827    /// Requires scope: `adPublishing.write`.
3828    pub async fn create_google_integration(
3829        &self,
3830        body: &models::CreateGoogleIntegrationDTO,
3831    ) -> Result<serde_json::Value> {
3832        let query = Vec::new();
3833        self.client
3834            .send_versioned(
3835                reqwest::Method::POST,
3836                "/ad-publishing/google/integration",
3837                &query,
3838                Some(body),
3839                Some("2021-07-28"),
3840            )
3841            .await
3842    }
3843
3844    /// Get keyword ideas
3845    ///
3846    /// Retrieve keyword suggestions for Google Ads campaigns
3847    ///
3848    /// `POST /ad-publishing/google/keyword-ideas`
3849    ///
3850    /// Requires scope: `adPublishing.readonly`.
3851    pub async fn get_keyword_ideas(
3852        &self,
3853        params: &GetKeywordIdeasParams,
3854        body: &models::KeywordSuggestionDTO,
3855    ) -> Result<serde_json::Value> {
3856        let query = params.to_query();
3857        self.client
3858            .send_versioned(
3859                reqwest::Method::POST,
3860                "/ad-publishing/google/keyword-ideas",
3861                &query,
3862                Some(body),
3863                Some("2021-07-28"),
3864            )
3865            .await
3866    }
3867
3868    /// Get current Google user
3869    ///
3870    /// Retrieve the authenticated Google user info for a location
3871    ///
3872    /// `GET /ad-publishing/google/me`
3873    ///
3874    /// Requires scope: `adPublishing.readonly`.
3875    pub async fn get_current_google_user(
3876        &self,
3877        params: &GetCurrentGoogleUserParams,
3878    ) -> Result<serde_json::Value> {
3879        let query = params.to_query();
3880        self.client
3881            .send_versioned(
3882                reqwest::Method::GET,
3883                "/ad-publishing/google/me",
3884                &query,
3885                None::<&()>,
3886                Some("2021-07-28"),
3887            )
3888            .await
3889    }
3890
3891    /// Get reporting data
3892    ///
3893    /// Retrieve aggregated Google Ads reporting metrics for a location
3894    ///
3895    /// `GET /ad-publishing/google/reporting`
3896    ///
3897    /// Requires scope: `adPublishing.readonly`.
3898    pub async fn get_reporting_data_op(
3899        &self,
3900        params: &GetReportingDataOpParams,
3901    ) -> Result<serde_json::Value> {
3902        let query = params.to_query();
3903        self.client
3904            .send_versioned(
3905                reqwest::Method::GET,
3906                "/ad-publishing/google/reporting",
3907                &query,
3908                None::<&()>,
3909                Some("2021-07-28"),
3910            )
3911            .await
3912    }
3913
3914    /// Get campaign reporting
3915    ///
3916    /// Retrieve reporting metrics for a specific Google campaign
3917    ///
3918    /// `GET /ad-publishing/google/reporting/campaign/{campaignId}`
3919    ///
3920    /// Requires scope: `adPublishing.readonly`.
3921    pub async fn get_campaign_reporting_op(
3922        &self,
3923        campaign_id: &str,
3924        params: &GetCampaignReportingOpParams,
3925    ) -> Result<serde_json::Value> {
3926        let path = format!(
3927            "/ad-publishing/google/reporting/campaign/{}",
3928            crate::services::encode(campaign_id)
3929        );
3930        let query = params.to_query();
3931        self.client
3932            .send_versioned(
3933                reqwest::Method::GET,
3934                &path,
3935                &query,
3936                None::<&()>,
3937                Some("2021-07-28"),
3938            )
3939            .await
3940    }
3941
3942    /// Get reporting list
3943    ///
3944    /// Retrieve a list of Google campaigns or ad groups with reporting data
3945    ///
3946    /// `GET /ad-publishing/google/reporting/list`
3947    ///
3948    /// Requires scope: `adPublishing.readonly`.
3949    pub async fn get_reporting_list_op(
3950        &self,
3951        params: &GetReportingListOpParams,
3952    ) -> Result<serde_json::Value> {
3953        let query = params.to_query();
3954        self.client
3955            .send_versioned(
3956                reqwest::Method::GET,
3957                "/ad-publishing/google/reporting/list",
3958                &query,
3959                None::<&()>,
3960                Some("2021-07-28"),
3961            )
3962            .await
3963    }
3964
3965    /// Get segments
3966    ///
3967    /// Retrieve Google Ads audience segments for a location
3968    ///
3969    /// `GET /ad-publishing/google/segments`
3970    ///
3971    /// Requires scope: `adPublishing.readonly`.
3972    pub async fn get_segments(&self, params: &GetSegmentsParams) -> Result<serde_json::Value> {
3973        let query = params.to_query();
3974        self.client
3975            .send_versioned(
3976                reqwest::Method::GET,
3977                "/ad-publishing/google/segments",
3978                &query,
3979                None::<&()>,
3980                Some("2021-07-28"),
3981            )
3982            .await
3983    }
3984
3985    /// Upsert segment
3986    ///
3987    /// Create or update a Google Ads audience segment
3988    ///
3989    /// `PUT /ad-publishing/google/segments`
3990    ///
3991    /// Requires scope: `adPublishing.write`.
3992    pub async fn upsert_segment(
3993        &self,
3994        params: &UpsertSegmentParams,
3995        body: &models::UpsertSegmentDTO,
3996    ) -> Result<serde_json::Value> {
3997        let query = params.to_query();
3998        self.client
3999            .send_versioned(
4000                reqwest::Method::PUT,
4001                "/ad-publishing/google/segments",
4002                &query,
4003                Some(body),
4004                Some("2021-07-28"),
4005            )
4006            .await
4007    }
4008
4009    /// Create offline user list job
4010    ///
4011    /// Create a job to upload users to a Google customer match list
4012    ///
4013    /// `POST /ad-publishing/google/segments/offline-user-list-job`
4014    ///
4015    /// Requires scope: `adPublishing.write`.
4016    pub async fn create_offline_user_list_job(
4017        &self,
4018        body: &models::CreateOfflineUserListJobDTO,
4019    ) -> Result<serde_json::Value> {
4020        let query = Vec::new();
4021        self.client
4022            .send_versioned(
4023                reqwest::Method::POST,
4024                "/ad-publishing/google/segments/offline-user-list-job",
4025                &query,
4026                Some(body),
4027                Some("2021-07-28"),
4028            )
4029            .await
4030    }
4031
4032    /// Delete segment
4033    ///
4034    /// Delete a Google Ads audience segment by ID
4035    ///
4036    /// `DELETE /ad-publishing/google/segments/{segmentId}`
4037    ///
4038    /// Requires scope: `adPublishing.write`.
4039    pub async fn delete_segment(
4040        &self,
4041        segment_id: &str,
4042        params: &DeleteSegmentParams,
4043    ) -> Result<serde_json::Value> {
4044        let path = format!(
4045            "/ad-publishing/google/segments/{}",
4046            crate::services::encode(segment_id)
4047        );
4048        let query = params.to_query();
4049        self.client
4050            .send_versioned(
4051                reqwest::Method::DELETE,
4052                &path,
4053                &query,
4054                None::<&()>,
4055                Some("2021-07-28"),
4056            )
4057            .await
4058    }
4059
4060    /// Get segment by ID
4061    ///
4062    /// Retrieve a specific Google Ads audience segment by ID
4063    ///
4064    /// `GET /ad-publishing/google/segments/{segmentId}`
4065    ///
4066    /// Requires scope: `adPublishing.readonly`.
4067    pub async fn get_segment_by_id(
4068        &self,
4069        segment_id: &str,
4070        params: &GetSegmentByIdParams,
4071    ) -> Result<serde_json::Value> {
4072        let path = format!(
4073            "/ad-publishing/google/segments/{}",
4074            crate::services::encode(segment_id)
4075        );
4076        let query = params.to_query();
4077        self.client
4078            .send_versioned(
4079                reqwest::Method::GET,
4080                &path,
4081                &query,
4082                None::<&()>,
4083                Some("2021-07-28"),
4084            )
4085            .await
4086    }
4087
4088    /// Get target interests
4089    ///
4090    /// Retrieve affinity and in-market audience options for Google Ads targeting
4091    ///
4092    /// `GET /ad-publishing/google/target-interests`
4093    ///
4094    /// Requires scope: `adPublishing.readonly`.
4095    pub async fn get_target_interests(
4096        &self,
4097        params: &GetTargetInterestsParams,
4098    ) -> Result<serde_json::Value> {
4099        let query = params.to_query();
4100        self.client
4101            .send_versioned(
4102                reqwest::Method::GET,
4103                "/ad-publishing/google/target-interests",
4104                &query,
4105                None::<&()>,
4106                Some("2021-07-28"),
4107            )
4108            .await
4109    }
4110
4111    /// Search targeting options
4112    ///
4113    /// Search Google geo-locations for ad targeting
4114    ///
4115    /// `GET /ad-publishing/google/targeting/search`
4116    ///
4117    /// Requires scope: `adPublishing.readonly`.
4118    pub async fn search_targeting_options_op(
4119        &self,
4120        params: &SearchTargetingOptionsOpParams,
4121    ) -> Result<serde_json::Value> {
4122        let query = params.to_query();
4123        self.client
4124            .send_versioned(
4125                reqwest::Method::GET,
4126                "/ad-publishing/google/targeting/search",
4127                &query,
4128                None::<&()>,
4129                Some("2021-07-28"),
4130            )
4131            .await
4132    }
4133
4134    /// Delete ad account
4135    ///
4136    /// Remove a LinkedIn ad account connection from a location
4137    ///
4138    /// `DELETE /ad-publishing/linkedin/ad-account`
4139    ///
4140    /// Requires scope: `adPublishing.write`.
4141    pub async fn delete_ad_account_op2(
4142        &self,
4143        params: &DeleteAdAccountOp2Params,
4144    ) -> Result<serde_json::Value> {
4145        let query = params.to_query();
4146        self.client
4147            .send_versioned(
4148                reqwest::Method::DELETE,
4149                "/ad-publishing/linkedin/ad-account",
4150                &query,
4151                None::<&()>,
4152                Some("2021-07-28"),
4153            )
4154            .await
4155    }
4156
4157    /// Get ad account details
4158    ///
4159    /// Retrieve details of a specific LinkedIn ad account
4160    ///
4161    /// `GET /ad-publishing/linkedin/ad-account`
4162    ///
4163    /// Requires scope: `adPublishing.readonly`.
4164    pub async fn get_ad_account_details_op2(
4165        &self,
4166        params: &GetAdAccountDetailsOp2Params,
4167    ) -> Result<serde_json::Value> {
4168        let query = params.to_query();
4169        self.client
4170            .send_versioned(
4171                reqwest::Method::GET,
4172                "/ad-publishing/linkedin/ad-account",
4173                &query,
4174                None::<&()>,
4175                Some("2021-07-28"),
4176            )
4177            .await
4178    }
4179
4180    /// Get LinkedIn ad accounts
4181    ///
4182    /// Retrieve LinkedIn Ads accounts available for the connected user
4183    ///
4184    /// `GET /ad-publishing/linkedin/ad-accounts`
4185    ///
4186    /// Requires scope: `adPublishing.readonly`.
4187    pub async fn get_linked_in_ad_accounts(
4188        &self,
4189        params: &GetLinkedInAdAccountsParams,
4190    ) -> Result<serde_json::Value> {
4191        let query = params.to_query();
4192        self.client
4193            .send_versioned(
4194                reqwest::Method::GET,
4195                "/ad-publishing/linkedin/ad-accounts",
4196                &query,
4197                None::<&()>,
4198                Some("2021-07-28"),
4199            )
4200            .await
4201    }
4202
4203    /// Upsert ad campaign group
4204    ///
4205    /// Create or update a LinkedIn ad campaign group with campaigns and ads
4206    ///
4207    /// `PUT /ad-publishing/linkedin/ads`
4208    ///
4209    /// Requires scope: `adPublishing.write`.
4210    pub async fn upsert_ad_campaign_group(
4211        &self,
4212        body: &models::AdCampaignGroupDataDTO,
4213    ) -> Result<serde_json::Value> {
4214        let query = Vec::new();
4215        self.client
4216            .send_versioned(
4217                reqwest::Method::PUT,
4218                "/ad-publishing/linkedin/ads",
4219                &query,
4220                Some(body),
4221                Some("2021-07-28"),
4222            )
4223            .await
4224    }
4225
4226    /// Get ad campaign group
4227    ///
4228    /// Retrieve a LinkedIn ad campaign group by ID
4229    ///
4230    /// `GET /ad-publishing/linkedin/ads/{adId}`
4231    ///
4232    /// Requires scope: `adPublishing.readonly`.
4233    pub async fn get_ad_campaign_group(
4234        &self,
4235        ad_id: &str,
4236        params: &GetAdCampaignGroupParams,
4237    ) -> Result<serde_json::Value> {
4238        let path = format!(
4239            "/ad-publishing/linkedin/ads/{}",
4240            crate::services::encode(ad_id)
4241        );
4242        let query = params.to_query();
4243        self.client
4244            .send_versioned(
4245                reqwest::Method::GET,
4246                &path,
4247                &query,
4248                None::<&()>,
4249                Some("2021-07-28"),
4250            )
4251            .await
4252    }
4253
4254    /// Publish ad campaign group
4255    ///
4256    /// Publish a LinkedIn ad campaign group and push it live
4257    ///
4258    /// `POST /ad-publishing/linkedin/ads/{adId}/publish`
4259    ///
4260    /// Requires scope: `adPublishing.write`.
4261    pub async fn publish_ad_campaign_group(
4262        &self,
4263        ad_id: &str,
4264        body: &models::LocationIdBodyDTO,
4265    ) -> Result<serde_json::Value> {
4266        let path = format!(
4267            "/ad-publishing/linkedin/ads/{}/publish",
4268            crate::services::encode(ad_id)
4269        );
4270        let query = Vec::new();
4271        self.client
4272            .send_versioned(
4273                reqwest::Method::POST,
4274                &path,
4275                &query,
4276                Some(body),
4277                Some("2021-07-28"),
4278            )
4279            .await
4280    }
4281
4282    /// Get LinkedIn integration
4283    ///
4284    /// Retrieve the LinkedIn Ads integration details for a location
4285    ///
4286    /// `GET /ad-publishing/linkedin/integration`
4287    ///
4288    /// Requires scope: `adPublishing.readonly`.
4289    pub async fn get_linked_in_integration(
4290        &self,
4291        params: &GetLinkedInIntegrationParams,
4292    ) -> Result<serde_json::Value> {
4293        let query = params.to_query();
4294        self.client
4295            .send_versioned(
4296                reqwest::Method::GET,
4297                "/ad-publishing/linkedin/integration",
4298                &query,
4299                None::<&()>,
4300                Some("2021-07-28"),
4301            )
4302            .await
4303    }
4304
4305    /// Create LinkedIn integration
4306    ///
4307    /// Create a LinkedIn Ads integration for a location with ad account details
4308    ///
4309    /// `POST /ad-publishing/linkedin/integration`
4310    ///
4311    /// Requires scope: `adPublishing.write`.
4312    pub async fn create_linked_in_integration(
4313        &self,
4314        body: &models::CreateLinkedinIntegrationDTO,
4315    ) -> Result<serde_json::Value> {
4316        let query = Vec::new();
4317        self.client
4318            .send_versioned(
4319                reqwest::Method::POST,
4320                "/ad-publishing/linkedin/integration",
4321                &query,
4322                Some(body),
4323                Some("2021-07-28"),
4324            )
4325            .await
4326    }
4327
4328    /// Get current LinkedIn user
4329    ///
4330    /// Retrieve the authenticated LinkedIn user info for a location
4331    ///
4332    /// `GET /ad-publishing/linkedin/me`
4333    ///
4334    /// Requires scope: `adPublishing.readonly`.
4335    pub async fn get_current_linked_in_user(
4336        &self,
4337        params: &GetCurrentLinkedInUserParams,
4338    ) -> Result<serde_json::Value> {
4339        let query = params.to_query();
4340        self.client
4341            .send_versioned(
4342                reqwest::Method::GET,
4343                "/ad-publishing/linkedin/me",
4344                &query,
4345                None::<&()>,
4346                Some("2021-07-28"),
4347            )
4348            .await
4349    }
4350
4351    /// Get ad analytics
4352    ///
4353    /// Retrieve LinkedIn Ads analytics data with configurable pivot and time grouping
4354    ///
4355    /// `GET /ad-publishing/linkedin/reporting`
4356    ///
4357    /// Requires scope: `adPublishing.readonly`.
4358    pub async fn get_ad_analytics(
4359        &self,
4360        params: &GetAdAnalyticsParams,
4361    ) -> Result<serde_json::Value> {
4362        let query = params.to_query();
4363        self.client
4364            .send_versioned(
4365                reqwest::Method::GET,
4366                "/ad-publishing/linkedin/reporting",
4367                &query,
4368                None::<&()>,
4369                Some("2021-07-28"),
4370            )
4371            .await
4372    }
4373
4374    /// Get campaign group reporting
4375    ///
4376    /// Retrieve reporting metrics for a specific LinkedIn campaign group
4377    ///
4378    /// `GET /ad-publishing/linkedin/reporting/campaign-group/{campaignGroupId}`
4379    ///
4380    /// Requires scope: `adPublishing.readonly`.
4381    pub async fn get_campaign_group_reporting(
4382        &self,
4383        campaign_group_id: &str,
4384        params: &GetCampaignGroupReportingParams,
4385    ) -> Result<serde_json::Value> {
4386        let path = format!(
4387            "/ad-publishing/linkedin/reporting/campaign-group/{}",
4388            crate::services::encode(campaign_group_id)
4389        );
4390        let query = params.to_query();
4391        self.client
4392            .send_versioned(
4393                reqwest::Method::GET,
4394                &path,
4395                &query,
4396                None::<&()>,
4397                Some("2021-07-28"),
4398            )
4399            .await
4400    }
4401
4402    /// Get reporting list
4403    ///
4404    /// Retrieve a list of LinkedIn campaigns or campaign groups with reporting data
4405    ///
4406    /// `GET /ad-publishing/linkedin/reporting/list`
4407    ///
4408    /// Requires scope: `adPublishing.readonly`.
4409    pub async fn get_reporting_list_op2(
4410        &self,
4411        params: &GetReportingListOp2Params,
4412    ) -> Result<serde_json::Value> {
4413        let query = params.to_query();
4414        self.client
4415            .send_versioned(
4416                reqwest::Method::GET,
4417                "/ad-publishing/linkedin/reporting/list",
4418                &query,
4419                None::<&()>,
4420                Some("2021-07-28"),
4421            )
4422            .await
4423    }
4424
4425    /// Search targeting options
4426    ///
4427    /// Search LinkedIn targeting facets such as locations, industries, and job titles
4428    ///
4429    /// `GET /ad-publishing/linkedin/targeting/search`
4430    ///
4431    /// Requires scope: `adPublishing.readonly`.
4432    pub async fn search_targeting_options_op2(
4433        &self,
4434        params: &SearchTargetingOptionsOp2Params,
4435    ) -> Result<serde_json::Value> {
4436        let query = params.to_query();
4437        self.client
4438            .send_versioned(
4439                reqwest::Method::GET,
4440                "/ad-publishing/linkedin/targeting/search",
4441                &query,
4442                None::<&()>,
4443                Some("2021-07-28"),
4444            )
4445            .await
4446    }
4447
4448    /// Create lead form
4449    ///
4450    /// Create a new LinkedIn lead gen form for an ad account
4451    ///
4452    /// `POST /ad-publishing/linkedin/{accountId}/form`
4453    ///
4454    /// Requires scope: `adPublishing.write`.
4455    pub async fn create_lead_form(
4456        &self,
4457        account_id: &str,
4458        params: &CreateLeadFormParams,
4459        body: &models::LinkedInCreateLeadFormBodyDTO,
4460    ) -> Result<serde_json::Value> {
4461        let path = format!(
4462            "/ad-publishing/linkedin/{}/form",
4463            crate::services::encode(account_id)
4464        );
4465        let query = params.to_query();
4466        self.client
4467            .send_versioned(
4468                reqwest::Method::POST,
4469                &path,
4470                &query,
4471                Some(body),
4472                Some("2021-07-28"),
4473            )
4474            .await
4475    }
4476
4477    /// Get lead forms
4478    ///
4479    /// Retrieve LinkedIn lead gen forms for an ad account
4480    ///
4481    /// `GET /ad-publishing/linkedin/{accountId}/forms`
4482    ///
4483    /// Requires scope: `adPublishing.readonly`.
4484    pub async fn get_lead_forms(
4485        &self,
4486        account_id: &str,
4487        params: &GetLeadFormsParams,
4488    ) -> Result<serde_json::Value> {
4489        let path = format!(
4490            "/ad-publishing/linkedin/{}/forms",
4491            crate::services::encode(account_id)
4492        );
4493        let query = params.to_query();
4494        self.client
4495            .send_versioned(
4496                reqwest::Method::GET,
4497                &path,
4498                &query,
4499                None::<&()>,
4500                Some("2021-07-28"),
4501            )
4502            .await
4503    }
4504
4505    /// Update ad status
4506    ///
4507    /// Pause or resume a LinkedIn ad, campaign, or ad group
4508    ///
4509    /// `PATCH /ad-publishing/linkedin/{adId}/status`
4510    ///
4511    /// Requires scope: `adPublishing.write`.
4512    pub async fn update_ad_status(
4513        &self,
4514        ad_id: &str,
4515        params: &UpdateAdStatusParams,
4516        body: &models::LinkedInUpdateAdStatusBodyDTO,
4517    ) -> Result<serde_json::Value> {
4518        let path = format!(
4519            "/ad-publishing/linkedin/{}/status",
4520            crate::services::encode(ad_id)
4521        );
4522        let query = params.to_query();
4523        self.client
4524            .send_versioned(
4525                reqwest::Method::PATCH,
4526                &path,
4527                &query,
4528                Some(body),
4529                Some("2021-07-28"),
4530            )
4531            .await
4532    }
4533}