@@ -2,6 +2,8 @@ import type {
2
2
Account ,
3
3
ActionablePullRequest ,
4
4
AzureDevOps ,
5
+ AzureOrganization ,
6
+ AzureProject ,
5
7
Bitbucket ,
6
8
EnterpriseOptions ,
7
9
GetRepoInput ,
@@ -53,6 +55,8 @@ export type ProviderIssue = Issue;
53
55
export type ProviderEnterpriseOptions = EnterpriseOptions ;
54
56
export type ProviderJiraProject = JiraProject ;
55
57
export type ProviderJiraResource = JiraResource ;
58
+ export type ProviderAzureProject = AzureProject ;
59
+ export type ProviderAzureResource = AzureOrganization ;
56
60
export const ProviderPullRequestReviewState = GitPullRequestReviewState ;
57
61
export const ProviderBuildStatusState = GitBuildStatusState ;
58
62
@@ -128,6 +132,20 @@ export interface GetPullRequestsOptions {
128
132
baseUrl ?: string ;
129
133
}
130
134
135
+ export interface GetPullRequestsForUserOptions {
136
+ includeFromArchivedRepos ?: boolean ;
137
+ cursor ?: string ; // stringified JSON object of type { type: 'cursor' | 'page'; value: string | number } | {}
138
+ baseUrl ?: string ;
139
+ }
140
+
141
+ export interface GetPullRequestsForUserInput extends GetPullRequestsForUserOptions {
142
+ userId : string ;
143
+ }
144
+
145
+ export interface GetPullRequestsAssociatedWithUserInput extends GetPullRequestsForUserOptions {
146
+ username : string ;
147
+ }
148
+
131
149
export interface GetPullRequestsForRepoInput extends GetPullRequestsOptions {
132
150
repo : GetRepoInput ;
133
151
}
@@ -195,6 +213,16 @@ export type GetPullRequestsForRepoFn = (
195
213
options ?: EnterpriseOptions ,
196
214
) => Promise < { data : ProviderPullRequest [ ] ; pageInfo ?: PageInfo } > ;
197
215
216
+ export type GetPullRequestsForUserFn = (
217
+ input : GetPullRequestsForUserInput | GetPullRequestsAssociatedWithUserInput ,
218
+ options ?: EnterpriseOptions ,
219
+ ) => Promise < { data : ProviderPullRequest [ ] ; pageInfo ?: PageInfo } > ;
220
+
221
+ export type GetPullRequestsForAzureProjectsFn = (
222
+ input : { projects : { namespace : string ; project : string } [ ] ; authorLogin ?: string ; assigneeLogins ?: string [ ] } ,
223
+ options ?: EnterpriseOptions ,
224
+ ) => Promise < { data : ProviderPullRequest [ ] } > ;
225
+
198
226
export type GetIssueFn = (
199
227
input : { resourceId : string ; number : string } ,
200
228
options ?: EnterpriseOptions ,
@@ -220,7 +248,10 @@ export type GetReposForAzureProjectFn = (
220
248
options ?: EnterpriseOptions ,
221
249
) => Promise < { data : ProviderRepository [ ] ; pageInfo ?: PageInfo } > ;
222
250
223
- export type GetCurrentUserFn = ( options ?: EnterpriseOptions ) => Promise < { data : ProviderAccount } > ;
251
+ export type GetCurrentUserFn = (
252
+ input : Record < string , never > ,
253
+ options ?: EnterpriseOptions ,
254
+ ) => Promise < { data : ProviderAccount } > ;
224
255
export type GetCurrentUserForInstanceFn = (
225
256
input : { namespace : string } ,
226
257
options ?: EnterpriseOptions ,
@@ -235,6 +266,14 @@ export type GetJiraProjectsForResourcesFn = (
235
266
input : { resourceIds : string [ ] } ,
236
267
options ?: EnterpriseOptions ,
237
268
) => Promise < { data : JiraProject [ ] } > ;
269
+ export type GetAzureResourcesForUserFn = (
270
+ input : { userId : string } ,
271
+ options ?: EnterpriseOptions ,
272
+ ) => Promise < { data : AzureOrganization [ ] } > ;
273
+ export type GetAzureProjectsForResourceFn = (
274
+ input : { namespace : string ; cursor ?: string } ,
275
+ options ?: EnterpriseOptions ,
276
+ ) => Promise < { data : AzureProject [ ] ; pageInfo ?: PageInfo } > ;
238
277
export type GetIssuesForProjectFn = (
239
278
input : GetIssuesForProjectInput ,
240
279
options ?: EnterpriseOptions ,
@@ -248,6 +287,8 @@ export interface ProviderInfo extends ProviderMetadata {
248
287
provider : GitHub | GitLab | Bitbucket | Jira | Trello | AzureDevOps ;
249
288
getPullRequestsForReposFn ?: GetPullRequestsForReposFn ;
250
289
getPullRequestsForRepoFn ?: GetPullRequestsForRepoFn ;
290
+ getPullRequestsForUserFn ?: GetPullRequestsForUserFn ;
291
+ getPullRequestsForAzureProjectsFn ?: GetPullRequestsForAzureProjectsFn ;
251
292
getIssueFn ?: GetIssueFn ;
252
293
getIssuesForReposFn ?: GetIssuesForReposFn ;
253
294
getIssuesForRepoFn ?: GetIssuesForRepoFn ;
@@ -256,7 +297,9 @@ export interface ProviderInfo extends ProviderMetadata {
256
297
getCurrentUserForInstanceFn ?: GetCurrentUserForInstanceFn ;
257
298
getCurrentUserForResourceFn ?: GetCurrentUserForResourceFn ;
258
299
getJiraResourcesForCurrentUserFn ?: GetJiraResourcesForCurrentUserFn ;
300
+ getAzureResourcesForUserFn ?: GetAzureResourcesForUserFn ;
259
301
getJiraProjectsForResourcesFn ?: GetJiraProjectsForResourcesFn ;
302
+ getAzureProjectsForResourceFn ?: GetAzureProjectsForResourceFn ;
260
303
getIssuesForProjectFn ?: GetIssuesForProjectFn ;
261
304
getReposForAzureProjectFn ?: GetReposForAzureProjectFn ;
262
305
getIssuesForResourceForCurrentUserFn ?: GetIssuesForResourceForCurrentUserFn ;
@@ -270,7 +313,6 @@ export interface ProviderMetadata {
270
313
scopes : string [ ] ;
271
314
supportedPullRequestFilters ?: PullRequestFilter [ ] ;
272
315
supportedIssueFilters ?: IssueFilter [ ] ;
273
- usesPAT ?: boolean ;
274
316
}
275
317
276
318
export type Providers = Record < IntegrationId , ProviderInfo > ;
@@ -292,7 +334,6 @@ export const providersMetadata: ProvidersMetadata = {
292
334
// Use 'username' property on account for issue filters
293
335
supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee , IssueFilter . Mention ] ,
294
336
scopes : [ 'repo' , 'read:user' , 'user:email' ] ,
295
- usesPAT : true ,
296
337
} ,
297
338
[ SelfHostedIntegrationId . GitHubEnterprise ] : {
298
339
domain : '' ,
@@ -309,7 +350,6 @@ export const providersMetadata: ProvidersMetadata = {
309
350
// Use 'username' property on account for issue filters
310
351
supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee , IssueFilter . Mention ] ,
311
352
scopes : [ 'repo' , 'read:user' , 'user:email' ] ,
312
- usesPAT : true ,
313
353
} ,
314
354
[ HostingIntegrationId . GitLab ] : {
315
355
domain : 'gitlab.com' ,
@@ -325,7 +365,6 @@ export const providersMetadata: ProvidersMetadata = {
325
365
// Use 'username' property on account for issue filters
326
366
supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee ] ,
327
367
scopes : [ 'read_api' , 'read_user' , 'read_repository' ] ,
328
- usesPAT : true ,
329
368
} ,
330
369
[ SelfHostedIntegrationId . GitLabSelfHosted ] : {
331
370
domain : '' ,
@@ -341,7 +380,6 @@ export const providersMetadata: ProvidersMetadata = {
341
380
// Use 'username' property on account for issue filters
342
381
supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee ] ,
343
382
scopes : [ 'read_api' , 'read_user' , 'read_repository' ] ,
344
- usesPAT : true ,
345
383
} ,
346
384
[ HostingIntegrationId . Bitbucket ] : {
347
385
domain : 'bitbucket.org' ,
@@ -350,7 +388,6 @@ export const providersMetadata: ProvidersMetadata = {
350
388
// Use 'id' property on account for PR filters
351
389
supportedPullRequestFilters : [ PullRequestFilter . Author ] ,
352
390
scopes : [ 'account:read' , 'repository:read' , 'pullrequest:read' , 'issue:read' ] ,
353
- usesPAT : true ,
354
391
} ,
355
392
[ HostingIntegrationId . AzureDevOps ] : {
356
393
domain : 'dev.azure.com' ,
@@ -362,7 +399,6 @@ export const providersMetadata: ProvidersMetadata = {
362
399
// Use 'name' property on account for issue filters
363
400
supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee , IssueFilter . Mention ] ,
364
401
scopes : [ 'vso.code' , 'vso.identity' , 'vso.project' , 'vso.profile' , 'vso.work' ] ,
365
- usesPAT : true ,
366
402
} ,
367
403
[ IssueIntegrationId . Jira ] : {
368
404
domain : 'atlassian.net' ,
0 commit comments