/// <summary> /// Updates the localizable content for the specified discount or renames the discount without modifying its other properties. /// <example> /// <code> /// var result = DiscountFactory.UpdateDiscountContent(handler : handler, content : content, discountId : discountId, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode); /// var optionalCasting = ConvertClass<DiscountLocalizedContent/>(result); /// return optionalCasting; /// </code> /// </example> /// </summary> public static Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent UpdateDiscountContent(ServiceClientMessageHandler handler, Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent content, int discountId, 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.DiscountClient.UpdateDiscountContentClient( content : content, discountId : discountId, 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; }
/// <summary> /// /// </summary> /// <param name="discountId">discountId parameter description DOCUMENT_HERE </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="content">The container for the language-specific name of the discount. A container exists for each supported language (LocaleCode). This parameter enables you to display the discount name in multiple languages yet manage it as a single discount internally.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent"/> /// </returns> /// <example> /// <code> /// var discount = new Discount(); /// var discountLocalizedContent = await discount.UpdateDiscountContentAsync( content, discountId, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent> UpdateDiscountContentAsync(Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent content, int discountId, string responseFields = null, CancellationToken ct = default(CancellationToken)) { MozuClient <Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent> response; var client = Mozu.Api.Clients.Commerce.Catalog.Admin.DiscountClient.UpdateDiscountContentClient(content, discountId, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); return(await response.ResultAsync()); }
/// <summary> /// Updates the localizable content for the specified discount or rename the discount without modifying its other properties. /// </summary> /// <param name="discountId">Unique identifier of the discount. System-supplied and read only.</param> /// <param name="responseFields">Use this field to include those fields which are not included by default.</param> /// <param name="content">The container for the language-specific name of the discount. A container exists for each supported language (LocaleCode). This parameter enables you to display the discount name in multiple languages yet manage it as a single discount internally.</param> /// <returns> /// <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent"/>} /// </returns> /// <example> /// <code> /// var mozuClient=UpdateDiscountContent( content, discountId, responseFields); /// var discountLocalizedContentClient = mozuClient.WithBaseAddress(url).Execute().Result(); /// </code> /// </example> public static MozuClient <Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent> UpdateDiscountContentClient(Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent content, int discountId, string responseFields = null) { var url = Mozu.Api.Urls.Commerce.Catalog.Admin.DiscountUrl.UpdateDiscountContentUrl(discountId, responseFields); const string verb = "PUT"; var mozuClient = new MozuClient <Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent>() .WithVerb(verb).WithResourceUrl(url) .WithBody <Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent>(content); return(mozuClient); }
public virtual Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent UpdateDiscountContent(Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent content, int discountId, string responseFields = null) { MozuClient <Mozu.Api.Contracts.ProductAdmin.DiscountLocalizedContent> response; var client = Mozu.Api.Clients.Commerce.Catalog.Admin.DiscountClient.UpdateDiscountContentClient(content, discountId, responseFields); client.WithContext(_apiContext); response = client.Execute(); return(response.Result()); }