public async Task TestBasicOperation()
        {
            var client = new GeoDirectionsClient("gme-quantumit", "SMwlqqfA_96refkab9Gd8kxGmuw=");
            var request = new GeoDirectionsRequest();
            request.TravelMode = TravelMode.Transit;
            request.TransitMode = TransitMode.Bus;

            request.Origin = new GeoCoordinate() { Longitude = 53.21742417, Latitude = -2.603484875 };
            request.Destination = new GeoCoordinate() { Longitude = 53.0, Latitude = -2.603484875 };

            var result = await client.GetDirections(request);
            Console.WriteLine(result);
        }
 private string BuildUri(GeoDirectionsRequest request)
 {
     var options = new GeoDirectionsRequestVisitor().Visit(_mode, request).ToList();
     if (options.Count < 2) throw new Exception("Cannot call Directions API with no origin and destination parameters");
     var joinedOptions = string.Join("&", options);
     switch (_mode)
     {
         case UsageMode.ClientKey:
             joinedOptions = string.Format("{0}&key={1}", joinedOptions, _clientKey);
             break;
         case UsageMode.ApiForWork:
             joinedOptions = string.Format("{0}&client={1}", joinedOptions, _clientId);
             var signature = GeoHmacSignatureBuilder.GetSignature(string.Format("{0}{1}",ApiPath, joinedOptions), _cryptoKey);
             joinedOptions = string.Format("{0}&signature={1}", joinedOptions, signature);
             break;
     }
     return string.Format("{0}{1}{2}", Domain, ApiPath, joinedOptions);
 }
        public async Task<GeoDirectionsResponse> GetDirections(GeoDirectionsRequest request)
        {
            var url = BuildUri(request);
            string json;
            var httpRequest = WebRequest.CreateHttp(url);
            using (var ms = new MemoryStream())
            {
                using (var response = await httpRequest.GetResponseAsync())
                using (var body = response.GetResponseStream())
                {
                    if (body != null) await body.CopyToAsync(ms);
                }
                json = Encoding.UTF8.GetString(ms.ToArray());
            }

            return JsonConvert.DeserializeObject<GeoDirectionsResponse>(json);

        }
 internal IEnumerable<string> Visit(UsageMode usageMode, GeoDirectionsRequest request)
 {
     _result = new List<string>();
     _usageMode = usageMode;
     _request = request;
     // Visit all of the request properties and determine if the parameter is valid within the context of the call.
     VistRequiredParameters();
     VisitMode();
     VisitWaypoints();
     VisitAlternatives();
     VisitRouteRestrictions();
     VisitLanguage();
     VisitUnits();
     VisitRegion();
     VisitDepartureTime();
     VisitArrivalTime();
     VisitTransitMode();
     VisitTransitRoutingPreference();
     return _result;
 }