Skip to content

Commit d6253fa

Browse files
committed
feat(LicenseManager): add listBindings
1 parent 05728cd commit d6253fa

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

src/clients/janus/LicenseManager/index.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { RequestTracingConfig, inflightUrlWithQuery } from '../../../HttpClient'
1+
import { RequestTracingConfig, RequestConfig, inflightUrlWithQuery } from '../../../HttpClient'
22
import { JanusClient } from '../JanusClient'
3+
import { OptionsListBindings, APIBindingRes } from './types'
34

45
const TWO_MINUTES_S = 2 * 60
56

@@ -9,6 +10,7 @@ const routes = {
910
accountData: () => `${BASE_URL}/account`,
1011
resourceAccess: (resourceKey: string) => `${BASE_URL}/resources/${resourceKey}/access`,
1112
topbarData: () => `${BASE_URL}/site/pvt/newtopbar`,
13+
listBindings: (tenant: string) => `${BASE_URL}/binding/site/${tenant}`,
1214
}
1315

1416
export class LicenseManager extends JanusClient {
@@ -60,4 +62,21 @@ export class LicenseManager extends JanusClient {
6062
() => false
6163
)
6264
}
65+
66+
public listBindings = ({ tenant, adminUserAuthToken }: OptionsListBindings, config?: RequestConfig) => {
67+
const metric = 'lm-list-bindings'
68+
return this.http.get<APIBindingRes[]>(routes.listBindings(tenant), {
69+
inflightKey: inflightUrlWithQuery,
70+
memoizeable: true,
71+
metric,
72+
headers: {
73+
VtexIdclientAutCookie: adminUserAuthToken,
74+
},
75+
...config,
76+
tracing: {
77+
requestSpanNameSuffix: metric,
78+
...config?.tracing,
79+
},
80+
})
81+
}
6382
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export interface OptionsListBindings {
2+
tenant: string
3+
adminUserAuthToken: string
4+
}
5+
6+
export interface APIAddress {
7+
Host: string
8+
IsCanonical: boolean
9+
BasePath: string
10+
Localization: {
11+
[k: string]: string
12+
}
13+
}
14+
15+
export interface APIBindingCreate {
16+
Addresses: APIAddress[]
17+
SiteName: string
18+
DefaultSalesChannelId: number | null
19+
DefaultLocale: string
20+
SupportedLocales: string[]
21+
}
22+
23+
export interface APIBindingRes extends APIBindingCreate {
24+
Id: string
25+
}

0 commit comments

Comments
 (0)