Ejemplo n.º 1
0
        /// <summary>
        /// Updates one or more details of a the location specified in the request by location code.
        /// <example>
        ///  <code>
        /// var result = LocationFactory.UpdateLocation(handler : handler,  location :  location,  locationCode :  locationCode,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<Location/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Location.Location UpdateLocation(ServiceClientMessageHandler handler,
                                                                          Mozu.Api.Contracts.Location.Location location, string locationCode, 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.Admin.LocationClient.UpdateLocationClient(
                location:  location, locationCode:  locationCode, 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.Location UpdateLocation(Mozu.Api.Contracts.Location.Location location, string locationCode, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Location.Location> response;
            var client = Mozu.Api.Clients.Commerce.Admin.LocationClient.UpdateLocationClient(location, locationCode, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new physical location for the tenant specified in the request header.
        /// </summary>
        /// <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="location">Properties of a physical location a tenant uses to manage inventory and fulfills orders, provide store finder functionality, or both.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.Location.Location"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=AddLocation( location,  responseFields);
        ///   var locationClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.Location.Location> AddLocationClient(Mozu.Api.Contracts.Location.Location location, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Admin.LocationUrl.AddLocationUrl(responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.Location.Location>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.Location.Location>(location);

            return(mozuClient);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates one or more details of a the location specified in the request by location code.
        /// </summary>
        /// <param name="locationCode">The unique, user-defined code that identifies a location. </param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="location">Properties of a physical location a tenant uses to manage inventory and fulfills orders, provide store finder functionality, or both.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Location.Location"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var location = new Location();
        ///   var location = await location.UpdateLocationAsync( location,  locationCode,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Location.Location> UpdateLocationAsync(Mozu.Api.Contracts.Location.Location location, string locationCode, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Location.Location> response;
            var client = Mozu.Api.Clients.Commerce.Admin.LocationClient.UpdateLocationClient(location, locationCode, responseFields);

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

            return(await response.ResultAsync());
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="locationCode">The unique, user-defined code that identifies a location. </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="location">Properties of a physical location a tenant uses to manage inventory and fulfills orders, provide store finder functionality, or both.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Location.Location"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var location = new Location();
        ///   var location = await location.UpdateLocationAsync( location,  locationCode,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Location.Location> UpdateLocationAsync(Mozu.Api.Contracts.Location.Location location, string locationCode, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.Location.Location> response;
            var client = Mozu.Api.Clients.Commerce.Admin.LocationClient.UpdateLocationClient(location, locationCode, responseFields);

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

            return(await response.ResultAsync());
        }