@bloomreach/discovery-web-sdk

1.0.0-beta.3 • Public • Published

Bloomreach Discovery Web SDK

Welcome to the Bloomreach Discovery Web SDK, a TypeScript SDK designed to interact with the Bloomreach Discovery APIs. This SDK provides a convenient way to integrate and use the Discovery data in your applications.

Getting Started

First initialize the SDK by providing a set of account and product catalog specific options

import type { SetupConfiguration } from '@bloomreach/discovery-web-sdk';
import { initialize } from '@bloomreach/discovery-web-sdk';

// Set the account and catalog configuration
const config: SetupConfiguration = {
  account_id: 1234,
  domain_key: 'example_com',
};

// Initialize the SDK with the provided configuration
initialize(config);

Now we can utilize the exposed methods to retrieve data from the Bloomreach Discovery platform:

Product Search API

import type { ProductSearchOptions } from '@bloomreach/discovery-web-sdk';
import { productSearch } from '@bloomreach/discovery-web-sdk';

// Set up the search parameters
const searchOptions: ProductSearchOptions = {
  q: 'Generic Metal Pants',
};

// Retrieve the product data with a search using the provided search parameters
const data = await productSearch(searchOptions);

Category API

import type { CategorySearchOptions } from '@bloomreach/discovery-web-sdk';
import { categorySearch } from '@bloomreach/discovery-web-sdk';

// Set up the search parameters
const searchOptions: ProductSearchOptions = {
  q: 'cat92082',
};

// Retrieve the product data with a search using the provided search parameters
const data = await categorySearch(searchOptions);

Bestseller API

import type { BestsellerOptions } from '@bloomreach/discovery-web-sdk';
import { bestseller } from '@bloomreach/discovery-web-sdk';

// Set up the search parameters
const searchOptions: BestsellerOptions = {
  q: 'Bolts',
};

// Retrieve the product data with a search using the provided search parameters
const data = await bestseller(searchOptions);

Content Search API

import type { ContentSearchOptions } from '@bloomreach/discovery-web-sdk';
import { contentSearch } from '@bloomreach/discovery-web-sdk';

// Set up the search parameters
const searchOptions: ContentSearchOptions = {
  catalog_name: 'Flowers',
  q: 'Roses',
};

// Retrieve the Content data with a search using the provided search parameters
const data = await contentSearch(searchOptions);

Autosuggest API

import type { AutosuggestOptions } from '@bloomreach/discovery-web-sdk';
import { autosuggest } from '@bloomreach/discovery-web-sdk';

// Set up the search parameters
const searchOptions: AutosuggestOptions = {
  catalog_views: 'product:store1,store2|recipe:premium|articles',
  q: 'Roses',
};

// Retrieve the suggestions with a search using the provided search parameters
const data = await autosuggest(searchOptions);

Contributing

Contributions are welcome! Please read the contributing guidelines before getting started.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i @bloomreach/discovery-web-sdk

Weekly Downloads

45

Version

1.0.0-beta.3

License

none

Unpacked Size

33.1 kB

Total Files

6

Last publish

Collaborators

  • vahid.mehrjouei
  • stefanos.maziotis
  • prateek.pandey
  • shivanayak.dharavath2
  • feix-bloomreach
  • jeroenhoffman
  • skuzey-br
  • aakash.anand
  • rameshbr
  • boudekerk
  • mgiusto
  • beetlerom
  • joerideg
  • abogaart
  • pcentgraf-bloomreach
  • mjmetter
  • michielrop
  • sshepelevich
  • vlets
  • pauledwardsbloomreach
  • davidboyd1
  • br-mikedreynolds
  • tom.washek
  • drq
  • ricardomartins
  • ntrajkovski
  • bcanvural
  • lachire
  • brxm
  • glm-bloomreach
  • vaibhav.shukla
  • hachok
  • vkauryha