1.1.11 • Published 5 months ago

@adobe/spacecat-shared-brand-client v1.1.11

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 months ago

Spacecat Shared - Brand Client

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.

Installation

Install the package using npm:

npm install @adobe/spacecat-shared-brand-client

Usage

Constructor

import BrandClient from '@adobe/spacecat-shared-brand-client';

const config = {
  apiKey: '<API_KEY>',
  apiBaseUrl: '<API_BASE_URL>',
};

const client = new BrandClient(config, log);

Creating an instance from Helix UniversalContext

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);

Methods

getBrandsForOrganization(imsOrgId, imsAccessToken)

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']
// }

Testing

To run tests:

npm run test

Linting

Lint your code:

npm run lint

Cleaning

To remove node_modules and package-lock.json:

npm run clean

Additional Information

1.1.11

5 months ago

1.1.10

5 months ago

1.1.9

5 months ago

1.1.8

5 months ago

1.1.7

5 months ago

1.1.6

6 months ago

1.1.5

6 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago