HTTP client for interacting with a Teleprompter REST API.

Supports both direct HTTP URLs and Cloudflare Worker service bindings for flexible deployment scenarios. Implements the full TeleprompterSDK interface for managing prompt templates over HTTP.

Using with a base URL:

const client = new Teleprompter.HTTP('https://api.example.com');
const prompts = await client.listPrompts();

Using with a Cloudflare Worker binding:

const client = new Teleprompter.HTTP(env.API_BINDING);
const prompt = await client.getPrompt('welcome-email');

Implements

Constructors

Methods

  • Deletes a prompt by its ID.

    Parameters

    • id: string

      The unique identifier of the prompt to delete

    Returns Promise<void>

    Promise that resolves when the deletion completes

    Error if the prompt is not found or deletion fails

  • Retrieves a specific prompt by its ID.

    Parameters

    • id: string

      The unique identifier of the prompt

    Returns Promise<Prompt>

    Promise resolving to the requested prompt

    Error if the prompt is not found or the request fails

  • Retrieves all versions of a specific prompt.

    Parameters

    • id: string

      The unique identifier of the prompt

    Returns Promise<Prompt[]>

    Promise resolving to an array of all versions of the prompt

    Error if the prompt is not found or the request fails

  • Retrieves all available prompts from the API.

    Returns Promise<Prompt[]>

    Promise resolving to an array of all prompts

    Error if the HTTP request fails

  • Rolls back a prompt to a previous version.

    Parameters

    • id: string

      The unique identifier of the prompt

    • version: number

      The version number to roll back to

    Returns Promise<void>

    Promise that resolves when the rollback completes

    Error if the prompt or version is not found, or rollback fails

  • Creates a new prompt or updates an existing one.

    Parameters

    Returns Promise<void>

    Promise that resolves when the operation completes

    Error if the write operation fails