예제 #1
0
        static async Task Main(string[] args)
        {
            var oidcClient = InitializeLoginClient();

            Console.WriteLine("Logging in");
            var loginResult = await Login(oidcClient);

            // Request a new access token using the refresh token if it is expired.
            var refreshResult = await oidcClient.RefreshTokenAsync(loginResult.RefreshToken);

            var httpClient = new HttpClient();

            httpClient.SetBearerToken(loginResult.AccessToken);

            string grundriskEndpoint = "https://grundrisk-api.demo.miljoeportal.dk";
            var    webUrl            = "https://grundrisk.demo.miljoeportal.dk";

            Console.WriteLine("Initializing Grundrisk client");
            var grundriskClient = new GrundriskClient(grundriskEndpoint, httpClient);

            await Preliminaryscreening.StartPreliminarySceening(grundriskClient, webUrl);

            await JarEndpoints.GetJarScreeningDetailsAsync(grundriskClient, "253-00585");

            Console.WriteLine("---");
            await JarEndpoints.GetJarRiskCalculationDetailsAsync(grundriskClient, "253-00585");
        }
예제 #2
0
        public static async Task GetJarRiskCalculationDetailsAsync(GrundriskClient grundriskClient, string locationNumber)
        {
            Console.WriteLine($"Calling Jar endpoint /jar/locations/{locationNumber}/riskCalculations");
            var result = await grundriskClient.GetJarRiskCalculationDetailsAsync(locationNumber);

            var jsonResult = JsonConvert.SerializeObject(result);

            Console.WriteLine($"Receiving data:");
            Console.WriteLine($"{jsonResult}");
        }
        public static async Task StartPreliminarySceening(GrundriskClient grundriskClient, string webUrl)
        {
            var json = await System.IO.File.ReadAllTextAsync("request.json");

            var preliminaryScreeningCommand = JsonConvert.DeserializeObject <StartPreliminaryScreeningCommand>(json);

            Console.WriteLine("Retrieving preliminaryscreening details");
            var result = await grundriskClient.StartPreliminaryScreeningAsync(preliminaryScreeningCommand);

            foreach (var screeningResult in result.PreliminaryScreeningResults)
            {
                Console.WriteLine($"Retrieving prelimaryscreenings from {screeningResult.CompoundName} " +
                                  $"with a concentration {screeningResult.Conc100mGrundRisk} " +
                                  $"and a factor of {screeningResult.Factor} " +
                                  $"and with flag value {screeningResult.Flag}");
            }

            Console.WriteLine($"Preliminary screening link: {webUrl}/screening/preliminary/location-details/{result.LocationId}");
            Console.WriteLine($"Preliminary riskassessment link: {webUrl}/riskassessment/preliminary/location-details/{result.LocationId}");
        }