npm package: @plasma-platform/service-vendors
Description: Vendors Service API
Author: Anton Nemtsev
Latest version: 2.4.1-alpha.2

![version](https://badgen.net/npm/v/@plasma-platform/service-vendors)
![nextVersion](https://badgen.net/npm/v/@plasma-platform/service-vendors/next)
![downloads](https://badgen.net/npm/dt/@plasma-platform/service-vendors)
![license](https://badgen.net/npm/license/@plasma-platform/service-vendors)
![dependency](https://badgen.net/npm/dependents/@plasma-platform/service-vendors)  

* * *

[Full documentation](https://templatemonster.gitlab.io/PlasmaPlatform/Frontend/plasma-platform/?path=/story/plasma-platform-sdk--service-vendors)  
install:  
`npm i @plasma-platform/service-vendors -S`  

# Short 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)
    -   [getProfileByVendorId](#getprofilebyvendorid)
        -   [Parameters](#parameters-4)
        -   [Examples](#examples-5)
-   [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

### getProfileByVendorId

Get information about specific vendor by vendor id

#### Parameters

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

#### Examples

Get vendor profile by vendor id


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

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