Exemplo n.º 1
0
        /// <summary>
        /// List all URL channels in the specified ad client for this Ad Exchange account.
        /// Documentation https://developers.google.com/adexchangeseller/v1.1/reference/urlchannels/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 Adexchangeseller service.</param>
        /// <param name="adClientId">Ad client for which to list URL channels.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>UrlChannelsResponse</returns>
        public static UrlChannels List(AdexchangesellerService service, string adClientId, UrlchannelsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (adClientId == null)
                {
                    throw new ArgumentNullException(adClientId);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Urlchannels.List failed.", ex);
            }
        }
        /// <summary>
        /// List the preferred deals for this Ad Exchange account.
        /// Documentation https://developers.google.com/adexchangeseller/v1.1/reference/preferreddeals/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 Adexchangeseller service.</param>
        /// <returns>PreferredDealsResponse</returns>
        public static PreferredDeals List(AdexchangesellerService service)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Make the request.
                return(service.Preferreddeals.List().Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Preferreddeals.List failed.", ex);
            }
        }
        /// <summary>
        /// Get information about the selected Ad Exchange account.
        /// Documentation https://developers.google.com/adexchangeseller/v1.1/reference/accounts/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 Adexchangeseller service.</param>
        /// <param name="accountId">Account to get information about. Tip: 'myaccount' is a valid ID.</param>
        /// <returns>AccountResponse</returns>
        public static Account Get(AdexchangesellerService service, string accountId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }

                // Make the request.
                return(service.Accounts.Get(accountId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Accounts.Get failed.", ex);
            }
        }