17 "urlProgram": {
18 "toolName": "slot",
19 "code": "\"https://en.wikipedia.org/w/api.php\"",
20 "modeName": "code",
21 "defaultCode": "\"https://httpbin.org/get\"",
1import process from "node:process";
2import { TodoistApi } from "npm:@doist/todoist-api-typescript";
3import { Client } from "npm:@notionhq/client";
4
5const TODOIST_API_KEY = process.env.TODOIST_API_KEY;
6const todoistapi = new TodoistApi(TODOIST_API_KEY);
7const NOTION_API_KEY = process.env.NOTION_API_KEY;
8const notion = new Client({
9 auth: NOTION_API_KEY,
10});
11
121
122export default async function(interval: Interval) {
123 var tasks = await todoistapi.getTasks({
124 projectId: add_to_notion_todoist_project_id,
125 });
136 addPageToNotionDatabse(mappedNotionId, task.content);
137 }
138 todoistapi.deleteTask(task.id);
139 }
140 }
4
5export default async function(interval: Interval) {
6 const NOTION_API_KEY = process.env.NOTION_API_KEY;
7 const PAPERPILE_DB_ID = "DB_ID_GOES_HERE";
8
9 if (!NOTION_API_KEY || !PAPERPILE_DB_ID) {
10 throw new Error("Please fill in your API key and database ID");
11 }
12 let dont_update = [];
13
14 const notion = new Client({ auth: NOTION_API_KEY });
15
16 const databaseId = PAPERPILE_DB_ID;
51
52 const j = await fetch(
53 `https://api.semanticscholar.org/graph/v1/paper/search?query=${
54 encodeURIComponent(
55 semscholar_query,
92
93 if (doi_to_add) {
94 // const bib = await fetch('https://api.paperpile.com/api/public/convert', {
95 // method: 'POST',
96 // headers: {
151 let tldr = null;
152 const tl_f = await fetch(
153 `https://api.semanticscholar.org/graph/v1/paper/${encodeURIComponent(sem_scholar_ppid)}?fields=${
154 encodeURIComponent("tldr")
155 }`,
4// Note: this will not run on val town. You need to run it locally with deno.
5// * Install Deno: https://docs.deno.com/runtime/manual/getting_started/installation
6// * Set your val.town api key environment variable. https://www.val.town/settings/api
7// * `export valtown="abcdefgh-ijkl-mnop-qrst-uvwxyz123456"`
8// * Create a git repo to sync to.
71 let next_page:
72 | string
73 | undefined = `https://api.val.town/v1/users/${me.id}/vals`;
74 while (next_page) {
75 const [_, result] = await valtown(next_page);
97 for (let v = 1; v <= val.version; v++) {
98 const [_, result] = await valtown(
99 `https://api.val.town/v1/vals/${val.id}/versions/${v}`,
100 );
101 if (result !== null) {
131
132export default async function main() {
133 // check for api key
134 const api_key = Deno.env.get("valtown");
135 if (!api_key) {
136 console.error(
137 "Set your val.town api key as an enviroment variable.\n"
138 + ` $ export valtown="abcdefgh-ijkl-mnop-qrst-uvwxyz123456"`,
139 );
149 }
150
151 if (!api_key || !git_repo) {
152 Deno.exit(1);
153 }
178 }
179
180 // check the api key
181 const [status, result] = await valtown("https://api.val.town/v1/me");
182 if (status != 200) {
183 console.error("Invalid API key.");
184 Deno.exit(1);
185 }
8
9* Install Deno: https://docs.deno.com/runtime/manual/getting_started/installation
10* Set your val.town api key as an environment variable. https://www.val.town/settings/api
11 * `export valtown="abcdefgh-ijkl-mnop-qrst-uvwxyz123456"`
12* Create a git repo to sync to.
2
3export default async function(interval: Interval) {
4 const versions = await fetch("https://www.figma.com/api/plugins/1323092380415927575/versions").then(r => r.json());
5 const { install_count, like_count, view_count } = versions.meta.plugin;
6
10
11 {
12 const versions = await fetch("https://www.figma.com/api/plugins/1189962635826293304/versions").then(r => r.json());
13 const { install_count, like_count, view_count } = versions.meta.plugin;
14
3I develop two Figma plugins - [one that lets you create vector street maps in Figma](https://www.figma.com/community/plugin/1189962635826293304/placemark) and [one that lets you generate vector globes](https://www.figma.com/community/plugin/1323092380415927575). It's fun to watch them get some usage, but the Figma community site is pretty barebones.
4
5This uses one of the APIs on the Community page as an unofficial API and collects results in [Val Town SQLite](https://docs.val.town/std/sqlite/). You can see a chart of the resulting data [on Observable](https://observablehq.com/@tmcw/placemark-figma-plugin-stats).
1# Fets Example
2
3A openapi JSON spec is available at <https://pomdtr-fets.web.val.run/openapi.json>.
4
5You can access a fully typed client with a single import:
1export async function slackPost(token, channel, text) {
2 const resp = await fetch(
3 `https://slack.com/api/chat.postMessage`,
4 {
5 method: "POST",
37
38## How it works
39The sketch function returns an http handler that sets up a basic page with p5.js added. It then imports your module from the browser and wires up all the exports so p5.js can see them. All the code in your val will run in the browser (except for the default `sketch` export) so you can't call any Deno functions, environment variables, or other server side apis.
40
41