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 3232 - [x] 关注
3333 - [x] 取消关注
3434 - [x] 是否关注用户
35+ - [x] 不看 TA 的内容
36+ - [x] 重新看 TA 的内容
3537- 动态帖子
3638 - [x] 发送动态
3739 - [x] 获取动态详情
Original file line number Diff line number Diff line change @@ -82,3 +82,29 @@ export const unfollow = <T = UserRelation.UnfollowResponse>(
8282 } ,
8383 } )
8484 )
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> {
3131 this . #profile = profile
3232 }
3333
34+ /**
35+ * 获取用户 ID
36+ * @returns 用户 ID
37+ */
38+ async getId ( ) {
39+ return ( await this . queryProfile ( ) ) . user . id
40+ }
41+
3442 /**
3543 * 获取用户名
3644 * @returns 用户名
@@ -259,4 +267,24 @@ export class JikeUser<M extends boolean = boolean> {
259267 )
260268 if ( ! isSuccess ( result ) ) throwRequestFailureError ( result , '取消关注用户' )
261269 }
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+ }
262290}
Original file line number Diff line number Diff line change @@ -62,6 +62,14 @@ export namespace UserRelation {
6262 export interface UnfollowResponse {
6363 toast : LiteralUnion < '关注已取消' >
6464 }
65+
66+ export interface MuteResponse {
67+ toast : LiteralUnion < '操作成功!' >
68+ }
69+
70+ export interface UnmuteResponse {
71+ toast : LiteralUnion < '操作成功!' >
72+ }
6573}
6674
6775export namespace Users {
You can’t perform that action at this time.
0 commit comments