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%22Optional%20title%22?q=api&page=94&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 20751 results for "api"(2119ms)

reddit-checkerREADME.md10 matches

@sunnyatlightswitchโ€ขUpdated 1 week ago
6
7- **Unified Monitoring**: Single script handles all Reddit monitoring
8- **Multiple Methods**: Uses Reddit API with JSON and RSS fallbacks for reliability
9- **Multi-Subreddit Support**: Monitors 11 subreddits simultaneously
10- **Dual Notifications**: Sends both Slack and email notifications
72- **Execution**: Automated cron scheduling + manual override capability
73
74### Reddit API Credentials โœ… CONFIGURED
75
76- **Client ID**: `151sZ8h5TaHVZGZZn0rOhA`
137- **Frequency**: Automated cron execution + manual override capability
138- **Scope**: New posts since last check across all monitored subreddits
139- **Methods**: Reddit API (primary), JSON API (fallback), RSS feeds (last resort)
140
141### Keyword Matching โœ… TESTED
192## ๐Ÿ” Security
193
194- Reddit API credentials are configured and working
195- Access tokens are cached and automatically refreshed
196- All API calls use proper authentication headers
197- Fallback methods ensure reliability even if primary API fails
198
199## โœ… System Status
205- โœ… **Automated Scheduling**: Runs consistently on cron schedule
206- โœ… **Manual Override**: Can still be run manually when needed
207- โœ… **Multi-Method Fetching**: Reddit API โ†’ JSON API โ†’ RSS fallbacks
208- โœ… **Multi-Subreddit Support**: 11 subreddits monitored simultaneously
209- โœ… **Triple Output**: Slack notifications + Email alerts + Database storage
233 - Use `?action=reset` to check all posts again
234
2352. **API Errors**
236 - The script automatically falls back to JSON API then RSS
237 - Check the response for detailed error information
238
245
246The unified script provides comprehensive logging:
247- Shows which method was used for each subreddit (API/JSON/RSS)
248- Reports errors per subreddit but continues with others
249- Provides detailed match information
1import { setTimeout } from "node:timers/promises";
2
3const articles = [{
4 id: 0,
5 title: "A Crash Course in GraphQL",
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
16
17// Unwrap and rethrow Hono errors as the original error

enchantingBeigeFireflymain.tsx2 matches

@fkjkโ€ขUpdated 1 week ago
26
27 // Get weather for the current position
28 const apiKey = "28b7fee1c3078108ffb899013952f3e5"; // Replace with actual API key
29 const weatherUrl =
30 `https://api.openweathermap.org/data/2.5/weather?lat=${position.latitude}&lon=${position.longitude}&units=metric&appid=${apiKey}`;
31
32 try {

klarna-acquirer-interoperabilityserver.js7 matches

@mishaโ€ขUpdated 1 week ago
10app.get("/public/**/*", c => serveFile(c.req.path, import.meta.url));
11
12const { accountId: ACCOUNT_ID, apiKey: API_KEY } = process.env;
13
14const authorizeWithKlarna = async (
19) => {
20 const response = await fetch(
21 `https://api-global.test.klarna.com/v2/accounts/${ACCOUNT_ID}/payment/authorize`,
22 {
23 method: "POST",
25 "Content-Type": "application/json",
26 "Klarna-Interoperability-Token": interoperabilityToken,
27 Authorization: "Basic " + API_KEY,
28 },
29 body: JSON.stringify({
57const getKlarnaSDKToken = async (interoperabilityToken) => {
58 const response = await fetch(
59 `https://api-global.test.klarna.com/v2/accounts/${ACCOUNT_ID}/interoperability/sdk-tokens`,
60 {
61 method: "POST",
63 "Content-Type": "application/json",
64 "Klarna-Interoperability-Token": interoperabilityToken,
65 Authorization: "Basic " + API_KEY,
66 },
67 },
154});
155
156// Add your API routes here
157// app.get("/api/data", c => c.json({ hello: "world" }));
158
159// Unwrap and rethrow Hono errors as the original error

klarna-merchant-interoperabilityserver.js5 matches

@mishaโ€ขUpdated 1 week ago
13app.get("/public/**/*", c => serveFile(c.req.path, import.meta.url));
14
15// Add your API routes here
16// app.get("/api/data", c => c.json({ hello: "world" }));
17
18// Unwrap and rethrow Hono errors as the original error
37app.get("/paymentRequest", async function(c) {
38 const { amount, currency, returnUrl } = c.req.query();
39 const apiKey = process.env.API_KEY;
40
41 const response = await fetch(
42 `https://api-global.test.klarna.com/v2/payment/requests`,
43 {
44 method: "POST",
45 headers: {
46 "Content-Type": "application/json",
47 Authorization: "Basic " + apiKey,
48 },
49 body: JSON.stringify({
rust-nyc-discord-bot

rust-nyc-discord-botindex.ts32 matches

@colelโ€ขUpdated 1 week ago
72});
73
74// API Routes
75app.post("/api/submissions", async c => {
76 console.log(`๐ŸŽฏ [API] New talk submission received`);
77
78 try {
80 const { speakerName, talkContext, isOnBehalf, submitterName } = body;
81
82 console.log(`๐Ÿ“‹ [API] Submission details:`);
83 console.log(` Speaker: "${speakerName}"`);
84 console.log(` Context length: ${talkContext?.length || 0} characters`);
90 // Validate input
91 if (!speakerName || !talkContext || typeof isOnBehalf !== "boolean") {
92 console.error(`โŒ [API] Validation failed - missing required fields`);
93 console.error(` speakerName: ${!!speakerName}`);
94 console.error(` talkContext: ${!!talkContext}`);
99 // Validate submitter name if submitting on behalf
100 if (isOnBehalf && !submitterName?.trim()) {
101 console.error(`โŒ [API] Validation failed - submitter name required when submitting on behalf`);
102 return c.json({ error: "Submitter name is required when submitting on behalf of someone else" }, 400);
103 }
104
105 console.log(`๐Ÿ’พ [API] Inserting submission into database`);
106
107 // Insert submission into database
112
113 const submissionId = Number(result.lastInsertRowid);
114 console.log(`โœ… [API] Database insertion successful, submission ID: ${submissionId}`);
115
116 // Discord integration workflow
117 console.log(`๐Ÿค– [API] Starting Discord integration workflow`);
118
119 console.log(`๐Ÿ”ง [API] Step 1: Creating Discord channel`);
120 const discordChannelId = await createDiscordChannel(speakerName, submissionId);
121
122 console.log(`๐Ÿ”— [API] Step 2: Creating Discord invite`);
123 const discordInviteLink = await createDiscordInvite(discordChannelId);
124
125 console.log(`๐Ÿ“ข [API] Step 3: Notifying organizers`);
126 await postToOrganizersChannel(speakerName, talkContext, isOnBehalf, submitterName, discordChannelId);
127
128 console.log(`๐Ÿ’พ [API] Updating database with Discord information`);
129
130 // Update submission with Discord info
134 );
135
136 console.log(`โœ… [API] Submission processing complete!`);
137 console.log(`๐Ÿ“Š [API] Final result:`);
138 console.log(` Submission ID: ${submissionId}`);
139 console.log(` Discord Channel ID: ${discordChannelId}`);
146 });
147 } catch (error) {
148 console.error(`๐Ÿ’ฅ [API] Critical error processing submission:`, error);
149 console.error(`๐Ÿ’ฅ [API] Error type:`, error.constructor.name);
150 console.error(`๐Ÿ’ฅ [API] Error message:`, error.message);
151 if (error.stack) {
152 console.error(`๐Ÿ’ฅ [API] Stack trace:`, error.stack);
153 }
154 return c.json({ error: "Internal server error" }, 500);
157
158// Get all submissions (for admin view)
159app.get("/api/submissions", async c => {
160 try {
161 const submissions = await sqlite.execute(`SELECT * FROM ${TABLE_NAME} ORDER BY created_at DESC`);
207 }
208
209 console.log(`๐Ÿš€ [Discord] Making API request to create channel in guild ${guildId}`);
210 console.log(`๐Ÿ“Š [Discord] Channel data:`, JSON.stringify(channelData, null, 2));
211
212 const response = await fetch(`https://discord.com/api/v10/guilds/${guildId}/channels`, {
213 method: "POST",
214 headers: {
219 });
220
221 console.log(`๐Ÿ“ก [Discord] API Response Status: ${response.status} ${response.statusText}`);
222
223 if (!response.ok) {
233 }
234
235 throw new Error(`Discord API error: ${response.status} - ${errorText}`);
236 }
237
275 };
276
277 console.log(`๐Ÿš€ [Discord] Making API request to create invite for channel ${channelId}`);
278 console.log(`๐Ÿ“Š [Discord] Invite data:`, JSON.stringify(inviteData, null, 2));
279
280 const response = await fetch(`https://discord.com/api/v10/channels/${channelId}/invites`, {
281 method: "POST",
282 headers: {
287 });
288
289 console.log(`๐Ÿ“ก [Discord] Invite API Response Status: ${response.status} ${response.statusText}`);
290
291 if (!response.ok) {
301 }
302
303 throw new Error(`Discord API error: ${response.status} - ${errorText}`);
304 }
305
375 };
376
377 console.log(`๐Ÿš€ [Discord] Making API request to post to organizers channel ${organizersChannelId}`);
378 console.log(`๐Ÿ“Š [Discord] Message data:`, JSON.stringify(messageData, null, 2));
379
380 const response = await fetch(`https://discord.com/api/v10/channels/${organizersChannelId}/messages`, {
381 method: "POST",
382 headers: {
387 });
388
389 console.log(`๐Ÿ“ก [Discord] Message API Response Status: ${response.status} ${response.statusText}`);
390
391 if (!response.ok) {
410 }
411
412 throw new Error(`Discord API error: ${response.status} - ${errorText}`);
413 }
414

Linear-Slack-Pingdeployment-guide.md6 matches

@charmaineโ€ขUpdated 1 week ago
7Copy each TypeScript file into a new Val:
8
91. **linearApi** - Copy contents of `linearApi.ts`
102. **slackApi** - Copy contents of `slackApi.ts`
113. **database** - Copy contents of `database.ts`
124. **slashCommand** - Copy contents of `slashCommand.ts`
21```typescript
22// Change from:
23import { getLinearTicket } from "./linearApi";
24
25// To:
26import { getLinearTicket } from "https://esm.town/v/YOUR_USERNAME/linearApi";
27```
28
30
31In Val Town settings, add:
32- `LINEAR_API_KEY`
33- `SLACK_BOT_TOKEN`
34
56## Troubleshooting
57
58- **"Failed to fetch Linear ticket"**: Check your LINEAR_API_KEY
59- **"Failed to lookup user"**: Check SLACK_BOT_TOKEN permissions
60- **Modal doesn't open**: Verify interactivity URL is correct

klarna-acquirer-interoperabilityscript.js2 matches

@mishaโ€ขUpdated 1 week ago
43 console.log({ presentationResponse });
44
45 const buttonAPI = presentationResponse.paymentButton;
46
47 const buttonConfig = {
63 };
64
65 const klarnaButton = buttonAPI.component(buttonConfig).mount("#klarna-payment-button");
66
67 Klarna.Payment.on("complete", async (paymentRequest) => {

FileDumpThingupload.ts2 matches

@djsnipa1โ€ขUpdated 1 week ago
3import { readStdinToBuffer } from "./utils.ts";
4
5const API_URL = `https://filedumpthing.val.run/api/upload`;
6
7async function main() {
50 }
51
52 const response = await fetch(API_URL, {
53 method: "POST",
54 body: formData,

claude-api1 file match

@ziyanwouldโ€ขUpdated 3 days ago

api-workshop

@danarddanielsjrโ€ขUpdated 4 days ago
replicate
Run AI with an API
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of ๐Ÿชฟ HONC ๐Ÿชฟ (https://honc.dev)