Skip to content

Commit 682e6c9

Browse files
committed
feat(api): add hide and recover post
1 parent c54e164 commit 682e6c9

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
@@ -46,6 +46,8 @@
4646
- [x] [点赞](http://jike-sdk.surge.sh/functions/api_posts.like.html)
4747
- [x] [取消点赞](http://jike-sdk.surge.sh/functions/api_posts.unlike.html)
4848
- [x] [获取点赞用户列表](http://jike-sdk.surge.sh/functions/api_posts.listLikedUsers.html)
49+
- [x] [隐藏动态](http://jike-sdk.surge.sh/functions/api_posts.hide.html)
50+
- [x] [动态转为公开](http://jike-sdk.surge.sh/functions/api_posts.recover.html)
4951
- [动态广场](http://jike-sdk.surge.sh/modules/api_recommend_feed.html)
5052
- [x] [获取动态推荐](http://jike-sdk.surge.sh/functions/api_recommend_feed.list.html)
5153
- [评论](http://jike-sdk.surge.sh/modules/api_comments.html)

src/api/posts.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,25 @@ export const listLikedUsers = <T = Posts.ListLikedUsersResponse>(
106106
},
107107
})
108108
)
109+
110+
/**
111+
* 隐藏动态(仅会员)
112+
* @param id 动态ID
113+
*/
114+
export const hide = <T = Posts.HideResponse>(type: PostType, id: string) =>
115+
toResponse<T>(
116+
request.post(`1.0/${type}/sponsor/hide`, {
117+
json: { id },
118+
})
119+
)
120+
121+
/**
122+
* 转为公开动态(仅会员)
123+
* @param id 动态ID
124+
*/
125+
export const recover = <T = Posts.HideResponse>(type: PostType, id: string) =>
126+
toResponse<T>(
127+
request.post(`1.0/${type}/sponsor/recover`, {
128+
json: { id },
129+
})
130+
)

src/types/api-responses.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ export namespace Posts {
3434
data: User[]
3535
loadMoreKey?: string
3636
}
37+
export interface HideResponse {
38+
/** 提示文本 */
39+
toast: LiteralUnion<'已设置'>
40+
isPrivate: boolean
41+
privatizableStatus: LiteralUnion<'ENABLE_RECOVER'>
42+
}
43+
export interface RecoverResponse {
44+
/** 提示文本 */
45+
toast: LiteralUnion<'已设置'>
46+
isPrivate: boolean
47+
privatizableStatus: LiteralUnion<'ENABLE_HIDE'>
48+
}
3749
}
3850

3951
export namespace Notifications {

0 commit comments

Comments
 (0)