1.2.1 • Published 6 years ago

@plasma-platform/tm-service-reviews v1.2.1

Weekly downloads
-
License
CC-BY-4.0
Repository
gitlab
Last release
6 years ago

Documentation

Table of Contents

ReviewsService

Reviews Micro Service API

Parameters

  • url string service url
  • token (string | null) user access token if available (optional, default null)

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"}} }, ... }

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 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"}} }, ... }

approveReview

Return approve review information for given identifiers.

Parameters

  • token {String} Access token
  • id {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 token
  • id {Number} Review id
  • params {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 token
  • id {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 token
  • id {Number} Review id
  • params {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 token
  • reviewId {Number} ID of the parent review
  • params {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 token
  • id {Number} ID of the comment
  • 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"}} } }

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"}} }, ... }

addComment

Add new QA

Parameters

  • token {String} Access token
  • params {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 token
  • id {Number} Comment id
  • params {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>