/// <summary> /// Updates a site's general global settings. /// </summary> /// <param name="responseFields">Use this field to include those fields which are not included by default.</param> /// <param name="generalSettings">General settings used on the storefront site.</param> /// <returns> /// <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.SiteSettings.General.GeneralSettings"/>} /// </returns> /// <example> /// <code> /// var mozuClient=UpdateGeneralSettings( generalSettings, responseFields); /// var generalSettingsClient = mozuClient.WithBaseAddress(url).Execute().Result(); /// </code> /// </example> public static MozuClient <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings> UpdateGeneralSettingsClient(Mozu.Api.Contracts.SiteSettings.General.GeneralSettings generalSettings, string responseFields = null) { var url = Mozu.Api.Urls.Commerce.Settings.GeneralSettingsUrl.UpdateGeneralSettingsUrl(responseFields); const string verb = "PUT"; var mozuClient = new MozuClient <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings>() .WithVerb(verb).WithResourceUrl(url) .WithBody <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings>(generalSettings); return(mozuClient); }
/// <summary> /// Updates a site's general global settings. /// <example> /// <code> /// var result = GeneralSettingFactory.UpdateGeneralSettings(handler : handler, generalSettings : generalSettings, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode); /// var optionalCasting = ConvertClass<GeneralSettings/>(result); /// return optionalCasting; /// </code> /// </example> /// </summary> public static Mozu.Api.Contracts.SiteSettings.General.GeneralSettings UpdateGeneralSettings(ServiceClientMessageHandler handler, Mozu.Api.Contracts.SiteSettings.General.GeneralSettings generalSettings, 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.Settings.GeneralSettingsClient.UpdateGeneralSettingsClient( generalSettings: generalSettings, 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.SiteSettings.General.GeneralSettings UpdateGeneralSettings(Mozu.Api.Contracts.SiteSettings.General.GeneralSettings generalSettings, string responseFields = null) { MozuClient <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings> response; var client = Mozu.Api.Clients.Commerce.Settings.GeneralSettingsClient.UpdateGeneralSettingsClient(generalSettings, responseFields); client.WithContext(_apiContext); response = client.Execute(); return(response.Result()); }
/// <summary> /// Updates a site's general global settings. /// </summary> /// <param name="responseFields">Use this field to include those fields which are not included by default.</param> /// <param name="generalSettings">General settings used on the storefront site.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.SiteSettings.General.GeneralSettings"/> /// </returns> /// <example> /// <code> /// var generalsettings = new GeneralSettings(); /// var generalSettings = await generalsettings.UpdateGeneralSettingsAsync( generalSettings, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings> UpdateGeneralSettingsAsync(Mozu.Api.Contracts.SiteSettings.General.GeneralSettings generalSettings, string responseFields = null) { MozuClient <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings> response; var client = Mozu.Api.Clients.Commerce.Settings.GeneralSettingsClient.UpdateGeneralSettingsClient(generalSettings, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(); return(await response.ResultAsync()); }
/// <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="generalSettings">General settings used on the storefront site.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.SiteSettings.General.GeneralSettings"/> /// </returns> /// <example> /// <code> /// var generalsettings = new GeneralSettings(); /// var generalSettings = await generalsettings.UpdateGeneralSettingsAsync( generalSettings, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings> UpdateGeneralSettingsAsync(Mozu.Api.Contracts.SiteSettings.General.GeneralSettings generalSettings, string responseFields = null, CancellationToken ct = default(CancellationToken)) { MozuClient <Mozu.Api.Contracts.SiteSettings.General.GeneralSettings> response; var client = Mozu.Api.Clients.Commerce.Settings.GeneralSettingsClient.UpdateGeneralSettingsClient(generalSettings, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); return(await response.ResultAsync()); }