import { Api as GiteaNodeApi } from "gitea-js"; import * as node_fetch from "node-fetch"; import { GiteaPRDSL, GiteaIssueComment, GiteaUser } from "../../dsl/GiteaDSL"; import { api as fetch } from "../../api/fetch"; import { RepoMetaData } from "../../dsl/RepoMetaData"; export declare type APIToken = string; /** This represent the Gitea API */ export declare class GiteaAPI { 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) => GiteaNodeApi<"access-token">; /** * Grabs the contents of an individual file on gitea * * @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: string, comment: string) => Promise; deleteCommentWithID: (id: string) => Promise; deleteInlineCommentWithID: (id: string) => Promise; getUserID: () => Promise; postPRComment: (comment: string) => Promise; postInlinePRComment: (comment: string, commitId: string, path: string, position: number) => Promise; postInlinePRReview: (commitId: string, comments: { comment: string; path: string; position: number; }[]) => Promise; updateInlinePRComment: (comment: string, commentId: string) => Promise; getPullRequestInfo: () => Promise; getPullRequestCommits: () => Promise; getAllOfResource: (path: string) => Promise; getUserInfo: () => Promise; getPullRequestComments: () => Promise; getPullRequestInlineComments: (dangerID: string) => Promise<(GiteaIssueComment & { ownedByDanger: boolean; })[]>; getPullRequestDiff: () => Promise; getFileContents: (path: string, repoSlug: string, ref: string) => Promise; getPullRequests: () => Promise; getReviewerRequests: () => Promise; getReviews: () => Promise; getIssue: () => Promise; updateStatus: (passed: boolean | "pending", message: string, url?: string | undefined, dangerID?: string | undefined, ciCommitHash?: string | undefined) => 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; }