public virtual void WriteTo(XElement xE) { XElement xItem = null; if (Id != null) { xItem = new XElement(XName.Get("id", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(Id.Value.ToString()); xE.Add(xItem); } if (CampaignId != null) { xItem = new XElement(XName.Get("campaignId", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(CampaignId.Value.ToString()); xE.Add(xItem); } if (CampaignName != null) { xItem = new XElement(XName.Get("campaignName", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(CampaignName); xE.Add(xItem); } if (Name != null) { xItem = new XElement(XName.Get("name", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(Name); xE.Add(xItem); } if (Status != null) { xItem = new XElement(XName.Get("status", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(Status.Value.ToXmlValue()); xE.Add(xItem); } if (Settings != null) { foreach (var settingsItem in Settings) { xItem = new XElement(XName.Get("settings", "https://adwords.google.com/api/adwords/cm/v201609")); settingsItem.WriteTo(xItem); xE.Add(xItem); } } if (Labels != null) { foreach (var labelsItem in Labels) { xItem = new XElement(XName.Get("labels", "https://adwords.google.com/api/adwords/cm/v201609")); labelsItem.WriteTo(xItem); xE.Add(xItem); } } if (ForwardCompatibilityMap != null) { foreach (var forwardCompatibilityMapItem in ForwardCompatibilityMap) { xItem = new XElement(XName.Get("forwardCompatibilityMap", "https://adwords.google.com/api/adwords/cm/v201609")); forwardCompatibilityMapItem.WriteTo(xItem); xE.Add(xItem); } } if (BiddingStrategyConfiguration != null) { xItem = new XElement(XName.Get("biddingStrategyConfiguration", "https://adwords.google.com/api/adwords/cm/v201609")); BiddingStrategyConfiguration.WriteTo(xItem); xE.Add(xItem); } if (ContentBidCriterionTypeGroup != null) { xItem = new XElement(XName.Get("contentBidCriterionTypeGroup", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(ContentBidCriterionTypeGroup.Value.ToXmlValue()); xE.Add(xItem); } if (BaseCampaignId != null) { xItem = new XElement(XName.Get("baseCampaignId", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(BaseCampaignId.Value.ToString()); xE.Add(xItem); } if (BaseAdGroupId != null) { xItem = new XElement(XName.Get("baseAdGroupId", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(BaseAdGroupId.Value.ToString()); xE.Add(xItem); } if (TrackingUrlTemplate != null) { xItem = new XElement(XName.Get("trackingUrlTemplate", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(TrackingUrlTemplate); xE.Add(xItem); } if (UrlCustomParameters != null) { xItem = new XElement(XName.Get("urlCustomParameters", "https://adwords.google.com/api/adwords/cm/v201609")); UrlCustomParameters.WriteTo(xItem); xE.Add(xItem); } }
public virtual void ReadFrom(XElement xE) { Id = null; CampaignId = null; CampaignName = null; Name = null; Status = null; Settings = null; Labels = null; ForwardCompatibilityMap = null; BiddingStrategyConfiguration = null; ContentBidCriterionTypeGroup = null; BaseCampaignId = null; BaseAdGroupId = null; TrackingUrlTemplate = null; UrlCustomParameters = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "id") { Id = long.Parse(xItem.Value); } else if (localName == "campaignId") { CampaignId = long.Parse(xItem.Value); } else if (localName == "campaignName") { CampaignName = xItem.Value; } else if (localName == "name") { Name = xItem.Value; } else if (localName == "status") { Status = AdGroupStatusExtensions.Parse(xItem.Value); } else if (localName == "settings") { if (Settings == null) { Settings = new List <Setting>(); } var settingsItem = InstanceCreator.CreateSetting(xItem); settingsItem.ReadFrom(xItem); Settings.Add(settingsItem); } else if (localName == "labels") { if (Labels == null) { Labels = new List <Label>(); } var labelsItem = InstanceCreator.CreateLabel(xItem); labelsItem.ReadFrom(xItem); Labels.Add(labelsItem); } else if (localName == "forwardCompatibilityMap") { if (ForwardCompatibilityMap == null) { ForwardCompatibilityMap = new List <String_StringMapEntry>(); } var forwardCompatibilityMapItem = new String_StringMapEntry(); forwardCompatibilityMapItem.ReadFrom(xItem); ForwardCompatibilityMap.Add(forwardCompatibilityMapItem); } else if (localName == "biddingStrategyConfiguration") { BiddingStrategyConfiguration = new BiddingStrategyConfiguration(); BiddingStrategyConfiguration.ReadFrom(xItem); } else if (localName == "contentBidCriterionTypeGroup") { ContentBidCriterionTypeGroup = CriterionTypeGroupExtensions.Parse(xItem.Value); } else if (localName == "baseCampaignId") { BaseCampaignId = long.Parse(xItem.Value); } else if (localName == "baseAdGroupId") { BaseAdGroupId = long.Parse(xItem.Value); } else if (localName == "trackingUrlTemplate") { TrackingUrlTemplate = xItem.Value; } else if (localName == "urlCustomParameters") { UrlCustomParameters = new CustomParameters(); UrlCustomParameters.ReadFrom(xItem); } } }
public override void WriteTo(XElement xE) { base.WriteTo(xE); XmlUtility.SetXsiType(xE, "https://adwords.google.com/api/adwords/cm/v201609", "BiddableAdGroupCriterion"); XElement xItem = null; if (UserStatus != null) { xItem = new XElement(XName.Get("userStatus", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(UserStatus.Value.ToXmlValue()); xE.Add(xItem); } if (SystemServingStatus != null) { xItem = new XElement(XName.Get("systemServingStatus", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(SystemServingStatus.Value.ToXmlValue()); xE.Add(xItem); } if (ApprovalStatus != null) { xItem = new XElement(XName.Get("approvalStatus", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(ApprovalStatus.Value.ToXmlValue()); xE.Add(xItem); } if (DisapprovalReasons != null) { foreach (var disapprovalReasonsItem in DisapprovalReasons) { xItem = new XElement(XName.Get("disapprovalReasons", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(disapprovalReasonsItem); xE.Add(xItem); } } if (DestinationUrl != null) { xItem = new XElement(XName.Get("destinationUrl", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(DestinationUrl); xE.Add(xItem); } if (FirstPageCpc != null) { xItem = new XElement(XName.Get("firstPageCpc", "https://adwords.google.com/api/adwords/cm/v201609")); FirstPageCpc.WriteTo(xItem); xE.Add(xItem); } if (TopOfPageCpc != null) { xItem = new XElement(XName.Get("topOfPageCpc", "https://adwords.google.com/api/adwords/cm/v201609")); TopOfPageCpc.WriteTo(xItem); xE.Add(xItem); } if (FirstPositionCpc != null) { xItem = new XElement(XName.Get("firstPositionCpc", "https://adwords.google.com/api/adwords/cm/v201609")); FirstPositionCpc.WriteTo(xItem); xE.Add(xItem); } if (QualityInfo != null) { xItem = new XElement(XName.Get("qualityInfo", "https://adwords.google.com/api/adwords/cm/v201609")); QualityInfo.WriteTo(xItem); xE.Add(xItem); } if (BiddingStrategyConfiguration != null) { xItem = new XElement(XName.Get("biddingStrategyConfiguration", "https://adwords.google.com/api/adwords/cm/v201609")); BiddingStrategyConfiguration.WriteTo(xItem); xE.Add(xItem); } if (BidModifier != null) { xItem = new XElement(XName.Get("bidModifier", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(BidModifier.Value.ToString()); xE.Add(xItem); } if (FinalUrls != null) { xItem = new XElement(XName.Get("finalUrls", "https://adwords.google.com/api/adwords/cm/v201609")); FinalUrls.WriteTo(xItem); xE.Add(xItem); } if (FinalMobileUrls != null) { xItem = new XElement(XName.Get("finalMobileUrls", "https://adwords.google.com/api/adwords/cm/v201609")); FinalMobileUrls.WriteTo(xItem); xE.Add(xItem); } if (FinalAppUrls != null) { xItem = new XElement(XName.Get("finalAppUrls", "https://adwords.google.com/api/adwords/cm/v201609")); FinalAppUrls.WriteTo(xItem); xE.Add(xItem); } if (TrackingUrlTemplate != null) { xItem = new XElement(XName.Get("trackingUrlTemplate", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(TrackingUrlTemplate); xE.Add(xItem); } if (UrlCustomParameters != null) { xItem = new XElement(XName.Get("urlCustomParameters", "https://adwords.google.com/api/adwords/cm/v201609")); UrlCustomParameters.WriteTo(xItem); xE.Add(xItem); } }
public override void ReadFrom(XElement xE) { base.ReadFrom(xE); UserStatus = null; SystemServingStatus = null; ApprovalStatus = null; DisapprovalReasons = null; DestinationUrl = null; FirstPageCpc = null; TopOfPageCpc = null; FirstPositionCpc = null; QualityInfo = null; BiddingStrategyConfiguration = null; BidModifier = null; FinalUrls = null; FinalMobileUrls = null; FinalAppUrls = null; TrackingUrlTemplate = null; UrlCustomParameters = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "userStatus") { UserStatus = UserStatusExtensions.Parse(xItem.Value); } else if (localName == "systemServingStatus") { SystemServingStatus = SystemServingStatusExtensions.Parse(xItem.Value); } else if (localName == "approvalStatus") { ApprovalStatus = ApprovalStatusExtensions.Parse(xItem.Value); } else if (localName == "disapprovalReasons") { if (DisapprovalReasons == null) { DisapprovalReasons = new List <string>(); } DisapprovalReasons.Add(xItem.Value); } else if (localName == "destinationUrl") { DestinationUrl = xItem.Value; } else if (localName == "firstPageCpc") { FirstPageCpc = new Bid(); FirstPageCpc.ReadFrom(xItem); } else if (localName == "topOfPageCpc") { TopOfPageCpc = new Bid(); TopOfPageCpc.ReadFrom(xItem); } else if (localName == "firstPositionCpc") { FirstPositionCpc = new Bid(); FirstPositionCpc.ReadFrom(xItem); } else if (localName == "qualityInfo") { QualityInfo = new QualityInfo(); QualityInfo.ReadFrom(xItem); } else if (localName == "biddingStrategyConfiguration") { BiddingStrategyConfiguration = new BiddingStrategyConfiguration(); BiddingStrategyConfiguration.ReadFrom(xItem); } else if (localName == "bidModifier") { BidModifier = double.Parse(xItem.Value); } else if (localName == "finalUrls") { FinalUrls = new UrlList(); FinalUrls.ReadFrom(xItem); } else if (localName == "finalMobileUrls") { FinalMobileUrls = new UrlList(); FinalMobileUrls.ReadFrom(xItem); } else if (localName == "finalAppUrls") { FinalAppUrls = new AppUrlList(); FinalAppUrls.ReadFrom(xItem); } else if (localName == "trackingUrlTemplate") { TrackingUrlTemplate = xItem.Value; } else if (localName == "urlCustomParameters") { UrlCustomParameters = new CustomParameters(); UrlCustomParameters.ReadFrom(xItem); } } }
public virtual void WriteTo(XElement xE) { XElement xItem = null; if (Id != null) { xItem = new XElement(XName.Get("id", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(Id.Value.ToString()); xE.Add(xItem); } if (Name != null) { xItem = new XElement(XName.Get("name", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(Name); xE.Add(xItem); } if (Status != null) { xItem = new XElement(XName.Get("status", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(Status.Value.ToXmlValue()); xE.Add(xItem); } if (ServingStatus != null) { xItem = new XElement(XName.Get("servingStatus", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(ServingStatus.Value.ToXmlValue()); xE.Add(xItem); } if (StartDate != null) { xItem = new XElement(XName.Get("startDate", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(StartDate); xE.Add(xItem); } if (EndDate != null) { xItem = new XElement(XName.Get("endDate", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(EndDate); xE.Add(xItem); } if (Budget != null) { xItem = new XElement(XName.Get("budget", "https://adwords.google.com/api/adwords/cm/v201609")); Budget.WriteTo(xItem); xE.Add(xItem); } if (ConversionOptimizerEligibility != null) { xItem = new XElement(XName.Get("conversionOptimizerEligibility", "https://adwords.google.com/api/adwords/cm/v201609")); ConversionOptimizerEligibility.WriteTo(xItem); xE.Add(xItem); } if (AdServingOptimizationStatus != null) { xItem = new XElement(XName.Get("adServingOptimizationStatus", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(AdServingOptimizationStatus.Value.ToXmlValue()); xE.Add(xItem); } if (FrequencyCap != null) { xItem = new XElement(XName.Get("frequencyCap", "https://adwords.google.com/api/adwords/cm/v201609")); FrequencyCap.WriteTo(xItem); xE.Add(xItem); } if (Settings != null) { foreach (var settingsItem in Settings) { xItem = new XElement(XName.Get("settings", "https://adwords.google.com/api/adwords/cm/v201609")); settingsItem.WriteTo(xItem); xE.Add(xItem); } } if (AdvertisingChannelType != null) { xItem = new XElement(XName.Get("advertisingChannelType", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(AdvertisingChannelType.Value.ToXmlValue()); xE.Add(xItem); } if (AdvertisingChannelSubType != null) { xItem = new XElement(XName.Get("advertisingChannelSubType", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(AdvertisingChannelSubType.Value.ToXmlValue()); xE.Add(xItem); } if (NetworkSetting != null) { xItem = new XElement(XName.Get("networkSetting", "https://adwords.google.com/api/adwords/cm/v201609")); NetworkSetting.WriteTo(xItem); xE.Add(xItem); } if (Labels != null) { foreach (var labelsItem in Labels) { xItem = new XElement(XName.Get("labels", "https://adwords.google.com/api/adwords/cm/v201609")); labelsItem.WriteTo(xItem); xE.Add(xItem); } } if (BiddingStrategyConfiguration != null) { xItem = new XElement(XName.Get("biddingStrategyConfiguration", "https://adwords.google.com/api/adwords/cm/v201609")); BiddingStrategyConfiguration.WriteTo(xItem); xE.Add(xItem); } if (CampaignTrialType != null) { xItem = new XElement(XName.Get("campaignTrialType", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(CampaignTrialType.Value.ToXmlValue()); xE.Add(xItem); } if (BaseCampaignId != null) { xItem = new XElement(XName.Get("baseCampaignId", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(BaseCampaignId.Value.ToString()); xE.Add(xItem); } if (ForwardCompatibilityMap != null) { foreach (var forwardCompatibilityMapItem in ForwardCompatibilityMap) { xItem = new XElement(XName.Get("forwardCompatibilityMap", "https://adwords.google.com/api/adwords/cm/v201609")); forwardCompatibilityMapItem.WriteTo(xItem); xE.Add(xItem); } } if (TrackingUrlTemplate != null) { xItem = new XElement(XName.Get("trackingUrlTemplate", "https://adwords.google.com/api/adwords/cm/v201609")); xItem.Add(TrackingUrlTemplate); xE.Add(xItem); } if (UrlCustomParameters != null) { xItem = new XElement(XName.Get("urlCustomParameters", "https://adwords.google.com/api/adwords/cm/v201609")); UrlCustomParameters.WriteTo(xItem); xE.Add(xItem); } if (VanityPharma != null) { xItem = new XElement(XName.Get("vanityPharma", "https://adwords.google.com/api/adwords/cm/v201609")); VanityPharma.WriteTo(xItem); xE.Add(xItem); } if (SelectiveOptimization != null) { xItem = new XElement(XName.Get("selectiveOptimization", "https://adwords.google.com/api/adwords/cm/v201609")); SelectiveOptimization.WriteTo(xItem); xE.Add(xItem); } }
public virtual void ReadFrom(XElement xE) { Id = null; Name = null; Status = null; ServingStatus = null; StartDate = null; EndDate = null; Budget = null; ConversionOptimizerEligibility = null; AdServingOptimizationStatus = null; FrequencyCap = null; Settings = null; AdvertisingChannelType = null; AdvertisingChannelSubType = null; NetworkSetting = null; Labels = null; BiddingStrategyConfiguration = null; CampaignTrialType = null; BaseCampaignId = null; ForwardCompatibilityMap = null; TrackingUrlTemplate = null; UrlCustomParameters = null; VanityPharma = null; SelectiveOptimization = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "id") { Id = long.Parse(xItem.Value); } else if (localName == "name") { Name = xItem.Value; } else if (localName == "status") { Status = CampaignStatusExtensions.Parse(xItem.Value); } else if (localName == "servingStatus") { ServingStatus = ServingStatusExtensions.Parse(xItem.Value); } else if (localName == "startDate") { StartDate = xItem.Value; } else if (localName == "endDate") { EndDate = xItem.Value; } else if (localName == "budget") { Budget = new Budget(); Budget.ReadFrom(xItem); } else if (localName == "conversionOptimizerEligibility") { ConversionOptimizerEligibility = new ConversionOptimizerEligibility(); ConversionOptimizerEligibility.ReadFrom(xItem); } else if (localName == "adServingOptimizationStatus") { AdServingOptimizationStatus = AdServingOptimizationStatusExtensions.Parse(xItem.Value); } else if (localName == "frequencyCap") { FrequencyCap = new FrequencyCap(); FrequencyCap.ReadFrom(xItem); } else if (localName == "settings") { if (Settings == null) { Settings = new List <Setting>(); } var settingsItem = InstanceCreator.CreateSetting(xItem); settingsItem.ReadFrom(xItem); Settings.Add(settingsItem); } else if (localName == "advertisingChannelType") { AdvertisingChannelType = AdvertisingChannelTypeExtensions.Parse(xItem.Value); } else if (localName == "advertisingChannelSubType") { AdvertisingChannelSubType = AdvertisingChannelSubTypeExtensions.Parse(xItem.Value); } else if (localName == "networkSetting") { NetworkSetting = new NetworkSetting(); NetworkSetting.ReadFrom(xItem); } else if (localName == "labels") { if (Labels == null) { Labels = new List <Label>(); } var labelsItem = InstanceCreator.CreateLabel(xItem); labelsItem.ReadFrom(xItem); Labels.Add(labelsItem); } else if (localName == "biddingStrategyConfiguration") { BiddingStrategyConfiguration = new BiddingStrategyConfiguration(); BiddingStrategyConfiguration.ReadFrom(xItem); } else if (localName == "campaignTrialType") { CampaignTrialType = CampaignTrialTypeExtensions.Parse(xItem.Value); } else if (localName == "baseCampaignId") { BaseCampaignId = long.Parse(xItem.Value); } else if (localName == "forwardCompatibilityMap") { if (ForwardCompatibilityMap == null) { ForwardCompatibilityMap = new List <String_StringMapEntry>(); } var forwardCompatibilityMapItem = new String_StringMapEntry(); forwardCompatibilityMapItem.ReadFrom(xItem); ForwardCompatibilityMap.Add(forwardCompatibilityMapItem); } else if (localName == "trackingUrlTemplate") { TrackingUrlTemplate = xItem.Value; } else if (localName == "urlCustomParameters") { UrlCustomParameters = new CustomParameters(); UrlCustomParameters.ReadFrom(xItem); } else if (localName == "vanityPharma") { VanityPharma = new VanityPharma(); VanityPharma.ReadFrom(xItem); } else if (localName == "selectiveOptimization") { SelectiveOptimization = new SelectiveOptimization(); SelectiveOptimization.ReadFrom(xItem); } } }