11import { RequestTracingConfig , RequestConfig , inflightUrlWithQuery } from '../../../HttpClient'
22import { JanusClient } from '../JanusClient'
3- import { OptionsListBindings , APIBindingRes } from './types'
3+ import { OptionsListBindings , APIBindingRes , OptionsGetBinding } from './types'
44
55const TWO_MINUTES_S = 2 * 60
66
@@ -11,6 +11,7 @@ const routes = {
1111 resourceAccess : ( resourceKey : string ) => `${ BASE_URL } /resources/${ encodeURIComponent ( resourceKey ) } /access` ,
1212 topbarData : ( ) => `${ BASE_URL } /site/pvt/newtopbar` ,
1313 listBindings : ( tenant : string ) => `${ BASE_URL } /binding/site/${ encodeURIComponent ( tenant ) } ` ,
14+ getBinding : ( bindingId : string ) => `${ BASE_URL } /binding/${ encodeURIComponent ( bindingId ) } ` ,
1415}
1516
1617export class LicenseManager extends JanusClient {
@@ -79,4 +80,21 @@ export class LicenseManager extends JanusClient {
7980 } ,
8081 } )
8182 }
83+
84+ public getBinding = ( { adminUserAuthToken, bindingId } : OptionsGetBinding , config ?: RequestConfig ) => {
85+ const metric = 'lm-get-binding'
86+ return this . http . get < APIBindingRes [ ] > ( routes . getBinding ( bindingId ) , {
87+ inflightKey : inflightUrlWithQuery ,
88+ memoizeable : true ,
89+ metric,
90+ headers : {
91+ VtexIdclientAutCookie : adminUserAuthToken ,
92+ } ,
93+ ...config ,
94+ tracing : {
95+ requestSpanNameSuffix : metric ,
96+ ...config ?. tracing ,
97+ } ,
98+ } )
99+ }
82100}
0 commit comments