"use strict";
/* Write a text file to a project. */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const get_account_1 = __importDefault(require("lib/account/get-account"));
const get_params_1 = __importDefault(require("lib/api/get-params"));
const misc_1 = require("@cocalc/util/misc");
async function handle(req, res) {
    const account_id = await (0, get_account_1.default)(req);
    try {
        if (account_id == null)
            throw Error("must be authenticated");
        const { project_id, path, content } = (0, get_params_1.default)(req);
        if (!(0, misc_1.isValidUUID)(project_id))
            throw Error("must set project_id to a valid uuid");
        if (!path)
            throw Error("must specify a 'path'");
        if (content == null)
            throw Error("must include content of file");
        throw Error("NotImplementedError");
        //await writeTextFileToProject({ account_id, project_id, path, content });
        res.json({ status: "ok" });
    }
    catch (err) {
        res.json({ error: err.message });
    }
}
exports.default = handle;
//# sourceMappingURL=write-text-file.js.map