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=1399&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 15295 results for "api"(1742ms)

emailAPImain.tsx2 matches

@stevekrouse•Updated 1 year ago
1export let emailAPI = () => {
2 throw new Error("This API has moved to @std.emailAPI.");
3};

unserializeableLogExmain.tsx3 matches

@stevekrouse•Updated 1 year ago
2
3export let unserializeableLogEx = (async () => {
4 const { Configuration, OpenAIApi } = await import("npm:openai");
5 const configuration = new Configuration({
6 apiKey: process.env.openai,
7 });
8 const openai = new OpenAIApi(configuration);
9 console.log(openai);
10})();

stevekrouseFollowingmain.tsx1 match

@stevekrouse•Updated 1 year ago
7 twitterJSON;
8 let resp = await fetchJSON(
9 `https://api.twitter.com/1.1/friends/ids.json?user_id=${userId}`,
10 {
11 headers: {

privateAPIUnauthenticatedmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const privateAPIUnauthenticated =
4 (await fetch("https://api.val.town/v1/run/stevekrouse.example3")).status;

pricemain.tsx2 matches

@stevekrouse•Updated 1 year ago
2
3export let price = async (asset, base = "usd", amount = 1) => {
4 let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`)
5 if (rates && rates[asset.toUpperCase()]) return amount * (1 / rates[asset.toUpperCase()])
6 else {
7 let { rates } = await fetchJSON('https://api.coingecko.com/api/v3/exchange_rates')
8 return amount * rates[base.toLowerCase()]?.value / rates[asset.toLowerCase()]?.value
9 }

verifyAPIAuthmain.tsx1 match

@stevekrouse•Updated 1 year ago
4import { getPublicKey } from "https://esm.town/v/stevekrouse/getPublicKey";
5
6export async function verifyAPIAuth({ signature, ...signed }) {
7 let { handle, t } = signed;
8 let publicKey = await getPublicKey(handle);

githubFileChangedmain.tsx1 match

@stevekrouse•Updated 1 year ago
4export let githubFileChanged = async (owner, repo, file) => {
5 let handle = `${owner}/${repo}/${file}`
6 let current = await fetchJSON(`https://api.github.com/repos/${owner}/${repo}/contents/${file}`)
7 let previous = githubFileCache[handle]
8 if (previous?.content && current?.content && previous?.content !== current?.content) {

mathFactmain.tsx1 match

@andrewh•Updated 1 year ago
3// Random math fact
4export let mathFact = fetchText(
5 "http://numbersapi.com/random/math"
6);
19 url,
20 username: url
21 .replace("https://api.github.com/users/", "")
22 .replace("/events", ""),
23 commitsLast7Days: commits.filter((commit) =>

holidaysUSmain.tsx1 match

@brenton•Updated 1 year ago
3// Public holidays in the US in 2023
4export let holidaysUS = fetchJSON(
5 "https://date.nager.at/api/v2/publicholidays/2023/US"
6);

HN-fetch-call2 file matches

@ImGqb•Updated 1 day ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openai•Updated 2 days ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
Kapil01
apiv1