@@ -13,10 +13,12 @@ import {
13
13
RequestClientError ,
14
14
RequestNotFoundError ,
15
15
} from '../../../../errors' ;
16
+ import type { IssueOrPullRequest } from '../../../../git/models/issueOrPullRequest' ;
16
17
import type { PullRequest } from '../../../../git/models/pullRequest' ;
17
18
import type { Provider } from '../../../../git/models/remoteProvider' ;
18
19
import { showIntegrationRequestFailed500WarningMessage } from '../../../../messages' ;
19
20
import { configuration } from '../../../../system/-webview/configuration' ;
21
+ import { debug } from '../../../../system/decorators/log' ;
20
22
import { Logger } from '../../../../system/logger' ;
21
23
import type { LogScope } from '../../../../system/logger.scope' ;
22
24
import { getLogScope } from '../../../../system/logger.scope' ;
@@ -56,6 +58,7 @@ export class BitbucketApi implements Disposable {
56
58
this . _proxyAgent = null ;
57
59
}
58
60
61
+ @debug < BitbucketApi [ 'getPullRequestForBranch' ] > ( { args : { 0 : p => p . name , 1 : '<token>' } } )
59
62
public async getPullRequestForBranch (
60
63
provider : Provider ,
61
64
token : string ,
@@ -90,6 +93,36 @@ export class BitbucketApi implements Disposable {
90
93
return fromBitbucketPullRequest ( response . values [ 0 ] , provider ) ;
91
94
}
92
95
96
+ @debug < BitbucketApi [ 'getIssueOrPullRequest' ] > ( { args : { 0 : p => p . name , 1 : '<token>' } } )
97
+ public async getIssueOrPullRequest (
98
+ provider : Provider ,
99
+ token : string ,
100
+ owner : string ,
101
+ repo : string ,
102
+ id : string ,
103
+ options : {
104
+ baseUrl : string ;
105
+ } ,
106
+ ) : Promise < IssueOrPullRequest | undefined > {
107
+ const scope = getLogScope ( ) ;
108
+
109
+ const response = await this . request < BitbucketPullRequest > (
110
+ provider ,
111
+ token ,
112
+ options . baseUrl ,
113
+ `repositories/${ owner } /${ repo } /pullrequests/${ id } ?fields=*` ,
114
+ {
115
+ method : 'GET' ,
116
+ } ,
117
+ scope ,
118
+ ) ;
119
+
120
+ if ( ! response ) {
121
+ return undefined ;
122
+ }
123
+ return fromBitbucketPullRequest ( response , provider ) ;
124
+ }
125
+
93
126
private async request < T > (
94
127
provider : Provider ,
95
128
token : string ,
0 commit comments