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=819&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 10974 results for "api"(1515ms)

ShopifyProductSearchmain.tsx2 matches

@harper•Updated 11 months ago
3export async function ShopifyProductSearch(brokerId, first = 20) {
4 // The GraphQL endpoint you're going to query
5 const url = "https://shop.app/web/api/graphql";
6
7 // The GraphQL query
217 };
218
219 // Headers can include things like `Content-Type` and any authorization tokens required by the API
220 const headers = {
221 "Content-Type": "application/json",

OpenAImain.tsx7 matches

@pattysi•Updated 11 months ago
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
17 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
18 * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
26 });

OpenAIREADME.md3 matches

@pattysi•Updated 11 months ago
1# OpenAI - [Docs ↗](https://docs.val.town/std/openai)
2
3Use OpenAI's chat completion API with [`std/openai`](https://www.val.town/v/std/openai). This integration enables access to OpenAI's language models without needing to acquire API keys.
4
5Streaming is not yet supported. Upvote the [HTTP response streaming feature request](https://github.com/val-town/val-town-product/discussions/14) if you need it!
32If these limits are too low, let us know! You can also get around the limitation by using your own keys:
33
341. Create your own API key on [OpenAI's website](https://platform.openai.com/api-keys)
352. Create an [environment variable](https://www.val.town/settings/environment-variables?adding=true) named `OPENAI_API_KEY`
363. Use the `OpenAI` client from `npm:openai`:
37

bookmarkletsmain.tsx3 matches

@pomdtr•Updated 11 months ago
1/** @jsxImportSource https://esm.sh/hono@3.9.2/jsx **/
2import { api } from "https://esm.town/v/pomdtr/api";
3import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
4import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
36
37app.get("/", async c => {
38 const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent("#bookmarklet")}`);
39
40 const bookmarklets = await Promise.all(
85app.get("/v/:author/:name", async c => {
86 const { author, name } = c.req.param();
87 const { privacy } = await api(`/v1/alias/${author}/${name}`);
88 if (privacy === "private") {
89 return c.notFound();

gistsmain.tsx1 match

@yieldray•Updated 11 months ago
3const USERNAME = "yieldray"; // <--- Replace with your Github username
4
5const gistList: Array<Gist> = await fetch(`https://api.github.com/users/${USERNAME}/gists`).then((res) => res.json());
6
7app.get("/", (req) => {

translatormain.tsx4 matches

@yawnxyz•Updated 11 months 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 11 months 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 12 months 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 12 months ago
1# Email for OpenAPI account

openapi_schemamain.tsx12 matches

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

daily-advice-app1 file match

@dcm31•Updated 2 days ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaine•Updated 3 days ago
apiv1
papimark21