-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathapi.ts
More file actions
123 lines (105 loc) · 3.04 KB
/
Copy pathapi.ts
File metadata and controls
123 lines (105 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export interface GitHub {
repoOwner: string;
repoName: string;
query(query: Query): AsyncIterableIterator<GitHubIssue[]>;
hasWriteAccess(user: User): Promise<boolean>;
repoHasLabel(label: string): Promise<boolean>;
createLabel(label: string, color: string, description: string): Promise<void>;
deleteLabel(label: string): Promise<void>;
readConfig(path: string): Promise<any>;
dispatch(title: string): Promise<void>;
createIssue(owner: string, repo: string, title: string, body: string): Promise<void>;
releaseContainsCommit(release: string, commit: string): Promise<'yes' | 'no' | 'unknown'>;
/**
* Returns what we think the current milestone for the repo is based on the due on date.
* @returns The milestone id if one is found, else undefined
*/
getCurrentRepoMilestone(): Promise<number | undefined>;
}
export interface GitHubIssue extends GitHub {
getIssue(): Promise<Issue>;
postComment(body: string): Promise<void>;
deleteComment(id: number): Promise<void>;
getComments(last?: boolean): AsyncIterableIterator<Comment[]>;
closeIssue(reason: 'completed' | 'not_planned'): Promise<void>;
lockIssue(): Promise<void>;
unlockIssue(): Promise<void>;
reopenIssue(): Promise<void>;
setMilestone(milestoneId: number): Promise<void>;
addLabel(label: string): Promise<void>;
removeLabel(label: string): Promise<void>;
addAssignee(assignee: string): Promise<void>;
removeAssignee(assignee: string): Promise<void>;
getClosingInfo(): Promise<{ hash: string | undefined; timestamp: number } | undefined>;
}
type SortVar =
| 'comments'
| 'reactions'
| 'reactions-+1'
| 'reactions--1'
| 'reactions-smile'
| 'reactions-thinking_face'
| 'reactions-heart'
| 'reactions-tada'
| 'interactions'
| 'created'
| 'updated';
type SortOrder = 'asc' | 'desc';
export type Reactions = {
'+1': number;
'-1': number;
laugh: number;
hooray: number;
confused: number;
heart: number;
rocket: number;
eyes: number;
};
export interface User {
name: string;
isGitHubApp?: boolean;
}
export interface Comment {
author: User;
body: string;
id: number;
timestamp: number;
}
export interface Issue {
author: User;
body: string;
title: string;
labels: string[];
open: boolean;
locked: boolean;
number: number;
isPr: boolean;
numComments: number;
reactions: Reactions;
milestone: Milestone | null;
assignee?: string;
assignees: string[];
createdAt: number;
updatedAt: number;
closedAt?: number;
}
export interface Milestone {
milestoneId: number;
title: string;
description: string;
numClosedIssues: number;
numOpenIssues: number;
dueOn: Date | null;
createdAt: Date | null;
closedAt: Date | null;
state: 'open' | 'closed';
}
export interface Query {
q: string;
sort?: SortVar;
order?: SortOrder;
}