1import { fetch } from "https://esm.town/v/std/fetch";
23export let gpt3 = async (prompt: string, openAiApiKey: string): Promise<string> => {
4if (!prompt || !openAiApiKey) {
5let cat = await fetch("https://catfact.ninja/fact");
6let { fact } = await cat.json();
7return Promise.reject(
8`Prompt text or api key was not provided. \n \n here's a cat fact: \n ${fact}`,
9);
10}
11const content = await fetch("https://api.openai.com/v1/chat/completions", {
12method: "POST",
13body: JSON.stringify({
17}),
18headers: {
19"Authorization": `Bearer ${openAiApiKey}`,
20"Content-Type": "application/json",
21},
streamingTestmain.tsx1 match
8maxTokens: 25,
9streaming: true,
10openAIApiKey: process.env.OPENAI_API_KEY,
11});
12const response = await chat.call("Tell me a joke.", undefined, [
githubStarredmain.tsx1 match
3// GitHub starred repos
4export let githubStarred = fetchJSON(
5"https://api.github.com/users/klapacz/starred"
6);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5"https://swapi.dev/api/people/1/"
6);
bookReservationOnResymain.tsx7 matches
30}) => {
31const { z } = await import("npm:zod");
32const RESY_API_URL = "https://api.resy.com";
33const RESY_DEFAULT_HEADERS = {
34accept: "application/json, text/plain, */*",
35"accept-encoding": "gzip, deflate, br",
36"accept-language": "en-US,en;q=0.9",
37authorization: 'ResyAPI api_key="VbWk7s3L4KiK5fzlO7JD3Q5EYolJI7n5"',
38"x-origin": "https://resy.com",
39origin: "https://resy.com/",
143params.email
144)}&password=${encodeURIComponent(params.password)}`;
145const response = await fetch(`${RESY_API_URL}/3/auth/password`, {
146method: "POST",
147body: body,
164seats: number;
165}) => {
166const url = `${RESY_API_URL}/3/details`;
167const response = await fetch(url.toString(), {
168method: "POST",
183seats: number;
184}) => {
185const url = `${RESY_API_URL}/4/find`;
186const searchParams = new URLSearchParams();
187searchParams.set("lat", "0");
206city: string;
207}) => {
208const url = `${RESY_API_URL}/3/venue`;
209const searchParams = new URLSearchParams();
210searchParams.set("url_slug", params.slug);
222authToken: string;
223}) => {
224const response = await fetch(`${RESY_API_URL}/3/book`, {
225method: "POST",
226headers: {