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=20&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 11820 results for "api"(841ms)

myApi1 file match

@quinnUpdated 1 year ago

myApi1 file match

@wltUpdated 1 year ago

myApi1 file match

@carlosrglUpdated 1 year ago

runValAPIEx2 file matches

@stevekrouseUpdated 1 year ago

valtownAPIExamples2 file matches

@stevekrouseUpdated 1 year ago

myApi1 file match

@fsawaktaUpdated 1 year ago

myApi1 file match

@baiheinetUpdated 1 year ago

myApi1 file match

@devnUpdated 1 year ago

myApiAdd2 file matches

@acmuUpdated 1 year ago

myApi1 file match

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

GitHub-Release-Notesgithub.ts20 matches

@charmaineUpdated 50 mins 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];
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