@adobe/spacecat-shared-brand-client
TypeScript icon, indicating that this package has built-in type declarations

1.1.8 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

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

Weekly Downloads

74

Version

1.1.8

License

Apache-2.0

Unpacked Size

39 kB

Total Files

8

Last publish

Collaborators

  • marbec
  • tripod
  • garthdb
  • lazd
  • adobe-admin
  • patrickfulton
  • trieloff
  • shazron
  • krisnye
  • dcpfsdk
  • natebaldwin
  • devongovett
  • aspro83
  • symanovi
  • dpfister
  • stefan-guggisberg
  • rofe
  • kptdobe
  • adobehalls
  • fullcolorcoder
  • djaeggi
  • dylandepass
  • mhaack
  • amol-anand
  • stopp-adobe
  • doten
  • duh_schmidt
  • asthabh23
  • zdahbi
  • tuicu