new AtlasSDKClient(config)
Creates an AtlasSDK instance from config provided by config-api
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | config from config-api |
Methods
-
createGuestCheckout(json)
-
Creates guest checkout object with payload.
Parameters:
Name Type Description json
Object JSON payload Returns:
response containing redirectURL that should be used to go to the payment. -
getArticle(sku [, options])
-
Fetches an article based on a SKU.
Parameters:
Name Type Argument Description sku
String SKU of an article options
Object <optional>
Configuration options: -
media:
- {String} cdn: 'mosaic01' or 'mosaic02' (default is 'mosaic01')
-
{Array} image_resolutions: request media image with the different resolutions
(default ['thumbnail', 'medium', 'large']):
- 'thumbnail' – width: 78px
- 'thumbnail_hd' – width: 76px
- 'small' – width: 135px
- 'small_hd' – width: 270px
- 'medium' – width: 300px, height: 400px
- 'medium_sd' – width: 480px
- 'medium_hd' – width: 600px, height: 800px
- 'large' – width: 1100px, height: 1100px
- 'large_hd' – height: 1650px
{ media: { cdn: 'mosaic02', image_resolutions: ['thumbnail', 'medium'] } }
Returns:
return Article object- Type
- Article
Example
const sdk = await AtlasSDK.configure({ client_id: 'CLIENT_ID', sales_channel: 'SALES_CHANNEL', is_sandBox: true }); const article = await sdk.getArticle('AD112B0F6-A11', { media: { image_resolutions: ['thumbnail', 'medium'] } });
-
media:
-
getConfig()
-
Returns configuration from config-api
Returns:
config- Type
- Object
-
getCountryCode()
-
Returns country code based on sales channel, e.g. 'DE'
Returns:
country code- Type
- String
-
getLanguage()
-
Returns language based on sales channel, e.g. 'de'
Returns:
language- Type
- String
-
getLocale()
-
Returns locale based on sales channel, e.g. 'de_DE'
Returns:
locale- Type
- String
-
getRecommendations(sku [, options])
-
Fetches recommendations for an article based on a SKU.
Parameters:
Name Type Argument Description sku
String SKU of an article options
Object <optional>
Configuration options: - {String} reco_id: UUID for recommendations API
- {String} tracking_string: (Optional) The first time you call recommendations it's empty. The response will have it then and then you use it for every further call.
-
media:
- {String} cdn: 'mosaic01' or 'mosaic02' (default is 'mosaic01')
-
{Array} image_resolutions: request media image with the different resolutions
(default ['thumbnail', 'medium', 'large']):
- 'thumbnail' – width: 78px
- 'thumbnail_hd' – width: 76px
- 'small' – width: 135px
- 'small_hd' – width: 270px
- 'medium' – width: 300px, height: 400px
- 'medium_sd' – width: 480px
- 'medium_hd' – width: 600px, height: 800px
- 'large' – width: 1100px, height: 1100px
- 'large_hd' – height: 1650px
{ reco_id: 'UUUID', tracking_string: 'SOME_TRACKING_STRING', media: { cdn: 'mosaic02', image_resolutions: ['thumbnail', 'medium'] } }
Returns:
return array of RecommendedArticles objects- Type
- Array.<RecommendedArticles>
Example
const sdk = await AtlasSDK.configure({ client_id: 'CLIENT_ID', sales_channel: 'SALES_CHANNEL', is_sandBox: true }); const recos = await sdk.getRecommendations('AD112B0F6-A11', { reco_id: 'UUID', tracking_string: 'TRACK', media: { cdn: 'mosaic02', image_resolutions: ['thumbnail', 'medium'] } });