UNPKG

@confluentinc/schemaregistry

Version:
50 lines (49 loc) 2.03 kB
import { AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from 'axios'; export interface BasicAuthCredentials { credentialsSource: 'USER_INFO' | 'URL' | 'SASL_INHERIT'; userInfo?: string; sasl?: SaslInfo; } export interface SaslInfo { mechanism?: string; username: string; password: string; } export interface BearerAuthCredentials { credentialsSource: 'STATIC_TOKEN' | 'OAUTHBEARER'; token?: string; issuerEndpointUrl?: string; clientId?: string; clientSecret?: string; scope?: string; logicalCluster?: string; identityPoolId?: string; } export interface ClientConfig { baseURLs: string[]; cacheCapacity?: number; cacheLatestTtlSecs?: number; isForward?: boolean; createAxiosDefaults?: CreateAxiosDefaults; basicAuthCredentials?: BasicAuthCredentials; bearerAuthCredentials?: BearerAuthCredentials; maxRetries?: number; retriesWaitMs?: number; retriesMaxWaitMs?: number; } export declare class RestService { private client; private baseURLs; private oauthClient?; private oauthBearer; constructor(baseURLs: string[], isForward?: boolean, axiosDefaults?: CreateAxiosDefaults, basicAuthCredentials?: BasicAuthCredentials, bearerAuthCredentials?: BearerAuthCredentials, maxRetries?: number, retriesWaitMs?: number, retriesMaxWaitMs?: number); handleBasicAuth(basicAuthCredentials?: BasicAuthCredentials): void; handleBearerAuth(maxRetries: number, retriesWaitMs: number, retriesMaxWaitMs: number, bearerAuthCredentials?: BearerAuthCredentials): void; handleRequest<T>(url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?: any, // eslint-disable-line @typescript-eslint/no-explicit-any config?: AxiosRequestConfig): Promise<AxiosResponse<T>>; setHeaders(headers: Record<string, string>): void; setAuth(basicAuth?: string, bearerToken?: string): void; setOAuthBearerToken(): Promise<void>; setTimeout(timeout: number): void; setBaseURL(baseUrl: string): void; }