/// <reference types="express" />
import * as express from 'express';
import { Context } from './context';
import { LoggerWithTarget } from './wrap-logger';
import { EventEmitter } from 'promise-events';
import { OctokitWithPagination } from './github';
/**
 * The `robot` parameter available to apps
 *
 * @property {logger} log - A logger
 */
export declare class Robot {
    events: EventEmitter;
    app: () => string;
    cache: RobotCache;
    router: express.Router;
    catchErrors?: boolean;
    log: LoggerWithTarget;
    constructor(options: RobotOptions);
    receive(event: WebhookEvent): Promise<any>;
    /**
     * Get an {@link http://expressjs.com|express} router that can be used to
     * expose HTTP endpoints
     *
     * @example
     * module.exports = robot => {
     *   // Get an express router to expose new HTTP endpoints
     *   const app = robot.route('/my-app');
     *
     *   // Use any middleware
     *   app.use(require('express').static(__dirname + '/public'));
     *
     *   // Add a new route
     *   app.get('/hello-world', (req, res) => {
     *     res.end('Hello World');
     *   });
     * };
     *
     * @param {string} path - the prefix for the routes
     * @returns {@link http://expressjs.com/en/4x/api.html#router|express.Router}
     */
    route(path?: string): express.Router;
    /**
     * Listen for [GitHub webhooks](https://developer.github.com/webhooks/),
     * which are fired for almost every significant action that users take on
     * GitHub.
     *
     * @param {string} event - the name of the [GitHub webhook
     * event](https://developer.github.com/webhooks/#events). Most events also
     * include an "action". For example, the * [`issues`](
     * https://developer.github.com/v3/activity/events/types/#issuesevent)
     * event has actions of `assigned`, `unassigned`, `labeled`, `unlabeled`,
     * `opened`, `edited`, `milestoned`, `demilestoned`, `closed`, and `reopened`.
     * Often, your bot will only care about one type of action, so you can append
     * it to the event name with a `.`, like `issues.closed`.
     *
     * @param {Robot~webhookCallback} callback - a function to call when the
     * webhook is received.
     *
     * @example
     *
     * robot.on('push', context => {
     *   // Code was just pushed.
     * });
     *
     * robot.on('issues.opened', context => {
     *   // An issue was just opened.
     * });
     */
    on(event: string | string[], callback: (context: Context) => void): any;
    /**
     * Authenticate and get a GitHub client that can be used to make API calls.
     *
     * You'll probably want to use `context.github` instead.
     *
     * **Note**: `robot.auth` is asynchronous, so it needs to be prefixed with a
     * [`await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)
     * to wait for the magic to happen.
     *
     * @example
     *
     *  module.exports = function(robot) {
     *    robot.on('issues.opened', async context => {
     *      const github = await robot.auth();
     *    });
     *  };
     *
     * @param {number} [id] - ID of the installation, which can be extracted from
     * `context.payload.installation.id`. If called without this parameter, the
     * client wil authenticate [as the app](https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/about-authentication-options-for-github-apps/#authenticating-as-a-github-app)
     * instead of as a specific installation, which means it can only be used for
     * [app APIs](https://developer.github.com/v3/apps/).
     *
     * @returns {Promise<github>} - An authenticated GitHub API client
     * @private
     */
    auth(id?: string, log?: LoggerWithTarget): Promise<OctokitWithPagination>;
}
export declare const createRobot: (options: RobotOptions) => Robot;
export interface WebhookEvent {
    event: string;
    id: string;
    payload: any;
    protocol: 'http' | 'https';
    host: string;
    url: string;
}
export interface RobotCache {
    wrap<T>(key: string, wrapper: (callback: (error: any, result: T) => void) => any, options: RobotCacheConfig): Promise<any>;
}
export interface RobotCacheConfig {
    ttl: number;
}
export interface RobotOptions {
    app: () => string;
    cache: RobotCache;
    router?: express.Router;
    catchErrors: boolean;
}
