Comparing version 0.0.2 to 0.0.3
var Clips = require('./clips').Clips; | ||
var Lists = require('./lists').Lists; | ||
@@ -10,2 +11,3 @@ | ||
this.clips = new Clips(opts); | ||
this.lists = new Lists(opts); | ||
}; | ||
@@ -15,1 +17,2 @@ | ||
exports.Clips = Clips; | ||
exports.Lists = Lists; |
@@ -56,7 +56,6 @@ var https = require('https'); | ||
if(opts.method === 'DELETE') console.log(opts, params); | ||
var req = https.request(opts, function(res) { | ||
var chunks = ''; | ||
res.on('data', function(resultData) { chunks += resultData; }); | ||
res.on('end', function() { fn(null, JSON.parse(chunks)); }); | ||
res.on('end', function() { fn(null, opts.method === 'DELETE' ? chunks : JSON.parse(chunks)); }); | ||
}); | ||
@@ -63,0 +62,0 @@ if(params) req.write(params); |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "", | ||
@@ -11,0 +11,0 @@ "repository": "git://github.com/enotionz/node-kippt.git", |
@@ -41,2 +41,62 @@ # node-kippt | ||
}); | ||
// add to the clips list | ||
kippt.clips.add({ | ||
url: "Clip's url", // required | ||
title: "Clip's title", | ||
list: "resource_uri for clip's list", | ||
notes: "Notes for the clip", | ||
is_starred: Boolean, | ||
is_read_later: Boolean | ||
}, function(error, data) { | ||
if(!error) console.log(data); | ||
}); | ||
// update the clip, refer to above options | ||
kippt.clips.update({ | ||
id: CLIP_ID, // require | ||
other_options: '' // refer to above options | ||
}, function(error, data) { | ||
if(!error) console.log(data); | ||
}); | ||
// remove the clip | ||
kippt.clips.remove(CLIP_ID, function(error, data) { | ||
if(!error) console.log('SUCCESS'); | ||
}); | ||
``` | ||
### Lists API | ||
``` js | ||
// Returns the full lists object | ||
kippt.lists.all(function(error, data) { | ||
if(!error) console.log(data); | ||
}); | ||
// Returns the list information associated with a list ID | ||
kippt.lists.getById(LIST_ID, function(error, data) { | ||
if(!error) console.log(data); | ||
}); | ||
// add to the list | ||
kippt.lists.add({ | ||
title: "list title", // required | ||
is_private: Boolean | ||
}, function(error, data) { | ||
if(!error) console.log(data); | ||
}); | ||
// update the list | ||
kippt.lists.update({ | ||
id: LIST_ID, // require | ||
title: "list title", | ||
is_private: Boolean | ||
}, function(error, data) { | ||
if(!error) console.log(data); | ||
}); | ||
// remove an item from the list | ||
kippt.clips.remove(LIST_ID, function(error, data) { | ||
if(!error) console.log('SUCCESS'); | ||
}); | ||
``` |
@@ -53,3 +53,6 @@ var mocha = require('mocha'); | ||
assert.equal(data.url, url, 'Saved url equals post url'); | ||
done(); | ||
clips.remove(data.id, function(err) { | ||
assert.ok(!err, 'No error'); | ||
done(); | ||
}); | ||
}); | ||
@@ -56,0 +59,0 @@ }); |
@@ -14,3 +14,7 @@ /** | ||
id: 'SOME_ID' | ||
}, | ||
lists: { | ||
// A list ID you know to exist | ||
id: 'SOME_ID' | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11096
11
248
102