import ApiCall from "./ApiCall"; import Conversations from "./Conversations"; export interface ConversationDeleteSchema { id: number; } export interface ConversationUpdateSchema { ttl: number; } export interface ConversationSchema { id: number; conversation: object[]; last_updated: number; ttl: number; } export default class Conversation { constructor( private id: string, private apiCall: ApiCall, ) {} async retrieve(): Promise { return this.apiCall.get(this.endpointPath()); } async update( params: ConversationUpdateSchema, ): Promise { return this.apiCall.put( this.endpointPath(), params, ); } async delete(): Promise { return this.apiCall.delete(this.endpointPath()); } private endpointPath(): string { return `${Conversations.RESOURCEPATH}/${encodeURIComponent(this.id)}`; } }