public async Task<PlanResponse> Plan(PlanRequest request)
 {
     var query = new Dictionary<string, string>
     {
         ["fromPlace"] =
             $"{request.FromPlace.Latitude.ToString(CultureInfo.InvariantCulture)},{request.FromPlace.Longitude.ToString(CultureInfo.InvariantCulture)}",
         ["toPlace"] =
             $"{request.ToPlace.Latitude.ToString(CultureInfo.InvariantCulture)},{request.ToPlace.Longitude.ToString(CultureInfo.InvariantCulture)}",
         ["date"] = request.Time.ToString("MM-dd-yyyy"),
         ["time"] = request.Time.ToString("HH:mm"),
         ["mode"] = request.Mode
     };
     using (
         var stream = await _client.GetStreamAsync(Url.AddQuery("routers/" + request.RouterId + "/plan", query)))
        return stream.Deserialize<PlanResponse>();
 }
Beispiel #2
0
        public async Task <PlanResponse> Plan(PlanRequest request)
        {
            var query = new Dictionary <string, string>
            {
                ["fromPlace"] =
                    $"{request.FromPlace.Latitude.ToString(CultureInfo.InvariantCulture)},{request.FromPlace.Longitude.ToString(CultureInfo.InvariantCulture)}",
                ["toPlace"] =
                    $"{request.ToPlace.Latitude.ToString(CultureInfo.InvariantCulture)},{request.ToPlace.Longitude.ToString(CultureInfo.InvariantCulture)}",
                ["date"] = request.Time.ToString("MM-dd-yyyy"),
                ["time"] = request.Time.ToString("HH:mm"),
                ["mode"] = request.Mode
            };

            using (
                var stream = await _client.GetStreamAsync(Url.AddQuery("routers/" + request.RouterId + "/plan", query)))
                return(stream.Deserialize <PlanResponse>());
        }