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?q=api&page=1&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 11504 results for "api"(1109ms)

growingEmeraldGrasshoppermain.tsx6 matches

@speedaddโ€ขUpdated 39 mins ago
4import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
5
6const ELEVENLABS_API_KEY = "sk_352c51c19a910aa3973cc146d057c11a1216da0eec41e0ee";
7const ELON_VOICE_ID = "UgBBYS2sOqTuMpoF3BR0"; // Specific Elon Musk voice ID
8
60 try {
61 for (const chunk of chunks) {
62 const response = await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${ELON_VOICE_ID}`, {
63 method: "POST",
64 headers: {
65 "Content-Type": "application/json",
66 "xi-api-key": ELEVENLABS_API_KEY,
67 },
68 body: JSON.stringify({
161 setError(error.message);
162
163 // Fallback response if API fails
164 const fallbackResponse = {
165 role: "Character",
424 try {
425 const openai = new OpenAI({
426 apiKey:
427 "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",
428 });
432 console.log("Received messages:", JSON.stringify(messages, null, 2));
433
434 // Prepare messages for OpenAI API
435 const formattedMessages = [
436 { role: "system", content: CHARACTER_DESCRIPTION },

instagram-toolsfollows-check.jsx1 match

@julianperaโ€ขUpdated 1 hour ago
4export default async function handleCron(interval) {
5 const following = await fetchCookie(
6 "https://www.instagram.com/api/v1/friendships/375942300/following/?query=miguelse10",
7 {
8 method: "GET",
GitHub-PR-Automation

GitHub-PR-AutomationREADME.md1 match

@charmaineโ€ขUpdated 1 hour ago
82
831. **Create a Slack App**:
84 - Go to [Slack API Apps](https://api.slack.com/apps) โ†’ Create New App โ†’ From scratch
85 - Name your app and select your workspace
86 - Click "Create App"
137
138 try {
139 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
140
141 const response = await fetch(url, {
166 }
167 } catch (error) {
168 console.error("Exception during API call:", error);
169 return { success: false, message: error.message };
170 }
162 }
163
164 const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}`;
165
166 const response = await fetch(url, {
195
196 try {
197 const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/labels`;
198
199 const response = await fetch(url, {
32};
33
34// Types for Slack API
35type SlackMessage = {
36 blocks: any[];
219
220 // Get PR details
221 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
222
223 let response;
241 return await response.json();
242 } catch (jsonError) {
243 throw new Error(`Failed to parse GitHub API response: ${jsonError.message}`);
244 }
245}
246
247// Merge a PR via GitHub API
248async function mergePR(repo: string, prNumber: number) {
249 const token = Deno.env.get("GITHUB_TOKEN");
282
283 // Proceed with merge
284 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`;
285
286 const response = await fetch(url, {
GitHub-PR-Automation

GitHub-PR-Automationgithub-pr-auto-assign.ts2 matches

@charmaineโ€ขUpdated 2 hours ago
99
100 try {
101 const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/assignees`;
102
103 const response = await fetch(url, {
132 }
133 } catch (error) {
134 console.error("Exception during API call:", error);
135 return { success: false, message: error.message };
136 }
GitHub-PR-Automation

GitHub-PR-Automationgithub-pr-auto-assign.ts5 matches

@charmaineโ€ขUpdated 2 hours ago
129
130 try {
131 const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/assignees`;
132 console.log("๐Ÿ” Sending assignee request to:", url);
133
145 });
146
147 console.log("๐Ÿ” GitHub API response status:", response.status);
148
149 if (response.ok) {
155 try {
156 const error = await response.json();
157 console.error("โŒ GitHub API error:", JSON.stringify(error));
158 errorMessage = error.message || errorMessage;
159
168 } catch (e) {
169 const errorText = await response.text();
170 console.error("โŒ GitHub API error text:", errorText);
171 }
172 return { success: false, message: errorMessage };
173 }
174 } catch (error) {
175 console.error("โŒ Exception during API call:", error);
176 return { success: false, message: error.message };
177 }
34};
35
36// Types for Slack API
37type SlackMessage = {
38 blocks: any[];
323
324 // Get PR details
325 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
326 console.log("๐Ÿ” Fetching from GitHub API URL:", url);
327
328 let response;
335 },
336 });
337 console.log("๐Ÿ” GitHub API response received");
338 console.log("๐Ÿ” Response status:", response.status);
339 console.log("๐Ÿ” Response status text:", response.statusText);
346
347 if (!response.ok) {
348 console.error(`โŒ GitHub API error: ${response.status} ${response.statusText}`);
349
350 let errorText;
351 try {
352 errorText = await response.text();
353 console.error("โŒ GitHub API error response:", errorText);
354
355 try {
356 // Try to parse as JSON for more details
357 const errorJson = JSON.parse(errorText);
358 console.error("โŒ GitHub API error details:", JSON.stringify(errorJson));
359 } catch (e) {
360 // Not JSON, that's fine
370 try {
371 data = await response.json();
372 console.log("๐Ÿ” Successfully parsed GitHub API response");
373 } catch (jsonError) {
374 console.error("โŒ Failed to parse GitHub API response:", jsonError);
375
376 try {
384 }
385
386 throw new Error(`Failed to parse GitHub API response: ${jsonError.message}`);
387 }
388
400}
401
402// Merge a PR via GitHub API
403async function mergePR(repo: string, prNumber: number) {
404 console.log(`๐Ÿ” Starting mergePR for PR #${prNumber} in ${repo}`);
448
449 // Proceed with merge
450 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`;
451 console.log("๐Ÿ” Sending merge request to:", url);
452
468 body: mergeBody,
469 });
470 console.log("๐Ÿ” Merge API response received");
471 console.log("๐Ÿ” Response status:", response.status);
472 console.log("๐Ÿ” Response status text:", response.statusText);
638 body: JSON.stringify(message),
639 });
640 console.log("๐Ÿ” Slack API response received");
641 console.log("๐Ÿ” Response status:", response.status);
642 console.log("๐Ÿ” Response status text:", response.statusText);
649
650 if (!response.ok) {
651 console.error(`โŒ Slack API error: ${response.status} ${response.statusText}`);
652
653 let errorText;
654 try {
655 errorText = await response.text();
656 console.error("โŒ Slack API error response:", errorText);
657 } catch (e) {
658 console.error("โŒ Could not read error response:", e);
198 }
199
200 const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}`;
201 console.log("๐Ÿ” Fetching issue from:", url);
202
209 });
210
211 console.log("๐Ÿ” GitHub API response status:", response.status);
212
213 if (!response.ok) {
215 try {
216 const error = await response.json();
217 console.error("โŒ GitHub API error:", JSON.stringify(error));
218 errorMessage = error.message || errorMessage;
219 } catch (e) {
220 const errorText = await response.text();
221 console.error("โŒ GitHub API error text:", errorText);
222 }
223 throw new Error(`Failed to fetch issue: ${errorMessage}`);
237
238 try {
239 const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/labels`;
240 console.log("๐Ÿ” Sending labels update request to:", url);
241
253 });
254
255 console.log("๐Ÿ” GitHub API response status:", response.status);
256
257 if (response.ok) {
264 try {
265 const error = await response.json();
266 console.error("โŒ GitHub API error:", JSON.stringify(error));
267 errorMessage = error.message || errorMessage;
268 } catch (e) {
269 const errorText = await response.text();
270 console.error("โŒ GitHub API error text:", errorText);
271 }
272 return { success: false, message: errorMessage };
273 }
274 } catch (error) {
275 console.error("โŒ Exception during API call:", error);
276 return { success: false, message: error.message };
277 }

gptApiTemplate2 file matches

@charmaineโ€ขUpdated 13 hours ago

mod-interview-api1 file match

@twschillerโ€ขUpdated 1 day ago
apiv1
papimark21