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=861&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 11003 results for "api"(1787ms)

honoTanaEndpointmain.tsx3 matches

@nbbaierUpdated 1 year ago
1import { saveToTana } from "https://esm.town/v/nbbaier/saveToTana";
2import { APIPlainNode } from "https://esm.town/v/nbbaier/tanaTypes";
3import { Hono } from "npm:hono";
4
5const token = Deno.env.get("tanaInputAPI");
6
7export const honoTanaEndpoint = async (req: Request) => {
10 let { text, url } = c.req.query();
11
12 const payload: APIPlainNode = {
13 name: text,
14 children: [

createValmain.tsx1 match

@andreterronUpdated 1 year ago
7 privacy?: "public" | "unlisted" | "private";
8}) => {
9 return fetchJSON("https://api.val.town/v1/vals", {
10 method: "post",
11 bearer: token,

longest_valmain.tsx5 matches

@andreterronUpdated 1 year ago
1import { paginateAPI } from "https://esm.town/v/andreterron/paginateAPI";
2import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
4
11};
12const me = await fetchJSON(
13 `${API_URL}/v1/me`,
14 opts,
15);
16// TODO: Paginate
17const vals = await paginateAPI(
18 `${API_URL}/v1/users/${me.id}/vals?limit=100`,
19 opts,
20);

API_URLmain.tsx2 matches

@stdUpdated 1 year ago
2 // try/catch prevents crashes if the script doesn't have env access
3 try {
4 return Deno.env.get("VALTOWN_API_URL");
5 } catch {}
6}
7
8export const API_URL = envOrUndefined("VALTOWN_API_URL") ?? "https://api.val.town";

chat_openaimain.tsx2 matches

@cosmoUpdated 1 year ago
1const { default: OpenAI } = await import("npm:openai");
2
3export async function chat(apiKey, messages) {
4 const openai = new OpenAI({ apiKey });
5
6 return openai.chat.completions.create({

draftReadmemain.tsx2 matches

@nbbaierUpdated 1 year ago
25async function getVal(username: string, valName: string) {
26 try {
27 const res = await fetch(`https://api.val.town/v1/alias/${username}/${valName}`, {
28 method: "GET",
29 headers: {
67async function updateReadme(id: string, readme: string) {
68 try {
69 const res = await fetch(`https://api.val.town/v1/vals/${id}`, {
70 method: "PUT",
71 headers: {

readmeGPTmain.tsx3 matches

@nbbaierUpdated 1 year ago
6 model: string;
7 openai: OpenAI;
8 apiKey: string;
9 valtownKey: string;
10
32 private async getVal(username: string, valName: string) {
33 try {
34 const res = await fetch(`https://api.val.town/v1/alias/${username}/${valName}`, {
35 method: "GET",
36 headers: {
72 private async updateReadme(id: string, readme: string) {
73 try {
74 const res = await fetch(`https://api.val.town/v1/vals/${id}`, {
75 method: "PUT",
76 headers: {

sqliteWritermain.tsx2 matches

@nbbaierUpdated 1 year ago
10 table: string;
11 model: string;
12 apiKey: string;
13 openai: OpenAI;
14
17 this.table = table;
18 this.model = model;
19 // this.apiKey = openaiOptions.apiKey ? openaiOptions.apiKey : Deno.env.get("OPENAI_API_KEY");
20 this.openai = new OpenAI(openaiOptions);
21 }

readmeGPTREADME.md2 matches

@nbbaierUpdated 1 year ago
30```
31
32## API Reference
33
34### Class: ReadmeWriter
43
44- `model` (optional): The model to be used for generating the readme. Defaults to "gpt-3.5-turbo".
45- `apiKey` (optional): An OpenAI API key. Defaults to `Deno.env.get("OPENAI_API_KEY")`.
46
47#### Methods

sqliteWriterREADME.md2 matches

@nbbaierUpdated 1 year ago
365. Handle the generated query or query result according to your application's needs.
37
38## API
39
40### `new QueryWriter(args: { table: string; model?: string }): QueryWriter`
44- `table`: The name of the database table to operate on.
45- `model` (optional): The model to use for generating SQL queries. Defaults to "gpt-3.5-turbo".
46- `apiKey` (optional): An OpenAI API key. Defaults to `Deno.env.get("OPENAI_API_KEY")`.
47
48

daily-advice-app1 file match

@dcm31Updated 2 days ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaineUpdated 3 days 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