Ejemplo n.º 1
0
        /// <summary>
        /// Updates the location usage for the site based on the location usage code specified in the request.
        /// <example>
        ///  <code>
        /// var result = LocationSettingsFactory.UpdateLocationUsage(handler : handler,  usage :  usage,  code :  code,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<LocationUsage/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Location.LocationUsage UpdateLocationUsage(ServiceClientMessageHandler handler,
                                                                                    Mozu.Api.Contracts.Location.LocationUsage usage, string code, 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.Settings.LocationSettingsClient.UpdateLocationUsageClient(
                usage:  usage, code:  code, 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);
        }
Ejemplo n.º 2
0
        public virtual Mozu.Api.Contracts.Location.LocationUsage UpdateLocationUsage(Mozu.Api.Contracts.Location.LocationUsage usage, string code, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Location.LocationUsage> response;
            var client = Mozu.Api.Clients.Commerce.Settings.LocationUsageClient.UpdateLocationUsageClient(usage, code, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="code">User-defined code that uniqely identifies the channel group.</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="usage">Configuration properties of a location usage type for a specified site. The direct ship location usage type consists of a single location that represents location that supports direct ship (DS) fulfillment. The in-store pickup location usage type consists of a list of location types that represent locations that support in-store pickup (SP) fulfillment. The store finder location usage type consists of a list of location codes, location types, or both.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Location.LocationUsage"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var locationusage = new LocationUsage();
        ///   var locationUsage = await locationusage.UpdateLocationUsageAsync( usage,  code,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Location.LocationUsage> UpdateLocationUsageAsync(Mozu.Api.Contracts.Location.LocationUsage usage, string code, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.Location.LocationUsage> response;
            var client = Mozu.Api.Clients.Commerce.Settings.LocationUsageClient.UpdateLocationUsageClient(usage, code, responseFields);

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

            return(await response.ResultAsync());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the location usage for the site based on the location usage code specified in the request.
        /// </summary>
        /// <param name="code">User-defined code that uniqely identifies the channel group.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="usage">Configuration properties of a location usage type for a specified site. The direct ship location usage type consists of a single location that represents location that supports direct ship (DS) fulfillment. The in-store pickup location usage type consists of a list of location types that represent locations that support in-store pickup (SP) fulfillment. The store finder location usage type consists of a list of location codes, location types, or both.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.Location.LocationUsage"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdateLocationUsage( usage,  code,  responseFields);
        ///   var locationUsageClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.Location.LocationUsage> UpdateLocationUsageClient(Mozu.Api.Contracts.Location.LocationUsage usage, string code, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Settings.LocationUsageUrl.UpdateLocationUsageUrl(code, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.Location.LocationUsage>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.Location.LocationUsage>(usage);

            return(mozuClient);
        }