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/image-url.jpg%20%22Image%20title%22?q=api&page=91&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 21177 results for "api"(5502ms)

counting-vals-on-blueskymain.tsx1 match

@stevekrouse•Updated 1 week ago
1import { blob } from "https://esm.town/v/std/blob";
2import atproto from "npm:@atproto/api@0.2.10";
3import { chunk } from "npm:lodash-es";
4

ideasmain.tsx1 match

@join•Updated 1 week ago
226 });
227
228 // --- API Calls ---
229 async function fetchIdeas(topic) {
230 ideaSelector.innerHTML = '<option>Synthesizing concepts...</option>';

ostpolispambsky.ts1 match

@stilobic•Updated 1 week ago
1import { BskyAgent } from "npm:@atproto/api";
2
3// constants

ostpolispammeteo.ts3 matches

@stilobic•Updated 1 week ago
13const ANNEMASSE_LATITUDE = "46.1933";
14const ANNEMASSE_LONGITUDE = "6.2342";
15const METEO_API_VERSION = 1;
16const METEO_API_BASE = `https://api.open-meteo.com/v${METEO_API_VERSION}`;
17
18// functions
20export async function getCurrentTemperature(): Promise<number> {
21 const resourceUrl =
22 `${METEO_API_BASE}/forecast?latitude=47.3769&longitude=8.5417&current=temperature_2m&timezone=auto`;
23 const res = await fetch(resourceUrl);
24 validateResponse(res);

formalforgemain.tsx4 matches

@join•Updated 1 week ago
47 <meta name="viewport" content="width=device-width, initial-scale=1.0">
48 <title>The Formal Letter Forge</title>
49 <link rel="preconnect" href="https://fonts.googleapis.com">
50 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
51 <link href="https://fonts.googleapis.com/css2?family=Lora:wght@400;600&family=Source+Sans+3:wght@400;600;700&display=swap" rel="stylesheet">
52<style>
53 :root {
255<script>
256(function() {
257 const API_URL = '${sourceUrl}';
258 const THEME_KEY = 'formal_forge_theme';
259 let commandPaletteItems = [];
422 try {
423 updateStatus('Initiating Process...', 'Sending context to strategists.');
424 const response = await fetch(\`\${API_URL}?action=forge\`, {
425 method: 'POST',
426 headers: { 'Content-Type': 'application/json' },

ostpolispamutils.ts1 match

@stilobic•Updated 1 week ago
1export function validateResponse(res: Response): void {
2 if (!res.ok) throw new Error(`api error: ${res.status}: ${res.statusText}`);
3 if (res.status < 200 || res.status >= 300)
4 throw new Error(`Unexpected status code: ${res.status}: ${res.statusText}`);

ProposalHandler.cursorrules10 matches

@lightweight•Updated 1 week ago
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
24
25- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176
177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225
226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248 });
249 ```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252 ```ts
285 - For files in the project, use `readFile` helpers
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`

github-apiIssueViewer.tsx1 match

@cricks_unmixed4u•Updated 1 week ago
44 try {
45 const response = await fetch(
46 `/api/issues/${issue.number}/content?owner=${repoOwner}&repo=${repoName}`,
47 {
48 headers: {
2
3<newFunctionality>
4 Declared in: https://esm.town/v/cricks_unmixed4u/github-api/api/index.tsx?v=30 onwards
5
6```tsx
85- Generate code in TypeScript or TSX
86- Add appropriate TypeScript types and interfaces for all data structures
87- Prefer official SDKs or libraries than writing API calls directly
88- Ask the user to supply API or library documentation if you are at all unsure about it
89- **Never bake in secrets into the code** - always use environment variables
90- Include comments explaining complex logic (avoid commenting obvious operations)
95### 1. HTTP Trigger
96
97- Create web APIs and endpoints
98- Handle HTTP requests and responses
99- Example structure:
245However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
246If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
247or by making an API request for it.
248
249## Val Town Platform Specifics
253- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
254- **Storage:** DO NOT use the Deno KV module for storage
255- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
256- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
257- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
258- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
259- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
260- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
261- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
262- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
296### Backend (Hono) Best Practices
297
298- Hono is the recommended API framework
299- Main entry point should be `backend/index.ts`
300- **Static asset serving:** Use the utility functions to read and serve project files:
320 });
321 ```
322- Create RESTful API routes for CRUD operations
323- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
324 ```ts
357 - For files in the project, use `readFile` helpers
358
3595. **API Design:**
360 - `fetch` handler is the entry point for HTTP vals
361 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
369- Import `https://www.val.town/x/cricks_unmixed4u/logger/code/logger/main.tsx` and use `logInfo`, `logError` or `logDebug`.
370
371# Next Step 1 - Export a new function from api
372
373The new function should return the relevant content of a given issue in markdown format.

github-apillm12 matches

@cricks_unmixed4u•Updated 1 week ago
2
3<newFunctionality>
4 Declared in: https://esm.town/v/cricks_unmixed4u/github-api/api/index.tsx?v=30 onwards
5
6```tsx
85- Generate code in TypeScript or TSX
86- Add appropriate TypeScript types and interfaces for all data structures
87- Prefer official SDKs or libraries than writing API calls directly
88- Ask the user to supply API or library documentation if you are at all unsure about it
89- **Never bake in secrets into the code** - always use environment variables
90- Include comments explaining complex logic (avoid commenting obvious operations)
95### 1. HTTP Trigger
96
97- Create web APIs and endpoints
98- Handle HTTP requests and responses
99- Example structure:
245However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
246If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
247or by making an API request for it.
248
249## Val Town Platform Specifics
253- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
254- **Storage:** DO NOT use the Deno KV module for storage
255- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
256- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
257- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
258- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
259- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
260- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
261- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
262- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
296### Backend (Hono) Best Practices
297
298- Hono is the recommended API framework
299- Main entry point should be `backend/index.ts`
300- **Static asset serving:** Use the utility functions to read and serve project files:
320 });
321 ```
322- Create RESTful API routes for CRUD operations
323- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
324 ```ts
357 - For files in the project, use `readFile` helpers
358
3595. **API Design:**
360 - `fetch` handler is the entry point for HTTP vals
361 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
369- Import `https://www.val.town/x/cricks_unmixed4u/logger/code/logger/main.tsx` and use `logInfo`, `logError` or `logDebug`.
370
371# Next Step 1 - Export a new function from api
372
373The new function should return the relevant content of a given issue in markdown format.

github-api8 file matches

@cricks_unmixed4u•Updated 9 hours ago
Very incomplete collection of useful GitHub API adapters

myAPiKey

@Kix111•Updated 12 hours ago
papimark21
codingpapi