aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs
blob: 468a885b567b94c6ee54307332f6611a57a3f2cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Timeline.Services.Api
{
    /// <summary>
    /// Service interface that manages timeline bookmarks.
    /// </summary>
    public interface IBookmarkTimelineService
    {
        /// <summary>
        /// Get bookmarks of a user.
        /// </summary>
        /// <param name="userId">User id of bookmark owner.</param>
        /// <returns>Id of Bookmark timelines in order.</returns>
        /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
        Task<List<long>> GetBookmarksAsync(long userId);

        /// <summary>
        /// Check if a timeline is a bookmark.
        /// </summary>
        /// <param name="userId">The user id.</param>
        /// <param name="timelineId">Timeline id.</param>
        /// <param name="checkUserExistence">If true it will throw when user does not exist.</param>
        /// <param name="checkTimelineExistence">If true it will throw when timeline does not exist.</param>
        /// <returns>True if timeline is a bookmark. Otherwise false.</returns>
        /// <exception cref="EntityNotExistException">Throw if user does not exist and <paramref name="checkUserExistence"/> is true.</exception>
        /// <exception cref="EntityNotExistException">Thrown if timeline does not exist and <paramref name="checkTimelineExistence"/> is true.</exception>
        Task<bool> IsBookmarkAsync(long userId, long timelineId, bool checkUserExistence = true, bool checkTimelineExistence = true);

        /// <summary>
        /// Add a bookmark to tail to a user.
        /// </summary>
        /// <param name="userId">User id of bookmark owner.</param>
        /// <param name="timelineId">Timeline id.</param>
        /// <returns>True if timeline is added to bookmark. False if it already is.</returns>
        /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
        /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
        Task<bool> AddBookmarkAsync(long userId, long timelineId);

        /// <summary>
        /// Remove a bookmark from a user.
        /// </summary>
        /// <param name="userId">User id of bookmark owner.</param>
        /// <param name="timelineId">Timeline id.</param>
        /// <returns>True if deletion is performed. False if bookmark does not exist.</returns>
        /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
        /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
        Task<bool> RemoveBookmarkAsync(long userId, long timelineId);

        /// <summary>
        /// Move bookmark to a new position.
        /// </summary>
        /// <param name="userId">User id of bookmark owner.</param>
        /// <param name="timelineId">Timeline name.</param>
        /// <param name="newPosition">New position. Starts at 1.</param>
        /// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
        /// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
        /// <exception cref="EntityNotExistException">Thrown when the timeline is not a bookmark.</exception>
        Task MoveBookmarkAsync(long userId, long timelineId, long newPosition);
    }
}