forked from ds0nt/quip-rip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hackpad.js
114 lines (90 loc) · 2.38 KB
/
hackpad.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
var fs = require('fs');
var _ = require('lodash');
var Hackpad = require('hackpad');
var keys = require('./keys').hackpad;
function hackpad() {
var client_id = keys.client_id
var secret = keys.secret;
var options = {
site: 'advocate',
};
return new Hackpad(client_id, secret, options);
}
var client = hackpad();
var last
var timestamp = new Date.now() / 1000 | 0;
//works better than list
client.editedSince(timestamp, function(err, ids) {
_.forEach(ids, function(id) {
client.export(id, 'latest', 'md', function(err, body) {
fs.writeFileSync(`pads/${id}.md`, body);
})
})
});
// // request
// var path, method, headers, body;
// client.request(path, method, headers, body, function(err, response) {
// console.log(err, response)
// });
// // get
// var path;
// client.get(path, function(err, response) {
// console.log(err, response)
// });
// // post
// var path, headers, body;
// client.post(path, headers, body, function(err, response) {
// console.log(err, response)
// });
// // create
// var body, contentType;
// client.create(body, contentType, function(err, response) {
// console.log(err, response)
// });
// // import
// var padId, body, contentType;
// client.import(padId, body, contentType, function(err, response) {
// console.log(err, response)
// });
// // revert
// var padId, revisionId;
// client.revert(padId, revisionId, function(err, response) {
// console.log(err, response)
// });
// // export
// var padId, revisionId, format;
// client.export(padId, revisionId, format, function(err, response) {
// console.log(err, response)
// });
// // editedSince
// var timestamp;
// // revisions
// var padId;
// client.revisions(padId, function(err, response) {
// console.log(err, response)
// });
// // options
// var padId;
// client.options(padId, function(err, response) {
// console.log(err, response)
// });
// // revokeAccess
// var padId, email;
// client.revokeAccess(padId, email, function(err, response) {
// console.log(err, response)
// });
// // removeUser
// var email;
// client.removeUser(email, function(err, response) {
// console.log(err, response)
// });
// // setEmailEnabled
// var email, setting;
// client.setEmailEnabled(email, setting, function(err, response) {
// console.log(err, response)
// });
// // search
// var terms, start, limit;
// client.search(terms, start, limit, function(err, response) {
// console.log(err, response)
// });