コード例 #1
0
        /// <summary>
        /// Updates the details of the specified price list.
        /// <example>
        ///  <code>
        /// var result = PriceListFactory.UpdatePriceList(handler : handler,  priceList :  priceList,  priceListCode :  priceListCode,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<PriceList/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductAdmin.PriceList UpdatePriceList(ServiceClientMessageHandler handler,
                                                                                Mozu.Api.Contracts.ProductAdmin.PriceList priceList, string priceListCode, string responseFields = null,
                                                                                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.PriceListClient.UpdatePriceListClient(
                priceList:  priceList, priceListCode:  priceListCode, responseFields:  responseFields);

            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
        public virtual Mozu.Api.Contracts.ProductAdmin.PriceList UpdatePriceList(Mozu.Api.Contracts.ProductAdmin.PriceList priceList, string priceListCode, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.PriceList> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.PriceListClient.UpdatePriceListClient(priceList, priceListCode, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
コード例 #3
0
        /// <summary>
        /// Adds a new price list to the tenant.
        /// </summary>
        /// <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="priceList">The details of the new price list.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.PriceList"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=AddPriceList( priceList,  responseFields);
        ///   var priceListClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.ProductAdmin.PriceList> AddPriceListClient(Mozu.Api.Contracts.ProductAdmin.PriceList priceList, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Catalog.Admin.PriceListUrl.AddPriceListUrl(responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.ProductAdmin.PriceList>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.ProductAdmin.PriceList>(priceList);

            return(mozuClient);
        }
コード例 #4
0
        /// <summary>
        /// Adds a new price list to the tenant.
        /// </summary>
        /// <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="priceList">The details of the new price list.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.ProductAdmin.PriceList"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var pricelist = new PriceList();
        ///   var priceList = await pricelist.AddPriceListAsync( priceList,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.ProductAdmin.PriceList> AddPriceListAsync(Mozu.Api.Contracts.ProductAdmin.PriceList priceList, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.PriceList> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.PriceListClient.AddPriceListClient(priceList, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync();

            return(await response.ResultAsync());
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="priceListCode">The unique, user-defined code of the price list.</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="priceList">The details of the updated price list.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.ProductAdmin.PriceList"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var pricelist = new PriceList();
        ///   var priceList = await pricelist.UpdatePriceListAsync( priceList,  priceListCode,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.ProductAdmin.PriceList> UpdatePriceListAsync(Mozu.Api.Contracts.ProductAdmin.PriceList priceList, string priceListCode, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.PriceList> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.PriceListClient.UpdatePriceListClient(priceList, priceListCode, responseFields);

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

            return(await response.ResultAsync());
        }