forked from phts/nodejs-torrent-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-get-request-params.js
More file actions
43 lines (41 loc) · 901 Bytes
/
Copy pathcreate-get-request-params.js
File metadata and controls
43 lines (41 loc) · 901 Bytes
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
var qs = require('qs');
function createGetRequestParams () {
return {
withInfoHash: function (info_hash) {
this.info_hash = info_hash;
return this;
},
withPeerId: function (peer_id) {
this.peer_id = peer_id;
return this;
},
withIp: function (ip) {
this.ip = ip;
return this;
},
withPort: function (port) {
this.port = port;
return this;
},
withLeft: function (left) {
this.left = left;
return this;
},
withEvent: function (event) {
this.event = event;
return this;
},
withCompact: function (compact) {
this.compact = compact;
return this;
},
without: function (param) {
delete this[param];
return this;
},
toQuery: function () {
return qs.stringify(this, {encode: false});
}
};
}
module.exports = createGetRequestParams;