Class: Reviews

Reviews

new Reviews()

Reviews API JS client.

In order to use Reviews API you should create an instance of this class.

import Reviews from "tm-reviews-api-client-js";
const reviews = new Reviews ('http://api.templatemonster.com/reviews/v1', 'en');
const list = reviews.getReviews ([12345, 55555]);
Source:

Methods

addReviewVote(token, id) → {Object}

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

Parameters:
Name Type Description
token String

Access token

id Number

Review id

Source:
Returns:
{
"canModerate": 1,
"item":
 {
    "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"}}
  }
 }
Type
Object

approveReview(token, id) → {Object}

Return approve review information for given identifiers.

Parameters:
Name Type Description
token String

Access token

id Number

Review id

Source:
Returns:
{
"canModerate": 1,
"item":
 {
    "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"}}
  }
 }
Type
Object

completeReview(token, id) → {Object}

Return complete review information for given identifiers.

Parameters:
Name Type Description
token String

Access token

id Number

Review id

Source:
Returns:
{
"canModerate": 1,
"item":
 {
    "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"}}
  }
 }
Type
Object

declineReview(token, id) → {Object}

Return decline review information for given identifiers.

Parameters:
Name Type Description
token String

Access token

id Number

Review id

Source:
Returns:
{
"canModerate": 1,
"item":
 {
    "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"}}
  }
 }
Type
Object

getReviews(params) → {Object}

Return review information for given identifiers.

Parameters:
Name Type Description
params Object

Reviews parameters

Source:
Returns:
{
"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"}}
  }, ...]
 }
Type
Object

replayTheReview(token, review_id) → {Object}

Return reply of the review information for given identifiers.

Parameters:
Name Type Description
token String

Access token

review_id Number

ID of the parent review

Source:
Returns:
{
"canModerate": 1,
"item":
 {
  "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"}}
  }
 }
Type
Object

requestReviewComments(review_id) → {Object}

Return request review comments list.

Parameters:
Name Type Description
review_id Number

ID of the parent review

Source:
Returns:
{
"canModerate": 1,
"item":
 {
  "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"}}
  }
 }
Type
Object

voteComments(token, id, review_id) → {Object}

Return votes of the review.

Parameters:
Name Type Description
token String

Access token

id Number

ID of the comment

review_id Number

ID of the parent review

Source:
Returns:
{
"canModerate": 1,
"item":
 {

  "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"}}
  }
 }
Type
Object