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/$%7Burl%7D?q=api&page=144&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 13226 results for "api"(1397ms)

Flarum-Discussion-To-PlainTextapp.tsx2 matches

@tyler71•Updated 1 week ago
122async function getDiscussionPosts(discussionId: string): Promise<PostT[]> {
123 // Used to get the list of post id's for the discussion.
124 const discussionRes = await fetch(`${server}/api/discussions/${discussionId}`);
125 const discussionResJson = await discussionRes.json();
126
134
135 await Promise.all(chunks.map(async (c: string[]) => {
136 const postRes = await fetch(`${server}/api/posts?filter[id]=${c.join(",")}`);
137 const postJson = await postRes.json();
138
GitHub-Release-Notes

GitHub-Release-NotesReleaseNotes.tsx1 match

@charmaine•Updated 1 week ago
222
223 try {
224 const response = await fetch("/api/share", {
225 method: "POST",
226 headers: {
GitHub-Release-Notes

GitHub-Release-Notesgithub.ts20 matches

@charmaine•Updated 1 week ago
26 let hasMorePages = true;
27
28 // GitHub API headers
29 const headers = {
30 "Accept": "application/vnd.github.v3+json",
31 "Authorization": `Bearer ${token}`,
32 "User-Agent": "GitHub-Release-Notes-Generator",
33 "X-GitHub-Api-Version": "2022-11-28",
34 };
35
39 while (hasMorePages) {
40 const url =
41 `https://api.github.com/repos/${owner}/${repo}/commits?since=${sinceISO}&until=${untilISO}&per_page=100&page=${page}`;
42 console.log(`Fetching page ${page}...`);
43
46 if (!response.ok) {
47 const error = await response.text();
48 throw new Error(`GitHub API error: ${response.status} - ${error}`);
49 }
50
77 prNumber: number,
78): Promise<GitHubPR | null> {
79 const url = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}`;
80
81 const response = await fetch(url, {
84 "Authorization": `Bearer ${token}`,
85 "User-Agent": "GitHub-Release-Notes-Generator",
86 "X-GitHub-Api-Version": "2022-11-28",
87 },
88 });
94 if (!response.ok) {
95 const error = await response.text();
96 throw new Error(`GitHub API error: ${response.status} - ${error}`);
97 }
98
109 commitSha: string,
110): Promise<GitHubPR[]> {
111 const url = `https://api.github.com/repos/${owner}/${repo}/commits/${commitSha}/pulls`;
112
113 const response = await fetch(url, {
116 "Authorization": `Bearer ${token}`,
117 "User-Agent": "GitHub-Release-Notes-Generator",
118 "X-GitHub-Api-Version": "2022-11-28",
119 },
120 });
126 if (!response.ok) {
127 const error = await response.text();
128 throw new Error(`GitHub API error: ${response.status} - ${error}`);
129 }
130
133
134/**
135 * Fetches issues referenced by a commit or PR using GitHub API
136 */
137async function fetchIssueReferences(
147 // If we have a PR number, check for issues closed by the PR
148 if (prNumber) {
149 const prIssuesUrl = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}/commits`;
150
151 const prResponse = await fetch(prIssuesUrl, {
154 "Authorization": `Bearer ${token}`,
155 "User-Agent": "GitHub-Release-Notes-Generator",
156 "X-GitHub-Api-Version": "2022-11-28",
157 },
158 });
161 const prCommits = await prResponse.json();
162
163 // Extract issue numbers from commit messages using the GitHub API pattern
164 for (const commit of prCommits) {
165 // Look for "Fixes #X", "Closes #X", "Resolves #X" patterns that GitHub recognizes
180 // Also check the timeline of the PR to find linked issues
181 if (prNumber) {
182 const timelineUrl = `https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/timeline`;
183
184 const timelineResponse = await fetch(timelineUrl, {
187 "Authorization": `Bearer ${token}`,
188 "User-Agent": "GitHub-Release-Notes-Generator",
189 "X-GitHub-Api-Version": "2022-11-28",
190 },
191 });
213 * Fetches commits and their associated PRs
214 * Includes progress tracking for large repositories
215 * Uses GitHub API to find PR and issue references
216 */
217export async function fetchCommitsWithPRs(
231
232 // Process commits in batches to not get rate limited
233 const BATCH_SIZE = 5; // Reduced batch size since we're making more API calls per commit
234 for (let i = 0; i < commits.length; i += BATCH_SIZE) {
235 const batch = commits.slice(i, i + BATCH_SIZE);
236 const batchPromises = batch.map(async (commit) => {
237 // Use GitHub API to find associated PRs for this commit
238 const associatedPRs = await fetchPRsForCommit(token, owner, repo, commit.sha);
239
245 pr = associatedPRs[0]; // Use the first PR if multiple exist
246
247 // Get issue references using the GitHub API
248 const prIssueRefs = await fetchIssueReferences(token, owner, repo, commit.sha, pr.number);
249 issueRefs = [...prIssueRefs];
GitHub-Release-Notes

GitHub-Release-Notesllm.ts1 match

@charmaine•Updated 1 week ago
186`;
187
188 // Call the OpenAI API
189 const completion = await openai.chat.completions.create({
190 model: "gpt-4o",

Townieuser-summary.ts1 match

@jxnblk•Updated 1 week ago
20 SUM(num_images) as total_images
21 FROM ${USAGE_TABLE}
22 WHERE our_api_token = 1
23 GROUP BY user_id, username
24 ORDER BY total_price DESC

TownieuseProject.tsx2 matches

@jxnblk•Updated 1 week ago
2import { useAuth } from "./useAuth.tsx";
3
4const PROJECT_ENDPOINT = "/api/project";
5const FILES_ENDPOINT = "/api/project-files";
6
7export function useProject (projectId: string, branchId?: string) {

TownieuseProjects.tsx1 match

@jxnblk•Updated 1 week ago
2import { useAuth } from "./useAuth.tsx";
3
4const ENDPOINT = "/api/projects-loader";
5
6export function useProjects () {

TownieuseCreateProject.tsx1 match

@jxnblk•Updated 1 week ago
3import { useAuth } from "./useAuth.tsx";
4
5const ENDPOINT = "/api/create-project";
6
7export function useCreateProject () {

TownieuseCreateBranch.tsx1 match

@jxnblk•Updated 1 week ago
2import { useAuth } from "./useAuth.tsx";
3
4const ENDPOINT = "/api/create-branch";
5
6export function useCreateBranch (projectId: string) {

TownieuseChatLogic.ts4 matches

@jxnblk•Updated 1 week ago
6 project: any;
7 branchId: string | undefined;
8 anthropicApiKey: string;
9 bearerToken: string;
10 selectedFiles: string[];
16 project,
17 branchId,
18 anthropicApiKey,
19 bearerToken,
20 selectedFiles,
37 status,
38 } = useChat({
39 api: "/api/send-message",
40 body: {
41 project,
42 branchId,
43 anthropicApiKey,
44 selectedFiles,
45 images: images

vapi-minutes-db1 file match

@henrywilliams•Updated 2 days ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 3 days ago
snartapi
Kapil01