-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (35 loc) · 957 Bytes
/
index.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
var createClient = require("flickr-client");
var generateURLs = require("flickr-generate-urls");
var client;
module.exports = setup;
function setup (options) {
client = createClient(options);
return favs;
}
function favs (userId, options, callback) {
if (typeof options == 'function') {
callback = options;
options = {};
}
options.user_id = userId;
client('favorites.getPublicList', options, function (error, response) {
if (error) return callback(error);
response.photos.photo.forEach(function (p) {
p.urls = generateURLs({
id: p.id,
secret: p.secret,
osecret: p.originalsecret,
format: "jpg",
farm: p.farm,
server: p.server
});
});
callback(undefined, {
page: response.photos.page,
pages: response.photos.pages,
perpage: response.photos.perpage,
total: response.photos.total,
photos: response.photos.photo
});
});
}