/// <summary> /// Updates one or more properties of a coupon set in the catalog. /// <example> /// <code> /// var result = CouponSetFactory.UpdateCouponSet(handler : handler, couponSet : couponSet, couponSetCode : couponSetCode, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode); /// var optionalCasting = ConvertClass<CouponSet/>(result); /// return optionalCasting; /// </code> /// </example> /// </summary> public static Mozu.Api.Contracts.ProductAdmin.CouponSet UpdateCouponSet(ServiceClientMessageHandler handler, Mozu.Api.Contracts.ProductAdmin.CouponSet couponSet, string couponSetCode, 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.CouponSetClient.UpdateCouponSetClient( couponSet: couponSet, couponSetCode: couponSetCode, 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); }
public virtual Mozu.Api.Contracts.ProductAdmin.CouponSet UpdateCouponSet(Mozu.Api.Contracts.ProductAdmin.CouponSet couponSet, string couponSetCode, string responseFields = null) { MozuClient <Mozu.Api.Contracts.ProductAdmin.CouponSet> response; var client = Mozu.Api.Clients.Commerce.Catalog.Admin.Couponsets.CouponClient.UpdateCouponSetClient(couponSet, couponSetCode, responseFields); client.WithContext(_apiContext); response = client.Execute(); return(response.Result()); }
/// <summary> /// /// </summary> /// <param name="couponSetCode">The unique identifier of the coupon set.</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="couponSet">The details of the updated coupon set.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.ProductAdmin.CouponSet"/> /// </returns> /// <example> /// <code> /// var couponset = new CouponSet(); /// var couponSet = await couponset.UpdateCouponSetAsync( couponSet, couponSetCode, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.ProductAdmin.CouponSet> UpdateCouponSetAsync(Mozu.Api.Contracts.ProductAdmin.CouponSet couponSet, string couponSetCode, string responseFields = null, CancellationToken ct = default(CancellationToken)) { MozuClient <Mozu.Api.Contracts.ProductAdmin.CouponSet> response; var client = Mozu.Api.Clients.Commerce.Catalog.Admin.CouponSetClient.UpdateCouponSetClient(couponSet, couponSetCode, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); return(await response.ResultAsync()); }
/// <summary> /// Updates one or more properties of a coupon set in the catalog. /// </summary> /// <param name="couponSetCode">The unique identifier of the coupon set.</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="couponSet">The details of the updated coupon set.</param> /// <returns> /// <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.CouponSet"/>} /// </returns> /// <example> /// <code> /// var mozuClient=UpdateCouponSet( couponSet, couponSetCode, responseFields); /// var couponSetClient = mozuClient.WithBaseAddress(url).Execute().Result(); /// </code> /// </example> public static MozuClient <Mozu.Api.Contracts.ProductAdmin.CouponSet> UpdateCouponSetClient(Mozu.Api.Contracts.ProductAdmin.CouponSet couponSet, string couponSetCode, string responseFields = null) { var url = Mozu.Api.Urls.Commerce.Catalog.Admin.CouponSetUrl.UpdateCouponSetUrl(couponSetCode, responseFields); const string verb = "PUT"; var mozuClient = new MozuClient <Mozu.Api.Contracts.ProductAdmin.CouponSet>() .WithVerb(verb).WithResourceUrl(url) .WithBody <Mozu.Api.Contracts.ProductAdmin.CouponSet>(couponSet); return(mozuClient); }
/// <summary> /// /// </summary> /// <param name="responseFields"></param> /// <param name="couponSet"></param> /// <returns> /// <see cref="Mozu.Api.Contracts.ProductAdmin.CouponSet"/> /// </returns> /// <example> /// <code> /// var couponset = new CouponSet(); /// var couponSet = await couponset.AddCouponSetAsync( couponSet, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.ProductAdmin.CouponSet> AddCouponSetAsync(Mozu.Api.Contracts.ProductAdmin.CouponSet couponSet, string responseFields = null) { MozuClient <Mozu.Api.Contracts.ProductAdmin.CouponSet> response; var client = Mozu.Api.Clients.Commerce.Catalog.Admin.CouponSetClient.AddCouponSetClient(couponSet, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(); return(await response.ResultAsync()); }