import { APIClient } from './APIClient' ; export class FileClient { public constructor ( private api ) { } public async get ( projectId , fileName ) { const data = await this . api . get ( 'files/read' , { projectId , name : fileName , } ) ; return data . files [ 0 ] ; } public async getAll ( projectId ) { const data = await this . api . get ( 'files/read' , { projectId } ) ; return data . files ; } public async create ( projectId , fileName , content ) { const data = await this . api . post ( 'files/create' , { projectId , name : fileName , content , } ) ; return data . files [ 0 ] ; } public async rename ( projectId , oldFileName , newFileName ) { await this . api . post ( 'files/create' , { projectId , name : oldFileName , newName : newFileName , } ) ; } public async update ( projectId , fileName , content ) { await this . api . post ( 'files/update' , { projectId , name : fileName , content , } ) ; } public async delete ( projectId , fileName ) { await this . api . post ( 'files/delete' , { projectId , name : fileName , } ) ; } }