#![allow(clippy::too_many_arguments)]
use crate::client::Ghl;
use crate::error::Result;
use ghl_models::v3::ad_publishing as models;
#[derive(Debug, Clone)]
pub struct AdPublishingService {
pub(crate) client: Ghl,
}
impl AdPublishingService {
pub(crate) fn new(client: Ghl) -> Self {
Self { client }
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAdAccountsParams {
pub location_id: String,
pub type_: Option<String>,
pub next: Option<String>,
pub fetch_all: Option<String>,
pub limit: Option<String>,
}
impl GetAdAccountsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn next(mut self, v: impl Into<String>) -> Self {
self.next = Some(v.into());
self
}
pub fn fetch_all(mut self, v: impl Into<String>) -> Self {
self.fetch_all = Some(v.into());
self
}
pub fn limit(mut self, v: impl Into<String>) -> Self {
self.limit = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.type_ {
q.push(("type".into(), v.to_string()));
}
if let Some(v) = &self.next {
q.push(("next".into(), v.to_string()));
}
if let Some(v) = &self.fetch_all {
q.push(("fetchAll".into(), v.to_string()));
}
if let Some(v) = &self.limit {
q.push(("limit".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAdAccountDetailsParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetAdAccountDetailsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCampaignWithLinkedEntitiesParams {
pub location_id: String,
pub fields: Option<String>,
pub source: Option<String>,
}
impl GetCampaignWithLinkedEntitiesParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn fields(mut self, v: impl Into<String>) -> Self {
self.fields = Some(v.into());
self
}
pub fn source(mut self, v: impl Into<String>) -> Self {
self.source = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.fields {
q.push(("fields".into(), v.to_string()));
}
if let Some(v) = &self.source {
q.push(("source".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCampaignPublishingProgressParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetCampaignPublishingProgressParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetConversationFormsParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetConversationFormsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCustomAudiencesParams {
pub location_id: String,
pub type_: String,
pub source: Option<String>,
pub ad_account_id: String,
}
impl GetCustomAudiencesParams {
pub fn new(
location_id: impl Into<String>,
type_: impl Into<String>,
ad_account_id: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
ad_account_id: ad_account_id.into(),
..Default::default()
}
}
pub fn source(mut self, v: impl Into<String>) -> Self {
self.source = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
("adAccountId".into(), self.ad_account_id.clone()),
];
if let Some(v) = &self.source {
q.push(("source".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct DeleteCustomAudienceParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl DeleteCustomAudienceParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCustomAudienceByIdParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetCustomAudienceByIdParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetEntitiesParams {
pub location_id: String,
pub type_: String,
pub next: Option<String>,
pub fetch_all: Option<String>,
pub campaign_id: Option<String>,
pub ad_set_id: Option<String>,
pub entity_type: String,
pub search_id: Option<String>,
pub selected_ad_account_id: Option<String>,
}
impl GetEntitiesParams {
pub fn new(
location_id: impl Into<String>,
type_: impl Into<String>,
entity_type: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
entity_type: entity_type.into(),
..Default::default()
}
}
pub fn next(mut self, v: impl Into<String>) -> Self {
self.next = Some(v.into());
self
}
pub fn fetch_all(mut self, v: impl Into<String>) -> Self {
self.fetch_all = Some(v.into());
self
}
pub fn campaign_id(mut self, v: impl Into<String>) -> Self {
self.campaign_id = Some(v.into());
self
}
pub fn ad_set_id(mut self, v: impl Into<String>) -> Self {
self.ad_set_id = Some(v.into());
self
}
pub fn search_id(mut self, v: impl Into<String>) -> Self {
self.search_id = Some(v.into());
self
}
pub fn selected_ad_account_id(mut self, v: impl Into<String>) -> Self {
self.selected_ad_account_id = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
("entityType".into(), self.entity_type.clone()),
];
if let Some(v) = &self.next {
q.push(("next".into(), v.to_string()));
}
if let Some(v) = &self.fetch_all {
q.push(("fetchAll".into(), v.to_string()));
}
if let Some(v) = &self.campaign_id {
q.push(("campaignId".into(), v.to_string()));
}
if let Some(v) = &self.ad_set_id {
q.push(("adSetId".into(), v.to_string()));
}
if let Some(v) = &self.search_id {
q.push(("searchId".into(), v.to_string()));
}
if let Some(v) = &self.selected_ad_account_id {
q.push(("selectedAdAccountId".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetFacebookIntegrationParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetFacebookIntegrationParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetLeadFormByIdParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetLeadFormByIdParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCurrentFacebookUserParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetCurrentFacebookUserParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct DeletePageConnectionParams {
pub location_id: String,
pub page_id: String,
}
impl DeletePageConnectionParams {
pub fn new(location_id: impl Into<String>, page_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
page_id: page_id.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("pageId".into(), self.page_id.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct SetDefaultPageParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl SetDefaultPageParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetPageLeadFormsParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetPageLeadFormsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetInstagramAccountsForPageParams {
pub location_id: String,
pub type_: Option<String>,
}
impl GetInstagramAccountsForPageParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.type_ {
q.push(("type".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetFacebookPagesParams {
pub location_id: String,
pub fetch_existing: Option<String>,
}
impl GetFacebookPagesParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn fetch_existing(mut self, v: impl Into<String>) -> Self {
self.fetch_existing = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.fetch_existing {
q.push(("fetchExisting".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetConversionPixelsParams {
pub location_id: String,
pub channel: Option<String>,
pub page_id: Option<String>,
pub ig_user_id: Option<String>,
}
impl GetConversionPixelsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn channel(mut self, v: impl Into<String>) -> Self {
self.channel = Some(v.into());
self
}
pub fn page_id(mut self, v: impl Into<String>) -> Self {
self.page_id = Some(v.into());
self
}
pub fn ig_user_id(mut self, v: impl Into<String>) -> Self {
self.ig_user_id = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.channel {
q.push(("channel".into(), v.to_string()));
}
if let Some(v) = &self.page_id {
q.push(("pageId".into(), v.to_string()));
}
if let Some(v) = &self.ig_user_id {
q.push(("igUserId".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetReportingDataParams {
pub location_id: String,
pub fields: String,
pub group_by: String,
pub start_date: String,
pub end_date: String,
pub type_: String,
}
impl GetReportingDataParams {
pub fn new(
location_id: impl Into<String>,
fields: impl Into<String>,
group_by: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
type_: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
fields: fields.into(),
group_by: group_by.into(),
start_date: start_date.into(),
end_date: end_date.into(),
type_: type_.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("fields".into(), self.fields.clone()),
("groupBy".into(), self.group_by.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
("type".into(), self.type_.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCampaignReportingParams {
pub location_id: String,
pub start_date: String,
pub end_date: String,
}
impl GetCampaignReportingParams {
pub fn new(
location_id: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
start_date: start_date.into(),
end_date: end_date.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetReportingListParams {
pub location_id: String,
pub list_type: String,
pub start_date: String,
pub end_date: String,
pub campaign_id: Option<String>,
pub type_: String,
}
impl GetReportingListParams {
pub fn new(
location_id: impl Into<String>,
list_type: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
type_: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
list_type: list_type.into(),
start_date: start_date.into(),
end_date: end_date.into(),
type_: type_.into(),
..Default::default()
}
}
pub fn campaign_id(mut self, v: impl Into<String>) -> Self {
self.campaign_id = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("listType".into(), self.list_type.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
("type".into(), self.type_.clone()),
];
if let Some(v) = &self.campaign_id {
q.push(("campaignId".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct SearchTargetingOptionsParams {
pub location_id: Option<String>,
pub type_: String,
pub query: String,
pub search_type: Option<String>,
}
impl SearchTargetingOptionsParams {
pub fn new(type_: impl Into<String>, query: impl Into<String>) -> Self {
Self {
type_: type_.into(),
query: query.into(),
..Default::default()
}
}
pub fn location_id(mut self, v: impl Into<String>) -> Self {
self.location_id = Some(v.into());
self
}
pub fn search_type(mut self, v: impl Into<String>) -> Self {
self.search_type = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("type".into(), self.type_.clone()),
("query".into(), self.query.clone()),
];
if let Some(v) = &self.location_id {
q.push(("locationId".into(), v.to_string()));
}
if let Some(v) = &self.search_type {
q.push(("searchType".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetGoogleAdAccountsParams {
pub location_id: String,
pub type_: Option<String>,
}
impl GetGoogleAdAccountsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.type_ {
q.push(("type".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAdAccountDetailsOpParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetAdAccountDetailsOpParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetGoogleCampaignByIdParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetGoogleCampaignByIdParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAssetsParams {
pub location_id: String,
pub type_: String,
pub id: Option<String>,
pub advertiser_only: Option<String>,
}
impl GetAssetsParams {
pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
..Default::default()
}
}
pub fn id(mut self, v: impl Into<String>) -> Self {
self.id = Some(v.into());
self
}
pub fn advertiser_only(mut self, v: impl Into<String>) -> Self {
self.advertiser_only = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
];
if let Some(v) = &self.id {
q.push(("id".into(), v.to_string()));
}
if let Some(v) = &self.advertiser_only {
q.push(("advertiserOnly".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAudiencesParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetAudiencesParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAudienceByIdParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetAudienceByIdParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetConversionGoalsParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetConversionGoalsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetConversionsParams {
pub location_id: String,
pub type_: Option<String>,
pub conversion_type: Option<String>,
pub category: Option<String>,
pub start_date: Option<String>,
pub end_date: Option<String>,
}
impl GetConversionsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
pub fn conversion_type(mut self, v: impl Into<String>) -> Self {
self.conversion_type = Some(v.into());
self
}
pub fn category(mut self, v: impl Into<String>) -> Self {
self.category = Some(v.into());
self
}
pub fn start_date(mut self, v: impl Into<String>) -> Self {
self.start_date = Some(v.into());
self
}
pub fn end_date(mut self, v: impl Into<String>) -> Self {
self.end_date = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.type_ {
q.push(("type".into(), v.to_string()));
}
if let Some(v) = &self.conversion_type {
q.push(("conversionType".into(), v.to_string()));
}
if let Some(v) = &self.category {
q.push(("category".into(), v.to_string()));
}
if let Some(v) = &self.start_date {
q.push(("startDate".into(), v.to_string()));
}
if let Some(v) = &self.end_date {
q.push(("endDate".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct DeleteConversionParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl DeleteConversionParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetConversionByIdParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetConversionByIdParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetEntitiesOpParams {
pub location_id: String,
pub type_: String,
pub campaign_id: Option<String>,
pub ad_group_id: Option<String>,
pub entity_type: String,
pub search_id: Option<String>,
pub start_date: Option<String>,
pub end_date: Option<String>,
pub selected_ad_account_id: Option<String>,
}
impl GetEntitiesOpParams {
pub fn new(
location_id: impl Into<String>,
type_: impl Into<String>,
entity_type: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
entity_type: entity_type.into(),
..Default::default()
}
}
pub fn campaign_id(mut self, v: impl Into<String>) -> Self {
self.campaign_id = Some(v.into());
self
}
pub fn ad_group_id(mut self, v: impl Into<String>) -> Self {
self.ad_group_id = Some(v.into());
self
}
pub fn search_id(mut self, v: impl Into<String>) -> Self {
self.search_id = Some(v.into());
self
}
pub fn start_date(mut self, v: impl Into<String>) -> Self {
self.start_date = Some(v.into());
self
}
pub fn end_date(mut self, v: impl Into<String>) -> Self {
self.end_date = Some(v.into());
self
}
pub fn selected_ad_account_id(mut self, v: impl Into<String>) -> Self {
self.selected_ad_account_id = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
("entityType".into(), self.entity_type.clone()),
];
if let Some(v) = &self.campaign_id {
q.push(("campaignId".into(), v.to_string()));
}
if let Some(v) = &self.ad_group_id {
q.push(("adGroupId".into(), v.to_string()));
}
if let Some(v) = &self.search_id {
q.push(("searchId".into(), v.to_string()));
}
if let Some(v) = &self.start_date {
q.push(("startDate".into(), v.to_string()));
}
if let Some(v) = &self.end_date {
q.push(("endDate".into(), v.to_string()));
}
if let Some(v) = &self.selected_ad_account_id {
q.push(("selectedAdAccountId".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetGoogleIntegrationParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetGoogleIntegrationParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetKeywordIdeasParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetKeywordIdeasParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCurrentGoogleUserParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetCurrentGoogleUserParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetReportingDataOpParams {
pub location_id: String,
pub fields: String,
pub group_by: Option<String>,
pub start_date: String,
pub end_date: String,
pub type_: String,
}
impl GetReportingDataOpParams {
pub fn new(
location_id: impl Into<String>,
fields: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
type_: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
fields: fields.into(),
start_date: start_date.into(),
end_date: end_date.into(),
type_: type_.into(),
..Default::default()
}
}
pub fn group_by(mut self, v: impl Into<String>) -> Self {
self.group_by = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("fields".into(), self.fields.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
("type".into(), self.type_.clone()),
];
if let Some(v) = &self.group_by {
q.push(("groupBy".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCampaignReportingOpParams {
pub location_id: String,
pub start_date: String,
pub end_date: String,
}
impl GetCampaignReportingOpParams {
pub fn new(
location_id: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
start_date: start_date.into(),
end_date: end_date.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetReportingListOpParams {
pub location_id: String,
pub list_type: String,
pub start_date: String,
pub end_date: String,
pub campaign_id: Option<String>,
pub type_: String,
}
impl GetReportingListOpParams {
pub fn new(
location_id: impl Into<String>,
list_type: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
type_: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
list_type: list_type.into(),
start_date: start_date.into(),
end_date: end_date.into(),
type_: type_.into(),
..Default::default()
}
}
pub fn campaign_id(mut self, v: impl Into<String>) -> Self {
self.campaign_id = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("listType".into(), self.list_type.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
("type".into(), self.type_.clone()),
];
if let Some(v) = &self.campaign_id {
q.push(("campaignId".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetSegmentsParams {
pub location_id: String,
pub type_: Option<String>,
}
impl GetSegmentsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn type_(mut self, v: impl Into<String>) -> Self {
self.type_ = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.type_ {
q.push(("type".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct UpsertSegmentParams {
pub location_id: String,
pub type_: String,
}
impl UpsertSegmentParams {
pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct DeleteSegmentParams {
pub location_id: String,
pub type_: String,
}
impl DeleteSegmentParams {
pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetSegmentByIdParams {
pub location_id: String,
pub type_: String,
}
impl GetSegmentByIdParams {
pub fn new(location_id: impl Into<String>, type_: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetTargetInterestsParams {
pub location_id: String,
pub type_: String,
pub advertising_channel_type: String,
}
impl GetTargetInterestsParams {
pub fn new(
location_id: impl Into<String>,
type_: impl Into<String>,
advertising_channel_type: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
type_: type_.into(),
advertising_channel_type: advertising_channel_type.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("type".into(), self.type_.clone()),
(
"advertisingChannelType".into(),
self.advertising_channel_type.clone(),
),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct SearchTargetingOptionsOpParams {
pub type_: String,
pub query: Option<String>,
pub location_id: String,
}
impl SearchTargetingOptionsOpParams {
pub fn new(type_: impl Into<String>, location_id: impl Into<String>) -> Self {
Self {
type_: type_.into(),
location_id: location_id.into(),
..Default::default()
}
}
pub fn query(mut self, v: impl Into<String>) -> Self {
self.query = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("type".into(), self.type_.clone()),
("locationId".into(), self.location_id.clone()),
];
if let Some(v) = &self.query {
q.push(("query".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct DeleteAdAccountOp2Params {
pub location_id: String,
pub ad_account_id: String,
}
impl DeleteAdAccountOp2Params {
pub fn new(location_id: impl Into<String>, ad_account_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
ad_account_id: ad_account_id.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("adAccountId".into(), self.ad_account_id.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAdAccountDetailsOp2Params {
pub location_id: String,
pub ad_account_id: String,
}
impl GetAdAccountDetailsOp2Params {
pub fn new(location_id: impl Into<String>, ad_account_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
ad_account_id: ad_account_id.into(),
}
}
fn to_query(&self) -> Vec<(String, String)> {
let q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("adAccountId".into(), self.ad_account_id.clone()),
];
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetLinkedInAdAccountsParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetLinkedInAdAccountsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAdCampaignGroupParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetAdCampaignGroupParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetLinkedInIntegrationParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetLinkedInIntegrationParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCurrentLinkedInUserParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetCurrentLinkedInUserParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetAdAnalyticsParams {
pub location_id: String,
pub pivot: Option<String>,
pub group_by: Option<String>,
pub start_date: String,
pub end_date: String,
pub entity_urns: Option<String>,
pub fields: Option<String>,
}
impl GetAdAnalyticsParams {
pub fn new(
location_id: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
start_date: start_date.into(),
end_date: end_date.into(),
..Default::default()
}
}
pub fn pivot(mut self, v: impl Into<String>) -> Self {
self.pivot = Some(v.into());
self
}
pub fn group_by(mut self, v: impl Into<String>) -> Self {
self.group_by = Some(v.into());
self
}
pub fn entity_urns(mut self, v: impl Into<String>) -> Self {
self.entity_urns = Some(v.into());
self
}
pub fn fields(mut self, v: impl Into<String>) -> Self {
self.fields = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
];
if let Some(v) = &self.pivot {
q.push(("pivot".into(), v.to_string()));
}
if let Some(v) = &self.group_by {
q.push(("groupBy".into(), v.to_string()));
}
if let Some(v) = &self.entity_urns {
q.push(("entityUrns".into(), v.to_string()));
}
if let Some(v) = &self.fields {
q.push(("fields".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetCampaignGroupReportingParams {
pub location_id: String,
pub start_date: String,
pub end_date: String,
pub fields: Option<String>,
pub campaign_group_id: Option<String>,
}
impl GetCampaignGroupReportingParams {
pub fn new(
location_id: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
start_date: start_date.into(),
end_date: end_date.into(),
..Default::default()
}
}
pub fn fields(mut self, v: impl Into<String>) -> Self {
self.fields = Some(v.into());
self
}
pub fn campaign_group_id(mut self, v: impl Into<String>) -> Self {
self.campaign_group_id = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
];
if let Some(v) = &self.fields {
q.push(("fields".into(), v.to_string()));
}
if let Some(v) = &self.campaign_group_id {
q.push(("campaignGroupId".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetReportingListOp2Params {
pub location_id: String,
pub list_type: String,
pub campaign_id: String,
pub campaign_group_id: String,
pub start_date: String,
pub end_date: String,
pub fields: Option<String>,
}
impl GetReportingListOp2Params {
pub fn new(
location_id: impl Into<String>,
list_type: impl Into<String>,
campaign_id: impl Into<String>,
campaign_group_id: impl Into<String>,
start_date: impl Into<String>,
end_date: impl Into<String>,
) -> Self {
Self {
location_id: location_id.into(),
list_type: list_type.into(),
campaign_id: campaign_id.into(),
campaign_group_id: campaign_group_id.into(),
start_date: start_date.into(),
end_date: end_date.into(),
..Default::default()
}
}
pub fn fields(mut self, v: impl Into<String>) -> Self {
self.fields = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("listType".into(), self.list_type.clone()),
("campaignId".into(), self.campaign_id.clone()),
("campaignGroupId".into(), self.campaign_group_id.clone()),
("startDate".into(), self.start_date.clone()),
("endDate".into(), self.end_date.clone()),
];
if let Some(v) = &self.fields {
q.push(("fields".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct SearchTargetingOptionsOp2Params {
pub location_id: String,
pub facet: String,
pub query: Option<String>,
pub q: Option<String>,
}
impl SearchTargetingOptionsOp2Params {
pub fn new(location_id: impl Into<String>, facet: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
facet: facet.into(),
..Default::default()
}
}
pub fn query(mut self, v: impl Into<String>) -> Self {
self.query = Some(v.into());
self
}
pub fn q(mut self, v: impl Into<String>) -> Self {
self.q = Some(v.into());
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![
("locationId".into(), self.location_id.clone()),
("facet".into(), self.facet.clone()),
];
if let Some(v) = &self.query {
q.push(("query".into(), v.to_string()));
}
if let Some(v) = &self.q {
q.push(("q".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct CreateLeadFormParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl CreateLeadFormParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct GetLeadFormsParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl GetLeadFormsParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
#[derive(Debug, Clone, Default)]
pub struct UpdateAdStatusParams {
pub location_id: String,
pub is_draft: Option<bool>,
}
impl UpdateAdStatusParams {
pub fn new(location_id: impl Into<String>) -> Self {
Self {
location_id: location_id.into(),
..Default::default()
}
}
pub fn is_draft(mut self, v: bool) -> Self {
self.is_draft = Some(v);
self
}
fn to_query(&self) -> Vec<(String, String)> {
let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
if let Some(v) = &self.is_draft {
q.push(("isDraft".into(), v.to_string()));
}
q
}
}
impl AdPublishingService {
pub async fn get_ad_accounts(&self, params: &GetAdAccountsParams) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/ad-accounts",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn delete_ad_account(
&self,
ad_account_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/ad-accounts/{}",
crate::services::encode(ad_account_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_ad_account_details(
&self,
ad_account_id: &str,
params: &GetAdAccountDetailsParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/ad-accounts/{}",
crate::services::encode(ad_account_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_ad(&self, body: &models::UpsertAdDTO) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/facebook/ads",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn delete_ad(
&self,
ad_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/ads/{}",
crate::services::encode(ad_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn duplicate_ad(&self, ad_id: &str) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/ads/{}/duplicate",
crate::services::encode(ad_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn pause_ad(
&self,
ad_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/ads/{}/pause",
crate::services::encode(ad_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn resume_ad(
&self,
ad_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/ads/{}/resume",
crate::services::encode(ad_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn upsert_adset(&self, body: &models::UpsertAdsetDTO) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/facebook/adsets",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn delete_ad_set(
&self,
ad_set_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/adsets/{}",
crate::services::encode(ad_set_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn duplicate_ad_set(&self, ad_set_id: &str) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/adsets/{}/duplicate",
crate::services::encode(ad_set_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn pause_ad_set(
&self,
ad_set_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/adsets/{}/pause",
crate::services::encode(ad_set_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn resume_ad_set(
&self,
ad_set_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/adsets/{}/resume",
crate::services::encode(ad_set_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_campaign_with_linked_entities(
&self,
campaign_id: &str,
params: &GetCampaignWithLinkedEntitiesParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/campaign/{}",
crate::services::encode(campaign_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_campaign(
&self,
body: &models::UpsertCampaignDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/facebook/campaigns",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn delete_campaign(
&self,
campaign_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/campaigns/{}",
crate::services::encode(campaign_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn duplicate_campaign(
&self,
campaign_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/campaigns/{}/duplicate",
crate::services::encode(campaign_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn pause_campaign(
&self,
campaign_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/campaigns/{}/pause",
crate::services::encode(campaign_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn publish_campaign(
&self,
campaign_id: &str,
body: &models::PublishAdDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/campaigns/{}/publish",
crate::services::encode(campaign_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_campaign_publishing_progress(
&self,
campaign_id: &str,
params: &GetCampaignPublishingProgressParams,
) -> Result<models::PublishingProgressResponseDTO> {
let path = format!(
"/ad-publishing/facebook/campaigns/{}/publishing-progress",
crate::services::encode(campaign_id)
);
let query = params.to_query();
self.client
.send_versioned(reqwest::Method::GET, &path, &query, None::<&()>, Some("v3"))
.await
}
pub async fn resume_campaign(
&self,
campaign_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/campaigns/{}/resume",
crate::services::encode(campaign_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_conversation_forms(
&self,
params: &GetConversationFormsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/conversation-forms",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn create_conversation_form(
&self,
body: &models::CreateConversationFormDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
"/ad-publishing/facebook/conversation-forms",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_custom_audiences(
&self,
params: &GetCustomAudiencesParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/custom-audience",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn delete_custom_audience(
&self,
audience_id: &str,
params: &DeleteCustomAudienceParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/custom-audience/{}",
crate::services::encode(audience_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_custom_audience_by_id(
&self,
audience_id: &str,
params: &GetCustomAudienceByIdParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/custom-audience/{}",
crate::services::encode(audience_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn update_custom_audience(
&self,
audience_id: &str,
body: &models::FbUpdateAudienceBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/custom-audience/{}",
crate::services::encode(audience_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn remove_custom_audience_member(
&self,
audience_id: &str,
body: &models::UpdateCustomAudienceDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/custom-audience/{}/member",
crate::services::encode(audience_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn add_custom_audience_member(
&self,
audience_id: &str,
body: &models::UpdateCustomAudienceDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/custom-audience/{}/member",
crate::services::encode(audience_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn batch_update_audience_members(
&self,
audience_id: &str,
body: &models::UpdateCustomAudienceBatchDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/custom-audience/{}/member/batch",
crate::services::encode(audience_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_entities(&self, params: &GetEntitiesParams) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/entity",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn delete_facebook_integration(
&self,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::DELETE,
"/ad-publishing/facebook/integration",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_facebook_integration(
&self,
params: &GetFacebookIntegrationParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/integration",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn create_facebook_integration(
&self,
body: &models::CreateIntegrationDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
"/ad-publishing/facebook/integration",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_lead_form_by_id(
&self,
lead_form_id: &str,
params: &GetLeadFormByIdParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/lead-form/{}",
crate::services::encode(lead_form_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_current_facebook_user(
&self,
params: &GetCurrentFacebookUserParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/me",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn delete_page_connection(
&self,
params: &DeletePageConnectionParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::DELETE,
"/ad-publishing/facebook/page",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn set_default_page(
&self,
params: &SetDefaultPageParams,
body: &models::FbSetDefaultPageBodyDTO,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/facebook/page/default",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_page_lead_forms(
&self,
page_id: &str,
params: &GetPageLeadFormsParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/page/{}/forms",
crate::services::encode(page_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn create_page_lead_form(
&self,
page_id: &str,
body: &models::CreateLeadFormDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/page/{}/forms",
crate::services::encode(page_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_instagram_accounts_for_page(
&self,
page_id: &str,
params: &GetInstagramAccountsForPageParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/page/{}/instagram",
crate::services::encode(page_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_facebook_pages(
&self,
params: &GetFacebookPagesParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/pages",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_conversion_pixels(
&self,
params: &GetConversionPixelsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/pixels",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_conversion_pixel(
&self,
body: &models::UpsertConversionPixelDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/facebook/pixels",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_reporting_data(
&self,
params: &GetReportingDataParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/reporting",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_campaign_reporting(
&self,
campaign_id: &str,
params: &GetCampaignReportingParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/facebook/reporting/campaign/{}",
crate::services::encode(campaign_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_reporting_list(
&self,
params: &GetReportingListParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/reporting/list",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn search_targeting_options(
&self,
params: &SearchTargetingOptionsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/facebook/targeting/search",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_google_ad_accounts(
&self,
params: &GetGoogleAdAccountsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/ad-accounts",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn delete_ad_account_op(
&self,
ad_account_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/ad-accounts/{}",
crate::services::encode(ad_account_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_ad_account_details_op(
&self,
ad_account_id: &str,
params: &GetAdAccountDetailsOpParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/ad-accounts/{}",
crate::services::encode(ad_account_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_google_campaign(
&self,
body: &models::CampaignDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/google/ads",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_google_campaign_by_id(
&self,
ad_id: &str,
params: &GetGoogleCampaignByIdParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/ads/{}",
crate::services::encode(ad_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn publish_ad(&self, ad_id: &str) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/ads/{}/publish",
crate::services::encode(ad_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_assets(&self, params: &GetAssetsParams) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/assets",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_assets(&self, body: &models::UpsertAssetsDTO) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
"/ad-publishing/google/assets",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_audiences(&self, params: &GetAudiencesParams) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/audiences",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_audience(
&self,
body: &models::UpsertAudienceDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/google/audiences",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_audience_by_id(
&self,
audience_id: &str,
params: &GetAudienceByIdParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/audiences/{}",
crate::services::encode(audience_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_conversion_goals(
&self,
params: &GetConversionGoalsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/conversion-goals",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_conversions(
&self,
params: &GetConversionsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/conversions",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_conversion(
&self,
body: &models::UpsertConversionDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/google/conversions",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn delete_conversion(
&self,
conversion_id: &str,
params: &DeleteConversionParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/conversions/{}",
crate::services::encode(conversion_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_conversion_by_id(
&self,
conversion_id: &str,
params: &GetConversionByIdParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/conversions/{}",
crate::services::encode(conversion_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_entities_op(&self, params: &GetEntitiesOpParams) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/entity",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_google_integration(
&self,
params: &GetGoogleIntegrationParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/integration",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn create_google_integration(
&self,
body: &models::CreateGoogleIntegrationDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
"/ad-publishing/google/integration",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_keyword_ideas(
&self,
params: &GetKeywordIdeasParams,
body: &models::KeywordSuggestionDTO,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::POST,
"/ad-publishing/google/keyword-ideas",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_current_google_user(
&self,
params: &GetCurrentGoogleUserParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/me",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_reporting_data_op(
&self,
params: &GetReportingDataOpParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/reporting",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_campaign_reporting_op(
&self,
campaign_id: &str,
params: &GetCampaignReportingOpParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/reporting/campaign/{}",
crate::services::encode(campaign_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_reporting_list_op(
&self,
params: &GetReportingListOpParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/reporting/list",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_segments(&self, params: &GetSegmentsParams) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/segments",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_segment(
&self,
params: &UpsertSegmentParams,
body: &models::UpsertSegmentDTO,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/google/segments",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn create_offline_user_list_job(
&self,
body: &models::CreateOfflineUserListJobDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
"/ad-publishing/google/segments/offline-user-list-job",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn delete_segment(
&self,
segment_id: &str,
params: &DeleteSegmentParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/segments/{}",
crate::services::encode(segment_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::DELETE,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_segment_by_id(
&self,
segment_id: &str,
params: &GetSegmentByIdParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/google/segments/{}",
crate::services::encode(segment_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_target_interests(
&self,
params: &GetTargetInterestsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/target-interests",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn search_targeting_options_op(
&self,
params: &SearchTargetingOptionsOpParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/google/targeting/search",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn delete_ad_account_op2(
&self,
params: &DeleteAdAccountOp2Params,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::DELETE,
"/ad-publishing/linkedin/ad-account",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_ad_account_details_op2(
&self,
params: &GetAdAccountDetailsOp2Params,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/linkedin/ad-account",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_linked_in_ad_accounts(
&self,
params: &GetLinkedInAdAccountsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/linkedin/ad-accounts",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn upsert_ad_campaign_group(
&self,
body: &models::AdCampaignGroupDataDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::PUT,
"/ad-publishing/linkedin/ads",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_ad_campaign_group(
&self,
ad_id: &str,
params: &GetAdCampaignGroupParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/linkedin/ads/{}",
crate::services::encode(ad_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn publish_ad_campaign_group(
&self,
ad_id: &str,
body: &models::LocationIdBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/linkedin/ads/{}/publish",
crate::services::encode(ad_id)
);
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_linked_in_integration(
&self,
params: &GetLinkedInIntegrationParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/linkedin/integration",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn create_linked_in_integration(
&self,
body: &models::CreateLinkedinIntegrationDTO,
) -> Result<serde_json::Value> {
let query = Vec::new();
self.client
.send_versioned(
reqwest::Method::POST,
"/ad-publishing/linkedin/integration",
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_current_linked_in_user(
&self,
params: &GetCurrentLinkedInUserParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/linkedin/me",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_ad_analytics(
&self,
params: &GetAdAnalyticsParams,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/linkedin/reporting",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_campaign_group_reporting(
&self,
campaign_group_id: &str,
params: &GetCampaignGroupReportingParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/linkedin/reporting/campaign-group/{}",
crate::services::encode(campaign_group_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn get_reporting_list_op2(
&self,
params: &GetReportingListOp2Params,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/linkedin/reporting/list",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn search_targeting_options_op2(
&self,
params: &SearchTargetingOptionsOp2Params,
) -> Result<serde_json::Value> {
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
"/ad-publishing/linkedin/targeting/search",
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn create_lead_form(
&self,
account_id: &str,
params: &CreateLeadFormParams,
body: &models::LinkedInCreateLeadFormBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/linkedin/{}/form",
crate::services::encode(account_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::POST,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
pub async fn get_lead_forms(
&self,
account_id: &str,
params: &GetLeadFormsParams,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/linkedin/{}/forms",
crate::services::encode(account_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::GET,
&path,
&query,
None::<&()>,
Some("2021-07-28"),
)
.await
}
pub async fn update_ad_status(
&self,
ad_id: &str,
params: &UpdateAdStatusParams,
body: &models::LinkedInUpdateAdStatusBodyDTO,
) -> Result<serde_json::Value> {
let path = format!(
"/ad-publishing/linkedin/{}/status",
crate::services::encode(ad_id)
);
let query = params.to_query();
self.client
.send_versioned(
reqwest::Method::PATCH,
&path,
&query,
Some(body),
Some("2021-07-28"),
)
.await
}
}