npm package: @plasma-platform/tm-service-reviews
Description: Reviews service api
Author: Vira Peretiatko
Latest version: 1.2.1

# 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>
```