A JavaScript client for the Brand API, part of the SpaceCat Shared library. It allows you to query brand information and guidelines with in the given IMS Org.
Install the package using npm:
npm install @adobe/spacecat-shared-brand-client
import BrandClient from '@adobe/spacecat-shared-brand-client';
const config = {
apiKey: '<API_KEY>',
apiBaseUrl: '<API_BASE_URL>',
};
const client = new BrandClient(config, log);
const context = {
env: {
BRAND_API_BASE_URL: '<API_BASE_URL>',
BRAND_API_KEY: '<API_KEY>',
}
}; // Your Helix Universal context object
const client = BrandClient.createFrom(context);
Retrieves brands associated with an IMS organization.
const brands = await client.getBrandsForOrganization('org123', 'ims-access-token');
// Returns array of Brand objects:
// [{
// id: 'brand-id',
// name: 'Brand Name',
// imsOrgId: 'org123',
// createdAt: '2024-03-01T00:00:00.000Z',
// updatedAt: '2024-03-01T00:00:00.000Z'
// }]
#### getBrandGuidelines(brandId, imsOrgId, imsConfig)
Retrieves brand guidelines for the given brand and IMS Org.
```js
const imsConfig = {
host: 'ims-host',
clientId: 'client-id',
clientCode: 'client-code',
clientSecret: 'client-secret'
};
const guidelines = await client.getBrandGuidelines('brand123', 'org123', imsConfig);
// Returns BrandGuidelines object:
// {
// id: 'brand123',
// name: 'Brand Name',
// imsOrgId: 'org123',
// createdAt: '2024-03-01T00:00:00.000Z',
// updatedAt: '2024-03-01T00:00:00.000Z',
// toneOfVoice: ['friendly', 'professional'],
// coreValues: ['innovation', 'trust'],
// guidelines: ['Use active voice', 'Be concise'],
// restrictions: ['Avoid jargon'],
// additionalGuidelines: ['Additional guidelines here']
// }
To run tests:
npm run test
Lint your code:
npm run lint
To remove node_modules
and package-lock.json
:
npm run clean
- Repository: GitHub
- Issue Tracking: GitHub Issues
- License: Apache-2.0