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

52 lines (51 loc) 2.53 kB
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import * as Phonic from "../../../index.js"; export declare namespace AuthClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } export declare class AuthClient { protected readonly _options: NormalizedClientOptionsWithAuth<AuthClient.Options>; constructor(options?: AuthClient.Options); /** * Creates a short-lived session token that can be used to authenticate WebSocket connections. Session tokens are useful for client-side applications where you don't want to expose your API key. * * @param {Phonic.CreateSessionTokenRequest} request * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.BadRequestError} * @throws {@link Phonic.UnauthorizedError} * @throws {@link Phonic.ForbiddenError} * @throws {@link Phonic.InternalServerError} * * @example * await client.auth.createSessionToken({ * ttl_seconds: 300 * }) */ createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>; private __createSessionToken; /** * Creates a short-lived conversation token scoped to a specific agent. Conversation tokens are useful for client-side applications that start a conversation with a single agent without exposing your API key. * * @param {Phonic.CreateConversationTokenRequest} request * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.BadRequestError} * @throws {@link Phonic.UnauthorizedError} * @throws {@link Phonic.ForbiddenError} * @throws {@link Phonic.NotFoundError} * @throws {@link Phonic.InternalServerError} * * @example * await client.auth.createConversationToken({ * agent_id: "agent_12cf6e88-c254-4d3e-a149-a7f1bdd22783", * ttl_seconds: 30 * }) */ createConversationToken(request: Phonic.CreateConversationTokenRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateConversationTokenResponse>; private __createConversationToken; }