1 | import type { EndpointOptions } from "./EndpointOptions.js";
|
2 | import type { OctokitResponse } from "./OctokitResponse.js";
|
3 | import type { RequestInterface } from "./RequestInterface.js";
|
4 | import type { RequestParameters } from "./RequestParameters.js";
|
5 | import type { Route } from "./Route.js";
|
6 | /**
|
7 | * Interface to implement complex authentication strategies for Octokit.
|
8 | * An object Implementing the AuthInterface can directly be passed as the
|
9 | * `auth` option in the Octokit constructor.
|
10 | *
|
11 | * For the official implementations of the most common authentication
|
12 | * strategies, see https://github.com/octokit/auth.js
|
13 | */
|
14 | export interface AuthInterface<AuthOptions extends any[], Authentication extends any> {
|
15 | (...args: AuthOptions): Promise<Authentication>;
|
16 | hook: {
|
17 | /**
|
18 | * Sends a request using the passed `request` instance
|
19 | *
|
20 | * @param {object} endpoint Must set `method` and `url`. Plus URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
21 | */
|
22 | <T = any>(request: RequestInterface, options: EndpointOptions): Promise<OctokitResponse<T>>;
|
23 | /**
|
24 | * Sends a request using the passed `request` instance
|
25 | *
|
26 | * @param {string} route Request method + URL. Example: `'GET /orgs/{org}'`
|
27 | * @param {object} [parameters] URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`.
|
28 | */
|
29 | <T = any>(request: RequestInterface, route: Route, parameters?: RequestParameters): Promise<OctokitResponse<T>>;
|
30 | };
|
31 | }
|