Exemplo n.º 1
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = LocationTypeFactory.UpdateLocationType(handler : handler,  locationType :  locationType,  locationTypeCode :  locationTypeCode,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<LocationType/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Location.LocationType UpdateLocationType(ServiceClientMessageHandler handler,
                                                                                  Mozu.Api.Contracts.Location.LocationType locationType, string locationTypeCode, 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.LocationTypeClient.UpdateLocationTypeClient(
                locationType:  locationType, locationTypeCode:  locationTypeCode, responseFields:  responseFields);

            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);
        }
Exemplo n.º 2
0
        public virtual Mozu.Api.Contracts.Location.LocationType UpdateLocationType(Mozu.Api.Contracts.Location.LocationType locationType, string locationTypeCode, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Location.LocationType> response;
            var client = Mozu.Api.Clients.Commerce.Admin.LocationTypeClient.UpdateLocationTypeClient(locationType, locationTypeCode, responseFields);

            client.WithContext(_apiContext);
            response = client.Execute();
            return(response.Result());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the name of a defined location type.
        /// </summary>
        /// <param name="locationTypeCode">The user-defined code that identifies the location type.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="locationType">Properties of a type of physical location, such as warehouse or kiosk. Location types enable tenants to group similar locations for filtering and location usage type definition.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Location.LocationType"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var locationtype = new LocationType();
        ///   var locationType = await locationtype.UpdateLocationTypeAsync( locationType,  locationTypeCode,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Location.LocationType> UpdateLocationTypeAsync(Mozu.Api.Contracts.Location.LocationType locationType, string locationTypeCode, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Location.LocationType> response;
            var client = Mozu.Api.Clients.Commerce.Admin.LocationTypeClient.UpdateLocationTypeClient(locationType, locationTypeCode, responseFields);

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

            return(await response.ResultAsync());
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </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="locationType">Properties of a type of physical location, such as warehouse or kiosk. Location types enable tenants to group similar locations for filtering and location usage type definition.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.Location.LocationType"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=AddLocationType( locationType,  responseFields);
        ///   var locationTypeClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.Location.LocationType> AddLocationTypeClient(Mozu.Api.Contracts.Location.LocationType locationType, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Admin.LocationTypeUrl.AddLocationTypeUrl(responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.Location.LocationType>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.Location.LocationType>(locationType);

            return(mozuClient);
        }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </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="locationType">Properties of a type of physical location, such as warehouse or kiosk. Location types enable tenants to group similar locations for filtering and location usage type definition.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Location.LocationType"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var locationtype = new LocationType();
        ///   var locationType = await locationtype.AddLocationTypeAsync( locationType,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Location.LocationType> AddLocationTypeAsync(Mozu.Api.Contracts.Location.LocationType locationType, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.Location.LocationType> response;
            var client = Mozu.Api.Clients.Commerce.Admin.LocationTypeClient.AddLocationTypeClient(locationType, responseFields);

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

            return(await response.ResultAsync());
        }