@@ -4,6 +4,7 @@ import type { Account } from '../../../git/models/author';
4
4
import type { Issue , IssueShape } from '../../../git/models/issue' ;
5
5
import type { IssueOrPullRequest , IssueOrPullRequestType } from '../../../git/models/issueOrPullRequest' ;
6
6
import type { IssueResourceDescriptor , ResourceDescriptor } from '../../../git/models/resourceDescriptor' ;
7
+ import { Logger } from '../../../system/logger' ;
7
8
import type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider' ;
8
9
import type { ProviderAuthenticationSession } from '../authentication/models' ;
9
10
import { IssuesIntegration } from '../models/issuesIntegration' ;
@@ -62,11 +63,44 @@ export class LinearIntegration extends IssuesIntegration<IssuesCloudHostIntegrat
62
63
return metadata . domain ;
63
64
}
64
65
protected override async searchProviderMyIssues (
65
- _session : ProviderAuthenticationSession ,
66
- _resources ?: ResourceDescriptor [ ] ,
67
- _cancellation ?: CancellationToken ,
66
+ session : ProviderAuthenticationSession ,
67
+ resources ?: ResourceDescriptor [ ] ,
68
+ cancellation ?: CancellationToken ,
68
69
) : 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 ;
70
104
}
71
105
protected override getProviderIssueOrPullRequest (
72
106
_session : ProviderAuthenticationSession ,
0 commit comments