More detailed API docs and copy-paste examples could be found in the API documentation for each service.
Please also reference our XSearch Service, XRecommend Service, Tracking Service section for more examples.
import XGenClient from '@xgenai/sdk-core';
const xg = new XGenClient({
key: '<your_api_key>',
secret: '<your_api_secret>',
clientId: '<your_client_id>',
trackerId: '<your_tracker_id>',
getEnv: () => 'stage', //optional: function that returns the environment (`stage` or `prod`)
authStore: new LocalCookieAuthStore() //default - can pass in a custom auth store instance
});
// get recommendations by element id
const result = await xg.recommend.getResultsById({elementId: '<element_id>'})
// and much more...