1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
21
22 const getCompelitoins = async (data) => {
23 const response = await fetch("https://api.openai.com/v1/completions", {
24 method: "POST",
25 headers: {
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export const rand = () =>
4 fetchText("http://numbersapi.com/random/math");
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3/**
5 Receive daily emails of reported congress trades by scheduling a call to
6
7 @claytn.fetchCongressTradeReports((reports) => console.email(reports))
8*/
9
10
11export async function fetchCongressTradeReports(callback) {
12 const res = await fetchJSON(
13 "https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14 );
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const csvToJson = async (url: string) => {
14 url =
15 "https://www.ncbi.nlm.nih.gov/core/assets/pmc/files/removed_phe_articles_oa_subset.csv";
16 const response = await fetch(url);
17 const stream = response.body?.pipeThrough(textDecoder)
18 .pipeThrough(csvParser).pipeThrough(jsonStringifier).pipeThrough(
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const scheduleExample = () => fetch("example.com");
1import { fetchJSON } from "https://esm.town/v/sean/fetchJSON";
2import { toQueryString } from "https://esm.town/v/sean/toQueryString";
3
27
28 try {
29 const json = await fetchJSON(
30 `https://${API_HOST}/query?${queryString}`,
31 {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Activity suggestions for when you're bored
4export let boredActivities = fetchJSON(
5 "https://www.boredapi.com/api/activity",
6);
1import { nowcastPMAqi } from "https://esm.town/v/stevekrouse/nowcastPMAqi?v=6";
2import { msHour } from "https://esm.town/v/stevekrouse/msHour?v=1";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
4
5export async function nowCastPMAQI({ location_id }) {
6 const { results } = await fetchJSON(
7 "https://api.openaq.org/v2/measurements?" +
8 new URLSearchParams({
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Reddit recent posts from /r/aww (cute animals)
4export let subredditExample = fetchJSON(
5 "https://www.reddit.com/r/aww/.json"
6);
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export const likedUpdated = async (interval: Interval) => {
7 return;
8 }
9 const res = await fetchJSON(
10 "https://api.val.town/v1/me/likes",
11 {