public string ReverseGeocode(double latitude, double longitude, TwitterReverseGeocodeOptions options)
        {
            // Define the query string
            NameValueCollection qs = new NameValueCollection {
                { "lat", latitude.ToString(CultureInfo.InvariantCulture) },
                { "long", longitude.ToString(CultureInfo.InvariantCulture) }
            };

            // Add optional parameters
            if (options != null)
            {
                if (options.Accurary != null && options.Accurary != "0m")
                {
                    qs.Add("accuracy", options.Accurary);
                }
                if (options.Granularity != default(TwitterGranularity))
                {
                    qs.Add("granularity", options.Granularity.ToString().ToLower());
                }
                if (options.MaxResults > 0)
                {
                    qs.Add("max_results", options.MaxResults + "");
                }
            }

            // Make the call to the API
            return(Client.DoHttpRequestAsString("GET", "https://api.twitter.com/1.1/geo/reverse_geocode.json", qs));
        }
Esempio n. 2
0
 /// <summary>
 /// Given a latitude and a longitude, searches for up to 20 places that can be used as
 /// a <code>place_id</code> when updating a status. This request is an informative call
 /// and will deliver generalized results about geography.
 /// </summary>
 /// <param name="options">The options used when making the call to the API.</param>
 /// <returns>An instance of <see cref="TwitterReverseGeocodeResponse"/> representing the response.</returns>
 /// <see>
 ///     <cref>https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode</cref>
 /// </see>
 public TwitterReverseGeocodeResponse ReverseGeocode(TwitterReverseGeocodeOptions options)
 {
     return(TwitterReverseGeocodeResponse.ParseResponse(Raw.ReverseGeocode(options)));
 }
Esempio n. 3
0
 /// <summary>
 /// Given a latitude and a longitude, searches for up to 20 places that can be used as
 /// a <code>place_id</code> when updating a status. This request is an informative call
 /// and will deliver generalized results about geography.
 /// </summary>
 /// <param name="options">The options used when making the call to the API.</param>
 /// <returns>An instance of <see cref="SocialHttpResponse"/> representing the raw response.</returns>
 /// <see>
 ///     <cref>https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode</cref>
 /// </see>
 public SocialHttpResponse ReverseGeocode(TwitterReverseGeocodeOptions options)
 {
     return(Client.DoHttpGetRequest("https://api.twitter.com/1.1/geo/reverse_geocode.json", options));
 }
Esempio n. 4
0
 /// <summary>
 /// Given a latitude and a longitude, searches for up to 20 places that can be used as
 /// a <var>place_id</var> when updating a status. This request is an informative call
 /// and will deliver generalized results about geography.
 /// </summary>
 /// <param name="latitude">The latitude to search around. This parameter will be ignored
 /// unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will
 /// also be ignored if there isn't a corresponding <var>long</var> parameter.</param>
 /// <param name="longitude">The longitude to search around. The valid ranges for longitude
 /// is -180.0 to +180.0 (East is positive) inclusive. This parameter will be ignored if
 /// outside that range, if it is not a number, if <var>geo_enabled</var> is disabled, or
 /// if there not a corresponding <var>lat</var> parameter.</param>
 /// <param name="options">The options used when making the call to the API.</param>
 /// <see cref="https://dev.twitter.com/docs/api/1.1/get/geo/reverse_geocode"/>
 public TwitterReverseGeocodeResponse ReverseGeocode(double latitude, double longitude, TwitterReverseGeocodeOptions options)
 {
     return(TwitterReverseGeocodeResponse.ParseJson(Raw.ReverseGeocode(latitude, longitude, options)));
 }