import { IRequester } from './util';
export interface IShortcodeCreateResponse {
    code: string;
    expires_in: number;
    handle: string;
}
export interface IOAuthTokenData {
    accessToken: string;
    refreshToken: string;
    scopes: string[];
    expiresAt: Date;
}
/**
 * OAuthTokens is the handle for OAuth access and refresh tokens granted by
 * the user.
 */
export declare class OAuthTokens {
    readonly data: IOAuthTokenData;
    constructor(data: IOAuthTokenData);
    /**
     * Returns OAuth tokens created from a response from the token endpoint as
     * described in https://tools.ietf.org/html/rfc6749#section-5.1.
     */
    static fromTokenResponse(res: any, scopes: string[]): OAuthTokens;
    /**
     * Returns a header that can be used in making http requests.
     */
    header(): {
        Authorization: string;
    };
    /**
     * Returns whether the oauth tokens are expired.
     */
    expired(): boolean;
    /**
     * Returns whether all of the provided scopes have been granted by this set
     * of OAuth tokens.
     */
    granted(scopes: string[]): boolean;
}
/**
 * OAuthShortCode is the shortcode handle returned by the `OAuthClient`. See
 * documentation on that class for more information and usage examples.
 */
export declare class OAuthShortCode {
    private readonly clientId;
    private readonly scopes;
    private readonly shortcode;
    private readonly fetcher;
    /**
     * Interval on which to poll to see if the shortcode was accepted.
     */
    private static checkInterval;
    /**
     * The OAuth shortcode to display to the user.
     */
    readonly code: string;
    private expired;
    constructor(clientId: string, scopes: string[], shortcode: IShortcodeCreateResponse, fetcher: IRequester);
    waitForAccept(): Promise<OAuthTokens>;
    private getTokens({code});
}
/**
 * IOAuthOptions are passed into the OAuth client for creating
 * and retrieving grants.
 */
export interface IOAuthOptions {
    /**
     * OAuth client ID.
     */
    clientId: string;
    /**
     * OAuth client secret, if any.
     */
    clientSecret?: string;
    /**
     * A list of permissions to request. A full list can be found here:
     * https://dev.mixer.com/reference/oauth/index.html#oauth_scopes
     */
    scopes: string[];
    /**
     * OAuth host address, defaults to https://mixer.com/api/v1
     */
    host?: string;
}
/**
 * OAuthClient is a clien interface for handling shortcode grants and
 * reauthorizing access tokens.
 *
 * ```
 * const client = new OAuthClient(options);
 * const attempt = () => {
 *   return client.getCode()
 *     .then(code => {
 *       console.log(`Go to mixer.com/go and enter ${code.code}`);
 *       return code.waitForAccept();
 *     })
 *     .catch(err => {
 *       if (err instanceof ShortCodeExpireError) {
 *         return attempt(); // loop!
 *       }
 *
 *       throw err;
 *     });
 * };
 *
 * attempt().then(tokens => console.log(`Access token: ${tokens.access}`));
 * ```
 */
export declare class OAuthClient {
    private readonly options;
    private readonly fetcher;
    constructor(options: IOAuthOptions, fetcher?: IRequester);
    /**
     * Starts a flow to get an oauth code.
     */
    getCode(): Promise<OAuthShortCode>;
    /**
     * Refreshes the token set and returns a new set of tokens.
     */
    refresh(tokens: OAuthTokens): Promise<OAuthTokens>;
}
