/// <summary> /// Returns all the information about a known place. /// </summary> /// <param name="placeId">A place in the world. These IDs can be retrieved from ReverseGeocode method.</param> /// <returns></returns> public TwitterPlace RetrievePlaceById(string placeId) { if (String.IsNullOrEmpty(placeId)) { throw new ArgumentException(); } var uri = new Uri(this.CommandBaseUri + String.Format("/id/{0}.json", placeId)); TwitterPlace place = null; try { var response = this.TwitterApi.ExecuteUnauthenticatedRequest(uri); place = TwitterObject.Parse <TwitterPlace>(response); } catch (TwitterException e) { if (e.StatusCode != HttpStatusCode.NotFound) { throw; } } return(place); }
public void LookupPlaces() { TwitterPlaceLookupOptions options = new TwitterPlaceLookupOptions { Granularity = "city", MaxResults = 2 }; var places = TwitterPlace.Lookup(30.475012, -84.35509, options); Assert.IsNotNull(places.ResponseObject, places.ErrorMessage); Assert.AreNotEqual(0, places.ResponseObject.Count, places.ErrorMessage); Assert.IsTrue(places.ResponseObject.Count == 2, places.ErrorMessage); }
public static void LookupPlaces() { TwitterPlaceLookupOptions options = new TwitterPlaceLookupOptions { Granularity = "city", MaxResults = 2 }; TwitterPlaceCollection places = TwitterPlace.Lookup(30.475012, -84.35509, options).ResponseObject; Assert.IsNotNull(places); Assert.IsNotEmpty(places); Assert.That(places.Count == 2); }
/// <summary> /// Gets information about a place with with the specified ID. /// </summary> /// <param name="id">The ID of the place.</param> /// <see cref="https://dev.twitter.com/docs/api/1.1/get/geo/id/:place_id"/> public TwitterPlace GetPlace(string id) { return(TwitterPlace.ParseJson(Raw.GetPlace(id))); }