1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramSendPhoto = async (botToken: string, options: {
15 reply_markup?: any[];
16}) =>
17 fetchJSON(
18 `https://api.telegram.org/bot${botToken}/sendPhoto`,
19 {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let bitlyAPI = ({ token, endpoint, ...params }) => {
5 params.body = JSON.stringify(params.body);
6 }
7 return fetchJSON(
8 `https://api-ssl.bitly.com/v4/${endpoint}`,
9 {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export function sunbeamValTownFn(valtownToken: string) {
7 // extension manifest
8 app.get("/", async (c) => {
9 const resp = await fetch("https://api.val.town/v1/me", {
10 headers: {
11 Authorization: `Bearer ${valtownToken}`,
54 }`
55 : `https://api.val.town/v1/users/${user}/vals`;
56 const resp = await fetch(endpoint, {
57 headers: {
58 Authorization: `Bearer ${valtownToken}`,
96 app.post("/view-val", async (c) => {
97 const { params } = await c.req.json();
98 const resp = await fetch(`https://api.val.town/v1/vals/${params.val}`, {
99 headers: {
100 Authorization: `Bearer ${valtownToken}`,
120 });
121 });
122 return app.fetch(req);
123 };
124}
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const checkRyanair = (async () => {
22 const END_TO = "2023-09-30";
23 const PRICE_LIMIT = "260";
24 const fetchUrl = `${BASE_URL}roundTripFares?` +
25 `&arrivalAirportIataCode=${AIRPORT_TO}` +
26 `&departureAirportIataCode=${AIRPORT_FROM}` +
30 `&inboundDepartureDateTo=${END_TO}` +
31 `&priceValueTo=${PRICE_LIMIT}`;
32 const res = await fetch(fetchUrl);
33 const flights = await res.json();
34 console.log(flights?.total);
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const annotations = (async () => {
4 const url =
5 "https://annotations.allmaps.org/maps?imageservicedomain=images.dighimapper.eu";
6 const reponse = await fetch(url);
7 const annotations = await reponse.json();
8 return annotations;
1import { fetchJSON } from "https://esm.town/v/radu/fetchJSON?v=3";
2
3export let currency = async (base = "usd", desired?: string = "php") => {
4 let { rates } = await fetchJSON(
5 `https://open.er-api.com/v6/latest/${base}`,
6 );
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function myApi() {
5 "https://everycampus.com/campus/c1e6333f-7f5b-475d-897a-c78e0a88135e";
6 try {
7 const response = await fetch(url, {
8 method: "GET",
9 headers: {
18 }
19 catch (error) {
20 console.error("Error fetching data:", error);
21 throw error;
22 }
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5 "https://swapi.dev/api/people/1/"
6);
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 { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchPelotonWorkouts = async (user_id, session_id) => {
4 const workouts = await fetch(
5 `https://api.onepeloton.com/api/user/${user_id}/workouts?=peloton.ride&limit=50&page=0&sort_by=-created`,
6 {