ShopifyProductSearchmain.tsx2 matches
3export async function ShopifyProductSearch(brokerId, first = 20) {
4// The GraphQL endpoint you're going to query
5const url = "https://shop.app/web/api/graphql";
67// The GraphQL query
217};
218219// Headers can include things like `Content-Type` and any authorization tokens required by the API
220const headers = {
221"Content-Type": "application/json",
23/**
4* API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5*/
6export class OpenAI {
89/**
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*/
20constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21this.rawOpenAIClient = new RawOpenAI({
22...options,
23baseURL: "https://std-openaiproxy.web.val.run/v1",
24apiKey: Deno.env.get("valtown"),
25organization: null,
26});
1# OpenAI - [Docs ↗](https://docs.val.town/std/openai)
23Use 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.
45Streaming 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:
33341. 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
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";
3637app.get("/", async c => {
38const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent("#bookmarklet")}`);
3940const bookmarklets = await Promise.all(
85app.get("/v/:author/:name", async c => {
86const { author, name } = c.req.param();
87const { privacy } = await api(`/v1/alias/${author}/${name}`);
88if (privacy === "private") {
89return c.notFound();
3const USERNAME = "yieldray"; // <--- Replace with your Github username
45const gistList: Array<Gist> = await fetch(`https://api.github.com/users/${USERNAME}/gists`).then((res) => res.json());
67app.get("/", (req) => {
translatormain.tsx4 matches
56const app = new Hono();
7const openai = new OpenAI(Deno.env.get("OPENAI_API_KEY_VOICE"));
89class TranscriptionService {
18return transcription;
19} catch (error) {
20console.error('OpenAI API error:', error);
21throw error;
22}
368return c.text(translation);
369} catch (error) {
370console.error('OpenAI API error:', error);
371return c.text('Error occurred during translation', 500);
372}
395});
396} catch (error) {
397console.error('OpenAI API error:', error);
398return c.text('Error occurred during speech generation', 500);
399}
translatorREADME.md1 match
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.
45Add your OpenAI API Key, and make sure to open in a separate window for Mic to work.
67Migrated from folder: Projects/VoiceTranslator/translator
14export async function pipes(sql: string): Promise<Result> {
15const origin = "https://pipes.turbot.com";
16const pathname = `/api/latest/user/${user}/workspace/${workspace}/query`;
1718const resp = await fetch(`${origin}${pathname}?sql=${encodeURIComponent(sql)}`, {
openapi_emailREADME.md1 match
1# Email for OpenAPI account
openapi_schemamain.tsx12 matches
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*/
432get: {
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*/
468post: {
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