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/$%7Bsuccess?q=api&page=1569&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 18497 results for "api"(3396ms)

pipesmain.tsx1 match

@pomdtrUpdated 1 year ago
14export async function pipes(sql: string): Promise<Result> {
15 const origin = "https://pipes.turbot.com";
16 const pathname = `/api/latest/user/${user}/workspace/${workspace}/query`;
17
18 const resp = await fetch(`${origin}${pathname}?sql=${encodeURIComponent(sql)}`, {

openapi_emailREADME.md1 match

@pomdtrUpdated 1 year ago
1# Email for OpenAPI account

openapi_schemamain.tsx12 matches

@pomdtrUpdated 1 year ago
1/**
2 * This file was auto-generated by openapi-typescript.
3 * Do not make direct changes to the file.
4 */
428 * Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.
429 *
430 * Vals generated via this API will *not* appear in the authenticated user's workspace.
431 */
432 get: {
464 * Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.
465 *
466 * Vals generated via this API will *not* appear in the authenticated user's workspace.
467 */
468 post: {
524 "/v1/run/{username}.{val_name}": {
525 /**
526 * Run a val as an API
527 * @deprecated
528 * @description This endpoint runs the specified user's val and returns the output.
556 };
557 /**
558 * Run a val as an API
559 * @deprecated
560 */
593 "/": {
594 /**
595 * Run a val as an API (as an Express handler)
596 * @description Runs `@{username}.{val_name}` as an Express handler.
597 *
598 * `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
599 *
600 * Unlike the other two APIs, the Express API is specified via subdomain and runs at `https://{username}-{val_name}.express.val.run`.
601 *
602 * ### Unauthenticated
603 * Unauthenticated use will only be able to call public vals as Express handlers.
604 *
605 * The val will be executed with `{username}`'s permissions ("API Mode"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.
606 *
607 * ### Authenticated
631 };
632 /**
633 * Run a val as an API (as an Express handler)
634 * @description Runs `@{username}.{val_name}` as an Express handler.
635 *
636 * `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
637 *
638 * ### Unauthenticated
639 * Unauthenticated use will only be able to call public vals as Express handlers.
640 *
641 * The val will be executed with `{username}`'s permissions ("API Mode"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.
642 *
643 * ### Authenticated

generate_openapi_schemamain.tsx3 matches

@pomdtrUpdated 1 year ago
1import createClient from "https://esm.town/v/pomdtr/val_town_client";
2import openapiTS from "npm:openapi-typescript";
3
4const client = createClient({
6});
7
8const code = await openapiTS(new URL("https://pomdtr-val_town_openapi.web.val.run"));
9const { data, error, response } = await client.PUT("/v1/vals", {
10 body: {
11 name: "openapi_schema",
12 code: code,
13 },

bookmarkmain.tsx1 match

@michaelmangUpdated 1 year ago
78});
79
80app.get("/api/bookmarks", async (c) => {
81 var baseUrl = c.req.url;
82 var page = parseInt(c.req.query("page") || "0");

syncmain.tsx4 matches

@pomdtrUpdated 1 year ago
24
25 const env = JSON.parse(res);
26 delete env["VALTOWN_API_URL"];
27 return env;
28}
34 },
35): Promise<{ data: T; error?: Error }> {
36 const apiURL = Deno.env.get("API_URL") || "https://api.val.town";
37 const headers = {
38 ...options?.headers,
41 if (options?.paginate) {
42 const data = [];
43 let url = new URL(`${apiURL}${path}`);
44 url.searchParams.set("limit", "100");
45
68 }
69
70 const resp = await fetch(`${apiURL}${path}`, {
71 ...options,
72 headers,

chatmain.tsx4 matches

@kirinekoUpdated 1 year ago
5 options = {},
6) => {
7 // Initialize OpenAI API stub
8 const { Configuration, OpenAIApi } = await import(
9 "https://esm.sh/openai@3.3.0"
10 );
11 console.log(process.env);
12 // const configuration = new Configuration({
13 // apiKey: process.env.OPENAI,
14 // });
15 // const openai = new OpenAIApi(configuration);
16 // // Request chat completion
17 // const messages = typeof prompt === "string"

tree_examplemain.tsx3 matches

@pomdtrUpdated 1 year ago
4 */
5
6import { api } from "https://esm.town/v/pomdtr/api";
7import type { Tree } from "https://esm.town/v/pomdtr/tree_types";
8import { Hono } from "npm:hono";
49});
50
51// this endpoint is used to dynamically fetch a list of tags from the api
52app.get("/tags/:tag", async (c) => {
53 let { tag } = c.req.param();
55 tag = "#" + tag;
56 }
57 const { data: vals } = await api(
58 `/v1/search/vals?query=${encodeURIComponent(tag)}`
59 );

articlemain.tsx2 matches

@pomdtrUpdated 1 year ago
1import { api } from "https://esm.town/v/pomdtr/api";
2import { gfm } from "https://esm.town/v/pomdtr/gfm";
3import { html } from "https://esm.town/v/stevekrouse/html?v=5";
26 title = `@${val.author}/${val.name}`;
27 }
28 const { code, readme } = await api(`/v1/alias/${val.author}/${val.name}`);
29
30 return html(await gfm(readme, { title, favicon: "📝" }));

auth_middlewaremain.tsx2 matches

@pomdtrUpdated 1 year ago
12 <article>
13 <form method="post">
14 <label for="token"><a href="https://www.val.town/settings/api">API Token</a></label>
15 <input id="token" name="token" type="password" />
16 <button type="submit">Submit</button>
36
37async function fetchUser(token: string): Promise<User> {
38 const resp = await fetch("https://api.val.town/v1/me", {
39 headers: {
40 Authorization: `Bearer ${token}`,

Galacta3 file matches

@defunktUpdated 4 hours ago
Marvel Rivals GPT via tracker.gg API

github-api2 file matches

@cricks_unmixed4uUpdated 10 hours ago
Kapil01
apiv1