# @plasma-platform/tm-service-reviews

> Reviews service api

Latest version **1.2.1** (published 2018-10-30) · CC-BY-4.0 license · 0 weekly downloads

## Install

```sh
npm install @plasma-platform/tm-service-reviews
pnpm add @plasma-platform/tm-service-reviews
yarn add @plasma-platform/tm-service-reviews
bun add @plasma-platform/tm-service-reviews
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2018-10-30 |
| First published | 2018-06-12 |
| Weekly downloads | 0 |
| License | CC-BY-4.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 16 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vira Peretiatko |
| Maintainers | akond, arnie_petrosian, balaniuk, ch-tm, kyrylovoronoi, lven, mice-tm, shaggrath, silentimp, stevenreed, viram |
| Keywords | TM Micro Service, Template Monster, API |

## Links

- npm: https://www.npmjs.com/package/@plasma-platform/tm-service-reviews
- Repository: git@gitlab.com:TemplateMonster/PlasmaPlatform/Frontend/tm-service-reviews
- npm.io page: https://npm.io/package/@plasma-platform/tm-service-reviews

## Dependencies (16)

- [husky](https://npm.io/package/husky.md) ^0.14.3
- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.1
- [babel-cli](https://npm.io/package/babel-cli.md) ^6.24.1
- [urlencode](https://npm.io/package/urlencode.md) ^1.1.0
- [babel-core](https://npm.io/package/babel-core.md) ^6.24.1
- [npm-run-all](https://npm.io/package/npm-run-all.md) ^4.1.1
- [babel-minify](https://npm.io/package/babel-minify.md) ^0.2.0
- [babel-preset-env](https://npm.io/package/babel-preset-env.md) ^1.5.2
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1
- [plasma-serialize](https://npm.io/package/plasma-serialize.md) ^1.0.4
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) ^6.24.1
- [@plasma-platform/tm-css](https://npm.io/package/@plasma-platform/tm-css.md) ^1.8.0
- [babel-plugin-es6-promise](https://npm.io/package/babel-plugin-es6-promise.md) ^1.1.1
- [@plasma-platform/tm-service-api](https://npm.io/package/@plasma-platform/tm-service-api.md) ^2.3.2
- [@plasma-platform/tm-message-hook](https://npm.io/package/@plasma-platform/tm-message-hook.md) ^2.0.12

## Recent versions

- 1.2.1 (latest) — 2018-10-30
- 1.1.0-0 (next) — 2018-08-15
- 1.2.0 — 2018-10-26
- 1.1.0 — 2018-08-17
- 2.0.0-0 — 2018-08-15
- 1.0.7 — 2018-08-02
- 1.0.6 — 2018-08-01
- 1.0.7-0 — 2018-06-19
- 1.0.5 — 2018-06-14
- 1.0.5-0 — 2018-06-14
- 1.0.0 — 2018-06-12

## README

# Documentation

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

### Table of Contents

-   [ReviewsService](#reviewsservice)
-   [getReviews](#getreviews)
-   [getReviewsUser](#getreviewsuser)
-   [getReviewsVendor](#getreviewsvendor)
-   [approveReview](#approvereview)
-   [completeReview](#completereview)
-   [declineReview](#declinereview)
-   [addReviewVote](#addreviewvote)
-   [replayTheReview](#replaythereview)
-   [requestReviewComments](#requestreviewcomments)
-   [voteComments](#votecomments)
-   [getComments](#getcomments)
-   [getCommentsUser](#getcommentsuser)
-   [addComment](#addcomment)
-   [addCommentVote](#addcommentvote)
-   [getReviewsMetadata](#getreviewsmetadata)

## ReviewsService

Reviews 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 token if available (optional, default `null`)

## getReviews

Return review information for given identifiers.

**Parameters**

-   `params`  {Object} Reviews parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"currentPageIndex":1,
"totalCount":11,
"lastPageIndex":6,
"items": [
 {
   "id":23,
   "status":4,
   "user_id":21543,
   "user_name":"mice mice",
   "title":"review title",
   "content":"review content",
   "score":5,
   "template_id":58444,
   "vote_up":0,
   "vote_down":0,
   "_links":{"self":{"href":"http://service-reviews.dev/api/v1/reviews/23"}}
  }, ...]
 }</pre>

## getReviewsUser

Return review information for given identifiers. (user mode)

**Parameters**

-   `params`  {Object} Reviews parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"currentPageIndex":1,
"totalCount":11,
"lastPageIndex":6,
"items": [
 {
   "id":23,
   "status":4,
   "user_id":21543,
   "user_name":"mice mice",
   "title":"review title",
   "content":"review content",
   "score":5,
   "template_id":58444,
   "vote_up":0,
   "vote_down":0,
   "_links":{"self":{"href":"http://service-reviews.dev/api/v1/reviews/23"}}
  }, ...]
 }</pre>

## getReviewsVendor

Return vendors reviews for given identifiers.

**Parameters**

-   `params`  {Object} Reviews parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"currentPageIndex":1,
"totalCount":11,
"lastPageIndex":6,
"items": [
 {
   "id":23,
   "status":4,
   "user_id":21543,
   "user_name":"mice mice",
   "title":"review title",
   "content":"review content",
   "score":5,
   "template_id":58444,
   "vote_up":0,
   "vote_down":0,
   "_links":{"self":{"href":"http://service-reviews.dev/api/v1/reviews/23"}}
  }, ...]
 }</pre>

## approveReview

Return approve review information for given identifiers.

**Parameters**

-   `token`  {String} Access token
-   `id`  {Number} Review id

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
    "id": 1,
    "title": "Really good. Html is better than cms",
    "content": "I had font problem with flash cms. Now I have no problem with html",
    "score": 5,
    "created_at": 1469607948519,
    "user_id": 123,
    "template_id": 12345,
    "status": "initial",
    "vote_up": 1,
    "vote_down": 0,
    "_links": {"self":{"href":"http://service-reviews.dev/api/v1/reviews/1"}}
  }
 }</pre>

## completeReview

Return complete review information for given identifiers.

**Parameters**

-   `token`  {String} Access token
-   `id`  {Number} Review id
-   `params`  {Object} Reviews parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
    "id": 1,
    "title": "Really good. Html is better than cms",
    "content": "I had font problem with flash cms. Now I have no problem with html",
    "score": 5,
    "created_at": 1469607948519,
    "user_id": 123,
    "template_id": 12345,
    "status": "initial",
    "vote_up": 1,
    "vote_down": 0,
    "_links": {"self":{"href":"http://service-reviews.dev/api/v1/reviews/1"}}
  }
 }</pre>

## declineReview

Return decline review information for given identifiers.

**Parameters**

-   `token`  {String} Access token
-   `id`  {Number} Review id

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
    "id": 1,
    "title": "Really good. Html is better than cms",
    "content": "I had font problem with flash cms. Now I have no problem with html",
    "score": 5,
    "created_at": 1469607948519,
    "user_id": 123,
    "template_id": 12345,
    "status": "initial",
    "vote_up": 1,
    "vote_down": 0,
    "_links": {"self":{"href":"http://service-reviews.dev/api/v1/reviews/1"}}
  }
 }</pre>

## addReviewVote

Return added votes for the review: increment vote_up or vote_down field.

**Parameters**

-   `token`  {String} Access token
-   `id`  {Number} Review id
-   `params`  {Object} Reviews votes parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
    "id": 1,
    "title": "Really good. Html is better than cms",
    "content": "I had font problem with flash cms. Now I have no problem with html",
    "score": 5,
    "created_at": 1469607948519,
    "user_id": 123,
    "template_id": 12345,
    "status": "initial",
    "vote_up": 1,
    "vote_down": 0,
    "_links": {"self":{"href":"http://service-reviews.dev/api/v1/reviews/1"}}
  }
 }</pre>

## replayTheReview

Return reply of the review information for given identifiers.

**Parameters**

-   `token`  {String} Access token
-   `reviewId`  {Number} ID of the parent review
-   `params`  {Object} Body parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
  "id": 1,
  "review_id": 1,
  "content": "I had font problem with flash cms. Now I have no problem with html",
  "created_at": 1469607948519,
  "user_id": 123,
  "vote_up": 0,
  "vote_down": 0,
  "_links": {"self":{"href":"http://service-reviews.dev/api/v1/reviews/1/comment/1"}}
  }
 }</pre>

## requestReviewComments

Return request review comments list.

**Parameters**

-   `reviewId`  {Number} ID of the parent review

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
  "id": 1,
  "review_id": 1,
  "content": "I had font problem with flash cms. Now I have no problem with html",
  "created_at": 1469607948519,
  "user_id": 123,
  "vote_up": 0,
  "vote_down": 0,
  "_links": {"self":{"href":"http://service-reviews.dev/api/v1/reviews/1/comment/1"}}
  }
 }</pre>

## voteComments

Return votes of the review.

**Parameters**

-   `token`  {String} Access token
-   `id`  {Number} ID of the comment
-   `reviewId`  {Number} ID of the parent review

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {

  "id": 1,
  "review_id": 1,
  "content": "I had font problem with flash cms. Now I have no problem with html",
  "created_at": 1469607948519,
  "user_id": 123,
  "vote_up": 0,
  "vote_down": 0,
  "_links": {"self":{"href":"http://service-reviews.dev/api/v1/reviews/1/comment/1"}}
  }
 }</pre>

## getComments

Return comments information for given identifiers.

**Parameters**

-   `params`  {Object} Comments parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"currentPageIndex":1,
"totalCount":11,
"lastPageIndex":6,
"items": [
 {
   "id":23,
   "status":4,
   "user_id":21543,
   "user_name":"mice mice",
   "title":"comment title",
   "content":"comment content",
   "template_id":58444,
   "vote_up":0,
   "vote_down":0,
   "created_at": 1469607948519,
   "updated_at": 1469607948519,
   "author": "user",
   "_links":{"self":{"href":"http://service-reviews.dev/api/v1/reviews/23"}}
  }, ...]
 }</pre>

## getCommentsUser

Return users comments information for given identifiers.

**Parameters**

-   `params`  {Object} Comments parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"currentPageIndex":1,
"totalCount":11,
"lastPageIndex":6,
"items": [
 {
   "id":23,
   "status":4,
   "user_id":21543,
   "user_name":"mice mice",
   "title":"comment title",
   "content":"comment content",
   "template_id":58444,
   "vote_up":0,
   "vote_down":0,
   "created_at": 1469607948519,
   "updated_at": 1469607948519,
   "author": "user",
   "_links":{"self":{"href":"http://service-reviews.dev/api/v1/reviews/23"}}
  }, ...]
 }</pre>

## addComment

Add new QA

**Parameters**

-   `token`  {String} Access token
-   `params`  {Object} Body parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
    "id": 1,
    "status": "pending",
    "user_id": 12345,
    "user_name": "John Doe",
    "user_email": "jho***@gmail.com",
    "content": "I had font problem with flash cms. Now I have no problem with html",
    "template_id": 55555,
    "created_at": 1469607948519,
    "updated_at": 1469607948519,
    "vote_up": 0,
    "vote_down": 0,
    "locale": "en",
    "author": "moderator"
    "_links": {"self":{"href":"http://service-reviews.dev/api/v1/qas/1"}}
 }</pre>

## addCommentVote

Return added votes for the comment: increment vote_up or vote_down field.

**Parameters**

-   `token`  {String} Access token
-   `id`  {Number} Comment id
-   `params`  {Object} Comment votes parameters

Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** <pre>{
"canModerate": 1,
"items":
 {
     "id": 1,
     "status": "pending",
     "user_id": 12345,
     "user_name": "John Doe",
     "user_email": "jho***@gmail.com",
     "content": "I had font problem with flash cms. Now I have no problem with html",
     "template_id": 55555,
     "created_at": 1469607948519,
     "updated_at": 1469607948519,
     "vote_up": 0,
     "vote_down": 0,
     "locale": "en",
     "author": "moderator"
     "_links": {"self":{"href":"http://service-reviews.dev/api/v1/qas/1"}}
  }
 }</pre>

## getReviewsMetadata

Get reviews metadata

**Parameters**

-   `params`  {Object} parameters

**Examples**

```javascript
* @returns {Object} <pre>{
"headers":
 {
   "totalCount": 1}
 }</pre>
```

---
_Source: https://npm.io/package/@plasma-platform/tm-service-reviews · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
