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/$%7BsvgDataUrl%7D?q=api&page=8&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 18990 results for "api"(2197ms)

Todomain.tsx4 matches

@svc•Updated 21 hours ago
73<script>
74(function() {
75 const API_URL = '${sourceUrl}';
76 const STORE_KEYS = { projects: 'aura_projects_v1', tasks: 'aura_tasks_v1' };
77 const ACTIVE_TASK_WARNING_THRESHOLD = 50;
253 addMessageToChat('ai', 'Aura is thinking...');
254 try {
255 const res = await fetch(\`\${API_URL}?action=chat\`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: userMessage, tasks, projects, history: conversationHistory.slice(-4) }) });
256 if (!res.ok) {
257 const err = await res.json();
284 toggleLoading(btn, true);
285 try {
286 const res = await fetch(\`\${API_URL}?action=synthesizeProject\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ goal }) });
287 if (!res.ok) {
288 const err = await res.json();
317 toggleLoading(btn, true);
318 try {
319 const res = await fetch(\`\${API_URL}?action=getDailyReschedule\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ tasks: todayTasks }) });
320 if (!res.ok) {
321 const err = await res.json();

anthropicProxyREADME.md1 match

@maddy•Updated 21 hours ago
1This Val will proxy anthropic HTTP requests from some frontend client, like langchain, so that you can utilize anthropic apis from the browser.
2
3Convert it to an HTTP val in order to use it (you may want to setup an ENV var / header to protect the endpoint with a secret key)

anthropicProxymain.tsx6 matches

@maddy•Updated 21 hours ago
13 }
14
15 // Check that your valtown API key is sent in the 'x-authorization' header
16 // Delete this line if you don't mind other parties hitting this endpoint
17 if (req.headers.get("x-authorization") !== Deno.env.get("valtown")) {
24 try {
25 const body = await req.json();
26 const apiKey = req.headers.get("x-api-key");
27
28 if (!body) {
30 }
31
32 if (!apiKey) {
33 throw new Error("No API key provided");
34 }
35
36 const anthropic = new Anthropic({ apiKey });
37
38 if (body?.stream) {
57 }
58 } catch (e) {
59 if (e instanceof Anthropic.APIError) {
60 return Response.json(e.error, { status: e.status });
61 }

cardamonRecipeForm.tsx5 matches

@connnolly•Updated 22 hours ago
97 switch (parseMode) {
98 case 'url':
99 endpoint = '/api/parse/url';
100 requestData = { type: 'url', content: parseInput };
101 break;
102 case 'text':
103 endpoint = '/api/parse/text';
104 requestData = { type: 'url', content: parseInput }; // Note: backend expects 'url' type for text parsing
105 break;
110
111 if (uploadedFile.type.startsWith('image/')) {
112 endpoint = '/api/parse/image';
113 requestData = { type: 'image', content: parseInput };
114 } else if (uploadedFile.type === 'application/pdf') {
115 endpoint = '/api/parse/pdf';
116 requestData = { type: 'pdf', content: parseInput };
117 } else {
198 };
199
200 const url = isEditing ? `/api/recipes/${recipe.id}` : '/api/recipes';
201 const method = isEditing ? 'PUT' : 'POST';
202

cardamonindex.ts5 matches

@connnolly•Updated 22 hours ago
15await runMigrations();
16
17// API routes
18app.route('/api/recipes', recipesRoutes);
19app.route('/api/parse', parseRoutes);
20
21// Health check endpoint
22app.get('/api/health', (c) => {
23 return c.json({ status: 'ok', timestamp: new Date().toISOString() });
24});
25
26// Test delete endpoint
27app.get('/api/test-delete', async (c) => {
28 try {
29 const { createRecipe, deleteRecipe, getAllRecipes } = await import('./database/queries.ts');

cardamonRecipeView.tsx1 match

@connnolly•Updated 22 hours ago
34 const handleDelete = async () => {
35 try {
36 const response = await fetch(`/api/recipes/${recipe.id}`, {
37 method: 'DELETE'
38 });

cardamonRecipeList.tsx1 match

@connnolly•Updated 22 hours ago
48 const handleDelete = async (recipeId: number) => {
49 try {
50 const response = await fetch(`/api/recipes/${recipeId}`, {
51 method: 'DELETE'
52 });

cardamonApp.tsx1 match

@connnolly•Updated 22 hours ago
33 setState(prev => ({ ...prev, loading: true, error: null }));
34 try {
35 const response = await fetch('/api/recipes');
36 const data = await response.json();
37

cardamonrecipes.ts20 matches

@connnolly•Updated 22 hours ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { Recipe, RecipeFilters, ApiResponse } from "../../shared/types.ts";
3import {
4 createRecipe,
28
29 const recipes = await getAllRecipes(filters);
30 return c.json({ success: true, data: recipes } as ApiResponse<Recipe[]>);
31 } catch (error) {
32 console.error('Error fetching recipes:', error);
33 return c.json({ success: false, error: 'Failed to fetch recipes' } as ApiResponse, 500);
34 }
35});
40 const id = parseInt(c.req.param('id'));
41 if (isNaN(id)) {
42 return c.json({ success: false, error: 'Invalid recipe ID' } as ApiResponse, 400);
43 }
44
45 const recipe = await getRecipeById(id);
46 if (!recipe) {
47 return c.json({ success: false, error: 'Recipe not found' } as ApiResponse, 404);
48 }
49
50 return c.json({ success: true, data: recipe } as ApiResponse<Recipe>);
51 } catch (error) {
52 console.error('Error fetching recipe:', error);
53 return c.json({ success: false, error: 'Failed to fetch recipe' } as ApiResponse, 500);
54 }
55});
65 success: false,
66 error: 'Missing required fields: title, ingredients, and steps are required'
67 } as ApiResponse, 400);
68 }
69
72 success: false,
73 error: 'At least one ingredient is required'
74 } as ApiResponse, 400);
75 }
76
79 success: false,
80 error: 'At least one cooking step is required'
81 } as ApiResponse, 400);
82 }
83
84 const recipe = await createRecipe(recipeData);
85 return c.json({ success: true, data: recipe } as ApiResponse<Recipe>, 201);
86 } catch (error) {
87 console.error('Error creating recipe:', error);
88 return c.json({ success: false, error: 'Failed to create recipe' } as ApiResponse, 500);
89 }
90});
95 const id = parseInt(c.req.param('id'));
96 if (isNaN(id)) {
97 return c.json({ success: false, error: 'Invalid recipe ID' } as ApiResponse, 400);
98 }
99
102 const recipe = await updateRecipe(id, updates);
103 if (!recipe) {
104 return c.json({ success: false, error: 'Recipe not found' } as ApiResponse, 404);
105 }
106
107 return c.json({ success: true, data: recipe } as ApiResponse<Recipe>);
108 } catch (error) {
109 console.error('Error updating recipe:', error);
110 return c.json({ success: false, error: 'Failed to update recipe' } as ApiResponse, 500);
111 }
112});
117 const id = parseInt(c.req.param('id'));
118 if (isNaN(id)) {
119 return c.json({ success: false, error: 'Invalid recipe ID' } as ApiResponse, 400);
120 }
121
122 const deleted = await deleteRecipe(id);
123 if (!deleted) {
124 return c.json({ success: false, error: 'Recipe not found' } as ApiResponse, 404);
125 }
126
127 return c.json({ success: true, data: { deleted: true } } as ApiResponse);
128 } catch (error) {
129 console.error('Error deleting recipe:', error);
130 return c.json({ success: false, error: 'Failed to delete recipe' } as ApiResponse, 500);
131 }
132});

cardamontypes.ts1 match

@connnolly•Updated 22 hours ago
38}
39
40export interface ApiResponse<T = any> {
41 success: boolean;
42 data?: T;
Plantfo

Plantfo8 file matches

@Llad•Updated 4 hours ago
API for AI plant info

beeminder-api4 file matches

@cricks_unmixed4u•Updated 1 day ago
apiry
snartapi