UNPKG

phonic

Version:

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPhonic-Co%2Fphonic-node) [![npm shield](htt

222 lines (221 loc) 9.19 kB
/** * This file was auto-generated by Fern from our API Definition. */ import * as environments from "../../../../environments.js"; import * as core from "../../../../core/index.js"; import * as Phonic from "../../../index.js"; export declare namespace Agents { interface Options { environment?: core.Supplier<environments.PhonicEnvironment | environments.PhonicEnvironmentUrls>; /** Specify a custom URL to connect the client to. */ baseUrl?: core.Supplier<string>; apiKey?: core.Supplier<core.BearerToken | undefined>; /** Additional headers to include in requests. */ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>; fetcher?: core.FetchFunction; } interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Additional query string parameters to include in the request. */ queryParams?: Record<string, unknown>; /** Additional headers to include in the request. */ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>; } } export declare class Agents { protected readonly _options: Agents.Options; constructor(_options?: Agents.Options); /** * Returns all agents in a project. * * @param {Phonic.AgentsListRequest} request * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.NotFoundError} * @throws {@link Phonic.InternalServerError} * * @example * await client.agents.list() */ list(request?: Phonic.AgentsListRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsListResponse>; private __list; /** * Creates a new agent in a project. * * @param {Phonic.AgentsCreateRequest} request * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.BadRequestError} * @throws {@link Phonic.UnauthorizedError} * @throws {@link Phonic.NotFoundError} * @throws {@link Phonic.InternalServerError} * * @example * await client.agents.create({ * project: "main", * name: "support-agent", * phone_number: "assign-automatically", * timezone: "America/Los_Angeles", * voice_id: "grant", * audio_speed: 1, * background_noise_level: 0, * generate_welcome_message: false, * welcome_message: "Hi {{customer_name}}. How can I help you today?", * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.", * template_variables: { * "customer_name": { * default_value: null * }, * "subject": { * default_value: "Chess" * } * }, * tools: ["keypad_input"], * no_input_poke_sec: 30, * no_input_poke_text: "Are you still there?", * languages: ["en", "es"], * boosted_keywords: ["Load ID", "dispatch"], * configuration_endpoint: { * url: "https://api.example.com/config", * headers: { * "Authorization": "Bearer token123" * }, * timeout_ms: 7000 * } * }) */ create(request: Phonic.AgentsCreateRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsCreateResponse>; private __create; /** * Upserts an agent by name. If an agent with the same name already exists, it will be updated. Otherwise, it will be created. * * @param {Phonic.UpsertAgentRequest} request * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.BadRequestError} * @throws {@link Phonic.NotFoundError} * * @example * await client.agents.upsert({ * project: "main", * name: "support-agent", * phone_number: "assign-automatically", * timezone: "America/Los_Angeles", * voice_id: "grant", * audio_speed: 1, * background_noise_level: 0, * generate_welcome_message: false, * welcome_message: "Hi {{customer_name}}. How can I help you today?", * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.", * template_variables: { * "customer_name": { * default_value: null * }, * "subject": { * default_value: "Chess" * } * }, * tools: ["keypad_input"], * no_input_poke_sec: 30, * no_input_poke_text: "Are you still there?", * languages: ["en", "es"], * boosted_keywords: ["Load ID", "dispatch"], * configuration_endpoint: { * url: "https://api.example.com/config", * headers: { * "Authorization": "Bearer token123" * }, * timeout_ms: 7000 * } * }) */ upsert(request: Phonic.UpsertAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpsertResponse>; private __upsert; /** * Returns an agent by name or ID. * * @param {string} nameOrId - The name or the ID of the agent to get. * @param {Phonic.AgentsGetRequest} request * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.ForbiddenError} * @throws {@link Phonic.NotFoundError} * * @example * await client.agents.get("nameOrId", { * project: "main" * }) */ get(nameOrId: string, request?: Phonic.AgentsGetRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsGetResponse>; private __get; /** * Deletes an agent by name or ID. * * @param {string} nameOrId - The name or the ID of the agent to delete. * @param {Phonic.AgentsDeleteRequest} request * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.ForbiddenError} * @throws {@link Phonic.NotFoundError} * * @example * await client.agents.delete("nameOrId", { * project: "main" * }) */ delete(nameOrId: string, request?: Phonic.AgentsDeleteRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsDeleteResponse>; private __delete; /** * Updates an agent by name or ID. * * @param {string} nameOrId - The name or the ID of the agent to update. * @param {Phonic.UpdateAgentRequest} request * @param {Agents.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.BadRequestError} * @throws {@link Phonic.ForbiddenError} * @throws {@link Phonic.NotFoundError} * * @example * await client.agents.update("nameOrId", { * project: "main", * name: "updated-support-agent", * phone_number: "assign-automatically", * timezone: "America/Los_Angeles", * voice_id: "grant", * audio_speed: 1, * background_noise_level: 0, * generate_welcome_message: false, * welcome_message: "Hi {{customer_name}}. How can I help you today?", * system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.", * template_variables: { * "customer_name": { * default_value: null * }, * "subject": { * default_value: "Chess" * } * }, * tools: ["keypad_input"], * no_input_poke_sec: 30, * no_input_poke_text: "Are you still there?", * languages: ["en", "es"], * boosted_keywords: ["Load ID", "dispatch"], * configuration_endpoint: { * url: "https://api.example.com/config", * headers: { * "Authorization": "Bearer token123" * }, * timeout_ms: 7000 * } * }) */ update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>; private __update; protected _getAuthorizationHeader(): Promise<string | undefined>; }