use of org.icij.datashare.UserEvent.Type in project datashare by ICIJ.
the class UserResource method getUserHistory.
/**
* Gets the user's history by type
*
* @param type
* @param from
* @param size
* @return 200, the user's list of events and the total number of events
*
* Example :
* $(curl -i localhost:8080/api/users/me/history?type=document&from=0&size=10)
*/
@Get("/me/history?type=:type&from=:from&size=:size")
public WebResponse<UserEvent> getUserHistory(String type, int from, int size, Context context) {
DatashareUser user = (DatashareUser) context.currentUser();
Type eventType = Type.valueOf(type.toUpperCase());
return new WebResponse<>(repository.getUserEvents(user, eventType, from, size), repository.getTotalUserEvents(user, eventType));
}
Aggregations