Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bsuccess?q=api&page=963&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 12702 results for "api"(1644ms)

ivoryGiraffemain.tsx2 matches

@eczajkUpdated 10 months ago
3
4export default async function(req: Request): Promise<Response> {
5 const url = `https://api.phish.net/v5/shows/artist/phish.json?order_by=showdate&direction=desc&apikey=${
6 Deno.env.get("PHISH_NET_API_KEY")
7 }`;
8 const { data } = await axios.get(url);

getValsContextWindowmain.tsx7 matches

@janpaul123Updated 10 months ago
13 const readmeVals: any = await blob.getJSON("readme-vals.json");
14
15 const API_URL = "https://api.val.town";
16
17 const sections = [
129 {
130 prompt: "Write a val that accesses environment variables",
131 code: `const res = await fetch("${API_URL}/v1/me", {
132 headers: {
133 Authorization: \`Bearer \${Deno.env.get("valtown")}\`,
141 code: `import process from "node:process";
142
143 const res = await fetch("${API_URL}/v1/me", {
144 headers: {
145 Authorization: \`Bearer \${process.env.valtown}\`,
310 You can attach files to your emails by using the \`attachments\` field.
311 Attachments need to be [Base64](https://en.wikipedia.org/wiki/Base64) encoded,
312 which is that the [btoa](https://developer.mozilla.org/en-US/docs/Web/API/btoa)
313 method is doing in this example:
314
412 \`\`\`
413
414 ### Lower-level API
415
416 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.
417
418 - \`async get(key: string)\`: Retrieves a blob for a given key.
419 - \`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).
420
421 ### Limitations
458 role: "assistant",
459 content:
460 "```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&current_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```",
461 },
462 {

templatemain.tsx1 match

@liamUpdated 10 months ago
8
9 // Substrate graph
10 const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
11
12 const startup_name = new ComputeText({

shotclipmain.tsx1 match

@kousun12Updated 10 months ago
15async function getResults(q: string, n: number): Promise<ShotResult[]> {
16 const substrate = new Substrate({
17 apiKey: process.env.SUBSTRATE_API_KEY,
18 });
19 const collectionName = "shotclip";

IllustratedPrimerREADME.md1 match

@kousun12Updated 10 months ago
3ℹ️ Open the url and add a query parameter with a subject (click on titles to "delve"): https://substrate-illustratedprimer.web.val.run/?prompt=modernism
4
5🪩 If you fork, you can [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 in credits

IllustratedPrimermain.tsx3 matches

@kousun12Updated 10 months ago
9
10 // Substrate graph
11 const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
12 const Topic = z
13 .object({
83
84 // UI
85 const capitalize = s => s.replace(/^\w/, c => c.toUpperCase());
86 return new Response(
87 new ReadableStream({
100 <div style="margin:0 10px;">${pair.image}</div>
101 <div style="margin:0 10px;font-size:1.2rem;">
102 <a href="/?subject=${pair.title}"><b>${capitalize(pair.title)}</b></a><br/>${pair.caption}</div>
103</div>`,
104 ));

blob_adminREADME.md1 match

@janpaul123Updated 10 months ago
9[![](https://stevekrouse-button.express.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO

valwritermain.tsx1 match

@janpaul123Updated 10 months ago
106 console.log(result.rows[0]);
107
108 // Blob storage API
109 import { blob } from "https://esm.town/v/std/blob";
110 const key = "blob_test";

spotifymain.tsx5 matches

@huntyUpdated 10 months ago
25
26export let spotifyRequestToken = ({ client_id, client_secret, code, redirect_uri }) =>
27 fetchJSON("https://accounts.spotify.com/api/token", {
28 method: "POST",
29 body: querystring({
39
40export let spotifyRefreshToken = async ({ refresh_token, client_id, client_secret }) =>
41 fetch("https://accounts.spotify.com/api/token", {
42 method: "POST",
43 body: new URLSearchParams({
191
192 try {
193 const currentlyPlaying = await fetch("https://api.spotify.com/v1/me/player/currently-playing", {
194 method: "GET",
195 headers: {
207
208 if (!mostRecentTrack) {
209 const recentTracks = await fetch("https://api.spotify.com/v1/me/player/recently-played", {
210 method: "GET",
211 headers: {
232
233 try {
234 const playStateResponse = await fetch("https://api.spotify.com/v1/me/player?market=US", {
235 method: "GET",
236 headers: {

twitterSearchmain.tsx1 match

@stevekrouseUpdated 10 months ago
14}): Promise<TweetResult[]> {
15 const res = await twitterJSON({
16 url: `https://api.twitter.com/2/tweets/search/recent?query=${await searchParams(
17 {
18 query,

vapi-minutes-db1 file match

@henrywilliamsUpdated 15 hours ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 17 hours ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
mux
Your friendly, neighborhood video API.