-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
1 合约调用
1.1 发布文章
合约编号:1000
合约参数:
- title 文章标题,非空,最长256字符
- url 文章url,最长256字符
- text 发表内容,最长4096字符
- tags 文章标签,非空,最长20字符,多个词语用逗号分隔
注意:url与text必须有一个为空
1.2 发表评论
合约编号:1001
合约参数:
- aid 文章编号
- pid 回复评论编号,可选
- content 回复内容,非空,最长4096字符
1.3 给文章投票
合约编号:1002
合约参数:
- aid 文章编号
- amount 投票数额‘,大于等于100000
1.4 给评论打赏
合约编号:1003
合约参数:
- cid 评论编号
- amount 打赏数额,大于等于100000
1.5 举报文章或评论
合约编号:1004
合约参数:
- topic 只能为1或2. 1表示举报文章,2表示举报评论
- value 举报的文章或评论id
1.6 设置昵称
合约编号: 4
合约参数:
- nickname 用户输入的昵称,最多20字节
2 访问接口
2.1 获取文章列表
uri:/articles
请求参数:
- sortBy 可选项为score,timestamp,分别表示按分数排序和按时间排序,默认为score
- limit 返回的最大文章数量,默认为50
- offset 检索偏移量,默认为0
响应结果:
{
"count": 3,
"articles": [
{
"id": "3",
"tid": "649abb04dce2d2adf221479a52d3c12ff2d2734cf526de065426bd50527aa7fb",
"authorId": "A8QCwz5Vs77UGX9YqBg9kJ6AZmsXQBC8vj",
"timestamp": 74078878,
"title": "third article",
"url": "http://reditt.com",
"text": "",
"tags": "hello",
"votes": 0,
"t_timestamp": 74078878,
"t_type": 1000,
"t_height": 68,
},
{
"id": "2",
"tid": "fde73b38f6e3895fa4538abee9fec01ea681a23013fef6f463cf82f92d92552d",
"authorId": "A8QCwz5Vs77UGX9YqBg9kJ6AZmsXQBC8vj",
"timestamp": 74078111,
"title": "second article",
"url": "http://lisk.io",
"text": "",
"tags": "normal",
"votes": 0,
"t_timestamp": 74078111,
"t_type": 1000,
"t_height": 26
},
{
"id": "1",
"tid": "58c559facea3b5227335e66dff975240b12c53824d6fe9b1c7a3b45881d4e3c8",
"authorId": "A8QCwz5Vs77UGX9YqBg9kJ6AZmsXQBC8vj",
"timestamp": 74077893,
"title": "first article",
"url": "http://www.asch.so",
"text": "",
"tags": "normal",
"votes": 10,
"t_timestamp": 74077893,
"t_type": 1000,
"t_height": 4
}
],
"success": true
}
注意:score模式下,返回结果没有count,不需要分页,timestamp模式下需要用count进行分页
2.2 获取文章详情
uri:/articles/:id
响应结果:
{
"article": {
"id": "1",
"tid": "58c559facea3b5227335e66dff975240b12c53824d6fe9b1c7a3b45881d4e3c8",
"authorId": "A8QCwz5Vs77UGX9YqBg9kJ6AZmsXQBC8vj",
"timestamp": 74077893,
"title": "first article",
"url": "http://www.asch.so",
"text": "",
"tags": "normal",
"votes": 10,
"t_timestamp": 74077893,
"t_type": 1000,
"t_height": 4
},
"success": true
}
2.3 获取文章评论列表
uri:/articles/:id/comments
请求参数:
- limit 返回的最大评论数,默认50
- offset 检索偏移量,默认0
响应结果:
{
"comments": [
{
"id": 1,
"tid": "05b8910ecce5c043515d18632050f8a406b6c35b45660bb6b2731a2a53503733",
"authorId": "A8QCwz5Vs77UGX9YqBg9kJ6AZmsXQBC8vj",
"aid": 1,
"pid": 0,
"content": "Asch is an excellent project",
"rewards": 0,
"t_timestamp": 74078234,
"t_type": 1001,
"t_height": 38
}
],
"count": 1,
"success": true
}
2.4 获取转账记录
uri:/transfers
请求参数:
- limit 返回的最大记录条数,默认20
- offset 检索偏移量,默认0
- ownerId 转账记录所有者地址
- currency 转账币种
响应结果:
{
count: 9,
transfers: [
{
tid: "c3b8d0c5259c2742d2cdafaf0e3a6246310fc8861352f793237bb5f6a25e74db",
senderId: "AFUH568CbGC2GPcE4gXHiZhxdYQYfziz2J",
recipientId: "AA7pXek8Naa5Qdx93JxENFUJ5V45zNqBHA",
currency: "XAS",
amount: "100000000000",
t_timestamp: 76764297,
t_type: 3,
t_height: 33254
}
],
success: true
}
3 新增功能
3.1 昵称
返回的文章或评论,可能包含一个nickname字段,表示作者的昵称。
如果账户没有设置昵称,则无该字段
3.2 举报次数
所有文章和评论新增一个reports字段,表示被举报次数,默认为0,暂时无需显示
Metadata
Metadata
Assignees
Labels
No labels