Exemple #1
0
        /// <summary>
        /// Updates an existing account.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/accounts/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="id">The account id</param>
        /// <param name="body">A valid Adexchangebuyer v1.4 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>AccountResponse</returns>
        public static Account Update(AdexchangebuyerService service, int?id, Account body, AccountsUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Building the initial request.
                var request = service.Accounts.Update(body, id);

                // Applying optional parameters to the request.
                request = (AccountsResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Accounts.Update failed.", ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// Gets the status for a single creative. A creative will be available 30-40 minutes after submission.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/creatives/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="accountId">The id for the account that will serve this creative.</param>
        /// <param name="buyerCreativeId">The buyer-specific id for this creative.</param>
        /// <returns>CreativeResponse</returns>
        public static Creative Get(AdexchangebuyerService service, int?accountId, string buyerCreativeId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (buyerCreativeId == null)
                {
                    throw new ArgumentNullException(buyerCreativeId);
                }

                // Make the request.
                return(service.Creatives.Get(accountId, buyerCreativeId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Creatives.Get failed.", ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// Updates an existing account.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.3/reference/accounts/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="id">The account id</param>
        /// <param name="body">A valid Adexchangebuyer v1.3 body.</param>
        /// <returns>AccountResponse</returns>
        public static Account Update(AdexchangebuyerService service, int?id, Account body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Accounts.Update(body, id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Accounts.Update failed.", ex);
            }
        }
        /// <summary>
        /// Gets a specific pretargeting configuration
        /// Documentation https://developers.google.com/adexchangebuyer/v1.3/reference/pretargetingConfig/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="accountId">The account id to get the pretargeting config for.</param>
        /// <param name="configId">The specific id of the configuration to retrieve.</param>
        /// <returns>PretargetingConfigResponse</returns>
        public static PretargetingConfig Get(AdexchangebuyerService service, string accountId, string configId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (configId == null)
                {
                    throw new ArgumentNullException(configId);
                }

                // Make the request.
                return(service.PretargetingConfig.Get(accountId, configId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request PretargetingConfig.Get failed.", ex);
            }
        }
Exemple #5
0
        /// <summary>
        /// Add new deals for the specified proposal
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/marketplacedeals/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="proposalId">proposalId for which deals need to be added.</param>
        /// <param name="body">A valid Adexchangebuyer v1.4 body.</param>
        /// <returns>AddOrderDealsResponseResponse</returns>
        public static AddOrderDealsResponse Insert(AdexchangebuyerService service, string proposalId, AddOrderDealsRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (proposalId == null)
                {
                    throw new ArgumentNullException(proposalId);
                }

                // Make the request.
                return(service.Marketplacedeals.Insert(body, proposalId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Marketplacedeals.Insert failed.", ex);
            }
        }
Exemple #6
0
        /// <summary>
        /// Update the given proposal
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/proposals/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="proposalId">The proposal id to update.</param>
        /// <param name="revisionNumber">The last known revision number to update. If the head revision in the marketplace database has since changed, an error will be thrown. The caller should then fetch the latest proposal at head revision and retry the update at that revision.</param>
        /// <param name="updateAction">The proposed action to take on the proposal. This field is required and it must be set when updating a proposal.</param>
        /// <param name="body">A valid Adexchangebuyer v1.4 body.</param>
        /// <returns>ProposalResponse</returns>
        public static Proposal Update(AdexchangebuyerService service, string proposalId, string revisionNumber, string updateAction, Proposal body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (proposalId == null)
                {
                    throw new ArgumentNullException(proposalId);
                }
                if (revisionNumber == null)
                {
                    throw new ArgumentNullException(revisionNumber);
                }
                if (updateAction == null)
                {
                    throw new ArgumentNullException(updateAction);
                }

                // Make the request.
                return(service.Proposals.Update(body, proposalId, revisionNumber, updateAction).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Proposals.Update failed.", ex);
            }
        }
Exemple #7
0
        /// <summary>
        /// Remove a deal id associated with the creative.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/creatives/removeDeal
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="accountId">The id for the account that will serve this creative.</param>
        /// <param name="buyerCreativeId">The buyer-specific id for this creative.</param>
        /// <param name="dealId">The id of the deal id to disassociate with this creative.</param>
        public static void RemoveDeal(AdexchangebuyerService service, int?accountId, string buyerCreativeId, string dealId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (buyerCreativeId == null)
                {
                    throw new ArgumentNullException(buyerCreativeId);
                }
                if (dealId == null)
                {
                    throw new ArgumentNullException(dealId);
                }

                // Make the request.
                service.Creatives.RemoveDeal(accountId, buyerCreativeId, dealId).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Creatives.RemoveDeal failed.", ex);
            }
        }
        /// <summary>
        /// Update a given private auction proposal
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/marketplaceprivateauction/updateproposal
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="privateAuctionId">The private auction id to be updated.</param>
        /// <param name="body">A valid Adexchangebuyer v1.4 body.</param>
        public static void Updateproposal(AdexchangebuyerService service, string privateAuctionId, UpdatePrivateAuctionProposalRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (privateAuctionId == null)
                {
                    throw new ArgumentNullException(privateAuctionId);
                }

                // Make the request.
                service.Marketplaceprivateauction.Updateproposal(body, privateAuctionId).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Marketplaceprivateauction.Updateproposal failed.", ex);
            }
        }
        /// <summary>
        /// Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request. This method supports patch semantics.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/budget/patch
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="accountId">The account id associated with the budget being updated.</param>
        /// <param name="billingId">The billing id associated with the budget being updated.</param>
        /// <param name="body">A valid Adexchangebuyer v1.4 body.</param>
        /// <returns>BudgetResponse</returns>
        public static Budget Patch(AdexchangebuyerService service, string accountId, string billingId, Budget body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (billingId == null)
                {
                    throw new ArgumentNullException(billingId);
                }

                // Make the request.
                return(service.Budget.Patch(body, accountId, billingId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Budget.Patch failed.", ex);
            }
        }
Exemple #10
0
        /// <summary>
        /// List all the deals for a given proposal
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/marketplacedeals/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="proposalId">The proposalId to get deals for. To search across all proposals specify order_id = '-' as part of the URL.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>GetOrderDealsResponseResponse</returns>
        public static GetOrderDealsResponse List(AdexchangebuyerService service, string proposalId, MarketplacedealsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (proposalId == null)
                {
                    throw new ArgumentNullException(proposalId);
                }

                // Building the initial request.
                var request = service.Marketplacedeals.List(proposalId);

                // Applying optional parameters to the request.
                request = (MarketplacedealsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Marketplacedeals.List failed.", ex);
            }
        }
Exemple #11
0
        /// <summary>
        /// Retrieves a list of billing information for all accounts of the authenticated user. 
        /// Documentation https://developers.google.com/adexchangebuyer/v1.3/reference/billingInfo/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>  
        /// <returns>BillingInfoListResponse</returns>
        public static BillingInfoList List(AdexchangebuyerService service)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");

                // Make the request.
                return service.BillingInfo.List().Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request BillingInfo.List failed.", ex);
            }
        }
Exemple #12
0
        /// <summary>
        /// Retrieves the authenticated user's list of accounts.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.3/reference/accounts/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <returns>AccountsListResponse</returns>
        public static AccountsList List(AdexchangebuyerService service)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Make the request.
                return(service.Accounts.List().Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Accounts.List failed.", ex);
            }
        }
Exemple #13
0
        /// <summary>
        /// Returns the billing information for one account specified by account ID. 
        /// Documentation https://developers.google.com/adexchangebuyer/v1.3/reference/billingInfo/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>  
        /// <param name="accountId">The account id.</param>
        /// <returns>BillingInfoResponse</returns>
        public static BillingInfo Get(AdexchangebuyerService service, int? accountId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (accountId == null)
                    throw new ArgumentNullException(accountId);

                // Make the request.
                return service.BillingInfo.Get(accountId).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request BillingInfo.Get failed.", ex);
            }
        }
        /// <summary>
        /// Gets one direct deal by ID.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.3/reference/directDeals/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="id">The direct deal id</param>
        /// <returns>DirectDealResponse</returns>
        public static DirectDeal Get(AdexchangebuyerService service, string id)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.DirectDeals.Get(id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request DirectDeals.Get failed.", ex);
            }
        }
Exemple #15
0
        /// <summary>
        /// Gets the requested product by id.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/products/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="productId">The id for the product to get the head revision for.</param>
        /// <returns>ProductResponse</returns>
        public static Product Get(AdexchangebuyerService service, string productId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (productId == null)
                {
                    throw new ArgumentNullException(productId);
                }

                // Make the request.
                return(service.Products.Get(productId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Products.Get failed.", ex);
            }
        }
Exemple #16
0
        /// <summary>
        /// Update the given proposal to indicate that setup has been completed.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/proposals/setupcomplete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="proposalId">The proposal id for which the setup is complete</param>
        public static void Setupcomplete(AdexchangebuyerService service, string proposalId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (proposalId == null)
                {
                    throw new ArgumentNullException(proposalId);
                }

                // Make the request.
                service.Proposals.Setupcomplete(proposalId).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Proposals.Setupcomplete failed.", ex);
            }
        }
Exemple #17
0
        /// <summary>
        /// Gets the requested publisher profile(s) by publisher accountId.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/pubprofiles/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="accountId">The accountId of the publisher to get profiles for.</param>
        /// <returns>GetPublisherProfilesByAccountIdResponseResponse</returns>
        public static GetPublisherProfilesByAccountIdResponse List(AdexchangebuyerService service, int?accountId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }

                // Make the request.
                return(service.Pubprofiles.List(accountId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Pubprofiles.List failed.", ex);
            }
        }
Exemple #18
0
        /// <summary>
        /// Submit a new creative.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/creatives/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="body">A valid Adexchangebuyer v1.4 body.</param>
        /// <returns>CreativeResponse</returns>
        public static Creative Insert(AdexchangebuyerService service, Creative body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Creatives.Insert(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Creatives.Insert failed.", ex);
            }
        }
Exemple #19
0
        /// <summary>
        /// Gets the requested product.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/products/search
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>GetOffersResponseResponse</returns>
        public static GetOffersResponse Search(AdexchangebuyerService service, ProductsSearchOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.Products.Search();

                // Applying optional parameters to the request.
                request = (ProductsResource.SearchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Products.Search failed.", ex);
            }
        }
Exemple #20
0
        /// <summary>
        /// Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.4/reference/creatives/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>CreativesListResponse</returns>
        public static CreativesList List(AdexchangebuyerService service, CreativesListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Building the initial request.
                var request = service.Creatives.List();

                // Applying optional parameters to the request.
                request = (CreativesResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Creatives.List failed.", ex);
            }
        }
Exemple #21
0
        /// <summary>
        /// Retrieves the authenticated user's list of performance metrics.
        /// Documentation https://developers.google.com/adexchangebuyer/v1.3/reference/performanceReport/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Adexchangebuyer service.</param>
        /// <param name="accountId">The account id to get the reports.</param>
        /// <param name="endDateTime">The end time of the report in ISO 8601 timestamp format using UTC.</param>
        /// <param name="startDateTime">The start time of the report in ISO 8601 timestamp format using UTC.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>PerformanceReportListResponse</returns>
        public static PerformanceReportList List(AdexchangebuyerService service, string accountId, string endDateTime, string startDateTime, PerformanceReportListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }
                if (endDateTime == null)
                {
                    throw new ArgumentNullException(endDateTime);
                }
                if (startDateTime == null)
                {
                    throw new ArgumentNullException(startDateTime);
                }

                // Building the initial request.
                var request = service.PerformanceReport.List(accountId, endDateTime, startDateTime);

                // Applying optional parameters to the request.
                request = (PerformanceReportResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request PerformanceReport.List failed.", ex);
            }
        }