File tree Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 32
32
- [x] 关注
33
33
- [x] 取消关注
34
34
- [x] 是否关注用户
35
+ - [x] 不看 TA 的内容
36
+ - [x] 重新看 TA 的内容
35
37
- 动态帖子
36
38
- [x] 发送动态
37
39
- [x] 获取动态详情
Original file line number Diff line number Diff line change @@ -82,3 +82,29 @@ export const unfollow = <T = UserRelation.UnfollowResponse>(
82
82
} ,
83
83
} )
84
84
)
85
+
86
+ /**
87
+ * 不看 TA 的内容
88
+ * @param userId 用户 ID
89
+ */
90
+ export const mute = < T = UserRelation . MuteResponse > ( userId : string ) =>
91
+ toResponse < T > (
92
+ request . post ( '1.0/userRelation/mute' , {
93
+ json : {
94
+ id : userId ,
95
+ } ,
96
+ } )
97
+ )
98
+
99
+ /**
100
+ * 重新看 TA 的内容
101
+ * @param userId 用户 ID
102
+ */
103
+ export const unmute = < T = UserRelation . UnmuteResponse > ( userId : string ) =>
104
+ toResponse < T > (
105
+ request . post ( '1.0/userRelation/unmute' , {
106
+ json : {
107
+ id : userId ,
108
+ } ,
109
+ } )
110
+ )
Original file line number Diff line number Diff line change @@ -31,6 +31,14 @@ export class JikeUser<M extends boolean = boolean> {
31
31
this . #profile = profile
32
32
}
33
33
34
+ /**
35
+ * 获取用户 ID
36
+ * @returns 用户 ID
37
+ */
38
+ async getId ( ) {
39
+ return ( await this . queryProfile ( ) ) . user . id
40
+ }
41
+
34
42
/**
35
43
* 获取用户名
36
44
* @returns 用户名
@@ -259,4 +267,24 @@ export class JikeUser<M extends boolean = boolean> {
259
267
)
260
268
if ( ! isSuccess ( result ) ) throwRequestFailureError ( result , '取消关注用户' )
261
269
}
270
+
271
+ /**
272
+ * 不看 TA 的内容
273
+ */
274
+ async mute ( ) {
275
+ const result = await this . #client. apiClient . userRelation . mute (
276
+ await this . getId ( )
277
+ )
278
+ if ( ! isSuccess ( result ) ) throwRequestFailureError ( result , '不看 TA 的内容' )
279
+ }
280
+
281
+ /**
282
+ * 重新看 TA 的内容
283
+ */
284
+ async unmute ( ) {
285
+ const result = await this . #client. apiClient . userRelation . unmute (
286
+ await this . getId ( )
287
+ )
288
+ if ( ! isSuccess ( result ) ) throwRequestFailureError ( result , '重新看 TA 的内容' )
289
+ }
262
290
}
Original file line number Diff line number Diff line change @@ -62,6 +62,14 @@ export namespace UserRelation {
62
62
export interface UnfollowResponse {
63
63
toast : LiteralUnion < '关注已取消' >
64
64
}
65
+
66
+ export interface MuteResponse {
67
+ toast : LiteralUnion < '操作成功!' >
68
+ }
69
+
70
+ export interface UnmuteResponse {
71
+ toast : LiteralUnion < '操作成功!' >
72
+ }
65
73
}
66
74
67
75
export namespace Users {
You can’t perform that action at this time.
0 commit comments