1 |
|
2 | import { Server } from "http";
|
3 | import express from "express";
|
4 | import { Logger } from "pino";
|
5 | import { WebhookEvent, Webhooks } from "@octokit/webhooks";
|
6 | import { ProbotOctokit } from "./octokit/probot-octokit";
|
7 | import { ApplicationFunction, DeprecatedLogger, Options, ProbotWebhooks } from "./types";
|
8 | export declare type Constructor<T> = new (...args: any[]) => T;
|
9 | export 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:
|
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 |
|
62 |
|
63 | private internalRouter;
|
64 | |
65 |
|
66 |
|
67 | get logger(): DeprecatedLogger;
|
68 | |
69 |
|
70 |
|
71 | get router(): express.Router;
|
72 | }
|