blob: 7eb691b767fcb1e265e54e7a81a33d2706296517 (
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
63
64
65
66
67
68
69
70
71
72
73
74
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Models;
using Timeline.Services.Exceptions;
namespace Timeline.Services
{
[Serializable]
public class InvalidBookmarkException : Exception
{
public InvalidBookmarkException() { }
public InvalidBookmarkException(string message) : base(message) { }
public InvalidBookmarkException(string message, Exception inner) : base(message, inner) { }
protected InvalidBookmarkException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
/// <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>Bookmarks in order.</returns>
/// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
Task<List<TimelineInfo>> GetBookmarks(long userId);
/// <summary>
/// Add a bookmark to tail to a user.
/// </summary>
/// <param name="userId">User id of bookmark owner.</param>
/// <param name="timelineName">Timeline name.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="timelineName"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="timelineName"/> is not a valid name.</exception>
/// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
/// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
Task AddBookmark(long userId, string timelineName);
/// <summary>
/// Remove a bookmark from a user.
/// </summary>
/// <param name="userId">User id of bookmark owner.</param>
/// <param name="timelineName">Timeline name.</param>
/// <returns>True if deletion is performed. False if bookmark does not exist.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="timelineName"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="timelineName"/> is not a valid name.</exception>
/// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
/// <exception cref="TimelineNotExistException">Thrown when timeline does not exist.</exception>
Task<bool> RemoveBookmark(long userId, string timelineName);
/// <summary>
/// Move bookmark to a new position.
/// </summary>
/// <param name="userId">User id of bookmark owner.</param>
/// <param name="timelineName">Timeline name.</param>
/// <param name="position">New position. Starts at 1.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="timelineName"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="timelineName"/> is not a valid name.</exception>
/// <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 MoveBookmark(long userId, string timelineName, long position);
}
public class BookmarkTimelineService
{
}
}
|