UNPKG

2.27 kBTypeScriptView Raw
1import { AxiosPromise } from "axios";
2import { GitHubRepoRef } from "../operations/common/GitHubRepoRef";
3import { RepoRef } from "../operations/common/RepoId";
4import { SourceLocation } from "../operations/common/SourceLocation";
5/**
6 * Return a deep link to the file location
7 * @param {GitHubRepoRef} grr
8 * @param {SourceLocation} sourceLocation
9 * @return {string}
10 */
11export declare function deepLink(grr: GitHubRepoRef, sourceLocation: SourceLocation): string;
12/**
13 * Check whether the given file, including path, exists
14 * in the GitHub repo
15 * @param token GitHub token. Don't try to auth if it's undefined or null
16 * @param user
17 * @param repo
18 * @param path
19 * @return {Promise<boolean|T>}
20 */
21export declare function hasFile(token: string, user: string, repo: string, path: string): Promise<boolean>;
22/**
23 * Return file content, or undefined if it's not found
24 * @param {string} token
25 * @param {string} user
26 * @param {string} repo
27 * @param {string} path
28 * @return {Promise<string>}
29 */
30export declare function fileContent(token: string, user: string, repo: string, path: string): Promise<string | undefined>;
31export interface Issue {
32 title: string;
33 body: string;
34 state?: "open" | "closed";
35 assignee?: string;
36 milestone?: number;
37 labels?: string[];
38 assignees?: string[];
39}
40export declare function raiseIssue(token: string, rr: RepoRef, issue: Issue): AxiosPromise;
41export interface GitHubRepoWebhookConfig {
42 url: string;
43 content_type: "json" | "form";
44 secret?: string;
45 insecure_ssl?: string;
46}
47export interface GitHubRepoWebhookPayload {
48 name: "web";
49 events: string[];
50 active: boolean;
51 config: GitHubRepoWebhookConfig;
52}
53export declare function addRepoWebhook(token: string, rr: GitHubRepoRef, webhookData: GitHubRepoWebhookPayload): AxiosPromise;
54/**
55 * GitHub commit comment structure
56 */
57export interface Comment {
58 body: string;
59 path: string;
60 /**
61 * Line number in the diff
62 */
63 position: number;
64}
65export declare function createCommitComment(token: string, rr: GitHubRepoRef, comment: Comment): AxiosPromise;
66export declare function createRepo(token: string, rr: GitHubRepoRef, description: string, priv: boolean): AxiosPromise;
67//# sourceMappingURL=gitHub.d.ts.map
\No newline at end of file