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

53 lines (52 loc) 2.45 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 Auth { 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 Auth { protected readonly _options: Auth.Options; constructor(_options?: Auth.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 {Auth.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?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>; private __createSessionToken; protected _getAuthorizationHeader(): Promise<string | undefined>; }