Back

Version 50

10/27/2023
import { saveToTana } from "https://esm.town/v/nbbaier/saveToTana";
import { TanaAPIHelper } from "https://esm.town/v/nbbaier/TanaAPIHelper";
import { tanaConstants } from "https://esm.town/v/nbbaier/tanaConstants";
import { APIPlainNode } from "https://esm.town/v/nbbaier/tanaTypes";
import { Hono } from "npm:hono";

const token = Deno.env.get("tanaInputAPI");

export const tanaSave = async (req: Request) => {
const app = new Hono();
app.get("/save", async c => {
let { text, url } = c.req.query();

const payload = {
name: text,
children: [
{
type: "field",
attributeId: "cwi23sOzRSh8",
children: [
// {
// dataType: "url",
// name: url,
// },
],
},
],
// supertags: [],
};

const newNode = await saveToTana(token, payload, tanaConstants.inboxNodeId);

return c.json({ newNode });
});

return app.fetch(req);
Updated: October 27, 2023