File tree Expand file tree Collapse file tree 4 files changed +69
-0
lines changed
Expand file tree Collapse file tree 4 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 4747- 动态
4848 - [x] 获取用户动态
4949 - [x] 获取关注动态
50+ - [x] 置顶动态
51+ - [x] 取消置顶动态
5052- 通知
5153 - [x] 获取通知列表
5254- 上传
Original file line number Diff line number Diff line change 11import { request , toResponse } from '../request'
2+ import type { PostTypeRaw } from '../types/entity'
23import type { PaginationOption } from '../types/options'
34import type { PersonalUpdate } from '../types/api-responses'
45
@@ -42,3 +43,35 @@ export const followingUpdates = async <
4243 } ,
4344 } )
4445 )
46+
47+ /**
48+ * 置顶动态
49+ */
50+ export const pin = async < T = PersonalUpdate . PinResponse > (
51+ type : PostTypeRaw ,
52+ id : string
53+ ) =>
54+ toResponse < T > (
55+ request . post ( '1.0/personalUpdate/pin' , {
56+ json : {
57+ id,
58+ type,
59+ } ,
60+ } )
61+ )
62+
63+ /**
64+ * 取消置顶动态
65+ */
66+ export const unpin = async < T = PersonalUpdate . UnpinResponse > (
67+ type : PostTypeRaw ,
68+ id : string
69+ ) =>
70+ toResponse < T > (
71+ request . post ( '1.0/personalUpdate/unpin' , {
72+ json : {
73+ id,
74+ type,
75+ } ,
76+ } )
77+ )
Original file line number Diff line number Diff line change @@ -73,6 +73,32 @@ export class JikePost {
7373 return result . data . toast
7474 }
7575
76+ /**
77+ * 置顶动态
78+ * @returns 置顶提示文本
79+ */
80+ async pin ( ) {
81+ const result = await this . apiClient . personalUpdate . pin (
82+ enumTypeToRaw ( this . type ) ,
83+ this . id
84+ )
85+ if ( ! isSuccess ( result ) ) throwRequestFailureError ( result , '置顶动态' )
86+ return result . data . toast
87+ }
88+
89+ /**
90+ * 取消置顶动态
91+ * @returns 取消置顶提示文本
92+ */
93+ async unpin ( ) {
94+ const result = await this . apiClient . personalUpdate . unpin (
95+ enumTypeToRaw ( this . type ) ,
96+ this . id
97+ )
98+ if ( ! isSuccess ( result ) ) throwRequestFailureError ( result , '取消置顶动态' )
99+ return result . data . toast
100+ }
101+
76102 /**
77103 * 添加评论
78104 * @returns 评论信息
Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ export namespace PersonalUpdate {
139139
140140 export type FollowingUpdatesResponseMoreKey =
141141 FollowingUpdatesResponse [ 'loadMoreKey' ]
142+
143+ export interface PinResponse {
144+ toast : LiteralUnion < '已置顶' >
145+ }
146+
147+ export interface UnpinResponse {
148+ toast : LiteralUnion < '已取消置顶' >
149+ }
142150}
143151
144152export namespace Comments {
You can’t perform that action at this time.
0 commit comments