import * as GitHubNodeAPI from "@octokit/rest"; import * as node_fetch from "node-fetch"; import { GitHubPRDSL, GitHubUser } from "../../dsl/GitHubDSL"; import { api as fetch } from "../../api/fetch"; import { Comment } from "../platform"; import { RepoMetaData } from "../../dsl/BitBucketServerDSL"; import { CheckOptions } from "./comms/checks/resultsToCheck"; export declare type APIToken = string; /** This represent the GitHub API */ export declare class GitHubAPI { readonly repoMetadata: RepoMetaData; readonly token?: string | undefined; fetch: typeof fetch; additionalHeaders: any; private readonly d; private pr; constructor(repoMetadata: RepoMetaData, token?: string | undefined); /** * Bit weird, yes, but we want something that can be exposed to an end-user. * I wouldn't have a problem with moving this to use this API under the hood * but for now that's just a refactor someone can try. */ getExternalAPI: (accessTokenForApp?: string | undefined) => GitHubNodeAPI; /** * Grabs the contents of an individual file on GitHub * * @param {string} path path to the file * @param {string} [ref] an optional sha * @returns {Promise} text contents * */ fileContents: (path: string, repoSlug?: string | undefined, ref?: string | undefined) => Promise; getDangerCommentIDs: (dangerID: string) => Promise; updateCommentWithID: (id: number, comment: string) => Promise; deleteCommentWithID: (id: number) => Promise; deleteInlineCommentWithID: (id: string) => Promise; getUserID: () => Promise; postPRComment: (comment: string) => Promise; postInlinePRComment: (comment: string, commitId: string, path: string, position: number) => Promise; updateInlinePRComment: (comment: string, commentId: string) => Promise; getPullRequestInfo: () => Promise; getPullRequestCommits: () => Promise; /** * Get list of commits in pull requests. This'll try to iterate all available pages * Until it reaches hard limit of api itself (250 commits). * https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request * */ getAllOfResource: (path: string) => Promise; getUserInfo: () => Promise; getPullRequestComments: () => Promise; getPullRequestInlineComments: (dangerID: string) => Promise; getPullRequestDiff: () => Promise; getFileContents: (path: string, repoSlug: string, ref: string) => Promise; getPullRequests: () => Promise; getReviewerRequests: () => Promise; getReviews: () => Promise; getIssue: () => Promise; updateStatus: (passed: boolean, message: string, url?: string | undefined) => Promise; postCheck: (check: CheckOptions, token: string) => Promise; private api; get: (path: string, headers?: any) => Promise; post: (path: string, headers?: any, body?: any, suppressErrors?: boolean | undefined) => Promise; patch: (path: string, headers?: any, body?: any, suppressErrors?: boolean | undefined) => Promise; }