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=1591&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 18017 results for "api"(1423ms)

getRedditAccessTokenmain.tsx1 match

@tambre•Updated 1 year ago
13 `${process.env.reddit_client_id}:${process.env.reddit_client_secret}`,
14 ).toString("base64");
15 const response = await fetch("https://www.reddit.com/api/v1/access_token", {
16 method: "POST",
17 body: formData,

authenticateRedditmain.tsx1 match

@mschleske•Updated 1 year ago
24
25 try {
26 response = await fetch("https://www.reddit.com/api/v1/access_token", {
27 headers: headers,
28 method: "POST",

valSignmain.tsx1 match

@easrng•Updated 1 year ago
11}) {
12 const topUser = whoami().at(-1).slice(1).split(".")[0];
13 const verifyPublicKey = await __utils__.api(topUser + ".vsPublicKey");
14 if (verifyPublicKey !== keys.publicKey)
15 throw new Error("keypair doesn't match @" + topUser + ".vsPublicKey()");

valSignVerifymain.tsx1 match

@easrng•Updated 1 year ago
7 const [handle, encodedSignedMessage] = matches.slice(1);
8 const publicKey = Buffer.from(
9 await __utils__.api(handle + ".vsPublicKey"),
10 "base64",
11 );

addShortlinkmain.tsx3 matches

@byjp•Updated 1 year ago
51 Accept: "application/vnd.github+json",
52 Authorization: req.get("Authorization"),
53 "X-GitHub-Api-Version": "2022-11-28",
54 };
55 const path = `https://api.github.com/repos/${shortlink_repo}/contents/public/_redirects`;
56 const getRes = await fetch(path, {
57 method: "GET",
84 headers,
85 body: JSON.stringify({
86 message: `Adding '${shortlink}' shortlink via API`,
87 content: Buffer.from(redirects).toString("base64"),
88 sha,

getValREADME.md1 match

@stevekrouse•Updated 1 year ago
2Gets information about a specific val.
3
4To access private vals, pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: Archive/getVal

btoamain.tsx1 match

@stevekrouse•Updated 1 year ago
1// https://developer.mozilla.org/en-US/docs/Web/API/btoa
2import { Buffer } from "node:buffer";
3

callGoogleSheetsAPImain.tsx3 matches

@clayway•Updated 1 year ago
7 data: object;
8};
9export async function callGoogleSheetsAPI(
10 { serviceAccount, sheetId, action, data }: Args,
11) {
14 );
15 const googleAuthOptions = {
16 scope: ["https://www.googleapis.com/auth/spreadsheets"],
17 };
18 const { access_token } = await getToken(serviceAccount, googleAuthOptions);
19 const result = fetchJSON(
20 `https://sheets.googleapis.com/v4/spreadsheets/${sheetId}/${action}`,
21 {
22 method: "POST",

spotifyCreatePlaylistmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { spotifyMe } from "https://esm.town/v/stevekrouse/spotifyMe";
2import { spotifyAPI } from "https://esm.town/v/stevekrouse/spotifyAPI";
3
4export let spotifyCreatePlaylist = async ({token, ...params}) => spotifyAPI({
5 token,
6 endpoint: `users/${(await spotifyMe(token)).id}/playlists`,

googleClientmain.tsx1 match

@stevekrouse•Updated 1 year ago
1export const googleClient = async () => {
2 const { google } = await import("npm:googleapis");
3 const key = { client_id: "test", client_secret: "test" };
4 const client = new google.auth.OAuth2(key.client_id, key.client_secret, [

Apiify9 file matches

@wolf•Updated 17 mins ago

dailyQuoteAPI

@Souky•Updated 2 days ago
Kapil01
apiv1