1 | # 4sq
|
2 |
|
3 | A Node.JS wrapper for the [Foursquare API](https://developer.foursquare.com/overview/).
|
4 |
|
5 | How to use with JavaScript
|
6 | --------------------------
|
7 |
|
8 | ```javascript
|
9 | var foursquare = require('4sq');
|
10 |
|
11 | var fsq = new foursquare({token: 'OAuth2 access_token'});
|
12 |
|
13 | fsq.checkins('self', {limit: 5}, function(error, data) {
|
14 | if (error) {
|
15 | throw new Error(error);
|
16 | }
|
17 |
|
18 | console.log(data);
|
19 | });
|
20 | ```
|
21 |
|
22 | Or with CoffeeScript
|
23 | --------------------
|
24 |
|
25 | ```coffeescript
|
26 | foursquare = require '4sq'
|
27 |
|
28 | fsq = new foursquare token: 'OAuth2 access_token'
|
29 |
|
30 | fsq.checkins 'self', limit: 5, (error, data) ->
|
31 | throw new Error error if error
|
32 | console.log data
|
33 | ```
|
34 |
|
35 | ----------------
|
36 |
|
37 | Install with NPM
|
38 | ----------------
|
39 |
|
40 | npm install 4sq
|
41 |
|
42 | How to retrieve Foursquare OAuth2 access_token
|
43 | ----------------------------------------------
|
44 |
|
45 | Grab latest source code and install all dev dependencies
|
46 |
|
47 | npm link
|
48 |
|
49 | Change your host, client id, client secret in [examples/get-access-token.coffee](http://github.com/meritt/node-4sq/blob/master/examples/get-access-token.coffee) and after that run [examples/get-access-token.coffee](http://github.com/meritt/node-4sq/blob/master/examples/get-access-token.coffee)
|
50 |
|
51 | coffee examples/get-access-token.coffee
|
52 |
|
53 | API
|
54 | ---
|
55 |
|
56 | * user (*user id*, *params*, *callback*)
|
57 | * checkins (*user id*, *params*, *callback*)
|
58 | * badges (*user id*, *params*, *callback*)
|
59 |
|
60 | Author
|
61 | ------
|
62 |
|
63 | * [Alexey Simonenko](mailto:alexey@simonenko.su), [simonenko.su](http://simonenko.su) |
\ | No newline at end of file |