1Use my own OpenAI API key to avoid limit
9export async function getGeminiModels(): Promise<GeminiModel[]> {
10 try {
11 const API_KEY = process.env.GEMINI_API_KEY;
12
13 const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models?key=${API_KEY}`);
14
15 const data = await response.json();
1import { fetch } from "https://esm.town/v/std/fetch";
2
3let result = await fetch("https://api64.ipify.org?format=json");
4let json = await result.json();
5console.log(json.ip);
11- [ ] Have any other email login ping me for approval or make a private val with a list of approved emails
12
13## Switchbot API
14
15This val authenticates to the switchbot API with `SWITCHBOT_TOKEN` and `SWITCHBOT_KEY`.
16
17Learn how to get your own Switchbot API keys here: [Switchbot Docs](https://github.com/OpenWonderLabs/SwitchBotAPI).
18
19Migrated from folder: Archive/switchbot
11- [ ] Have any other email login ping me for approval or make a private val with a list of approved emails
12
13## Switchbot API
14
15This val authenticates to the switchbot API with `SWITCHBOT_TOKEN` and `SWITCHBOT_KEY`.
16
17Learn how to get your own Switchbot API keys here: [Switchbot Docs](https://github.com/OpenWonderLabs/SwitchBotAPI).
18
19Migrated from folder: Archive/switchbot
2 const readmeVals: any = await (await fetch("https://janpaul123-readmevals.web.val.run/")).json();
3
4 const API_URL = "https://api.val.town";
5
6 const sections = [
118 {
119 prompt: "Write a val that accesses environment variables",
120 code: `const res = await fetch("${API_URL}/v1/me", {
121 headers: {
122 Authorization: \`Bearer \${Deno.env.get("valtown")}\`,
130 code: `import process from "node:process";
131
132 const res = await fetch("${API_URL}/v1/me", {
133 headers: {
134 Authorization: \`Bearer \${process.env.valtown}\`,
299 You can attach files to your emails by using the \`attachments\` field.
300 Attachments need to be [Base64](https://en.wikipedia.org/wiki/Base64) encoded,
301 which is that the [btoa](https://developer.mozilla.org/en-US/docs/Web/API/btoa)
302 method is doing in this example:
303
401 \`\`\`
402
403 ### Lower-level API
404
405 We do provide access to the lower-level getter and setters, which are useful if you are storing non-JSON or binary data, need to stream in your response or request data, or do anything else lower-level.
406
407 - \`async get(key: string)\`: Retrieves a blob for a given key.
408 - \`async set(key: string, value: string | BodyInit)\`: Sets the blob value for a given key. See [BodyInit](https://deno.land/api@v1.38.1?s=BodyInit).
409
410 ### Limitations
533 role: "assistant",
534 content:
535 "```ts\nexport default async function(req: Request): Promise<Response> {\n const apiKey = Deno.env.get(\"METEO_KEY\");\n const apiUrl = `https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m¤t_weather=true&apikey=${apiKey}`;\n\n const response = await fetch(apiUrl);\n const weatherData = await response.json();\n\n return new Response(JSON.stringify(weatherData), { headers: { \"Content-Type\": \"application/json\" } });\n}\n```",
536 },
537 {
2import { email } from "https://esm.town/v/std/email";
3
4const ipqsApiKey = Deno.env.get("IPQS_API_KEY");
5const ipAddress = "8.8.8.8";
6const ipDataName = "googleIpqsData";
18
19export async function checkIp() {
20 const result = await fetch(`https://ipqualityscore.com/api/json/ip/${ipqsApiKey}/${ipAddress}`);
21 const newData = await result.json();
22
1// WELCOME TO THE API DEMO
2// Since val.town doesn't behave well, we cannot access the value of inputs after the page has been loaded once.
3// Therefore, the only way to let the user modify their values is to do it manually.
35
36 const data = await fetch(
37 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${start.toISOString()}&end=${end.toISOString()}`,
38 {
39 headers: {
40 // ADD YOUR API TOKEN INTO THE ENV VARIABLES
41 "Authorization": `Bearer ${Deno.env.get("TEAMSURFBOARD_API_TOKEN")}`,
42 },
43 },
138 <div style={styles.container}>
139 <h1>Employee hours and pay</h1>
140 <h3>(This is an API demo to showcase how the Teamsurfboard API can be used.)</h3>
141 <div style={styles.info}>
142 <p style={styles.info_text}>
63 tomorrow.setDate(tomorrow.getDate() + 1);
64 const data = await fetch(
65 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${today.toISOString()}&end=${tomorrow.toISOString()}`,
66 {
67 headers: {
68 // ADD YOUR API TOKEN INTO THE ENV VARIABLES
69 "Authorization": `Bearer ${Deno.env.get("TEAMSURFBOARD_API_TOKEN")}`,
70 },
71 },
9 tomorrow.setDate(tomorrow.getDate() + 1);
10 const data = await fetch(
11 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${today.toISOString()}&end=${tomorrow.toISOString()}`,
12 {
13 headers: {
14 // ADD YOUR API TOKEN INTO THE ENV VARIABLES
15 "Authorization": `Bearer ${Deno.env.get("TEAMSURFBOARD_API_TOKEN")}`,
16 },
17 },