1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const buddhaRandomQuote = (async () => {
4 const resp = await fetch("https://buddha-api.com/api/random");
5 const j = await resp.json();
6 const { text, byName } = j;
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3import { resume as resume2 } from "https://esm.town/v/ajax/resume";
50 `;
51 console.log({ prompt });
52 const response = await fetch("https://api.openai.com/v1/completions", {
53 method: "POST",
54 headers: {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchRssParser(rssUrl) {
4 // fetch the rss xml
5 const rssResult = await fetch(rssUrl).then((res) => res.text());
6 // parse xml to object
7 const { XMLParser } = await import("npm:fast-xml-parser");
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function finalUrl(req: Request) {
4 const url = new URL(req.url).pathname.replace(/^\//, "");
5 const response = await fetch(url);
6 return new Response("", {
7 headers: {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
9 if ("valName" in params && params.token)
10 headers.Authorization = `Bearer ${params.token}`;
11 return fetchJSON(url, { headers });
12}
13type UserParams = {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function valToString(val: string) {
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const todosPlaceholder = (async () => {
4 const resp = await fetch("https://jsonplaceholder.typicode.com/todos");
5 return resp.json();
6})();
24 document.getElementById("message-input").value = '';
25 const ul = document.getElementById("inbox");
26 const data = await fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
27 .then(res => res.json())
28 .then(res => res.data)
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function testPostCall() {
4 const result = await fetchJSON(
5 "https://api.val.town/express/@stevekrouse.postWebhook1",
6 {
1import { fetchJSON } from "https://esm.town/v/mgruel/fetchJSON";
2
3type PaginatedData<T> = {
22 nextUrl.searchParams.set("limit", `${limit}`);
23 while (nextUrl) {
24 const { data, links } = await fetchJSON<PaginatedData<T>>(
25 nextUrl,
26 options,