readwiseReaderDocumentListmain.tsx2 matches
43queryParams.append("location", location);
44}
45console.log("Making export api request with params " + queryParams.toString());
46const response = await fetch("https://readwise.io/api/v3/list/?" + queryParams.toString(), {
47method: "GET",
48headers: {
readwiseReaderReadItemsRssmain.tsx2 matches
4export async function readwiseReaderReadItemsRss() {
5// Get all of a user's archived documents
6const archivedData = await readwiseReaderDocumentList(Deno.env.get("readwiseReaderApiToken"), undefined, "archive");
78// Later, if you want to get new documents updated after some date, do this:
9// const docsAfterDate = new Date(Date.now() - 24 * 60 * 60 * 1000); // use your own stored date
10// const newData = await fetchDocumentListApi(docsAfterDate.toISOString());
1112return new Response(dataToRSS(
1Reader docs here: https://readwise.io/reader_api
23Adapted from the example code. Fetches items from Readwise Reader given a token, and optional updatedAfter and location parameters.
readwiseReaderReadItemsRssREADME.md2 matches
1Creates an RSS feed of my read items from Readwise Reader.
23Reader docs here: https://readwise.io/reader_api
45In order to get read items from Readwise Reader -> Workflowy, this turns the read items (aka "archive") into an RSS feed, which Zapier picks up, and creates bullets in Workflowy.
67Ideally would store the generated RSS or the last fetch date, and only get new items, but for now `readwiseReaderDocumentList` re-fetches the full history each time.
valTownChatGPTmain.tsx1 match
3import { renderToString } from "npm:react-dom/server";
45// This uses by personal API key, you'll need to provide your own if
6// you fork this. We'll be adding support to the std/openai lib soon!
7const openai = new OpenAI();
fetchTodaysNytCxPuzzlemain.tsx2 matches
37mini?: boolean;
38}): Promise<PuzzlesData> => {
39// https://api.foracross.com/api/puzzle_list?page=0&pageSize=50&filter%5BnameOrTitleFilter%5D=ny%20times%20june%2019%202024&filter%5BsizeFilter%5D%5BMini%5D=true&filter%5BsizeFilter%5D%5BStandard%5D=true
40const url = new URL("https://api.foracross.com/api/puzzle_list");
41const search = new URLSearchParams();
42search.set("page", `${page}`);
1const HUGGING_FACE_API_URL = "https://api-inference.huggingface.co/models";
2const HUGGING_FACE_API_KEY = Deno.env.get("HUGGING_FACE_API_KEY");
34const defaultModels = {
6061async featureExtraction(input, options) {
62return this.callHuggingFaceAPI(input, options);
63}
6465async textClassification(input, options) {
66return this.callHuggingFaceAPI(input, options);
67}
6869async tokenClassification(input, options) {
70return this.callHuggingFaceAPI(input, options);
71}
7273async questionAnswering(input, options) {
74return this.callHuggingFaceAPI(input, options);
75}
7677async summarization(input, options) {
78return this.callHuggingFaceAPI(input, options);
79}
8081async translation(input, options) {
82return this.callHuggingFaceAPI(input, options);
83}
8485async textGeneration(input, options) {
86return this.callHuggingFaceAPI(input, options);
87}
8889async sentenceSimilarity(input, options) {
90return this.callHuggingFaceAPI(input, options);
91}
9293async callHuggingFaceAPI(payload, options) {
94try {
95const response = await fetch(`${HUGGING_FACE_API_URL}/${this.model}`, {
96method: "POST",
97headers: {
98"Authorization": `Bearer ${HUGGING_FACE_API_KEY}`,
99"Content-Type": "application/json"
100},
104if (!response.ok) {
105const error = await response.json();
106console.error("Hugging Face API Error:", error);
107return { error: `API request failed: ${error.error}` };
108}
109111return data;
112} catch (error) {
113console.error("Error calling Hugging Face API:", error);
114return { error: "Error calling Hugging Face API" };
115}
116}
verifyTokenmain.tsx1 match
1async function fetchUser(token: string): Promise<{ id: string }> {
2const resp = await fetch("https://api.val.town/v1/me", {
3headers: {
4Authorization: `Bearer ${token}`,
vtApiTypesmain.tsx12 matches
1/**
2* This file was auto-generated by openapi-typescript.
3* Do not make direct changes to the file.
4*/
427* Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.
428*
429* Vals generated via this API will *not* appear in the authenticated user's workspace.
430*/
431get: {
463* Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.
464*
465* Vals generated via this API will *not* appear in the authenticated user's workspace.
466*/
467post: {
494"/v1/run/{username}.{val_name}": {
495/**
496* Run a val as an API
497* @deprecated
498* @description This endpoint runs the specified user's val and returns the output.
526};
527/**
528* Run a val as an API
529* @deprecated
530*/
563"/": {
564/**
565* Run a val as an API (as an Express handler)
566* @description Runs `@{username}.{val_name}` as an Express handler.
567*
568* `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
569*
570* Unlike the other two APIs, the Express API is specified via subdomain and runs at `https://{username}-{val_name}.express.val.run`.
571*
572* ### Unauthenticated
573* Unauthenticated use will only be able to call public vals as Express handlers.
574*
575* The val will be executed with `{username}`'s permissions ("API Mode"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.
576*
577* ### Authenticated
601};
602/**
603* Run a val as an API (as an Express handler)
604* @description Runs `@{username}.{val_name}` as an Express handler.
605*
606* `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
607*
608* ### Unauthenticated
609* Unauthenticated use will only be able to call public vals as Express handlers.
610*
611* The val will be executed with `{username}`'s permissions ("API Mode"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.
612*
613* ### Authenticated
1import { blob } from "https://esm.town/v/std/blob";
2import process from "node:process";
3import { TodoistApi } from "npm:@doist/todoist-api-typescript";
4import Instructor from "npm:@instructor-ai/instructor";
5import Jimp from "npm:jimp";
15// the task is skipped
1617const TODOIST_API_KEY = process.env.TODOIST_API_KEY;
18const HABITIFY_API_KEY = process.env.HABITIFY_API_KEY;
19const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
20const DEF_TIMEZONE = "America/Los_Angeles"; // Get your timezone from here: https://stackoverflow.com/a/54500197
2147};
4849const todoistapi = new TodoistApi(TODOIST_API_KEY);
5051const oai = new OpenAI({
52apiKey: OPENAI_API_KEY ?? undefined,
53});
54107async function getCommentsForTask(taskId) {
108try {
109const comments = await todoistapi.getComments({ taskId });
110return comments;
111} catch (error) {
137const response = await fetch(url, {
138headers: {
139Authorization: `Bearer ${TODOIST_API_KEY}`,
140},
141});
310311async function addLog(habit_id, unit_type, value, target_date) {
312const url = `https://api.habitify.me/logs/${habit_id}`;
313const headers = {
314Authorization: HABITIFY_API_KEY,
315"Content-Type": "application/json",
316};
338}
339async function addTextNote(habit_id, created, content) {
340const url = `https://api.habitify.me/notes/${habit_id}`;
341const headers = {
342Authorization: HABITIFY_API_KEY,
343"Content-Type": "application/json",
344};
366367async function addImageNote(habit_id, created_at, imageBuffer) {
368const url = `https://api.habitify.me/notes/addImageNote/${habit_id}?created_at=${encodeURIComponent(created_at)}`;
369const headers = {
370Authorization: HABITIFY_API_KEY,
371"Content-Type": "image/jpeg",
372};
395if (!habits_list || force_update_database)
396{
397const HABITIFY_API_KEY = process.env.HABITIFY_API_KEY;
398const url = "https://api.habitify.me/habits";
399const headers = {
400Authorization: HABITIFY_API_KEY,
401"Content-Type": "application/json",
402};
456export default async function(interval: Interval) {
457const habits_list = await get_habitify_database();
458var tasks = await todoistapi.getTasks({
459projectId: add_to_habitify_todoist_project_id,
460});
520}
521}
522await todoistapi.deleteTask(task.id);
523}
524}