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

143 lines (142 loc) 6.36 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 ExtractionSchemas { 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 ExtractionSchemas { protected readonly _options: ExtractionSchemas.Options; constructor(_options?: ExtractionSchemas.Options); /** * Returns all extraction schemas in a project. * * @param {Phonic.ExtractionSchemasListRequest} request * @param {ExtractionSchemas.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.NotFoundError} * * @example * await client.extractionSchemas.list({ * project: "main" * }) */ list(request?: Phonic.ExtractionSchemasListRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasListResponse>; private __list; /** * Creates a new extraction schema in a project. * * @param {Phonic.CreateExtractionSchemaRequest} request * @param {ExtractionSchemas.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.BadRequestError} * @throws {@link Phonic.NotFoundError} * @throws {@link Phonic.ConflictError} * * @example * await client.extractionSchemas.create({ * project: "main", * name: "Appointment details", * prompt: "Dates should be in `9 Apr 2025` format. Prices should be in $150.00 format.", * fields: [{ * name: "Date", * type: "string", * description: "The date of the appointment" * }, { * name: "Copay", * type: "string", * description: "Amount of money the patient pays for the appointment" * }, { * name: "Confirmed as booked", * type: "bool", * description: "Is the appointment confirmed as booked?" * }] * }) */ create(request: Phonic.CreateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasCreateResponse>; private __create; /** * Returns an extraction schema by name or ID. * * @param {string} nameOrId - The name or the ID of the extraction schema to get. * @param {Phonic.ExtractionSchemasGetRequest} request * @param {ExtractionSchemas.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.NotFoundError} * * @example * await client.extractionSchemas.get("nameOrId", { * project: "main" * }) */ get(nameOrId: string, request?: Phonic.ExtractionSchemasGetRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasGetResponse>; private __get; /** * Deletes an extraction schema by name or ID. * * @param {string} nameOrId - The name or the ID of the extraction schema to delete. * @param {Phonic.ExtractionSchemasDeleteRequest} request * @param {ExtractionSchemas.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.NotFoundError} * * @example * await client.extractionSchemas.delete("nameOrId", { * project: "main" * }) */ delete(nameOrId: string, request?: Phonic.ExtractionSchemasDeleteRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasDeleteResponse>; private __delete; /** * Updates an extraction schema by name or ID. * * @param {string} nameOrId - The name or the ID of the extraction schema to update. * @param {Phonic.UpdateExtractionSchemaRequest} request * @param {ExtractionSchemas.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Phonic.BadRequestError} * @throws {@link Phonic.NotFoundError} * @throws {@link Phonic.ConflictError} * * @example * await client.extractionSchemas.update("nameOrId", { * project: "main", * name: "Updated appointment details", * prompt: "Updated extraction instructions. Dates should be in `9 Apr 2025` format.", * fields: [{ * name: "Date", * type: "string", * description: "The date of the appointment" * }, { * name: "Time", * type: "string", * description: "The time of the appointment" * }] * }) */ update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>; private __update; protected _getAuthorizationHeader(): Promise<string | undefined>; }