/// <summary> /// Returns a list of venues near the current location, optionally matching the search term. /// </summary> /// <param name="ll">required Latitude and longitude of the user's location, so response can include distance.</param> /// <param name="llAcc">Accuracy of latitude and longitude, in meters.</param> /// <param name="alt">Altitude of the user's location, in meters.</param> /// <param name="altAcc">Accuracy of the user's altitude, in meters.</param> /// <param name="query">A search term to be applied against titles.</param> /// <param name="limit">Number of results to return, up to 50.</param> /// <param name="intent">Indicates your intent in performing the search. checkin, match, specials</param> /// <param name="categoryId">A category to limit results to. </param> /// <param name="url">A third-party URL which we will attempt to match against our map of venues to URLs.</param> /// <param name="providerId">Identifier for a known third party that is part of our map of venues to URLs, used in conjunction with linkedId</param> /// <param name="linkedId">Identifier used by third party specifed in providerId, which we will attempt to match against our map of venues to URLs.</param> public static FourSquareVenues VenueSearch(string ll, string llAcc, string alt, string altAcc, string query, string limit, string intent, string categoryId, string url, string providerId, string linkedId, string AccessToken) { HTTPGet GET = new HTTPGet(); string Query = ""; #region Query Conditioning //ll if (!ll.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "ll=" + ll; } //llAcc if (!llAcc.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "llAcc=" + llAcc; } //alt if (!alt.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "alt=" + alt; } //altAcc if (!altAcc.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "altAcc=" + altAcc; } //query if (!query.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "query=" + query; } //limit if (!limit.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "limit=" + limit; } //intent if (!intent.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "intent=" + intent; } //categoryId if (!categoryId.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "categoryId=" + categoryId; } //url if (!url.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "url=" + url; } //providerId if (!providerId.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "providerId=" + providerId; } //linkedId if (!linkedId.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "linkedId=" + linkedId; } #endregion Query Conditioning string EndPoint = "https://api.foursquare.com/v2/venues/search" + Query + "&callback=XXX&v=" + Version + "&oauth_token=" + AccessToken; GET.Request(EndPoint); Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody); FourSquareVenues FoundVenues = new FourSquareVenues(JSONDictionary); return FoundVenues; }
/// <summary> /// Returns a list of venues near the current location with the most people currently checked in. /// </summary> /// <param name="ll">required Latitude and longitude of the user's location.</param> /// <param name="limit">Number of results to return, up to 50.</param> /// <param name="radius">Radius in meters, up to approximately 2000 meters.</param> public static FourSquareVenues VenueTrending(string ll, string limit, string radius, string AccessToken) { HTTPGet GET = new HTTPGet(); string Query = ""; #region Query Conditioning //ll if (!ll.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "ll=" + ll; } //limit if (!limit.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "limit=" + limit; } //radius if (!radius.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "radius=" + radius; } #endregion Query Conditioning string EndPoint = "https://api.foursquare.com/v2/venues/trending" + Query + "&callback=XXX&v=" + Version + "&oauth_token=" + AccessToken; GET.Request(EndPoint); Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody); FourSquareVenues TrendingVenues = new FourSquareVenues(JSONDictionary); return TrendingVenues; }
/// <summary> /// Returns a list of all venues visited by the specified user, along with how many visits and when they were last there. /// </summary> /// <param name="USER_ID">For now, only "self" is supported</param> /// <param name="BeforeTimeStamp">Seconds since epoch.</param> /// <param name="AfterTimeStamp">Seconds after epoch.</param> /// <param name="CategoryID">Limits returned venues to those in this category. If specifying a top-level category, all sub-categories will also match the query.</param> public static FourSquareVenues UserVenueHistory(string USER_ID, string BeforeTimeStamp, string AfterTimeStamp, string CategoryID, string AccessToken) { if (USER_ID.Equals("")) { USER_ID = "self"; } string Query = ""; if (!BeforeTimeStamp.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "beforeTimestamp=" + BeforeTimeStamp; } if (!AfterTimeStamp.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "afterTimestamp=" + AfterTimeStamp; } if (!CategoryID.Equals("")) { if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } Query += "categoryId=" + CategoryID; } if (Query.Equals("")) { Query = "?"; } else { Query += "&"; } HTTPGet GET = new HTTPGet(); string EndPoint = "https://api.foursquare.com/v2/users/" + USER_ID + "/venuehistory" + Query + "callback=XXX&v=" + Version + "&oauth_token=" + AccessToken; GET.Request(EndPoint); Dictionary<string, object> JSONDictionary = JSONDeserializer(GET.ResponseBody); FourSquareVenues Venues = new FourSquareVenues(JSONDictionary); return Venues; }