clintandrewhall / node-foursquare Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kmiyashiro/node-foursquare
Foursquare API for NodeJS
Home Page: https://www.clintandrewhall.com/portfolio/node-foursquare
License: Other
This project forked from kmiyashiro/node-foursquare
Foursquare API for NodeJS
Home Page: https://www.clintandrewhall.com/portfolio/node-foursquare
License: Other
Source: https://developer.foursquare.com/docs/announcements
Beginning on May 31st, Foursquare is making five changes in order to simplify their API and maintain the quality of their service as their developer community grows. These changes are:
======================
I suspect 2 might require some modification to this npm module.
Just a couple of non-critical issues I have noticed while using the venues/search API
The Foursquare Venues API now deprecates versions <= 20110608 (see https://developer.foursquare.com/docs/venues/search.html) and the returned result has now a meta that looks like:
{"meta":{"code":200,"errorType":"deprecated","errorDetail":"This endpoint...
i) I think it would be nice (and easy) to log (WARN | ERROR) these messages in core.js -> extractData like:
if(json.meta.errorType) {
logger.error("Error type: "" + json.meta.errorType + "" - " + json.meta.errorDetail);
}
ii) 4SQ API seem to become more dependent on the version number (the docs even says that in the near future APIs with no version will default to the latest version - instead of the oldest). The version should probably be added to config-default.js so that clients can set their preferred version
iii) Enforcing a version > 20110608 in venues/search (e.g. 20110609) via param {v : 20110609} now returns an array of "venues" and not "groups". This means extractData() in core.js will report an error since the field "groups" does not exist. I have temporarily hacked search() in venues.js to set the "fields" param to "venues" (instead of "groups") if the API version is higher than 20110608.
Do you have support for that API?
thanks
In the file :
https://github.com/clintandrewhall/node-foursquare/blob/master/lib/node-foursquare.js#L98
Here :
callback({message: esultObj.error});
it should be :
callback({message: resultObj.error});
when using 0.4.* version in a CommonJS setup the error 'TypeError: require(...) is not a function' appears:
sahat/hackathon-starter#888
The project is written using CommonJS setup:
$ npm start
> [email protected] start /mnt/c/temp/hackathon-starter
> node app.js
/mnt/c/temp/hackathon-starter/controllers/api.js:16
const { Venues, Users } = require('node-foursquare')({
^
TypeError: require(...) is not a function
at Object.<anonymous> (/mnt/c/temp/hackathon-starter/controllers/api.js:16:53)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/mnt/c/temp/hackathon-starter/app.js:35:23)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
Can the Babel setup be configured to support default module exports for ES5/CommonJS:
https://babeljs.io/docs/en/babel-plugin-transform-es2015-modules-commonjs.html
Otherwise it breaks backward compatibility
Thanks!
Can you include a component.json file so we can use this lib with bower please?
https://github.com/twitter/bower#defining-a-package
With this library is it possible to change users or logout?
On your README example it's written:
var foursquare = require("node-foursquare")(config);
Shouldn't it be this?
var foursquare = require("node-foursquare-2")(config);
Function getUser haven't any parameters so I can't get self user because I can't add parameter 'v' for supported API version, I have got this error:
[Error: 410: The Foursquare API no longer supports requests that do not pass in a version parameter. For more details see https://developer.foursquare.com/overview/versioning]
It's annoying that venues.getSuggestcompletion not allow the parameter near.
In the foursquare api is allowed
I don't know how to do a pull request, but I needed access to the data returned by this endpoint: https://developer.foursquare.com/docs/api/venues/details
In venues.js I added
var getDetails = function getDetails(venueId) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var accessToken = arguments[2];
var callback = arguments[3];
var method = 'getDetails';
logger.enter(method);
return getSimpleEndpoint(venueId, method, '', params, accessToken, callback);
};
and changed the return to include the new function:
return {
browseBox,
browseCircle,
exploreLocation,
exploreNear,
getBoxedSuggestCompletion,
getCategories,
getDetails,
getEvents,
getHours,
getLikes,
getLinks,
getListed,
getLocationSuggestCompletion,
getLocationTrending,
getManagedVenues,
getMenu,
getNearSuggestCompletion,
getNearTrending,
getNextVenues,
getPhotos,
getSimilar,
getStats,
getTimeSeriesStats,
getTips,
globalSearch,
like,
match,
searchLocation,
searchNear,
unlike
};
Hello, is this still being maintained?
I want to know how to properly utilized this library.
// My Manager
export default class FoursquareManager {
constructor() {
const config = {
secrets: {
clientId: 'xxxxx',
clientSecret: 'xxxx$',
redirectUrl: 'xxxx,
},
};
this.foursquare = require("node-foursquare")(config);
}
getVenues() {
console.log('getting venues');
// Set the accesstoken as an empty string since I'm only accessing the public api.
return this.foursquare.Venues.search('40.7', '-74', null, {}, '', function (error, data) {
return data;
})
}
}
Testing via mocha:
describe("FoursquareManager", () => {
let fsqManager;
beforeEach(() => {
fsqManager = new FoursquareManager();
});
context("getVenues", () => {
context("can get venues", () => {
it("gets venues", done => {
let data = fsqManager.getVenues();
console.log('test', data);
done();
});
});
});
});
Logging the data
it revealed that is undefined
.
Is this the expected behavior then using this library or I'm using this in the wrong way?
node-foursquare/dist/venues.js
Line 63 in da9a99e
If i dont remove "this.", i get the error: TypeError: Cannot read property 'error' of undefined. whenever there is an issue
When foursquare redirects authenticated users, it appends the token via a fragment. Ideally, I'd like to do some processing on the server when that redirect hits. It appears, however, that NodeJS ignores the #access_token=XXXX completely, and does not make that information available on the request. I can fix this using the client as a proxy and make yet another request, which feels hacky and adds latency.
Just wondering if anyone has encountered this issue, and how it could be address using node-foursquare.
Please,
add support for setting a custom Agent in the https
requests.
Snyk.io is reporting that node-foursquare depends on an out-of-date version of winston which is using a vulnerable version of request. Winston as of version 0.8.0 no longer has a dependency on request. Can you please upgrade node-foursquare to use a more updated version of winston?
It's quite an invasive library to import by default - we're wondering if there's a way to suppress it, either directly or via node-foursquare?
The application makes ll or near required, but the api would also work if only NE/SW is required. The condition in venues.search should be something like that:
function search(lat, lng, near, params, accessToken, callback) {
logger.enter('search');
params = params || {};
if(!lat || !lng) {
if(!near) {
if (!params.ne || !params.sw) {
logger.error('Either lat and lng, near, or ne/sw are required as parameters.');
callback(new Error('Venues.explore: near or ne/sw must be specified if lat and lng are not set.'));
return;
}
} else {
params.near = near;
}
} else {
params.ll = lat + ',' + lng;
}
logger.debug('search:lat: ' + lat);
logger.debug('search:lng: ' + lng);
logger.debug('search:near: ' + near);
logger.debug('search:params: ' + util.inspect(params));
core.callApi('/venues/search', accessToken, params, callback);
}
Afters run npm install foursquarevenues
in the same directory of my app, i receive this error Cannot find module 'foursquarevenues'
i need to installed globally for that work, I realized that in github the package.json
{
....
"main": "./foursquareVenues"
....
}
the 'V' uppercase but in npm is lowercase after update this everything work fine.
please update this in npm. Because in my production server (nodjitsu) i cannot install it globally
sory for my english
Looks like that per https://github.com/clintandrewhall/node-foursquare/blob/master/package.json#L50 the package is no longer supporting any LTS versions of NodeJS. I suggest making adjustments so at least the latest LTS version of NodeJS, currently 8.x is supported. See https://github.com/nodejs/Release for the list of current versions of NodeJS, their support and LTS status.
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.