/
example.js
50 lines (42 loc) · 1.22 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var ChirpRest = require('./');
var twitter = new ChirpRest({
consumer: {
public: process.env.TWITTER_CONSUMER_PUBLIC,
secret: process.env.TWITTER_CONSUMER_SECRET
},
token: {
public: process.env.TWITTER_TOKEN_PUBLIC,
secret: process.env.TWITTER_TOKEN_SECRET
}
});
//get user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
console.log(err);
console.log(body.length);
});
//get user timeline count = 5
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', {
count: 5
}, function(err, body) {
console.log(err);
console.log(body.length);
});
//get user timeline count = 10
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json?count=10', function(err, body) {
console.log(err);
console.log(body.length);
});
/*
//post new status
twitter.post('https://api.twitter.com/1.1/statuses/update.json', {
status: 'Ladies!'
}, function(err, body) {
console.log(err);
console.log(body);
//delete
twitter.post('https://api.twitter.com/1.1/statuses/destroy/' + body.id + '.json', function(err, body) {
console.log(err);
console.log(body);
});
});
*/