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/?q=api&page=770&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 11605 results for "api"(1611ms)

discordActivityClientmain.tsx5 matches

@neverstewUpdated 6 months ago
51 // /.proxy/ is prepended here in compliance with CSP
52 // see https://discord.com/developers/docs/activities/development-guides#construct-a-full-url
53 const response = await fetch("/.proxy/api/token", {
54 method: "POST",
55 headers: {
104
105/**
106 * This function utilizes RPC and HTTP apis, in order show the current guild's avatar
107 * Here are the steps:
108 * 1. From RPC fetch the currently selected voice channel, which contains the voice channel's guild id
109 * 2. From the HTTP API fetch a list of all of the user's guilds
110 * 3. Find the current guild's info, including its "icon"
111 * 4. Append to the UI an img tag with the related information
117 }
118
119 // 1. From the HTTP API fetch a list of all of the user's guilds
120 const guilds = await fetch(
121 "https://discord.com/api/users/@me/guilds",
122 {
123 headers: {

arcGISHonoMiddlewaremain.tsx1 match

@wiltUpdated 6 months ago
108
109/**
110 * Converts parameters to the proper representation to send to the ArcGIS REST API.
111 * @param params The object whose keys will be encoded.
112 * @return A new object with properly encoded values.

arcGISHonoMiddlewareREADME.md1 match

@wiltUpdated 6 months ago
1Copy of [ArcGISIdentityManager.authorize()](https://github.com/Esri/arcgis-rest-js/blob/bfd7ce977d9879077e92fabfc491240d8f230844/packages/arcgis-rest-request/src/ArcGISIdentityManager.ts#L760), OAuth2 authentication for the ESRI ArcGIS API which is implemented as Express middleware, ported to Hono.
2
3Migrated from folder: gisc/arcGISHonoMiddleware

evalUImain.tsx1 match

@maxmUpdated 6 months ago
47 <pre><code id="resultCode"></code></pre>
48 </div>
49 <h2>API Documentation</h2>
50 <p>To use the POST endpoint programmatically, send a POST request to this URL with the TypeScript code in the request body.</p>
51 <h3>Curl Example:</h3>

falDemoAppmain.tsx2 matches

@stevekrouseUpdated 6 months ago
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }

falDemoAppmain.tsx2 matches

@stevekrouseUpdated 6 months ago
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }

prodigiousTanTurtlemain.tsx19 matches

@ocholap9Updated 6 months ago
111 const handleSubmit = async (e) => {
112 e.preventDefault();
113 const response = await fetch('/api/login', {
114 method: 'POST',
115 headers: { 'Content-Type': 'application/json' },
146 const handleSubmit = async (e) => {
147 e.preventDefault();
148 const response = await fetch('/api/register', {
149 method: 'POST',
150 headers: { 'Content-Type': 'application/json' },
181 const handleSubmit = async (e) => {
182 e.preventDefault();
183 const response = await fetch('/api/profile', {
184 method: 'PUT',
185 headers: {
230
231 const fetchVehicles = async () => {
232 const response = await fetch('/api/vehicles', {
233 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
234 });
240
241 const fetchTransactions = async () => {
242 const response = await fetch('/api/transactions', {
243 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
244 });
279
280 const fetchTollBooths = async () => {
281 const response = await fetch('/api/toll-booths', {
282 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
283 });
317
318 const fetchRevenueReport = async () => {
319 const response = await fetch('/api/revenue-report', {
320 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
321 });
327
328 const fetchTrafficAnalytics = async () => {
329 const response = await fetch('/api/traffic-analytics', {
330 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
331 });
364 const { pathname } = new URL(request.url);
365
366 if (pathname.startsWith('/api/')) {
367 return handleApiRequest(request);
368 }
369
391}
392
393async function handleApiRequest(request: Request): Promise<Response> {
394 const { pathname } = new URL(request.url);
395 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
446
447 switch (pathname) {
448 case '/api/register':
449 return handleRegister(request, sqlite, KEY, SCHEMA_VERSION);
450 case '/api/login':
451 return handleLogin(request, sqlite, KEY, SCHEMA_VERSION);
452 case '/api/profile':
453 return handleProfile(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
454 case '/api/vehicles':
455 return handleVehicles(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
456 case '/api/transactions':
457 return handleTransactions(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
458 case '/api/toll-booths':
459 return handleTollBooths(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
460 case '/api/revenue-report':
461 return handleRevenueReport(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
462 case '/api/traffic-analytics':
463 return handleTrafficAnalytics(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
464 default:

sqliteExplorerAppmain.tsx2 matches

@robaggioUpdated 6 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 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"
34 rel="stylesheet"
35 />

sqliteExplorerAppREADME.md1 match

@robaggioUpdated 6 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

whoIsHiringmain.tsx4 matches

@lowluUpdated 6 months ago
63 const fetchStories = async () => {
64 try {
65 const response = await fetch("/api/stories");
66 if (!response.ok) throw new Error("Failed to fetch dates");
67 const data = await response.json();
77 try {
78 dispatch({ type: "loading", value: true });
79 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80 if (!response.ok) throw new Error("Failed to fetch comments");
81 const data = await response.json();
387export default async function(req: Request): Promise<Response> {
388 const url = new URL(req.url);
389 if (url.pathname === "/api/stories") {
390 const storySearch = await hnSearch({
391 search_by_date: true,
408 }
409
410 if (url.pathname === "/api/comments") {
411 const params = url.searchParams;
412 const query = params.get("query") || "";

new-val-api-21 file match

@shouserUpdated 14 hours ago
This is an example of using the API to create a val.

gptApiTemplate2 file matches

@charmaineUpdated 1 day ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration