@@ -2,6 +2,8 @@ import type {
22 Account ,
33 ActionablePullRequest ,
44 AzureDevOps ,
5+ AzureOrganization ,
6+ AzureProject ,
57 Bitbucket ,
68 EnterpriseOptions ,
79 GetRepoInput ,
@@ -53,6 +55,8 @@ export type ProviderIssue = Issue;
5355export type ProviderEnterpriseOptions = EnterpriseOptions ;
5456export type ProviderJiraProject = JiraProject ;
5557export type ProviderJiraResource = JiraResource ;
58+ export type ProviderAzureProject = AzureProject ;
59+ export type ProviderAzureResource = AzureOrganization ;
5660export const ProviderPullRequestReviewState = GitPullRequestReviewState ;
5761export const ProviderBuildStatusState = GitBuildStatusState ;
5862
@@ -128,6 +132,20 @@ export interface GetPullRequestsOptions {
128132 baseUrl ?: string ;
129133}
130134
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+
131149export interface GetPullRequestsForRepoInput extends GetPullRequestsOptions {
132150 repo : GetRepoInput ;
133151}
@@ -195,6 +213,16 @@ export type GetPullRequestsForRepoFn = (
195213 options ?: EnterpriseOptions ,
196214) => Promise < { data : ProviderPullRequest [ ] ; pageInfo ?: PageInfo } > ;
197215
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+
198226export type GetIssueFn = (
199227 input : { resourceId : string ; number : string } ,
200228 options ?: EnterpriseOptions ,
@@ -220,7 +248,10 @@ export type GetReposForAzureProjectFn = (
220248 options ?: EnterpriseOptions ,
221249) => Promise < { data : ProviderRepository [ ] ; pageInfo ?: PageInfo } > ;
222250
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 } > ;
224255export type GetCurrentUserForInstanceFn = (
225256 input : { namespace : string } ,
226257 options ?: EnterpriseOptions ,
@@ -235,6 +266,14 @@ export type GetJiraProjectsForResourcesFn = (
235266 input : { resourceIds : string [ ] } ,
236267 options ?: EnterpriseOptions ,
237268) => 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 } > ;
238277export type GetIssuesForProjectFn = (
239278 input : GetIssuesForProjectInput ,
240279 options ?: EnterpriseOptions ,
@@ -248,6 +287,8 @@ export interface ProviderInfo extends ProviderMetadata {
248287 provider : GitHub | GitLab | Bitbucket | Jira | Trello | AzureDevOps ;
249288 getPullRequestsForReposFn ?: GetPullRequestsForReposFn ;
250289 getPullRequestsForRepoFn ?: GetPullRequestsForRepoFn ;
290+ getPullRequestsForUserFn ?: GetPullRequestsForUserFn ;
291+ getPullRequestsForAzureProjectsFn ?: GetPullRequestsForAzureProjectsFn ;
251292 getIssueFn ?: GetIssueFn ;
252293 getIssuesForReposFn ?: GetIssuesForReposFn ;
253294 getIssuesForRepoFn ?: GetIssuesForRepoFn ;
@@ -256,7 +297,9 @@ export interface ProviderInfo extends ProviderMetadata {
256297 getCurrentUserForInstanceFn ?: GetCurrentUserForInstanceFn ;
257298 getCurrentUserForResourceFn ?: GetCurrentUserForResourceFn ;
258299 getJiraResourcesForCurrentUserFn ?: GetJiraResourcesForCurrentUserFn ;
300+ getAzureResourcesForUserFn ?: GetAzureResourcesForUserFn ;
259301 getJiraProjectsForResourcesFn ?: GetJiraProjectsForResourcesFn ;
302+ getAzureProjectsForResourceFn ?: GetAzureProjectsForResourceFn ;
260303 getIssuesForProjectFn ?: GetIssuesForProjectFn ;
261304 getReposForAzureProjectFn ?: GetReposForAzureProjectFn ;
262305 getIssuesForResourceForCurrentUserFn ?: GetIssuesForResourceForCurrentUserFn ;
@@ -270,7 +313,6 @@ export interface ProviderMetadata {
270313 scopes : string [ ] ;
271314 supportedPullRequestFilters ?: PullRequestFilter [ ] ;
272315 supportedIssueFilters ?: IssueFilter [ ] ;
273- usesPAT ?: boolean ;
274316}
275317
276318export type Providers = Record < IntegrationId , ProviderInfo > ;
@@ -292,7 +334,6 @@ export const providersMetadata: ProvidersMetadata = {
292334 // Use 'username' property on account for issue filters
293335 supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee , IssueFilter . Mention ] ,
294336 scopes : [ 'repo' , 'read:user' , 'user:email' ] ,
295- usesPAT : true ,
296337 } ,
297338 [ SelfHostedIntegrationId . GitHubEnterprise ] : {
298339 domain : '' ,
@@ -309,7 +350,6 @@ export const providersMetadata: ProvidersMetadata = {
309350 // Use 'username' property on account for issue filters
310351 supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee , IssueFilter . Mention ] ,
311352 scopes : [ 'repo' , 'read:user' , 'user:email' ] ,
312- usesPAT : true ,
313353 } ,
314354 [ HostingIntegrationId . GitLab ] : {
315355 domain : 'gitlab.com' ,
@@ -325,7 +365,6 @@ export const providersMetadata: ProvidersMetadata = {
325365 // Use 'username' property on account for issue filters
326366 supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee ] ,
327367 scopes : [ 'read_api' , 'read_user' , 'read_repository' ] ,
328- usesPAT : true ,
329368 } ,
330369 [ SelfHostedIntegrationId . GitLabSelfHosted ] : {
331370 domain : '' ,
@@ -341,7 +380,6 @@ export const providersMetadata: ProvidersMetadata = {
341380 // Use 'username' property on account for issue filters
342381 supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee ] ,
343382 scopes : [ 'read_api' , 'read_user' , 'read_repository' ] ,
344- usesPAT : true ,
345383 } ,
346384 [ HostingIntegrationId . Bitbucket ] : {
347385 domain : 'bitbucket.org' ,
@@ -350,7 +388,6 @@ export const providersMetadata: ProvidersMetadata = {
350388 // Use 'id' property on account for PR filters
351389 supportedPullRequestFilters : [ PullRequestFilter . Author ] ,
352390 scopes : [ 'account:read' , 'repository:read' , 'pullrequest:read' , 'issue:read' ] ,
353- usesPAT : true ,
354391 } ,
355392 [ HostingIntegrationId . AzureDevOps ] : {
356393 domain : 'dev.azure.com' ,
@@ -362,7 +399,6 @@ export const providersMetadata: ProvidersMetadata = {
362399 // Use 'name' property on account for issue filters
363400 supportedIssueFilters : [ IssueFilter . Author , IssueFilter . Assignee , IssueFilter . Mention ] ,
364401 scopes : [ 'vso.code' , 'vso.identity' , 'vso.project' , 'vso.profile' , 'vso.work' ] ,
365- usesPAT : true ,
366402 } ,
367403 [ IssueIntegrationId . Jira ] : {
368404 domain : 'atlassian.net' ,
0 commit comments