/// <summary>
        ///
        /// </summary>
        /// <param name="dataViewMode">{<see cref="Mozu.Api.DataViewMode"/>}</param>
        /// <param name="softAllocationRenew">The details of the soft allocation that you want to renew.</param>
        /// <returns>
        /// List{<see cref="Mozu.Api.Contracts.ProductAdmin.SoftAllocation"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var softallocation = new SoftAllocation();
        ///   var softAllocation = await softallocation.RenewSoftAllocationsAsync( softAllocationRenew);
        /// </code>
        /// </example>
        public virtual async Task <List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> > RenewSoftAllocationsAsync(Mozu.Api.Contracts.ProductAdmin.SoftAllocationRenew softAllocationRenew, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> > response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.SoftAllocationClient.RenewSoftAllocationsClient(softAllocationRenew);

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

            return(await response.ResultAsync());
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataViewMode">{<see cref="Mozu.Api.DataViewMode"/>}</param>
        /// <param name="softAllocationRenew">The details of the soft allocation that you want to renew.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{List{<see cref="Mozu.Api.Contracts.ProductAdmin.SoftAllocation"/>}}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=RenewSoftAllocations( softAllocationRenew);
        ///   var softAllocationClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> > RenewSoftAllocationsClient(Mozu.Api.Contracts.ProductAdmin.SoftAllocationRenew softAllocationRenew)
        {
            var          url        = Mozu.Api.Urls.Commerce.Catalog.Admin.SoftAllocationUrl.RenewSoftAllocationsUrl();
            const string verb       = "POST";
            var          mozuClient = new MozuClient <List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> >()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.ProductAdmin.SoftAllocationRenew>(softAllocationRenew);

            return(mozuClient);
        }
Пример #3
0
        /// <summary>
        /// Updates the expiration time for a set of soft allocations in a non-transactional batch.
        /// </summary>
        /// <param name="dataViewMode">{<see cref="Mozu.Api.DataViewMode"/>}</param>
        /// <param name="softAllocationRenew">The details of the soft allocation that you want to renew.</param>
        /// <returns>
        /// List{<see cref="Mozu.Api.Contracts.ProductAdmin.SoftAllocation"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var softallocation = new SoftAllocation();
        ///   var softAllocation = await softallocation.RenewSoftAllocationsAsync( softAllocationRenew);
        /// </code>
        /// </example>
        public virtual async Task <List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> > RenewSoftAllocationsAsync(Mozu.Api.Contracts.ProductAdmin.SoftAllocationRenew softAllocationRenew)
        {
            MozuClient <List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> > response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.SoftAllocationClient.RenewSoftAllocationsClient(softAllocationRenew);

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

            return(await response.ResultAsync());
        }
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = SoftAllocationFactory.RenewSoftAllocations(handler : handler,  softAllocationRenew :  softAllocationRenew,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<List<SoftAllocation>/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> RenewSoftAllocations(ServiceClientMessageHandler handler,
                                                                                                 Mozu.Api.Contracts.ProductAdmin.SoftAllocationRenew softAllocationRenew,
                                                                                                 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.SoftAllocationClient.RenewSoftAllocationsClient(
                softAllocationRenew:  softAllocationRenew);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
Пример #5
0
        public virtual List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> RenewSoftAllocations(Mozu.Api.Contracts.ProductAdmin.SoftAllocationRenew softAllocationRenew)
        {
            MozuClient <List <Mozu.Api.Contracts.ProductAdmin.SoftAllocation> > response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.SoftAllocationClient.RenewSoftAllocationsClient(softAllocationRenew);

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