1- import { TBaseActionParams } from '../params' ;
1+ import { TBaseActionParams , TLimitParams } from '../params' ;
22
33export interface TPost {
44 url : string ;
@@ -12,6 +12,8 @@ export interface TPost {
1212 reactionsCount : number ;
1313 commentsCount : number ;
1414 repostsCount : number ;
15+ comments ?: ReadonlyArray < TPostComment > ;
16+ reactions ?: ReadonlyArray < TPostReaction > ;
1517}
1618
1719export const POST_TYPE = {
@@ -20,12 +22,6 @@ export const POST_TYPE = {
2022} as const ;
2123export type TPostType = ( typeof POST_TYPE ) [ keyof typeof POST_TYPE ] ;
2224
23- export interface TFetchPostParams extends TBaseActionParams {
24- postUrl : string ;
25- }
26-
27- export type TFetchPostResult = TPost ;
28-
2925export interface TReaction {
3026 postUrl : string ;
3127 time : string ;
@@ -59,3 +55,71 @@ export interface TCommentOnPostParams extends TBaseActionParams {
5955 postUrl : string ;
6056 text : string ;
6157}
58+
59+ export const POST_COMMENTER_TYPE = {
60+ person : 'person' ,
61+ company : 'company' ,
62+ } as const ;
63+ export type TPostCommenterType = ( typeof POST_COMMENTER_TYPE ) [ keyof typeof POST_COMMENTER_TYPE ] ;
64+
65+ export interface TPostComment {
66+ commenterUrl : string ;
67+ commenterName : string ;
68+ commenterHeadline : string ;
69+ commenterType : TPostCommenterType ;
70+ time : string ;
71+ text : string | null ;
72+ image : string | null ;
73+ isReply : boolean ;
74+ reactionsCount : number ;
75+ repliesCount : number ;
76+ }
77+
78+ export const POST_ENGAGER_TYPE = {
79+ person : 'person' ,
80+ company : 'company' ,
81+ } as const ;
82+ export type TPostEngagerType = ( typeof POST_ENGAGER_TYPE ) [ keyof typeof POST_ENGAGER_TYPE ] ;
83+
84+ export interface TPostReaction {
85+ engagerUrl : string ;
86+ engagerName : string ;
87+ engagerHeadline : string ;
88+ engagerType : TPostEngagerType ;
89+ type : TReactionType ;
90+ }
91+
92+ export const POST_COMMENTS_SORT = {
93+ mostRelevant : 'mostRelevant' ,
94+ mostRecent : 'mostRecent' ,
95+ } as const ;
96+ export type TPostCommentsSort = ( typeof POST_COMMENTS_SORT ) [ keyof typeof POST_COMMENTS_SORT ] ;
97+
98+ export interface TPostCommentsRetrievalConfig extends TLimitParams {
99+ replies ?: boolean ;
100+ sort ?: TPostCommentsSort ;
101+ }
102+
103+ export type TPostReactionsRetrievalConfig = TLimitParams ;
104+
105+ export interface TBaseFetchPostParams extends TBaseActionParams {
106+ postUrl : string ;
107+ retrieveComments ?: boolean ;
108+ retrieveReactions ?: boolean ;
109+ }
110+
111+ export interface TBaseFetchPostParamsWide extends TBaseFetchPostParams {
112+ retrieveComments : true ;
113+ retrieveReactions : true ;
114+ }
115+
116+ export type TFetchPostParams < T extends TBaseFetchPostParams = TBaseFetchPostParams > = T & {
117+ commentsRetrievalConfig ?: T [ 'retrieveComments' ] extends true
118+ ? TPostCommentsRetrievalConfig | undefined
119+ : never ;
120+ reactionsRetrievalConfig ?: T [ 'retrieveReactions' ] extends true
121+ ? TPostReactionsRetrievalConfig | undefined
122+ : never ;
123+ } ;
124+
125+ export type TFetchPostResult = TPost ;
0 commit comments