Beispiel #1
0
        public static LocationResult FetchLonLat(string userPostCode)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            var            restClient   = new RestClient("https://api.postcodes.io/");
            var            restRequest  = new RestRequest($"postcodes/{userPostCode}", Method.GET);
            var            restResponse = restClient.Execute(restRequest);
            LocationResult parseJson    = JsonConvert.DeserializeObject <LocationResult>(restResponse.Content);

            return(parseJson);
        }
Beispiel #2
0
        public static StopPointFixerDoer FetchStopPoints(LocationResult longAndLat)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            var restClient  = new RestClient("https://api.tfl.gov.uk/");
            var restRequest = new RestRequest($"StopPoint?stopTypes=NaptanPublicBusCoachTram&radius" +
                                              $"=200&useStopPointHierarchy=false&lat={longAndLat.result.latitude}&lon={longAndLat.result.longitude}", Method.GET);
            var restResponse             = restClient.Execute(restRequest);
            StopPointFixerDoer parseJson = JsonConvert.DeserializeObject <StopPointFixerDoer>(restResponse.Content);

            return(parseJson);
        }