Class RatingAPI


  • public class RatingAPI
    extends BaseAPI
    Many objects can be rated including items and status messages. Ratings can be of different types and have different values.
    See Also:
    RatingType, RatingValue
    • Constructor Detail

    • Method Detail

      • createRating

        public int createRating​(Reference reference,
                                RatingType type,
                                int value)
        Add a new rating of the user to the object. The rating can be one of many different types. For more details see the area. Ratings can be changed by posting a new rating, and deleted by doing a DELETE.
        Parameters:
        reference - The reference to the object the rating should be created on
        type - The type of the rating
        value - The value for the rating
        Returns:
        The id of the newly created rating
        See Also:
        RatingValue
      • deleteRating

        public void deleteRating​(Reference reference,
                                 RatingType type)
        Deletes the rating of the given type on the object by the active user
        Parameters:
        reference - The reference ot the object
        type - The type of the rating
      • like

        public int like​(Reference reference)
        Indicates that the active user likes the object
        Parameters:
        reference - The reference to the object that should be liked
        Returns:
        The id of the newly created rating
      • yes

        public int yes​(Reference reference)
        Indicates that the active user says "yes" to the object
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • no

        public int no​(Reference reference)
        Indicates that the active user says "no" to the object
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • approves

        public int approves​(Reference reference)
        Indicates that the active user approves the object
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • disapproves

        public int disapproves​(Reference reference)
        Indicates that the active user disapproves the object
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • fivestar

        public int fivestar​(Reference reference,
                            int stars)
        Give a five star rating of the object
        Parameters:
        reference - The reference to the object
        stars - The number of stars to give, between 1 and 5
        Returns:
        The id of the newly created rating
      • attend

        public int attend​(Reference reference)
        Indicates that the active user will attend
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • maybeAttend

        public int maybeAttend​(Reference reference)
        Indicates that the active user will maybe attend
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • notAttend

        public int notAttend​(Reference reference)
        Indicates that the active user will not attend
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • thumbsUp

        public int thumbsUp​(Reference reference)
        Indicates that the active user give thumbs up to the object
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • thumbsDown

        public int thumbsDown​(Reference reference)
        Indicates that the active user give thumbs down to the object
        Parameters:
        reference - The reference to the object
        Returns:
        The id of the newly created rating
      • getAllRatings

        public RatingValuesMap getAllRatings​(Reference reference)
        Returns all the ratings for the given object. It will only return the ratings that are enabled for the object.
        Parameters:
        reference - The reference to the object to get ratings for
        Returns:
        The map of rating types and their values
      • getRatings

        public TypeRating getRatings​(Reference reference,
                                     RatingType type)
        Get the rating average (for fivestar) and totals for the given rating type on the specified object.
        Parameters:
        reference - The reference to the object to get ratings for
        type - The type of rating to return
        Returns:
        The ratings for the type
      • getRating

        public int getRating​(Reference reference,
                             RatingType type,
                             int userId)
        Returns the rating value for the given rating type, object and user.
        Parameters:
        reference - The reference to the object to get ratings for
        type - The type of rating to return
        userId - The id of the user for which to return the rating for
        Returns:
        The value of the rating