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/$2?q=api&page=1487&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 17843 results for "api"(2181ms)

cmdk_commandmain.tsx7 matches

@pomdtrUpdated 11 months ago
1#!/usr/bin/env -S deno serve --allow-all --env --watch
2
3import { fetchAPI } from "https://esm.town/v/pomdtr/fetchAPI?v=4";
4import { Hono } from "npm:hono";
5
8
9app.get("/", async (c) => {
10 const resp = await fetchAPI("/v1/me", {
11 token,
12 });
51app.get("/vals/list", async (c) => {
52 const userID = c.req.query("user");
53 const resp = await fetchAPI(`/v1/users/${userID}/vals`, {
54 token,
55 paginate: true,
103app.get("/vals/view", async (c) => {
104 const valID = c.req.query("val");
105 const resp = await fetchAPI(`/v1/vals/${valID}`, {
106 token,
107 });
128 const { name, code, privacy, type, val } = await c.req.json();
129
130 await fetchAPI(`/v1/vals/${val}`, {
131 method: "PATCH",
132 token,
200 const { name, code, privacy, type } = await c.req.json();
201
202 const resp = await fetchAPI("/v1/vals", {
203 method: "POST",
204 token,
271app.post("/vals/delete", async (c) => {
272 const { reload, val } = await c.req.json();
273 const resp = await fetchAPI(`/v1/vals/${val}`, {
274 method: "DELETE",
275 token,

fetchAPImain.tsx4 matches

@pomdtrUpdated 11 months ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2
3export async function fetchAPI(
4 path: string,
5 options?: RequestInit & {
11 if (options?.paginate) {
12 const data = [];
13 let url = new URL(`${API_URL}${path}`);
14 url.searchParams.set("limit", "100");
15
42 }
43
44 return fetch(`${API_URL}${path}`, {
45 ...options,
46 headers: {

uploadImagemain.tsx1 match

@chriswmartinUpdated 11 months ago
24}
25async function getUploadURL(): Promise<string> {
26 const data = await (await fetch("https://www.val.town/api/trpc/generateImageUploadUrl", {
27 "headers": {
28 "content-type": "application/json",

blob_adminREADME.md1 match

@tarasUpdated 11 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

textToImagePlaygroundREADME.md1 match

@iamseeleyUpdated 11 months ago
1## 🖼️ text to image playground using [fal.ai](https://fal.ai) model apis
2
3Migrated from folder: image_gen/textToImagePlayground

sqliteExplorerAppmain.tsx2 matches

@iamseeleyUpdated 11 months ago
26 <head>
27 <title>SQLite Explorer</title>
28 <link rel="preconnect" href="https://fonts.googleapis.com" />
29
30 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
31 <link
32 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
33 rel="stylesheet"
34 />

sqliteExplorerAppREADME.md1 match

@iamseeleyUpdated 11 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

uploadThruFileIomain.tsx1 match

@yawnxyzUpdated 11 months ago
1// Function to upload data using Wormhole API and return the URL
2async function uploadToFileIo(file) {
3 const formData = new FormData();

convertResumemain.tsx12 matches

@iamseeleyUpdated 11 months ago
86 }
87
88 /* API Key Input Styles */
89 #apiKeyInput {
90 display: none;
91 margin-top: 10px;
108 <div class="buttons">
109 <div class="hosting">
110 <input type="text" id="apiKeyInput" placeholder="Enter your Val Town API Key">
111 <button id="hostButton">Host Resume on Val Town</button>
112 </div>
122 event.preventDefault();
123 const resumeContent = document.getElementById('resumeContent').value;
124 const apiKey = '${Deno.env.get("OPENAI_API_KEY")}';
125 const spinner = document.getElementById('spinner');
126 const jsonOutput = document.getElementById('jsonOutput');
127 const copyButton = document.getElementById('copyButton');
128 const hostButton = document.getElementById('hostButton');
129 const apiKeyInput = document.getElementById('apiKeyInput');
130
131 spinner.style.display = 'block';
133 copyButton.style.display = 'none';
134 hostButton.style.display = 'none';
135 apiKeyInput.style.display = 'none';
136
137 try {
138 const jsonResume = await convertToResumeJSON(resumeContent, apiKey);
139 jsonOutput.textContent = JSON.stringify(JSON.parse(jsonResume), null, 2);
140 copyButton.style.display = 'block';
141 hostButton.style.display = 'block';
142 apiKeyInput.style.display = 'block';
143 } catch (error) {
144 jsonOutput.textContent = 'An error occurred while converting the resume.';
153 document.getElementById('hostButton').addEventListener('click', async function() {
154 const jsonOutput = document.querySelector('#jsonOutput').innerText;
155 const valTownApiKey = document.getElementById('apiKeyInput').value; // Get the Val Town API key from input
156
157 if (!valTownApiKey) {
158 alert('Please enter your Val Town API Key.');
159 return;
160 }
161
162 try {
163 const hostedUrl = await hostResume(JSON.parse(jsonOutput), valTownApiKey);
164 alert('Resume hosted at: ' + hostedUrl);
165 window.open(hostedUrl, '_blank');

blobAdminREADME.md1 match

@yawnxyzUpdated 11 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

dailyQuoteAPI

@SoukyUpdated 21 hours ago

HTTP

@NcharityUpdated 23 hours ago
Daily Quote API
Kapil01
apiv1