import { CredentialProvider } from '@byu-oit-sdk/credential-provider'; import { type RetryMiddlewareConfiguration } from './RetryMiddleware/index.js'; import { type FinalizeHandler, type LoggerLike, type MiddlewareExecutionContext, MiddlewareStack } from '@byu-oit-sdk/middleware-stack'; import type { Command } from './Command.js'; import type { ClientMiddlewareExecutionContext } from './ClientMiddlewareExecutionContext.js'; import { RequestCommand, type RequestOutput } from './RequestCommand.js'; export interface ClientOptions { /** * A logger library compatible with Pino for logging in middleware layers. */ logger?: LoggerLike; /** * The initial middleware execution context */ context?: ClientMiddlewareExecutionContext & UserContext; /** * A credential provider to use for resolving access tokens. The default credential * provider is the ChainedCredentialsProvider. All credential provider inputs may * be configured via environmental variables. */ credentials?: typeof CredentialProvider | CredentialProvider | boolean; /** * The environment variable prefix to use to load the credential provider */ prefix?: string; /** * Configures the retry middleware. The default configuration will attempt one retry * when the response contains a 401 HTTP status code. */ retry?: RetryMiddlewareConfiguration; } export declare class Client { /** * A logger library compatible with Pino for logging in middleware layers. */ protected readonly logger: LoggerLike; /** * Shares information and functionality between middlewares. For example, the default * middleware execution context always includes a Pino logger instance. */ protected context: MiddlewareExecutionContext; /** * Expose the middleware stack as readonly so developers can add additional * middleware for a specific client. */ readonly middleware: MiddlewareStack>; /** * Expose the credential provider as readonly so developers can interact with it. */ readonly credentials?: CredentialProvider; /** * Expose the prefix for other extensions to match with. */ readonly prefix: string; /** * A function that ends the middleware callback chain by executing fetch request and * returning the response. * * between middlewares. * @returns A fetch Response object. */ terminalware(this: undefined): FinalizeHandler; /** * A generic client constructor * * @param options - Options to configure the HTTP Client. */ constructor({ credentials, retry, logger, context, prefix }?: ClientOptions); /** * Enchains the middleware stack executes the asynchronous operation * * @param command - A action that represents the parameters needed to * call a specific endpoint or perform some asynchronous sequence of work. * @returns The fully deserialized value. */ send(command: Command): Promise; /** * A convenience accessor for obtaining the issuer URL from an oauth credential provider. * The accessor will throw without properly instantiating an oauth credential provider. */ issuer(): Promise; /** * fetch is a wrapper around the send method, instantiating a FetchCommand and then invoking the send method. */ fetch(url: string | URL | Request, options?: RequestInit): Promise; request(...args: ConstructorParameters): Promise; }