/// <summary> /// Retrieves all the campaigns that exist within a specified account. /// https://msdn.microsoft.com/en-US/library/bing-ads-campaign-management-getcampaignsbyaccountid.aspx /// </summary> /// <param name="auth">Do not use ApiAuthentication directly. Use PasswordAuthentication or OAuthAuthentication derives from it instead.</param> /// <param name="accountId">The identifier of the account that contains the campaigns to get.</param> /// <param name="campaignType">The type of campaign to get. You can specify one or more types. /// https://msdn.microsoft.com/en-US/library/bing-ads-campaign-management-campaigntype.aspx /// </param> /// <param name="customerId">The identifier of the customer that owns the account. /// Note: Required for service operations related to targeting and editorial. As a best practice you should always specify this element.</param> /// <returns></returns> public GetCampaignsByAccountIdResponse GetCampaignsByAccountId( ApiAuthentication auth, long accountId, CampaignType campaignType, long?customerId = null) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType, CustomerAccountId = string.Format("{0}", accountId), CustomerId = string.Format("{0}", customerId), }; try { SetAuthHelper.SetAuth(auth, request); return(Check().GetCampaignsByAccountId(request)); } catch (Exception ex) { Log(new LogEventArgs(ServiceType.CampaignManagement, "GetCampaignsByAccountId", ex.Message, new { Request = request }, ex)); } return(null); }
// Gets the budget opportunities which have not expired for the specified account. private async Task <IList <Campaign> > GetCampaignsByAccountIdAsync(long accountId) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId }; return((await CampaignService.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)).Campaigns); }
// Retrieves all the requested campaign types in the account. private async Task <GetCampaignsByAccountIdResponse> GetCampaignsByAccountIdAsync( long accountId, CampaignType campaignType, CampaignAdditionalField returnAdditionalFields) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType, ReturnAdditionalFields = returnAdditionalFields }; return(await CampaignService.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)); }
// Gets campaigns of the specified type for the account. private async Task<IList<Campaign>> GetCampaignsByAccountIdAsync( long accountId, CampaignType campaignType) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType }; return (await Service.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)).Campaigns; }
// Retrieves all the requested campaign types in the account. private async Task<GetCampaignsByAccountIdResponse> GetCampaignsByAccountIdAsync( long accountId, CampaignType campaignType, CampaignAdditionalField returnAdditionalFields) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType, ReturnAdditionalFields = returnAdditionalFields }; return (await CampaignService.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)); }