Skip to content

Commit 75ee894

Browse files
committed
feat(api): add block & remove block
closes #77
1 parent e7ed3b5 commit 75ee894

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
- [x] [是否关注用户](http://jike-sdk.surge.sh/classes/index.JikeUser.html#isFollowing)
3636
- [x] [不看 TA 的内容](http://jike-sdk.surge.sh/functions/api_user_relation.mute.html)
3737
- [x] [重新看 TA 的内容](http://jike-sdk.surge.sh/functions/api_user_relation.unmute.html)
38+
- [x] [加入黑名单](http://jike-sdk.surge.sh/functions/api_user_relation.addBlock.html)
39+
- [x] [解除黑名单](http://jike-sdk.surge.sh/functions/api_user_relation.removeBlock.html)
3840
- [动态帖子](http://jike-sdk.surge.sh/modules/api_posts.html)
3941
- [x] [发送动态](http://jike-sdk.surge.sh/functions/api_posts.create.html)
4042
- [x] [获取动态详情](http://jike-sdk.surge.sh/functions/api_posts.get.html)

src/api/user-relation.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,31 @@ export const unmute = <T = UserRelation.UnmuteResponse>(userId: string) =>
108108
},
109109
})
110110
)
111+
112+
/**
113+
* 加入黑名单
114+
* @param username 用户名
115+
*/
116+
export const addBlock = <T = UserRelation.AddBlockResponse>(username: string) =>
117+
toResponse<T>(
118+
request.post('1.0/userRelation/addBlock', {
119+
json: {
120+
username,
121+
},
122+
})
123+
)
124+
125+
/**
126+
* 解除黑名单
127+
* @param username 用户名
128+
*/
129+
export const removeBlock = <T = UserRelation.RemoveBlockResponse>(
130+
username: string
131+
) =>
132+
toResponse<T>(
133+
request.post('1.0/userRelation/removeBlock', {
134+
json: {
135+
username,
136+
},
137+
})
138+
)

src/types/api-responses.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export namespace UserRelation {
7171
export interface UnmuteResponse {
7272
toast: LiteralUnion<'操作成功!'>
7373
}
74+
export interface AddBlockResponse {
75+
toast: LiteralUnion<'已将其加入黑名单'>
76+
}
77+
export interface RemoveBlockResponse {
78+
toast: LiteralUnion<'已将其解除黑名单'>
79+
}
7480
}
7581

7682
export namespace Users {

0 commit comments

Comments
 (0)