import { AxiosError, AxiosResponse } from 'axios'; import { Logger } from 'winston'; import { IPermitConfig } from '../config'; import { Configuration } from '../openapi'; import { ApiContextLevel, ApiKeyLevel } from './context'; export declare class PermitApiError extends Error { originalError: AxiosError; constructor(message: string, originalError: AxiosError); get request(): any; get response(): AxiosResponse | undefined; } export interface IPagination { /** * the page number to fetch (default: 1) */ page?: number; /** * how many items to fetch per page (default: 100) */ perPage?: number; } export declare abstract class BasePermitApi { protected config: IPermitConfig; protected logger: Logger; protected openapiClientConfig: Configuration; private scopeApi; constructor(config: IPermitConfig, logger: Logger); /** * Sets the API context and permitted access level based on the API key scope. */ private setContextFromApiKey; /** * Ensure that the API Key has the necessary permissions to successfully call the API endpoint. * Note that this check is not foolproof, and the API may still throw 401. * @param requiredAccessLevel The required API Key Access level for the endpoint. * @throws PermitContextError If the currently set API key access level does not match the required access level. */ ensureAccessLevel(requiredAccessLevel: ApiKeyLevel): Promise; /** * Ensure that the API context matches the required endpoint context. * @param requiredContext The required API context level for the endpoint. * @throws PermitContextError If the currently set API context level does not match the required context level. */ ensureContext(requiredContext: ApiContextLevel): Promise; protected handleApiError(err: unknown): never; }