API Docs for: 2.0.1
Show:

Client Class

DeviceAtlas Cloud API.

This client library can be used to easily get device data from the DeviceAtlas Cloud service. To reduce cloud calls and improve performance the API locally caches the data returned from the cloud service. This API caches data in memory and on the disk.

Constructor

Client

(
  • config
)

Parameters:

  • config Config
    • An instance of DeviceAtlas Cloud API configuration

Methods

getProperties

(
  • headers
  • [clientSideString]
)
Promise<Object>

Gets the device data for the provided headers and Client-side string from DeviceAtlas Cloud.

Once data has been returned from DeviceAtlas Cloud it can be cached locally to speed up subsequent requests. If device data provided by "DeviceAtlas Client Side Component" exists in a cookie then cloud data will be merged with the cookie data.

If en error occurs during device identification the returned object will contain an "error" key e.g.

    {"error": "Error message"}

Parameters:

  • headers Object.

    A set of HTTP headers

  • [clientSideString] String optional

    A client-side component string

Returns:

Promise<Object>:

A promise that contains a list of detected properties.

getPropertiesFromRequest

(
  • request
)
Promise<Object>

Gets the device data for the provided request from DeviceAtlas Cloud.

Once data has been returned from DeviceAtlas Cloud it can be cached locally to speed up subsequent requests. If device data provided by "DeviceAtlas Client Side Component" exists in a cookie then cloud data will be merged with the cookie data.

If en error occurs during device identification the returned object will contain an "error" key e.g.

    {"error": "Error message"}

Parameters:

  • request Request

    A request object

Returns:

Promise<Object>:

A promise that contains a list of detected properties.

getVersion

()

Gets the API version.

Returns:

string