1import { fetchRSS } from "https://esm.town/v/stevekrouse/fetchRSS?v=12";
23export let webhook1 = async (a) => {
4const response = await fetchRSS(a);
5return "asd";
6};
27li.innerHTML = '<span class="font-semibold text-gray-900">' + sender + '</span>: ' + message;
28ul.appendChild(li)
29fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
30}
31
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
36res: express.Response,
7) {
8let response = await fetch("https://api.onepeloton.com/auth/login", {
9method: "POST",
10mode: "no-cors",
20});
21const session = await response.json();
22let workoutResponse = await fetch(
23`https://api.onepeloton.com/api/user/${session["user_id"]}/workouts`,
24{
fetchCongressTradeReportsmain.tsx4 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23/**
5Receive daily emails of reported congress trades by scheduling a call to
67@claytn.fetchCongressTradeReports((reports) => console.email(reports))
8*/
91011export async function fetchCongressTradeReports(callback) {
12const res = await fetchJSON(
13"https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14);
checkBPPRequirementmain.tsx3 matches
1import { fetch } from "https://esm.town/v/std/fetch";
23export async function checkBPPRequirement(imageUrl, minWidth, minHeight) {
4try {
5const response = await fetch(imageUrl);
6const buffer = await response.arrayBuffer();
7const totalPixels = minWidth * minHeight;
23}
24catch (error) {
25console.error("❌ Error fetching image:", error.message);
26}
27}
1import { fetch } from "https://esm.town/v/std/fetch";
23export const getTrains = (async () => {
4const skerries = await fetch(
5"https://irish-rail-rest-api.fly.dev/stations/SKRES/timetable",
6).then((res) => res.json());
7const connolly = await fetch(
8"https://irish-rail-rest-api.fly.dev/stations/CNLLY/timetable",
9).then((res) => res.json());
getOpenMeteoForecastmain.tsx2 matches
1import { toDatesWithTz } from "https://esm.town/v/wilt/toDatesWithTz";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
34// See https://open-meteo.com/en/docs for usage
92}
93export async function getOpenMeteoForecast(params: OMParams) {
94const data = await fetchJSON(
95`https://api.open-meteo.com/v1/forecast?${new URLSearchParams(
96params as {} // Typescript is stricter than Deno here
test_dlockmain.tsx15 matches
14),
15ttl: 1,
16fetchStub:
17(data = {}, { status = 200, ok = status < 400 } = {}) => async () =>
18Promise.resolve({ ok, status, json: async () => data } as const),
19throwingFetchStub: async () => {
20throw new Error("sync from test_dlock::throwingFetchStub");
21},
22...await import("https://deno.land/std/assert/mod.ts"),
28id,
29ttl,
30throwingFetchStub,
31assertEquals,
32assertRejects,
36},
37) {
38const fetchSpy = spy(throwingFetchStub);
39const err = await assertRejects(() => dlock({ id, ttl }, fetchSpy));
40assertEquals(err.message, "sync from test_dlock::throwingFetchStub");
41assertSpyCalls(fetchSpy, 5);
42assertSpyCall(fetchSpy, 4, {
43args: [`https://dlock.univalent.net/lock/${id}/aquire?ttl=${ttl}`],
44});
45},
46async function should_reject_ttl_of_0(
47{ dlock, id, ttl, fetchStub, assertMatch, assertRejects },
48) {
49const err = await assertRejects(() => dlock({ id, ttl: 0 }, fetchStub()));
50assertMatch(err.message, /ttl/);
51},
52async function should_return_lock_on_successful_request(
53{ dlock, deadline, fetchStub, assertFalse, assertEquals },
54) {
55const lease = 375;
56const lock = await dlock({}, fetchStub({ lease, deadline }));
57assertEquals(lock.lease, lease, "lease");
58assertEquals(lock.deadline, deadline, "deadline");
64// runs into endless loop!
65async function skip_should_reject_when_id_is_locked(
66{ dlock, id, ttl, deadline, fetchStub, assertRejects, assertEquals },
67) {
68const error = "lock is acquired by another client";
69const err = await assertRejects(() =>
70dlock({ id, ttl }, fetchStub({ error, deadline }, { status: 409 }))
71);
72assertEquals(err.message, error);
1import { fetch } from "https://esm.town/v/std/fetch";
23export let fetchCat = async () => {
4const result = await fetch("https://aws.random.cat/meow");
5const json = await result.json();
6return json.file;
twitterJSONmain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
23export let twitterJSON = ({url, bearerToken}) => fetchJSON(
4url,
5{headers: {authorization: `Bearer ${bearerToken}`}}