/// <summary> /// Updates a collection of synonym definitions.Refer to [Search Synonyms](../../../../developer/api-guides/search-settings.htm#search_synonyms) for more information about search synonyms. /// </summary> /// <param name="localeCode">The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country.</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="collection">The updated details of the synonym definition collection.</param> /// <returns> /// <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection"/>} /// </returns> /// <example> /// <code> /// var mozuClient=UpdateSynonymDefinitionCollection( collection, localeCode, responseFields); /// var synonymDefinitionCollectionClient = mozuClient.WithBaseAddress(url).Execute().Result(); /// </code> /// </example> public static MozuClient <Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection> UpdateSynonymDefinitionCollectionClient(Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection collection, string localeCode, string responseFields = null) { var url = Mozu.Api.Urls.Commerce.Catalog.Admin.SearchUrl.UpdateSynonymDefinitionCollectionUrl(localeCode, responseFields); const string verb = "POST"; var mozuClient = new MozuClient <Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection>() .WithVerb(verb).WithResourceUrl(url) .WithBody <Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection>(collection); return(mozuClient); }
/// <summary> /// /// <example> /// <code> /// var result = SearchFactory.UpdateSynonymDefinitionCollection(handler : handler, collection : collection, localeCode : localeCode, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode); /// var optionalCasting = ConvertClass<SynonymDefinitionCollection/>(result); /// return optionalCasting; /// </code> /// </example> /// </summary> public static Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection UpdateSynonymDefinitionCollection(ServiceClientMessageHandler handler, Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection collection, string localeCode, 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.SearchClient.UpdateSynonymDefinitionCollectionClient( collection: collection, localeCode: localeCode, 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); }
/// <summary> /// /// </summary> /// <param name="localeCode">The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country.</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="collection">The updated details of the synonym definition collection.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection"/> /// </returns> /// <example> /// <code> /// var search = new Search(); /// var synonymDefinitionCollection = await search.UpdateSynonymDefinitionCollectionAsync( collection, localeCode, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection> UpdateSynonymDefinitionCollectionAsync(Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection collection, string localeCode, string responseFields = null, CancellationToken ct = default(CancellationToken)) { MozuClient <Mozu.Api.Contracts.ProductAdmin.Search.SynonymDefinitionCollection> response; var client = Mozu.Api.Clients.Commerce.Catalog.Admin.SearchClient.UpdateSynonymDefinitionCollectionClient(collection, localeCode, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); return(await response.ResultAsync()); }