Skip to content

Loading…

Added support for the venues/suggestioncompletion endpoint #7

Merged
merged 3 commits into from

2 participants

@lkosak

This is what foursquare uses to drive their own autocomplete search inputs.

@clintandrewhall clintandrewhall merged commit 8a22115 into clintandrewhall:master
@clintandrewhall

Thank you for your support! Cheers!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 29, 2012
  1. @lkosak

    added suggestcompletion endpoint

    lkosak committed
  2. @lkosak
  3. @lkosak

    fixed typos

    lkosak committed
This page is out of date. Refresh to see the latest.
Showing with 36 additions and 2 deletions.
  1. +36 −2 lib/venues.js
View
38 lib/venues.js
@@ -244,6 +244,39 @@ module.exports = function(config) {
getVenueAspect(venueId, "links", params, accessToken, callback)
}
+ /**
+ * Search Foursquare Venues for autocomplete.
+ * @memberof module:node-foursquare/Venues
+ * @param {String|Number} lat The latitude of the location around which to search.
+ * @param {String|Number} lng The longitude of the location around which to search.
+ * @param {String} query Query parameter to search against
+ * @param {Object} [params] An object containing additional parameters. Refer to Foursquare documentation for details
+ * on currently supported parameters.
+ * @param {String} [accessToken] The access token provided by Foursquare for the current user.
+ * @param {Function} callback The function to call with results, function({Error} error, {Object} results).
+ * @see https://developer.foursquare.com/docs/venues/search.html
+ */
+ function getSuggestcompletion(lat, lng, query, params, accessToken, callback) {
+ logger.debug("ENTERING: Venues.suggestComplete");
+ params = params || {};
+
+ if(!lat || !lng) {
+ logger.error("Lat and Lng are both required parameters.");
+ callback(new Error("Venues.explore: lat and lng are both required."));
+ return;
+ }
+ params.ll = lat + "," + lng;
+
+ if(!query) {
+ logger.error("Query is a required parameter.");
+ callback(new Error("Venues.getSuggestcompletion: query is a required parameter."));
+ return;
+ }
+ params.query = query;
+
+ core.callApi("/venues/suggestcompletion", accessToken, params, callback);
+ }
+
return {
"getCategories" : getCategories,
"explore" : explore,
@@ -254,6 +287,7 @@ module.exports = function(config) {
"getHereNow" : getHereNow,
"getTips" : getTips,
"getPhotos" : getPhotos,
- "getLinks" : getLinks
+ "getLinks" : getLinks,
+ "getSuggestcompletion": getSuggestcompletion
}
-};
+};
Something went wrong with that request. Please try again.