@plasma-platform/service-reviews
v1.8.0
Published
Reviews service api
Downloads
21
Readme
Full documentation
install:npm i @plasma-platform/service-reviews -S
Short documentation
Table of Contents
- ReviewsService
- getReviews
- getReviewsDesiredLocale
- checkReviewsUserCount
- getReviewsUser
- getReviewsVendor
- approveReview
- completeReview
- declineReview
- addReviewVote
- replayTheReview
- requestReviewComments
- voteComments
- getComments
- getCommentsUser
- getCommentsUser
- addComment
- addCommentVote
- getReviewsMetadata
- getReviewInfoById
- checkCommentsCount
ReviewsService
Reviews Micro Service API
Parameters
getReviews
Return review information for given identifiers.
Parameters
params
{Object} Reviews parameters
Returns Object { "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"}} }, ...] }
getReviewsDesiredLocale
Return review information for given identifiers.
Parameters
params
{Object} Reviews parameters: desiredLocale, template_id, page, 'per-page', expand, sort etc.
Returns Object { "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"}} }, ...] }
checkReviewsUserCount
Return review head information for given identifiers. (user mode)
Parameters
params
{Object} Reviews parameters
Returns Object { "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"}} }, ...] }
getReviewsUser
Return review information for given identifiers. (user mode)
Parameters
params
{Object} Reviews parameters
Returns Object { "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"}} }, ...] }
getReviewsVendor
Return vendors reviews for given identifiers.
Parameters
params
{Object} Reviews parametersheaders
{Object} Reviews headers
Returns Object { "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"}} }, ...] }
approveReview
Return approve review information for given identifiers.
Parameters
token
{String} Access tokenid
{Number} Review id
Returns Object { "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"}} } }
completeReview
Return complete review information for given identifiers.
Parameters
token
{String} Access tokenid
{Number} Review idparams
{Object} Reviews parameters
Returns Object { "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"}} } }
declineReview
Return decline review information for given identifiers.
Parameters
token
{String} Access tokenid
{Number} Review id
Returns Object { "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"}} } }
addReviewVote
Return added votes for the review: increment vote_up or vote_down field.
Parameters
token
{String} Access tokenid
{Number} Review idparams
{Object} Reviews votes parameters
Returns Object { "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"}} } }
replayTheReview
Return reply of the review information for given identifiers.
Parameters
token
{String} Access tokenreviewId
{Number} ID of the parent reviewparams
{Object} Body parameters
Returns Object { "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"}} } }
requestReviewComments
Return request review comments list.
Parameters
reviewId
{Number} ID of the parent review
Returns Object { "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"}} } }
voteComments
Return votes of the review.
Parameters
token
{String} Access tokenid
{Number} ID of the commentreviewId
{Number} ID of the parent review
Returns Object { "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"}} } }
getComments
Return comments information for given identifiers.
Parameters
params
{Object} Comments parameters
Returns Object { "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"}} }, ...] }
getCommentsUser
Return users comments information for given identifiers.
Parameters
params
{Object} Comments parameters
Returns Object { "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"}} }, ...] }
getCommentsUser
Return authors comments information for given identifiers.
addComment
Add new QA
Parameters
token
{String} Access tokenparams
{Object} Body parameters
Returns Object { "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"}} }
addCommentVote
Return added votes for the comment: increment vote_up or vote_down field.
Parameters
token
{String} Access tokenid
{Number} Comment idparams
{Object} Comment votes parameters
Returns Object { "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"}} } }
getReviewsMetadata
Get reviews metadata
Parameters
params
{Object} parameters
Examples
* @returns {Object} <pre>{
"headers":
{
"totalCount": 1}
}</pre>
getReviewInfoById
Get review info by id
Parameters
reviewId
{Object} review id
checkCommentsCount
Return count of unreplied comments.