mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1769] Added JSDocs for services (#2949)
This commit is contained in:
committed by
Eugenio Romano
parent
8bfac2f9f8
commit
9887d8bca4
@@ -28,12 +28,23 @@ export class RatingService {
|
||||
constructor(private apiService: AlfrescoApiService) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current user's rating for a node.
|
||||
* @param nodeId Node to get the rating from
|
||||
* @param ratingType Type of rating (can be "likes" or "fiveStar")
|
||||
*/
|
||||
getRating(nodeId: string, ratingType: any): any {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.ratingsApi.getRating(nodeId, ratingType))
|
||||
.map(res => res)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the current user's rating for a node.
|
||||
* @param nodeId Target node for the rating
|
||||
* @param ratingType Type of rating (can be "likes" or "fiveStar")
|
||||
* @param vote Rating value (boolean for "likes", numeric 0..5 for "fiveStar")
|
||||
*/
|
||||
postRating(nodeId: string, ratingType: any, vote: any): any {
|
||||
let ratingBody: RatingBody = {
|
||||
'id': ratingType,
|
||||
@@ -44,6 +55,11 @@ export class RatingService {
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the current user's rating for a node.
|
||||
* @param nodeId Target node
|
||||
* @param ratingType Type of rating to remove (can be "likes" or "fiveStar")
|
||||
*/
|
||||
deleteRating(nodeId: string, ratingType: any): any {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.ratingsApi.removeRating(nodeId, ratingType))
|
||||
.map(res => res)
|
||||
|
Reference in New Issue
Block a user