import { API } from '../core/api' ; import { Text , TextList , Block } from '../models' ; extends API export default class Messages extends API { param thread param body returns async add ( thread , body ) { const response = await this . sendPost ( `threads/${ thread }/messages` , [ body ] ) ; return response . json ( ) as Promise < Text > ; } param id returns async get ( id ) { const response = await this . sendGet ( `messages/${ id }` ) ; return response . json ( ) as Promise < Text > ; } param thread param offset param limit returns async list ( thread ? , offset ? , limit ? ) { const response = await this . sendGet ( 'messages' , undefined , { thread : thread || '' , offset : offset || '' , limit : limit || 5 } ) ; return response . json ( ) as Promise < TextList > ; } param id returns async ignore ( id ) { const response = await this . sendDelete ( `blocks/${ id }` ) ; return response . json ( ) as Promise < Block > ; } }