/// <summary> /// /// <example> /// <code> /// var result = CustomRouteSettingsFactory.CreateCustomRouteSettings(handler : handler, settings : settings, responseFields : responseFields, expectedCode: expectedCode, successCode: successCode); /// var optionalCasting = ConvertClass<CustomRouteSettings/>(result); /// return optionalCasting; /// </code> /// </example> /// </summary> public static Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings CreateCustomRouteSettings(ServiceClientMessageHandler handler, Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings settings, string responseFields = null, HttpStatusCode expectedCode = HttpStatusCode.Created, HttpStatusCode successCode = HttpStatusCode.Created) { 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.General.CustomRouteSettingsClient.CreateCustomRouteSettingsClient( settings: settings, 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="responseFields"></param> /// <param name="settings"></param> /// <returns> /// <see cref="Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings"/> /// </returns> /// <example> /// <code> /// var customroutesettings = new CustomRouteSettings(); /// var customRouteSettings = await customroutesettings.UpdateCustomRouteSettingsAsync( settings, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings> UpdateCustomRouteSettingsAsync(Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings settings, string responseFields = null) { MozuClient <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings> response; var client = Mozu.Api.Clients.Commerce.Settings.General.CustomRouteSettingsClient.UpdateCustomRouteSettingsClient(settings, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(); return(await response.ResultAsync()); }
/// <summary> /// Updates custom route settings. /// </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="settings">The updated details of the custom route settings.</param> /// <returns> /// <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings"/>} /// </returns> /// <example> /// <code> /// var mozuClient=UpdateCustomRouteSettings( settings, responseFields); /// var customRouteSettingsClient = mozuClient.WithBaseAddress(url).Execute().Result(); /// </code> /// </example> public static MozuClient <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings> UpdateCustomRouteSettingsClient(Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings settings, string responseFields = null) { var url = Mozu.Api.Urls.Commerce.Settings.General.CustomRouteSettingsUrl.UpdateCustomRouteSettingsUrl(responseFields); const string verb = "PUT"; var mozuClient = new MozuClient <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings>() .WithVerb(verb).WithResourceUrl(url) .WithBody <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings>(settings); return(mozuClient); }
public virtual Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings CreateCustomRouteSettings(Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings settings, string responseFields = null) { MozuClient <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings> response; var client = Mozu.Api.Clients.Commerce.Settings.General.CustomRouteSettingsClient.CreateCustomRouteSettingsClient(settings, responseFields); client.WithContext(_apiContext); response = client.Execute(); return(response.Result()); }
/// <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="settings">The details of the new custom route setting.</param> /// <returns> /// <see cref="Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings"/> /// </returns> /// <example> /// <code> /// var customroutesettings = new CustomRouteSettings(); /// var customRouteSettings = await customroutesettings.CreateCustomRouteSettingsAsync( settings, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings> CreateCustomRouteSettingsAsync(Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings settings, string responseFields = null, CancellationToken ct = default(CancellationToken)) { MozuClient <Mozu.Api.Contracts.SiteSettings.General.General.Routing.CustomRouteSettings> response; var client = Mozu.Api.Clients.Commerce.Settings.General.CustomRouteSettingsClient.CreateCustomRouteSettingsClient(settings, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); return(await response.ResultAsync()); }