phonic
Version:
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPhonic-Co%2Fphonic-node) [ • 6.65 kB
text/typescript
/**
* This file was auto-generated by Fern from our API Definition.
*/
import * as environments from "../../../../environments.mjs";
import * as core from "../../../../core/index.mjs";
import * as Phonic from "../../../index.mjs";
export declare namespace Projects {
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 Projects {
protected readonly _options: Projects.Options;
constructor(_options?: Projects.Options);
/**
* Returns all projects in a workspace.
*
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.projects.list()
*/
list(requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsListResponse>;
private __list;
/**
* Creates a new project in a workspace.
*
* @param {Phonic.CreateProjectRequest} request
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ConflictError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.projects.create({
* name: "customer-support"
* })
*/
create(request: Phonic.CreateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateResponse>;
private __create;
/**
* Returns a project by name or ID.
*
* @param {string} nameOrId - The name or the ID of the project to get.
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.projects.get("nameOrId")
*/
get(nameOrId: string, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsGetResponse>;
private __get;
/**
* Deletes a project by name or ID.
*
* @param {string} nameOrId - The name or the ID of the project to delete.
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.projects.delete("nameOrId")
*/
delete(nameOrId: string, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsDeleteResponse>;
private __delete;
/**
* Updates a project by name or ID.
*
* @param {string} nameOrId - The name or the ID of the project to update.
* @param {Phonic.UpdateProjectRequest} request
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.ConflictError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.projects.update("nameOrId", {
* name: "updated-customer-support",
* default_agent: "another-agent"
* })
*/
update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
private __update;
/**
* Returns all conversation evaluation prompts for a project.
*
* @param {string} id - The ID of the project.
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.projects.listEvalPrompts("id")
*/
listEvalPrompts(id: string, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsListEvalPromptsResponse>;
private __listEvalPrompts;
/**
* Creates a new conversation evaluation prompt for a project.
*
* @param {string} id - The ID of the project.
* @param {Phonic.CreateConversationEvalPromptRequest} request
* @param {Projects.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.ConflictError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.projects.createEvalPrompt("id", {
* name: "test_prompt",
* prompt: "The assistant used the word chocolate in the conversation"
* })
*/
createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
private __createEvalPrompt;
protected _getAuthorizationHeader(): Promise<string | undefined>;
}