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]);
Methods
addComment(token, params) → {Object}
Add new QA
Parameters:
Name | Type | Description |
---|---|---|
token |
String | Access token |
params |
Object | Body parameters |
Returns:
{ "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"}} }
- 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 |
Returns:
{ "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"}} } }
- Type
- Object
getReviews(params) → {Object}
Return review information for given identifiers.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Reviews parameters |
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
getReviewsUser(token, params) → {Object}
Return review information for given identifiers. (user mode)
Parameters:
Name | Type | Description |
---|---|---|
token |
String | Access token |
params |
Object | Reviews parameters |
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
getReviewsUser(params) → {Object}
Return vendors reviews for given identifiers.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | Reviews parameters |
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