diff options
author | crupest <crupest@outlook.com> | 2021-04-29 19:29:35 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-04-29 19:29:35 +0800 |
commit | bf4c48980f81e566065c07f3fe534ce7551ebdcc (patch) | |
tree | b34c57efd216c5b94845a298ffcb7480d773784c /BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs | |
parent | fc9eb47119dd33d67c1e4daba18608bfb3355f54 (diff) | |
download | timeline-bf4c48980f81e566065c07f3fe534ce7551ebdcc.tar.gz timeline-bf4c48980f81e566065c07f3fe534ce7551ebdcc.tar.bz2 timeline-bf4c48980f81e566065c07f3fe534ce7551ebdcc.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs')
-rw-r--r-- | BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs b/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs new file mode 100644 index 00000000..18feee54 --- /dev/null +++ b/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic;
+using System.Threading.Tasks;
+using Timeline.Services.Timeline;
+using Timeline.Services.User;
+
+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="UserNotExistException">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="UserNotExistException">Throw if user does not exist and <paramref name="checkUserExistence"/> is true.</exception>
+ /// <exception cref="TimelineNotExistException">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="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="TimelineNotExistException">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="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="TimelineNotExistException">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="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
+ /// <exception cref="InvalidBookmarkException">Thrown when the timeline is not a bookmark.</exception>
+ Task MoveBookmarkAsync(long userId, long timelineId, long newPosition);
+ }
+}
|