Class: Client

Client(optionsopt)

Create a client to perform

Constructor

new Client(optionsopt)

Create an instance of the Bricklin Node Client.
Parameters:
Name Type Attributes Description
options object <optional>
Options that are used to create a new client.
Properties
Name Type Attributes Default Description
token string <optional>
The `TokenValue` from https://www.bricklink.com/v2/api/register_consumer.page
token_secret string <optional>
The `TokenSecret` from https://www.bricklink.com/v2/api/register_consumer.page
consumer_key string <optional>
The `ConsumerKey` from https://www.bricklink.com/v2/api/register_consumer.page
consumer_secret string <optional>
The `ConsumerSecret` from https://www.bricklink.com/v2/api/register_consumer.page
endpoint string <optional>
'https://api.bricklink.com/api/store/v1/' The url of the Bricklink API.
Source:

Classes

Client

Members

_oauth :object

Type:
  • object
Source:

consumer_key :string

Type:
  • string
Source:

consumer_secret :string

Type:
  • string
Source:

endpoint :string

Type:
  • string
Source:

requestQueue :Array.<function()>

Type:
  • Array.<function()>
Source:

token :string

Type:
  • string
Source:

token_secret :string

Type:
  • string
Source:

Methods

dispatch(req) → {Promise}

Performs a bricklink request and the callback upon success.
Parameters:
Name Type Description
req BricklinkRequest The request to perform.
Source:
Returns:
The data that has been return from the API request and any callbacks.
Type
Promise

getCatalogItem(itemType, itemNumber) → {Promise.<CatalogItem>}

Get a catalog item by type and identification number.
Parameters:
Name Type Description
itemType string An item type as can be foud at ItemType.
itemNumber string An item identification number.
Source:
Returns:
A promise that resolves to a catalog item.
Type
Promise.<CatalogItem>

getItemImage(itemType, itemNumber, colorId) → {Promise.<ItemImage>}

Can get an image for a specific image color of a known catalog item.
Parameters:
Name Type Description
itemType string An item type as can be foud at ItemType.
itemNumber string An item identification number.
colorId number The color id of the item.
Source:
Returns:
A promise that resolves to an Item Image.
Type
Promise.<ItemImage>

getItemSubset(itemType, itemNumber, paramsopt) → {Promise.<Array>}

Gets a subset of a catalog item.
Parameters:
Name Type Attributes Description
itemType string An item type as can be foud at ItemType.
itemNumber string An item identification number.
params object <optional>
Options for the price guide as outlined in SubsetOptions.
Source:
Returns:
A promise that resolves to a list of Subset.
Type
Promise.<Array>

getItemSuperset(itemType, itemNumber, paramsopt) → {Promise.<Array>}

Gets a superset of a catalog item.
Parameters:
Name Type Attributes Description
itemType string An item type as can be foud at ItemType.
itemNumber string An item identification number.
params object <optional>
Options for the price guide as outlined in SupersetOptions.
Source:
Returns:
A promise that resolves to a list of Superset.
Type
Promise.<Array>

getKnownColors(itemType, itemNumber) → {Promise.<Array>}

Get known colors for a catalog item.
Parameters:
Name Type Description
itemType string An item type as can be foud at ItemType.
itemNumber string An item identification number.
Source:
Returns:
A promise that resolves to a list of KnownColor.
Type
Promise.<Array>

getPriceGuide(itemType, itemNumber, params) → {Promise.<PriceGuide>}

Get the price guide for a given catalog item.
Parameters:
Name Type Description
itemType string An item type as can be foud at ItemType.
itemNumber string An item identification number.
params object Options for the price guide as outlined in PriceGuideOptions.
Source:
Returns:
A promise that resolves to a price guide.
Type
Promise.<PriceGuide>

send(req) → {Promise}

Performs a concurrent-safe bricklink request and the callback upon success.
Parameters:
Name Type Description
req BricklinkRequest The request to perform.
Source:
Returns:
The data that has been return from the API request and any callbacks.
Type
Promise