import type AuthProvider from '../authProvider'; import TransportCore from './core'; import TransportBase from './transport-base'; import type { TransportOptions } from './types'; import type { OAPIRequestResult, HTTPMethodType, StringTemplateArgs, RequestOptions } from '../../types'; /** * This class builds on top of {@link TransportCore} and adds authentication management. You need only * construct one or the other, they automatically wrap each other. All of the options from the {@link TransportCore} * constructor are valid here as well. * For authentication management, this class will wait until just before the authentication expires (see tokenRefreshMarginMs) * and will refresh the token generating an event which is picked up by some of the other Transports. * * @param baseUrl - The base url used for all open api requests. This should be an absolute URL. * @param authProvider - a AuthProvider to get the token from * @param options - (optional) Options for auth and for the core transport. See Transport. */ declare class TransportAuth extends TransportBase { authErrorsDebouncePeriod: number; authorizationErrors: Record>; transport: TransportCore; authProvider: AuthProvider; constructor(baseUrl: string, authProvider: AuthProvider, options?: TransportOptions); private onTransportError; prepareTransportMethod(method: HTTPMethodType): (servicePath: string, urlTemplate: string, templateArgs?: StringTemplateArgs, options?: RequestOptions) => Promise; cleanupAuthErrors(): void; /** * Add a authentication error to the error map * @param url - The url/endpoint at which a auth error occurred * @param authExpiry - The expiry of the token that was rejected * @param timeRequested - The time the request was made */ addAuthError(url: string, authExpiry: number, timeRequested: number): void; /** * Returns if the auth errors for a url are problematic * @param url - The url/endpoint to check * @param authExpiry - The auth expiry of the request to check * @returns Whether it is problematic */ areUrlAuthErrorsProblematic(url: string, authExpiry: number): boolean; dispose(): void; } export default TransportAuth;