11import * as i from 'twitter-openapi-typescript-generated' ;
2- import { DefaultFlag } from '@/types' ;
2+ import { DefaultFlag , TwitterApiUtilsResponse } from '@/types' ;
3+ import { buildHeader } from '@/models' ;
4+
5+ type PostCreateFriendshipsParam = {
6+ userId : string ;
7+ extraParam ?: { [ key : string ] : any } ;
8+ } ;
9+
10+ type PostDestroyFriendshipsParam = {
11+ userId : string ;
12+ extraParam ?: { [ key : string ] : any } ;
13+ } ;
314
415export class V11PostApiUtils {
516 api : i . V11PostApi ;
@@ -9,4 +20,54 @@ export class V11PostApiUtils {
920 this . api = api ;
1021 this . flag = flag ;
1122 }
23+
24+ async postCreateFriendships ( param : PostCreateFriendshipsParam ) : Promise < TwitterApiUtilsResponse < undefined > > {
25+ const response = await this . api . postCreateFriendshipsRaw ( {
26+ includeBlockedBy : 1 ,
27+ includeBlocking : 1 ,
28+ includeCanDm : 1 ,
29+ includeCanMediaTag : 1 ,
30+ includeExtHasNftAvatar : 1 ,
31+ includeExtIsBlueVerified : 1 ,
32+ includeExtProfileImageShape : 1 ,
33+ includeExtVerifiedType : 1 ,
34+ includeFollowedBy : 1 ,
35+ includeMuteEdge : 1 ,
36+ includeProfileInterstitialType : 1 ,
37+ includeWantRetweets : 1 ,
38+ skipStatus : 1 ,
39+ userId : param . userId ,
40+ ...param . extraParam ,
41+ } ) ;
42+ return {
43+ raw : { response : response . raw } ,
44+ header : buildHeader ( response . raw . headers ) ,
45+ data : undefined ,
46+ } ;
47+ }
48+
49+ async postDestroyFriendships ( param : PostDestroyFriendshipsParam ) : Promise < TwitterApiUtilsResponse < undefined > > {
50+ const response = await this . api . postDestroyFriendshipsRaw ( {
51+ includeBlockedBy : 0 ,
52+ includeBlocking : 0 ,
53+ includeCanDm : 0 ,
54+ includeCanMediaTag : 0 ,
55+ includeExtHasNftAvatar : 0 ,
56+ includeExtIsBlueVerified : 0 ,
57+ includeExtProfileImageShape : 0 ,
58+ includeExtVerifiedType : 0 ,
59+ includeFollowedBy : 0 ,
60+ includeMuteEdge : 0 ,
61+ includeProfileInterstitialType : 0 ,
62+ includeWantRetweets : 0 ,
63+ skipStatus : 0 ,
64+ userId : param . userId ,
65+ ...param . extraParam ,
66+ } ) ;
67+ return {
68+ raw : { response : response . raw } ,
69+ header : buildHeader ( response . raw . headers ) ,
70+ data : undefined ,
71+ } ;
72+ }
1273}
0 commit comments