import { apiClient } from './client'; import type { FileContent } from '../types/api'; export interface UpdateFileParams { owner: string; repo: string; path: string; content: string; frontmatter: Record; } export const filesApi = { async getFileContent( owner: string, repo: string, path: string, branch?: string ): Promise { const params = branch ? { branch } : {}; const response = await apiClient.get( `/api/repos/${owner}/${repo}/files/${path}`, { params } ); return response.data; }, async updateFile(params: UpdateFileParams): Promise<{ success: boolean; draft_saved: boolean; saved_at: string }> { const { owner, repo, path, content, frontmatter } = params; const response = await apiClient.put( `/api/repos/${owner}/${repo}/files/${path}`, { content, frontmatter } ); return response.data; }, };