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/$%7Bart_info.art.src%7D?q=api&page=1465&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 17453 results for "api"(8991ms)

translatormain.tsx4 matches

@yawnxyz•Updated 1 year ago
5
6const app = new Hono();
7const openai = new OpenAI(Deno.env.get("OPENAI_API_KEY_VOICE"));
8
9class TranscriptionService {
18 return transcription;
19 } catch (error) {
20 console.error('OpenAI API error:', error);
21 throw error;
22 }
368 return c.text(translation);
369 } catch (error) {
370 console.error('OpenAI API error:', error);
371 return c.text('Error occurred during translation', 500);
372 }
395 });
396 } catch (error) {
397 console.error('OpenAI API error:', error);
398 return c.text('Error occurred during speech generation', 500);
399 }

translatorREADME.md1 match

@yawnxyz•Updated 1 year ago
3The app is set up so you can easily have a conversation between two people. The app will translate between the two selected languages, in each voice, as the speakers talk.
4
5Add your OpenAI API Key, and make sure to open in a separate window for Mic to work.
6
7Migrated from folder: Projects/VoiceTranslator/translator

pipesmain.tsx1 match

@pomdtr•Updated 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

@pomdtr•Updated 1 year ago
1# Email for OpenAPI account

openapi_schemamain.tsx12 matches

@pomdtr•Updated 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

@pomdtr•Updated 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

@michaelmang•Updated 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

@pomdtr•Updated 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

@kirineko•Updated 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

@pomdtr•Updated 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 );

RandomQuoteAPI

@Freelzy•Updated 14 hours ago

HAPI7 file matches

@dIgitalfulus•Updated 20 hours ago
Kapil01
apiv1