import Octokit from '@octokit/rest'; import { ICommit } from 'gitlog'; import HttpsProxyAgent from 'https-proxy-agent'; import { ILabelDefinition } from './release'; import { ILogger } from './utils/logger'; declare type Omit = Pick> & Partial>; export declare type IPRInfo = Omit; export interface IGitOptions { /** Github repo owner (user) */ owner: string; /** GitHub project to operate on */ repo: string; /** The URL to the GitHub (public or enterprise) the project is using */ baseUrl?: string; /** The URL to the GitHub graphql API (public or enterprise) the project is using */ graphqlBaseUrl?: string; /** A token to auth to GitHub with */ token?: string; /** An optional proxy agent to route requests through */ agent?: HttpsProxyAgent; } /** * A class to interact with the local git instance and the git remote. * currently it only interfaces with GitHub. */ export default class Git { /** An octokit instance to use to interact with GitHub */ readonly github: Octokit; /** Options the git client was initialized with */ readonly options: IGitOptions; /** The GitHub api to communicate with through octokit */ private readonly baseUrl; /** The GitHub graphql api to communicate with through octokit */ private readonly graphqlBaseUrl; /** A logger that uses log levels */ private readonly logger; /** Initialize the git interface and auth with GitHub */ constructor(options: IGitOptions, logger?: ILogger); /** Get the "Latest Release" from GitHub */ getLatestReleaseInfo(): Promise; /** Get the "Latest Release" or the first commit SHA as a fallback */ getLatestRelease(): Promise; /** Get the date a commit sha was created */ getCommitDate(sha: string): Promise; /** Get the first commit for the repo */ getFirstCommit(): Promise; /** Get the SHA of the latest commit */ getSha(short?: boolean): Promise; /** Get the labels for a PR */ getLabels(prNumber: number): Promise; /** Get all the information about a PR or issue */ getPr(prNumber: number): Promise>; /** Get information about specific commit */ getCommit(sha: string): Promise>; /** Get the labels for a the project */ getProjectLabels(): Promise; /** Get the git log for a range of commits */ getGitLog(start: string, end?: string): Promise; /** Get the GitHub user for an email. Will not work if they do not have their email set to "public". */ getUserByEmail(email: string): Promise<{} | undefined>; /** Get the GitHub user for a username */ getUserByUsername(username: string): Promise; /** Get all the information about a PR or issue */ getPullRequest(pr: number): Promise>; /** Search to GitHub project's issue and pull requests */ searchRepo(options: Octokit.SearchIssuesAndPullRequestsParams): Promise; /** Run a graphql query on the GitHub project */ graphql(query: string): Promise; /** Create a status (or checkmark) on a commit */ createStatus(prInfo: IPRInfo): Promise>; /** Add a label to the project */ createLabel(label: ILabelDefinition): Promise>; /** Update a label on the project */ updateLabel(label: ILabelDefinition): Promise>; /** Add a label to and issue or pull request */ addLabelToPr(pr: number, label: string): Promise>; /** Add a label to and issue or pull request */ removeLabel(pr: number, label: string): Promise>; /** Lock an issue */ lockIssue(issue: number): Promise; /** Get information about the GitHub project */ getProject(): Promise; /** Get all the pull requests for a project */ getPullRequests(options?: Partial): Promise; /** Get all the commits for a PR */ getCommitsForPR(pr: number): Promise; /** Find a comment that is using the context in a PR */ getCommentId(pr: number, context?: string): Promise; /** Delete a comment on an issue or pull request */ deleteComment(pr: number, context?: string): Promise; /** Create a comment on an issue or pull request */ createComment(message: string, pr: number, context?: string): Promise>; /** Edit a comment on an issue or pull request */ editComment(message: string, pr: number, context?: string): Promise>; /** Create a comment on a pull request body */ addToPrBody(message: string, pr: number, context?: string): Promise>; /** Create a release for the GitHub projecct */ publish(releaseNotes: string, tag: string, prerelease?: boolean): Promise>; /** Get the latest tag in the git tree */ getLatestTagInBranch(): Promise; } export {}; //# sourceMappingURL=git.d.ts.map