@@ -4,6 +4,7 @@ import type { Account } from '../../../git/models/author';
44import type { Issue , IssueShape } from '../../../git/models/issue' ;
55import type { IssueOrPullRequest , IssueOrPullRequestType } from '../../../git/models/issueOrPullRequest' ;
66import type { IssueResourceDescriptor , ResourceDescriptor } from '../../../git/models/resourceDescriptor' ;
7+ import { Logger } from '../../../system/logger' ;
78import type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider' ;
89import type { ProviderAuthenticationSession } from '../authentication/models' ;
910import { IssuesIntegration } from '../models/issuesIntegration' ;
@@ -62,11 +63,44 @@ export class LinearIntegration extends IssuesIntegration<IssuesCloudHostIntegrat
6263 return metadata . domain ;
6364 }
6465 protected override async searchProviderMyIssues (
65- _session : ProviderAuthenticationSession ,
66- _resources ?: ResourceDescriptor [ ] ,
67- _cancellation ?: CancellationToken ,
66+ session : ProviderAuthenticationSession ,
67+ resources ?: ResourceDescriptor [ ] ,
68+ cancellation ?: CancellationToken ,
6869 ) : Promise < IssueShape [ ] | undefined > {
69- return Promise . resolve ( undefined ) ;
70+ if ( resources != null ) {
71+ return undefined ;
72+ }
73+ const api = await this . getProvidersApi ( ) ;
74+ let cursor = undefined ;
75+ let hasMore = false ;
76+ let requestCount = 0 ;
77+ const issues = [ ] ;
78+ try {
79+ do {
80+ if ( cancellation ?. isCancellationRequested ) {
81+ break ;
82+ }
83+ const result = await api . getIssuesForCurrentUser ( this . id , {
84+ accessToken : session . accessToken ,
85+ cursor : cursor ,
86+ } ) ;
87+ requestCount += 1 ;
88+ hasMore = result . paging ?. more ?? false ;
89+ cursor = result . paging ?. cursor ;
90+ const formattedIssues = result . values
91+ . map ( issue => toIssueShape ( issue , this ) )
92+ . filter ( ( result ) : result is IssueShape => result != null ) ;
93+ if ( formattedIssues . length > 0 ) {
94+ issues . push ( ...formattedIssues ) ;
95+ }
96+ } while ( requestCount < maxPagesPerRequest && hasMore ) ;
97+ } catch ( ex ) {
98+ if ( issues . length === 0 ) {
99+ throw ex ;
100+ }
101+ Logger . error ( ex , 'searchProviderMyIssues' ) ;
102+ }
103+ return issues ;
70104 }
71105 protected override getProviderIssueOrPullRequest (
72106 _session : ProviderAuthenticationSession ,
0 commit comments