Skip to content

Commit 82309e2

Browse files
committed
Provides more information about azure PR and issue types
(#3977, #3996)
1 parent 7427eec commit 82309e2

File tree

1 file changed

+138
-10
lines changed
  • src/plus/integrations/providers/azure

1 file changed

+138
-10
lines changed

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

Lines changed: 138 additions & 10 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 {
@@ -119,29 +144,118 @@ export interface AzureRepository {
119144
isInMaintenance: boolean;
120145
}
121146

147+
export type AzureProjectState = 'createPending' | 'deleted' | 'deleting' | 'new' | 'unchanged' | 'wellFormed';
148+
export type AzureProjectVisibility = 'private' | 'public';
149+
150+
export interface AzureProject {
151+
id: string;
152+
name: string;
153+
url: string;
154+
state: AzureProjectState;
155+
revision: number;
156+
visibility: AzureProjectVisibility;
157+
lastUpdateTime: string;
158+
}
159+
160+
export interface AzureRepository {
161+
id: string;
162+
name: string;
163+
url: string;
164+
project: AzureProject;
165+
size: number;
166+
remoteUrl: string;
167+
sshUrl: string;
168+
webUrl: string;
169+
isDisabled: boolean;
170+
isInMaintenance: boolean;
171+
}
172+
173+
export interface AzureGitCommitRef {
174+
commitId: string;
175+
url: string;
176+
}
177+
178+
export interface AzureResourceRef {
179+
id: string;
180+
url: string;
181+
}
182+
183+
export interface AzurePullRequestCompletionOptions {
184+
autoCompleteIgnoreConflicts: number[];
185+
bypassPolicy: boolean;
186+
bypassReason: string;
187+
deleteSourceBranch: boolean;
188+
mergeCommitMessage: string;
189+
mergeStrategy: 'noFastForward' | 'rebase' | 'rebaseMerge' | 'squash';
190+
squashMerge: boolean;
191+
transitionWorkItems: boolean;
192+
triggeredByAutoComplete: boolean;
193+
}
194+
195+
export interface AzureGitStatus {
196+
context: {
197+
name: string;
198+
genre: string;
199+
};
200+
createdBy: AzureUser;
201+
createDate: string;
202+
description: string;
203+
state: 'error' | 'failed' | 'notApplicable' | 'notSet' | 'pending' | 'succeeded';
204+
targetUrl: string;
205+
updateDate: string;
206+
}
207+
208+
export interface AzureGitForkRef {
209+
creator: AzureUser;
210+
isLocked: boolean;
211+
isLockedBy: AzureUser;
212+
name: string;
213+
objectId: string;
214+
peeledObjectId: string;
215+
repository: AzureRepository;
216+
statuses: AzureGitStatus[];
217+
url: string;
218+
}
219+
220+
export interface AzureWebApiTagDefinition {
221+
active: boolean;
222+
id: string;
223+
name: string;
224+
url: string;
225+
}
226+
227+
export interface AzureGitPullRequestMergeOptions {
228+
conflictAuthorshipCommits: boolean;
229+
detectRenameFalsePositives: boolean;
230+
disableRenames: boolean;
231+
}
232+
233+
export type AzurePullRequestAsyncStatus =
234+
| 'conflicts'
235+
| 'failure'
236+
| 'notSet'
237+
| 'queued'
238+
| 'rejectedByPolicy'
239+
| 'succeeded';
240+
122241
export interface AzurePullRequest {
123242
repository: AzureRepository;
124243
pullRequestId: number;
125244
codeReviewId: number;
126245
status: AzurePullRequestStatus;
127246
createdBy: AzureUser;
128247
creationDate: string;
129-
closedDate: string;
248+
closedDate?: string;
249+
closedBy?: AzureUser; // Can be missed even if closedDate is presented.
130250
title: string;
131251
description: string;
132252
sourceRefName: string;
133253
targetRefName: string;
134254
isDraft: boolean;
135255
mergeId: string;
136-
lastMergeSourceCommit: {
137-
commitId: string;
138-
url: string;
139-
};
140-
lastMergeTargetCommit: {
141-
commitId: string;
142-
url: string;
143-
};
144-
reviewers: unknown[];
256+
lastMergeSourceCommit: AzureGitCommitRef;
257+
lastMergeTargetCommit: AzureGitCommitRef;
258+
reviewers: AzureUserWithVote[];
145259
url: string;
146260
_links: {
147261
self: AzureLink;
@@ -157,6 +271,20 @@ export interface AzurePullRequest {
157271
};
158272
supportsIterations: boolean;
159273
artifactId: string;
274+
autoCompleteSetBy?: AzureUser;
275+
commits?: AzureGitCommitRef[];
276+
completionOptions?: AzurePullRequestCompletionOptions;
277+
completionQueueTime?: string;
278+
forkSource?: AzureGitForkRef;
279+
hasMultipleMergeBases?: boolean;
280+
labels?: AzureWebApiTagDefinition[];
281+
lastMergeCommit?: AzureGitCommitRef;
282+
mergeFailureMessage?: string;
283+
mergeFailureType?: 'caseSensitive' | 'none' | 'objectTooLarge' | 'unknown';
284+
mergeOptions?: AzureGitPullRequestMergeOptions;
285+
mergeStatus?: AzurePullRequestAsyncStatus;
286+
remoteUrl?: string;
287+
workItemRefs?: AzureResourceRef[];
160288
}
161289
export function getAzureDevOpsOwner(url: URL): string {
162290
return url.pathname.split('/')[1];

0 commit comments

Comments
 (0)