BoxKite.Twitter.PlacesGeoExtensions.GetPlaceIDFromInfo C# (CSharp) Метод

GetPlaceIDFromInfo() публичный статический Метод

Search for places that can be attached to a statuses/update. Given a latitude and a longitude pair, an IP address, or a name, this request will return a list of all the valid places that can be used as the place_id when updating a status
ref: https://dev.twitter.com/docs/api/1.1/get/geo/search
public static GetPlaceIDFromInfo ( this session, string query = "", double latitude = 0.0, double longitude = 0.0, string accuracy = "10m", string containedWithin = "", string granularity = "neighborhood", int maxResults = 20, string ipAddress = "" ) : Task
session this
query string Free-form text to match against while executing a geo-based query, best suited for finding nearby locations by name. Remember to URL encode the query.
latitude double The latitude to search around.
longitude double The longitude to search around.
accuracy string A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If this is not passed in, then it is assumed to be 0m.
containedWithin string This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.
granularity string This is the minimal granularity of place types to return and must be one of: poi, neighborhood, city, admin or country. If no granularity is provided for the request neighborhood is assumed.
maxResults int A hint as to the number of results to return.
ipAddress string An IP address. Used when attempting to fix geolocation based off of the user's IP address.
Результат Task
        public static async Task<ReverseGeoCodePlaces> GetPlaceIDFromInfo(this IUserSession session, string query="", double latitude = 0.0,
     double longitude = 0.0, string accuracy = "10m", string containedWithin ="", string granularity = "neighborhood", int maxResults = 20, string ipAddress="")
        {
            var parameters = new TwitterParametersCollection
                             {
                                 {"max_results", maxResults.ToString()}
                             };

            if (!string.IsNullOrWhiteSpace(query))
            {
                parameters.Add("query", query);
            }

            if (!string.IsNullOrWhiteSpace(containedWithin))
            {
                parameters.Add("contained_within", containedWithin);
            }

            if (!string.IsNullOrWhiteSpace(granularity))
            {
                parameters.Add("granularity", granularity);
            }

            if (!string.IsNullOrWhiteSpace(ipAddress))
            {
                parameters.Add("ip", ipAddress);
            }

            if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0)
            {
                parameters.Add("lat", latitude.ToString());
                parameters.Add("long", longitude.ToString());

                if (!string.IsNullOrWhiteSpace(accuracy)) // nested because I think this only matters when lat/long is set
                {
                    parameters.Add("accuracy", accuracy);
                }
            }

            return await session.GetAsync(TwitterApi.Resolve("/1.1/geo/search.json"), parameters)
                          .ContinueWith(c => c.MapToSingle<ReverseGeoCodePlaces>());

        }