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 47
47
- 动态
48
48
- [x] 获取用户动态
49
49
- [x] 获取关注动态
50
+ - [x] 置顶动态
51
+ - [x] 取消置顶动态
50
52
- 通知
51
53
- [x] 获取通知列表
52
54
- 上传
Original file line number Diff line number Diff line change 1
1
import { request , toResponse } from '../request'
2
+ import type { PostTypeRaw } from '../types/entity'
2
3
import type { PaginationOption } from '../types/options'
3
4
import type { PersonalUpdate } from '../types/api-responses'
4
5
@@ -42,3 +43,35 @@ export const followingUpdates = async <
42
43
} ,
43
44
} )
44
45
)
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 {
73
73
return result . data . toast
74
74
}
75
75
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
+
76
102
/**
77
103
* 添加评论
78
104
* @returns 评论信息
Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ export namespace PersonalUpdate {
139
139
140
140
export type FollowingUpdatesResponseMoreKey =
141
141
FollowingUpdatesResponse [ 'loadMoreKey' ]
142
+
143
+ export interface PinResponse {
144
+ toast : LiteralUnion < '已置顶' >
145
+ }
146
+
147
+ export interface UnpinResponse {
148
+ toast : LiteralUnion < '已取消置顶' >
149
+ }
142
150
}
143
151
144
152
export namespace Comments {
You can’t perform that action at this time.
0 commit comments