import client from '../client' ; import { AxiosRequestConfig } from 'axios' ; type CommentFindFilter = { updatedDate ? : { start : Date ; end : Date ; } ; folderId ? : string ; taskId ? : string ; } ; export type FindManyOpts = { plainText ? : boolean ; filter ? : CommentFindFilter ; limit ? : number ; } ; export async function commentFindMany ( opts , context ) { const { filter , limit , plainText } = opts || { } ; let params = { } ; const { folderId , taskId , ... restFilter } = filter || { } ; if ( restFilter ) { params = { ... restFilter , plainText } ; } if ( limit ) { params . limit = limit ; } let url = '/comments' ; if ( folderId ) { url = `/folders/${ folderId }/comments` ; } else if ( taskId ) { url = `/tasks/${ taskId }/comments` ; } const res = await client . get ( url , { ... context , params } ) ; return res ?. data ?. data ; }