import type * as RMOAS from './rmoas.types';
import type { MatchResult } from 'path-to-regexp';
import Operation, { Callback, Webhook } from './operation';
import utils from './utils';
interface PathMatch {
    match?: MatchResult;
    operation: RMOAS.PathsObject;
    url: {
        method?: RMOAS.HttpMethods;
        nonNormalizedPath: string;
        origin: string;
        path: string;
        slugs: Record<string, string>;
    };
}
type PathMatches = PathMatch[];
type Variables = Record<string, string | number | {
    default?: string | number;
}[] | {
    default?: string | number;
}>;
export default class Oas {
    /**
     * An OpenAPI API Definition.
     */
    api: RMOAS.OASDocument;
    /**
     * The current user that we should use when pulling auth tokens from security schemes.
     */
    user: RMOAS.User;
    /**
     * Internal storage array that the library utilizes to keep track of the times the
     * {@see Oas.dereference} has been called so that if you initiate multiple promises they'll all
     * end up returning the same data set once the initial dereference call completed.
     */
    protected promises: {
        reject: any;
        resolve: any;
    }[];
    /**
     * Internal storage array that the library utilizes to keep track of its `dereferencing` state so
     * it doesn't initiate multiple dereferencing processes.
     */
    protected dereferencing: {
        circularRefs: string[];
        complete: boolean;
        processing: boolean;
    };
    /**
     * @param oas An OpenAPI definition.
     * @param user The information about a user that we should use when pulling auth tokens from
     *    security schemes.
     */
    constructor(oas: RMOAS.OASDocument | string, user?: RMOAS.User);
    /**
     * This will initialize a new instance of the `Oas` class. This method is useful if you're using
     * Typescript and are attempting to supply an untyped JSON object into `Oas` as it will force-type
     * that object to an `OASDocument` for you.
     *
     * @param oas An OpenAPI definition.
     * @param user The information about a user that we should use when pulling auth tokens from
     *    security schemes.
     */
    static init(oas: Record<string, unknown> | RMOAS.OASDocument, user?: RMOAS.User): Oas;
    /**
     * Retrieve the OpenAPI version that this API definition is targeted for.
     */
    getVersion(): string;
    /**
     * Retrieve the current OpenAPI API Definition.
     *
     */
    getDefinition(): RMOAS.OASDocument;
    url(selected?: number, variables?: Variables): string;
    variables(selected?: number): {
        [variable: string]: import("openapi-types").OpenAPIV3.ServerVariableObject;
    };
    defaultVariables(selected?: number): Record<string, unknown>;
    splitUrl(selected?: number): ({
        type: string;
        value: string;
        key: string;
        description?: undefined;
        enum?: undefined;
    } | {
        type: string;
        value: string;
        key: string;
        description: string;
        enum: string[];
    })[];
    /**
     * With a fully composed server URL, run through our list of known OAS servers and return back
     * which server URL was selected along with any contained server variables split out.
     *
     * For example, if you have an OAS server URL of `https://{name}.example.com:{port}/{basePath}`,
     * and pass in `https://buster.example.com:3000/pet` to this function, you'll get back the
     * following:
     *
     *    { selected: 0, variables: { name: 'buster', port: 3000, basePath: 'pet' } }
     *
     * Re-supplying this data to `oas.url()` should return the same URL you passed into this method.
     *
     * @param baseUrl A given URL to extract server variables out of.
     */
    splitVariables(baseUrl: string): false | {
        selected: number;
        variables: Record<string, string | number>;
    };
    /**
     * Replace templated variables with supplied data in a given URL.
     *
     * There are a couple ways that this will utilize variable data:
     *
     *  - If data is stored in `this.user` and it matches up with the variable name in the URL user
     *    data will always take priority. See `getUserVariable` for some more information on how this
     *    data is pulled from `this.user`.
     *  - Supplying a `variables` object. This incoming `variables` object can be two formats:
     *    `{ variableName: { default: 'value' } }` and `{ variableName: 'value' }`. If the former is
     *    present, that will take prescendence over the latter.
     *
     * If no variables supplied match up with the template name, the template name will instead be
     * used as the variable data.
     *
     * @param url A URL to swap variables into.
     * @param variables An object containing variables to swap into the URL.
     */
    replaceUrl(url: string, variables?: Variables): string;
    /**
     * Retrieve an Operation of Webhook class instance for a given path and method.
     *
     * @param path Path to lookup and retrieve.
     * @param method HTTP Method to retrieve on the path.
     */
    operation(path: string, method: RMOAS.HttpMethods, opts?: {
        /**
         * If you prefer to first look for a webhook with this path and method.
         */
        isWebhook?: boolean;
    }): Operation;
    findOperationMatches(url: string): PathMatches;
    /**
     * Discover an operation in an OAS from a fully-formed URL and HTTP method. Will return an object
     * containing a `url` object and another one for `operation`. This differs from `getOperation()`
     * in that it does not return an instance of the `Operation` class.
     *
     * @param url A full URL to look up.
     * @param method The cooresponding HTTP method to look up.
     */
    findOperation(url: string, method: RMOAS.HttpMethods): PathMatch;
    /**
     * Discover an operation in an OAS from a fully-formed URL without an HTTP method. Will return an
     * object containing a `url` object and another one for `operation`.
     *
     * @param url A full URL to look up.
     */
    findOperationWithoutMethod(url: string): PathMatch;
    /**
     * Retrieve an operation in an OAS from a fully-formed URL and HTTP method. Differs from
     * `findOperation` in that while this method will return an `Operation` instance,
     * `findOperation()` does not.
     *
     * @param url A full URL to look up.
     * @param method The cooresponding HTTP method to look up.
     */
    getOperation(url: string, method: RMOAS.HttpMethods): Operation;
    /**
     * With an object of user information, retrieve the appropriate API auth keys from the current
     * OAS definition.
     *
     * @see {@link https://docs.readme.com/docs/passing-data-to-jwt}
     * @param user User
     * @param selectedApp The user app to retrieve an auth key for.
     */
    getAuth(user: RMOAS.User, selectedApp?: string | number): {
        [x: string]: unknown;
    };
    /**
     * Returns the `paths` object that exists in this API definition but with every `method` mapped
     * to an instance of the `Operation` class.
     *
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#oasObject}
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}
     */
    getPaths(): Record<string, Record<RMOAS.HttpMethods, Operation | Webhook>>;
    /**
     * Returns the `webhooks` object that exists in this API definition but with every `method`
     * mapped to an instance of the `Webhook` class.
     *
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#oasObject}
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}
     */
    getWebhooks(): Record<string, Record<RMOAS.HttpMethods, Webhook>>;
    /**
     * Return an array of all tag names that exist on this API definition.
     *
     * Note: This method right now does **not** factor in webhooks that have tags.
     *
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#oasObject}
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}
     * @param setIfMissing If a tag is not present on an operation that operations path will be added
     *    into the list of tags returned.
     */
    getTags(setIfMissing?: boolean): string[];
    /**
     * Determine if a given a custom specification extension exists within the API definition.
     *
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions}
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions}
     * @param extension Specification extension to lookup.
     */
    hasExtension(extension: string): boolean;
    /**
     * Retrieve a custom specification extension off of the API definition.
     *
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions}
     * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions}
     * @param extension Specification extension to lookup.
     */
    getExtension(extension: string): unknown;
    /**
     * Retrieve any circular `$ref` pointers that maybe present within the API definition.
     *
     * This method requires that you first dereference the definition.
     *
     * @see Oas.dereference
     */
    getCircularReferences(): string[];
    /**
     * Dereference the current OAS definition so it can be parsed free of worries of `$ref` schemas
     * and circular structures.
     *
     */
    dereference(opts?: {
        /**
         * A callback method can be supplied to be called when dereferencing is complete. Used for
         * debugging that the multi-promise handling within this method works.
         *
         * @private
         */
        cb?: () => void;
        /**
         * Preserve component schema names within themselves as a `title`.
         */
        preserveRefAsJSONSchemaTitle?: boolean;
    }): Promise<unknown>;
}
export { Operation, Callback, Webhook, utils };
