cnode社区开放接口sdk
快捷方便统一。
接口命名
TOPICS:
- getTopics: get /topics 获取主题首页
- getTopic: get /topic/:id 主题详情
- postTopics: post /topics 新建主题
- postTopicsUpdate: post /topics/update 编辑主题
USER:
- getUser: get /user/:loginname 用户详情
- postAccessToken: post /accesstoken 验证 accessToken 的正确性
MESSAGE:
- getMessageCount: get /message/count 获取未读消息数
- getMessages: get /messages 获取已读和未读消息
- postMessageMarkall: post /message/mark_all 标记全部已读
COLLECT:
- postCollect: post /topic_collect/collect 收藏主题
- postDeCollect: post /topic_collect/de_collect 取消主题
- getLoginnameCollect: get /topic_collect/:loginname 用户所收藏的主题
REPLY:
- postTopicReplies: post /topic/:topic_id/replies 新建评论
- postReplyUps: post /reply/:reply_id/ups 为评论点赞
安装和使用
npm install ccnode --save
cnodejs社区api参数参考:https://cnodejs.org/api
公共参数:
const options = accesstoken: 'xxxx'
ES5:
promise使用:
var cnode = ;var topics = options;topics;
callback使用:
var cnode = ;var topics = options;topics// 带参数的接口,比如/topic/:topic_id,需要自己写hosttopics;
ES7:
;const topics = options;// Within Async Funcasync try const result = await topics; return result; catch e console; ;