Skip to content

Commit fabd51c

Browse files
committed
Provides more information about azure PR and issue types
(#3977, #3996)
1 parent ced4a9b commit fabd51c

File tree

1 file changed

+139
-11
lines changed
  • src/plus/integrations/providers/azure

1 file changed

+139
-11
lines changed

src/plus/integrations/providers/azure/models.ts

Lines changed: 139 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,29 @@ export interface AzureUser {
3737
descriptor: string;
3838
}
3939

40+
export interface AzureUserWithVote extends AzureUser {
41+
isFlagged: boolean;
42+
isReapprove: boolean;
43+
isRequired: boolean;
44+
}
45+
46+
export interface AzureWorkItemCommentVersionRef {
47+
commentId: number;
48+
createdInRevision: number;
49+
isDeleted: boolean;
50+
text: string;
51+
url: string;
52+
version: number;
53+
}
54+
55+
export interface AzureWorkItemRelation {
56+
attributes: {
57+
[key: string]: string;
58+
};
59+
relation: string;
60+
url: string;
61+
}
62+
4063
export interface WorkItem {
4164
_links: {
4265
fields: AzureLink;
@@ -68,6 +91,8 @@ export interface WorkItem {
6891
id: number;
6992
rev: number;
7093
url: string;
94+
commentVersionRef?: AzureWorkItemCommentVersionRef;
95+
relations?: AzureWorkItemRelation[];
7196
}
7297

7398
export interface AzureWorkItemState {
@@ -103,29 +128,118 @@ export function getPullRequestUrl(
103128
return `${baseUrl}/${owner}/${projectName}/_git/${repoName}/pullrequest/${pullRequestId}`;
104129
}
105130

131+
export type AzureProjectState = 'createPending' | 'deleted' | 'deleting' | 'new' | 'unchanged' | 'wellFormed';
132+
export type AzureProjectVisibility = 'private' | 'public';
133+
134+
export interface AzureProject {
135+
id: string;
136+
name: string;
137+
url: string;
138+
state: AzureProjectState;
139+
revision: number;
140+
visibility: AzureProjectVisibility;
141+
lastUpdateTime: string;
142+
}
143+
144+
export interface AzureRepository {
145+
id: string;
146+
name: string;
147+
url: string;
148+
project: AzureProject;
149+
size: number;
150+
remoteUrl: string;
151+
sshUrl: string;
152+
webUrl: string;
153+
isDisabled: boolean;
154+
isInMaintenance: boolean;
155+
}
156+
157+
export interface AzureGitCommitRef {
158+
commitId: string;
159+
url: string;
160+
}
161+
162+
export interface AzureResourceRef {
163+
id: string;
164+
url: string;
165+
}
166+
167+
export interface AzurePullRequestCompletionOptions {
168+
autoCompleteIgnoreConflicts: number[];
169+
bypassPolicy: boolean;
170+
bypassReason: string;
171+
deleteSourceBranch: boolean;
172+
mergeCommitMessage: string;
173+
mergeStrategy: 'noFastForward' | 'rebase' | 'rebaseMerge' | 'squash';
174+
squashMerge: boolean;
175+
transitionWorkItems: boolean;
176+
triggeredByAutoComplete: boolean;
177+
}
178+
179+
export interface AzureGitStatus {
180+
context: {
181+
name: string;
182+
genre: string;
183+
};
184+
createdBy: AzureUser;
185+
createDate: string;
186+
description: string;
187+
state: 'error' | 'failed' | 'notApplicable' | 'notSet' | 'pending' | 'succeeded';
188+
targetUrl: string;
189+
updateDate: string;
190+
}
191+
192+
export interface AzureGitForkRef {
193+
creator: AzureUser;
194+
isLocked: boolean;
195+
isLockedBy: AzureUser;
196+
name: string;
197+
objectId: string;
198+
peeledObjectId: string;
199+
repository: AzureRepository;
200+
statuses: AzureGitStatus[];
201+
url: string;
202+
}
203+
204+
export interface AzureWebApiTagDefinition {
205+
active: boolean;
206+
id: string;
207+
name: string;
208+
url: string;
209+
}
210+
211+
export interface AzureGitPullRequestMergeOptions {
212+
conflictAuthorshipCommits: boolean;
213+
detectRenameFalsePositives: boolean;
214+
disableRenames: boolean;
215+
}
216+
217+
export type AzurePullRequestAsyncStatus =
218+
| 'conflicts'
219+
| 'failure'
220+
| 'notSet'
221+
| 'queued'
222+
| 'rejectedByPolicy'
223+
| 'succeeded';
224+
106225
export interface AzurePullRequest {
107-
repository: unknown;
226+
repository: AzureRepository;
108227
pullRequestId: number;
109228
codeReviewId: number;
110229
status: AzurePullRequestStatus;
111230
createdBy: AzureUser;
112231
creationDate: string;
113-
closedDate: string;
232+
closedDate?: string;
233+
closedBy?: AzureUser; // Can be missed even if closedDate is presented.
114234
title: string;
115235
description: string;
116236
sourceRefName: string;
117237
targetRefName: string;
118238
isDraft: boolean;
119239
mergeId: string;
120-
lastMergeSourceCommit: {
121-
commitId: string;
122-
url: string;
123-
};
124-
lastMergeTargetCommit: {
125-
commitId: string;
126-
url: string;
127-
};
128-
reviewers: unknown[];
240+
lastMergeSourceCommit: AzureGitCommitRef;
241+
lastMergeTargetCommit: AzureGitCommitRef;
242+
reviewers: AzureUserWithVote[];
129243
url: string;
130244
_links: {
131245
self: AzureLink;
@@ -141,4 +255,18 @@ export interface AzurePullRequest {
141255
};
142256
supportsIterations: boolean;
143257
artifactId: string;
258+
autoCompleteSetBy?: AzureUser;
259+
commits?: AzureGitCommitRef[];
260+
completionOptions?: AzurePullRequestCompletionOptions;
261+
completionQueueTime?: string;
262+
forkSource?: AzureGitForkRef;
263+
hasMultipleMergeBases?: boolean;
264+
labels?: AzureWebApiTagDefinition[];
265+
lastMergeCommit?: AzureGitCommitRef;
266+
mergeFailureMessage?: string;
267+
mergeFailureType?: 'caseSensitive' | 'none' | 'objectTooLarge' | 'unknown';
268+
mergeOptions?: AzureGitPullRequestMergeOptions;
269+
mergeStatus?: AzurePullRequestAsyncStatus;
270+
remoteUrl?: string;
271+
workItemRefs?: AzureResourceRef[];
144272
}

0 commit comments

Comments
 (0)