import type ParserBase from './parser-base'; declare type EnginesMap = Record; declare type ParserCreatorsMap = Record ParserBase>; /** * Parser facade for multiple parsing solution. */ declare const ParserFacade: { /** * Add parser engine for given endpoint. * Use case: * Protobuf parsing, where protobufjs library is imported in userspace and provided as configuration to openapi-clientlib. * Allows for keeping openapi-library size low, and configuring only 'what we need' for given platform. * For example, omitting protobuf from phone platform. * * @param engines - The engine map, where key is format name and value is engine object/constructor. * Example: `{ 'applications/x-protobuf': protobuf }` */ addEngines(engines: EnginesMap): void; /** * Add parsing methods. * @param parsersCreatorsMap - The parser map, where key is format name and value is factory for parser. */ addParsers(parsersCreatorsMap: ParserCreatorsMap): void; getDefaultFormat(): string; /** * Check if given format is supported by available parser. * @param format - Data format ie. application/json * @returns Returns true if format is supported. Returns false if format is not supported by available parsing methods. */ isFormatSupported(format?: string | null): boolean; /** * Get parser for given format name, service path and url. * Parsers are mapped per name, service and url, to keep schemas per endpoints. * Such approach is required as schemas are currently not namespaced and reuse similar message names with different structures. * Due to that, we need to keep per endpoint parsers for protobuf parsing type. * * @param format - The format name. ie. "application/json" * @param servicePath - The service path * @param url - The url for given endpoint * @returns Parser */ getParser(format: string | undefined | null, servicePath: string, url: string): ParserBase; /** * Clears the parsers that have been created. It should not be necessary to use this function, * it has been created for testing. */ clearParsers(): void; }; export default ParserFacade;