Permalink
Browse files

add favorites apis; add jscoverage result to readme.md.

  • Loading branch information...
1 parent 49cd414 commit 637b0cbc83b75b9d4fa8984529a9598c8575d7df @fengmk2 fengmk2 committed Sep 30, 2012
Showing with 2,536 additions and 635 deletions.
  1. +1 −0 Makefile
  2. +9 −0 README.md
  3. +109 −0 api.md
  4. +1,119 −7 examples/browser/bundle.js
  5. +2 −0 lib/github.js
  6. +70 −98 lib/tapi.js
  7. +45 −1 lib/tbase.js
  8. +8 −0 lib/tqq.js
  9. +9 −1 lib/weibo.js
  10. +1 −1 package.json
  11. +1,119 −7 test/browser/bundle.js
  12. +2 −1 test/config.js
  13. +1 −2 test/mocha.opts
  14. +2 −1 test/oauth.js
  15. +23 −0 test/tapi.js
  16. +0 −514 test/tsina.js
  17. +13 −0 test/utils/check.js
  18. +3 −2 test/weibo_text_process.js
View
@@ -19,6 +19,7 @@ test-g:
test-cov:
@rm -rf ./lib-cov
@$(MAKE) lib-cov
+ @WEIBO_COV=1 $(MAKE) test REPORTER=dot
@WEIBO_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
lib-cov:
View
@@ -165,6 +165,15 @@ app.listen(8088);
console.log('Server start on http://localhost:8088/');
```
+## Test
+
+```bash
+$ npm install
+$ npm test
+```
+
+jscoverage: [79%](http://fengmk2.github.com/coverage/node-weibo.html)
+
## Authors
Below is the output from `git-summary`.
View
@@ -31,6 +31,13 @@ All apis and data in `node-weibo` will convert to this unity format.
| * [comments_timeline](#comments_timeline)(user[, cursor], callback)|List comments to my statues|[weibo], [tqq]|
| * [comments_to_me](#comments_to_me)(user[, cursor], callback)|List comments to me|[weibo]|
| * [comments_by_me](#comments_by_me)(user[, cursor], callback)|List comments by me|[weibo]|
+| **[Favorite](#favorite) APIs** |||
+| Write |||
+| * [favorite_create](#favorite_create)(user, id, callback)|Add a status to favorites|[weibo], [tqq]|
+| * [favorite_destroy](#favorite_destroy)(user, id, callback)|Remove the status from favorites|[weibo], [tqq]|
+| Read |||
+| * [favorites](#favorites)(user[, cursor], callback)|List favorites|[weibo], [tqq]|
+| * [favorite_show](#favorite_show)(user, id, callback)|Show a favorite item|[weibo], [tqq]|
| **[Message](#message) APIs** |||
| Write |||
| * [message_create](#message_create)(user, text, id, callback)|post a message to some one|-|
@@ -578,6 +585,80 @@ comment_reply: function (user, cid, id, comment, callback)
comment_destroy: function (user, cid, callback) {
```
+## Favorite APIs
+
+### favorites
+
+```js
+/**
+ * List favorites.
+ *
+ * @param {User} user
+ * @param {Cursor} [cursor]
+ * - {String} since_id
+ * - {String} max_id
+ * - {String} [since_time], only for tqq
+ * - {String} [max_time], only for tqq
+ * - {Number} count, default is `20`
+ * - {Number} page
+ * @param {Function(err, result)} callback
+ * {Object} result:
+ * - {Array} items, [Favorite, ...]
+ * - {Cursor} cursor
+ * - ...
+ * @return {Context} this
+ */
+favorites: function (user, cursor, callback)
+```
+
+### favorite_show
+
+```js
+/**
+ * Show a favorite item by item id.
+ *
+ * @param {User} user
+ * @param {String} id, favorite item's id.
+ * @param {Function(err, favorite)} callback
+ * @return {Context} this
+ */
+favorite_show: function (user, id, callback)
+```
+
+### favorite_create
+
+```js
+/**
+ * Add a status to favorites.
+ *
+ * @param {User} user
+ * @param {String} id, status's id.
+ * @param {Function(err, result)} callback
+ * - {Object} result
+ * - {String} id, relation item's id.
+ * - addtional infomation maybe.
+ * @return {Context} this
+ */
+favorite_create: function (user, id, callback)
+```
+
+### favorite_destroy
+
+```js
+/**
+ * Remove the status from favorites.
+ *
+ * @param {User} user
+ * @param {String} id, the favorite item's id.
+ * @param {Function(err, result)} callback
+ * - {Object} result
+ * - {String} id, relation item's id.
+ * - addtional infomation maybe.
+ * @return {Context} this
+ */
+favorite_destroy: function (user, id, callback)
+```
+
## Data Structure
### Status
@@ -942,6 +1023,34 @@ Demo:
]
```
+### Favorite
+
+|Field name|Data Type|Description|Demo|
+|----------|---------|-----------|----|
+|status|[Status]|Status detail infomation|`{id: "123123", text: "foo", ...}`|
+|[tags]|Array|Favorite item's tag list|`[{id: '123', tag: 'funny'}, ...]`|
+|[created_at]|Date|favorite item create time|`new Date("Thu Jun 02 15:16:16 +0800 2011")`|
+
+Demo:
+
+```js
+{
+ "status": {
+ "id": "11488058246",
+ "text": "求关注。",
+ // ...
+ },
+ "tags": [
+ {
+ "id": 23,
+ "tag": "80后"
+ },
+ // ...
+ ],
+ "favorited_time": new Date("Thu Jun 02 15:16:16 +0800 2011")
+}
+```
+
## OAuth
### RequestToken
Oops, something went wrong.

0 comments on commit 637b0cb

Please sign in to comment.