/// <summary>
        /// Modifies the collection of variations for the specified product code. Because this PUT replaces the existing resource, supply all information necessary to maintain for the product variation.
        /// <example>
        ///  <code>
        /// var result = ProductVariationFactory.UpdateProductVariations(handler : handler,  productVariations :  productVariations,  productCode :  productCode,  responseFields :  responseFields,  dataViewMode: dataViewMode,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<ProductVariationCollection/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection UpdateProductVariations(ServiceClientMessageHandler handler,
                                                                                                         Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection productVariations, string productCode, string responseFields = null, DataViewMode dataViewMode = DataViewMode.Live,
                                                                                                         HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
        {
            SetSdKparameters();
            var currentClassName  = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
            var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Debug.WriteLine(currentMethodName + '.' + currentMethodName);
            var apiClient = Mozu.Api.Clients.Commerce.Catalog.Admin.Products.ProductVariationClient.UpdateProductVariationsClient(
                productVariations:  productVariations, productCode:  productCode, responseFields:  responseFields, dataViewMode: dataViewMode);

            try
            {
                apiClient.WithContext(handler.ApiContext).Execute();
            }
            catch (ApiException ex)
            {
                // Custom error handling for test cases can be placed here
                Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
                if (customException != null)
                {
                    throw customException;
                }
                return(null);
            }
            return(ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null);
        }
예제 #2
0
        /// <summary>
        /// Modifies the collection of variations for the specified product code. Because this PUT replaces the existing resource, supply all information necessary to maintain for the product variation.
        /// </summary>
        /// <param name="productCode">Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.</param>
        /// <param name="responseFields">A list or array of fields returned for a call. These fields may be customized and may be used for various types of data calls in Mozu. For example, responseFields are returned for retrieving or updating attributes, carts, and messages in Mozu.</param>
        /// <param name="productVariations">Collection of variations configured for a product.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdateProductVariations(dataViewMode,  productVariations,  productCode,  responseFields);
        ///   var productVariationCollectionClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection> UpdateProductVariationsClient(DataViewMode dataViewMode, Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection productVariations, string productCode, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Catalog.Admin.Products.ProductVariationUrl.UpdateProductVariationsUrl(productCode, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection>(productVariations).WithHeader(Headers.X_VOL_DATAVIEW_MODE, dataViewMode.ToString())
            ;

            return(mozuClient);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="productCode">The unique, user-defined product code of a product, used throughout  to reference and associate to a product.</param>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="productVariations">Collection of variations configured for a product.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var productvariation = new ProductVariation();
        ///   var productVariationCollection = await productvariation.UpdateProductVariationsAsync(_dataViewMode,  productVariations,  productCode,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection> UpdateProductVariationsAsync(Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection productVariations, string productCode, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.Products.ProductVariationClient.UpdateProductVariationsClient(_dataViewMode, productVariations, productCode, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync(ct).ConfigureAwait(false);

            return(await response.ResultAsync());
        }
예제 #4
0
        public virtual Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection UpdateProductVariations(Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection productVariations, string productCode, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.ProductVariationCollection> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.Products.ProductVariationClient.UpdateProductVariationsClient(_dataViewMode, productVariations, productCode, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }