import type { ClientConfig } from "./Client" import { Client } from "./Client" import type { PrismicDocument } from "./types/value/document" /** Type definitions for the `createClient()` function. May be augmented by third-party libraries. */ export interface CreateClient { ( ...args: ConstructorParameters ): Client } /** * Creates a Prismic client that can be used to query content from a repository. * * @example * ;```ts * // With a repository name * createClient("my-repo") * * // With a full Prismic Content API endpoint * createClient("https://my-repo.cdn.prismic.io/api/v2") * ``` * * @typeParam TDocuments - A union of Prismic page and custom types for the * repository. * @param repositoryNameOrEndpoint - The Prismic repository name or full Content API endpoint for * the repository. * @param options - Configuration that determines how content will be queried from the Prismic * repository. * @returns A client that can query content from the repository. * @see https://prismic.io/docs/technical-reference/prismicio-client/v7 */ export const createClient: CreateClient = ( repositoryNameOrEndpoint: string, options?: ClientConfig, ) => new Client(repositoryNameOrEndpoint, options)