npm package: @plasma-platform/tm-service-vendors
Description: Vendors Service API
Author: Anton Nemtsev
Latest version: 2.0.3

# Documentation

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [VendorsService](#vendorsservice)
    -   [Parameters](#parameters)
    -   [messages](#messages)
    -   [getList](#getlist)
        -   [Parameters](#parameters-1)
        -   [Examples](#examples)
    -   [getListCount](#getlistcount)
        -   [Examples](#examples-1)
    -   [getProfile](#getprofile)
        -   [Examples](#examples-2)
    -   [getProfileById](#getprofilebyid)
        -   [Parameters](#parameters-2)
        -   [Examples](#examples-3)
    -   [getProfileByNickname](#getprofilebynickname)
        -   [Parameters](#parameters-3)
        -   [Examples](#examples-4)
-   [Array](#array)
    -   [Properties](#properties)
-   [Vendor](#vendor)
    -   [Properties](#properties-1)

## VendorsService

-   **See: <http://authors.templatemonster.com/doc/>**

Vendors Micro Service API

### Parameters

-   `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** service url
-   `token` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null)** user access tocken if available (optional, default `null`)

### messages

Object with class service messages

Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

### getList

Get vendors list

#### Parameters

-   `sortBy` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sort by field (optional, default `'rating'`)
-   `sortAsc` **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** ascending sorting (optional, default `true`)
-   `page` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** page number (optional, default `1`)
-   `nickname` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** search by nickname (optional, default `''`)

#### Examples

_Get vendors list_

```javascript
(async () => {
  const Vendors = new VendorsService('//api.templatemonster.com/authors/v1/');
  const items = await Vendors.getList();
})();
```

Returns **VendorsList** array of posts

### getListCount

Get vendors count

#### Examples

_Get vendors list count_

```javascript
(async () => {
  const Vendors = new VendorsService('//api.templatemonster.com/authors/v1/');
  const count = await Vendors.getListCount();
})();
```

Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** vendors count

### getProfile

Get information about current vendor

#### Examples

_Get vendor details_

```javascript
(async () => {
  const Vendors = new VendorsService('//api.templatemonster.com/authors/v1/');
  const details = await Vendors.getProfile();
})();
```

Returns **[Vendor](#vendor)** vendor details

### getProfileById

Get information about specific vendor by id

#### Parameters

-   `id` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** post id

#### Examples

_Get vendor profile by id_

```javascript
(async () => {
  const Vendors = new VendorsService('//api.templatemonster.com/authors/v1/');
  const details = await Vendors.getProfileById(2);
})();
```

Returns **[Vendor](#vendor)** vendor details

### getProfileByNickname

Get information about specific vendor by nickname

#### Parameters

-   `nickname` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** vendor nickname

#### Examples

_Get vendor profile by nickname_

```javascript
(async () => {
  const Vendors = new VendorsService('//api.templatemonster.com/authors/v1/');
  const details = await Vendors.getProfileByNickname('nickname');
})();
```

Returns **[Vendor](#vendor)** vendor details

## Array

Vendors list object

Type: VendorsList

### Properties

-   `null-null` **[Array](#array)&lt;[Vendor](#vendor)>** array of vendors

## Vendor

Vendor object

Type: [Vendor](#vendor)

### Properties

-   `id` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** vendor id
-   `nickname` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** vendor nickname
-   `country` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** author country (2 char code)
-   `nickname` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** vendor nickname
-   `cover` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** url to author cover image
-   `avatar` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** url to author avatar image
-   `rating` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** author total rating
-   `designQualityIndex` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Design Quality Index
-   `supportQualityIndex` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Support Quality Index (don't use it at the moment)
-   `userReviewsRatings` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** User Reviews Rating
-   `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** author description
-   `user_id` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** author user ID (required)
-   `exclusive_percent` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** revenue percent of exclusive sales per item
-   `regular_percent` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** revenue percent of regular sales per item
-   `is_trusted` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 1 if trusted either 0
-   `is_internal` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 1 if is TM vendor and 0 if external vendor
-   `socialAccounts` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** social accounts (additional field)
-   `supportOptions` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** support options (additional field)
-   `_links` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** HATEOAS links
-   `products` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** products count
-   `sales` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** sales count
-   `created_at` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** creation timestamp
-   `updated_at` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** update timestamp