private static string GetRequestUrl(this IGeocodingQuery query) { var requestBuilder = new StringBuilder(query.BaseServiceUrl); requestBuilder = requestBuilder.AppendFormat("?key={0}", query.ApiKey); foreach (var param in query.Params) { requestBuilder = requestBuilder.AppendFormat("&{0}={1}", param.Key, param.Value); } return(requestBuilder.ToString()); }
public static async Task <string> GetResultAsync(this IGeocodingQuery query) { return(await GoogleMapGeocodingHttpClient.Instance.GetStringAsync(GetRequestUrl(query))); }
public static async Task <GeocodingResultLite> GetGeocodingResultAsync(this IGeocodingQuery query) { var responseAsString = await query.GetResultAsync(); return(JsonConvert.DeserializeObject <GeocodingResultLite>(responseAsString)); }
public static IGeocodingQuery WithAddress(this IGeocodingQuery query, string address) { query.Params["address"] = address; return(query); }
public static IGeocodingQuery WithResultType(this IGeocodingQuery query, ResultType resultType) { query.Params["result_type"] = Enum.GetName(typeof(ResultType), resultType); return(query); }
public static IGeocodingQuery WithLocationType(this IGeocodingQuery query, LocationType locationType) { query.Params["location_type"] = Enum.GetName(typeof(LocationType), locationType); return(query); }
public static IGeocodingQuery WithCordinate(this IGeocodingQuery query, Location location) { query.Params["latlng"] = string.Format("{0},{1}", location.Latitude, location.Longitude); return(query); }