UNPKG

2.63 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Server } from "http";
3import express from "express";
4import { Logger } from "pino";
5import { WebhookEvent, Webhooks } from "@octokit/webhooks";
6import { ProbotOctokit } from "./octokit/probot-octokit";
7import { ApplicationFunction, DeprecatedLogger, Options, ProbotWebhooks } from "./types";
8export declare type Constructor<T> = new (...args: any[]) => T;
9export declare class Probot {
10 static run(appFn: ApplicationFunction | string[]): Promise<import(".").Server>;
11 static version: string;
12 static defaults<S extends Constructor<any>>(this: S, defaults: Options): {
13 new (...args: any[]): {
14 [x: string]: any;
15 };
16 } & S;
17 server: express.Application;
18 webhooks: ProbotWebhooks;
19 log: DeprecatedLogger;
20 version: String;
21 on: ProbotWebhooks["on"];
22 auth: (installationId?: number, log?: Logger) => Promise<InstanceType<typeof ProbotOctokit>>;
23 throttleOptions: any;
24 private httpServer?;
25 private state;
26 constructor(options?: Options);
27 /**
28 * @deprecated `probot.webhook` is deprecated. Use `probot.webhooks` instead
29 */
30 get webhook(): Webhooks;
31 receive(event: WebhookEvent): Promise<void>;
32 load(appFn: string | ApplicationFunction | ApplicationFunction[]): this;
33 setup(appFns: Array<string | ApplicationFunction>): void;
34 start(): Server;
35 stop(): void;
36 /**
37 * Get an {@link http://expressjs.com|express} router that can be used to
38 * expose HTTP endpoints
39 *
40 * ```
41 * module.exports = ({ app, getRouter }) => {
42 * // Get an express router to expose new HTTP endpoints
43 * const router = getRouter('/my-app');
44 *
45 * // Use any middleware
46 * router.use(require('express').static(__dirname + '/public'));
47 *
48 * // Add a new route
49 * router.get('/hello-world', (req, res) => {
50 * res.end('Hello World');
51 * });
52 * };
53 * ```
54 *
55 * @param path - the prefix for the routes* @param path
56 *
57 * @deprecated "app.route()" is deprecated, use the "getRouter()" argument from the app function instead: "({ app, getRouter }) => { ... }"
58 */
59 route(path?: string): express.Router;
60 /**
61 * @deprecated this.internalRouter can be removed once we remove the Application class
62 */
63 private internalRouter;
64 /**
65 * @deprecated use probot.log instead
66 */
67 get logger(): DeprecatedLogger;
68 /**
69 * @deprecated "app.router" is deprecated, use "getRouter()" from the app function instead: "({ app, getRouter }) => { ... }"
70 */
71 get router(): express.Router;
72}