@salesforce/b2c-tooling-sdk / clients / createMrtB2CClient
Function: createMrtB2CClient()
createMrtB2CClient(
config,auth):MrtB2CClient
Defined in: packages/b2c-tooling-sdk/src/clients/mrt-b2c.ts:151
Creates a typed Managed Runtime B2C Commerce API client.
This client handles the B2C Commerce integration endpoints, which manage the connection between MRT targets/environments and B2C Commerce instances.
Parameters
config
MRT B2C client configuration
auth
Authentication strategy (typically ApiKeyStrategy)
Returns
Typed openapi-fetch client
Examples
ts
// Create MRT B2C client with API key auth
const apiKeyStrategy = new ApiKeyStrategy(apiKey, 'Authorization');
const client = createMrtB2CClient({}, apiKeyStrategy);
// Get B2C organization info
const { data, error } = await client.GET('/b2c-organization-info/{organization_slug}/', {
params: {
path: { organization_slug: 'my-org' }
}
});ts
// Get B2C target info
const { data, error } = await client.GET('/projects/{project_slug}/b2c-target-info/{target_slug}/', {
params: {
path: { project_slug: 'my-project', target_slug: 'staging' }
}
});ts
// Update B2C target info
const { data, error } = await client.PUT('/projects/{project_slug}/b2c-target-info/{target_slug}/', {
params: {
path: { project_slug: 'my-project', target_slug: 'staging' }
},
body: {
instance_id: 'zzxy_prd',
sites: ['RefArch', 'SiteGenesis']
}
});