UNPKG

@iebh/vuex-tera-json

Version:

A Vuex plugin for syncing state with Tera (using JSON files)

29 lines (28 loc) 1.32 kB
import { TeraApi } from "../index.js"; /** * Represents the structure of a file object returned by the list endpoint. */ export interface ApiFile { name: string; size: number; modified: string; } /** * Retrieves the content of a specific file from a project's storage. * @param projectId The UUID of the project. * @param filePath The path/name of the file to retrieve. * @param teraInstance The TeraApi instance for authentication. * @returns A promise that resolves to the parsed JSON content of the file, or `null` if not found. */ export declare function getFileContent(projectId: string, filePath: string, teraInstance: TeraApi): Promise<any | null>; /** * Saves content to a file in a project's storage. * This will create the file if it does not exist, or overwrite it if it does. * @param projectId The UUID of the project. * @param filePath The path/name of the file to save. * @param content The JavaScript object to be saved as JSON. * @param teraInstance The TeraApi instance for authentication. * @returns A promise that resolves when the operation is complete. * @throws An error if the network request fails or the server returns an error. */ export declare function saveFileContent(projectId: string, filePath: string, content: any, teraInstance: TeraApi): Promise<void>;