/// <summary> /// Create new API service with specific route /// </summary> /// <param name="route">Specific route </param> public APIService(string route = "") { try { #if DEBUG var httpClientHandler = new HttpClientHandler { ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true }; #endif var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(Settings.Default.ApiUrl) }; var _flurlClient = new FlurlClient(httpClient); request = _flurlClient.Request(route); BaseUrl = request.Url; request = request.GetAuthorizedApiRequest().AllowAnyHttpStatus(); BaseUrl = request.Url; } catch (UnauthorizedException ex) { MessageBox.Show(ex.Message); } }