#pragma warning restore CA1822 // Mark members as static /// <summary> /// Reads RTM configuration from json file. /// </summary> /// <returns>RTM configuration</returns> private static RtmSettings GetRTMConfiguration() { try { RtmSettings rtmSettings = null; Configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .Build(); rtmSettings = new RtmSettings(Configuration.GetSection("RtmSettings")); return(rtmSettings); } catch { throw new Exception("Invalid Application configurations"); } }
private async Task <dynamic> GetRTMProviderDetails(dynamic site, string sessionId, RtmSettings rtmSettings, IHttpClientService httpClient) { dynamic spDetails = null; string siteID = site["ID"]; string serviceGroupID = site["ServiceGroup"][0]["ID"]; string serviceSiteID = site["ServiceGroup"][0]["ServiceSites"][0]["ID"]; string servicedetailURL = string.Format(CultureInfo.InvariantCulture, rtmSettings.ServiceProviderDetailURL.OriginalString, rtmSettings.ApiKey, siteID, serviceGroupID, serviceSiteID, sessionId); var response = await httpClient.GetAsync(new Uri(servicedetailURL)).ConfigureAwait(false); if (response.StatusCode == HttpStatusCode.OK) { var spDetailResponse = response.Content.ReadAsStringAsync().Result; spDetails = JsonConvert.DeserializeObject(spDetailResponse); } return(spDetails); }