コード例 #1
0
        /// <summary>
        /// Updates the shipping settings of the account. This method can only be called for accounts to which the managing account has access: either the managing account itself or sub-accounts if the managing account is a multi-client account.
        /// Documentation https://developers.google.com/shoppingcontent/v2/reference/accountshipping/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 ShoppingContent service.</param>
        /// <param name="merchantId">The ID of the managing account.</param>
        /// <param name="accountId">The ID of the account for which to get/update account shipping settings.</param>
        /// <param name="body">A valid ShoppingContent v2 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>AccountShippingResponse</returns>
        public static AccountShipping Update(ShoppingContentService service, string merchantId, string accountId, AccountShipping body, AccountshippingUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (merchantId == null)
                {
                    throw new ArgumentNullException(merchantId);
                }
                if (accountId == null)
                {
                    throw new ArgumentNullException(accountId);
                }

                // Building the initial request.
                var request = service.Accountshipping.Update(body, merchantId, accountId);

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

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