-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathISendRepository.cs
More file actions
109 lines (97 loc) · 4.18 KB
/
ISendRepository.cs
File metadata and controls
109 lines (97 loc) · 4.18 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#nullable enable
using Bit.Core.KeyManagement.UserKey;
using Bit.Core.Repositories;
using Bit.Core.Tools.Entities;
namespace Bit.Core.Tools.Repositories;
/// <summary>
/// Service for saving and loading <see cref="Send"/>s in persistent storage.
/// </summary>
public interface ISendRepository : IRepository<Send, Guid>
{
/// <summary>
/// Loads all <see cref="Send"/>s created by a user.
/// </summary>
/// <param name="userId">
/// Identifies the user.
/// </param>
/// <returns>
/// A task that completes once the <see cref="Send"/>s have been loaded.
/// The task's result contains the loaded <see cref="Send"/>s.
/// </returns>
Task<ICollection<Send>> GetManyByUserIdAsync(Guid userId);
/// <summary>
/// Loads all <see cref="Send"/>s owned by an organization.
/// </summary>
/// <param name="organizationId">
/// Identifies the organization.
/// </param>
/// <returns>
/// A task that completes once the <see cref="Send"/>s have been loaded.
/// The task's result contains the loaded <see cref="Send"/>s.
/// </returns>
Task<ICollection<Send>> GetManyByOrganizationIdAsync(Guid organizationId);
/// <summary>
/// Loads <see cref="Send"/>s scheduled for deletion.
/// </summary>
/// <param name="deletionDateBefore">
/// Load sends whose <see cref="Send.DeletionDate" /> is < this date.
/// </param>
/// <returns>
/// A task that completes once the <see cref="Send"/>s have been loaded.
/// The task's result contains the loaded <see cref="Send"/>s.
/// </returns>
Task<ICollection<Send>> GetManyByDeletionDateAsync(DateTime deletionDateBefore);
/// <summary>
/// Loads file-type <see cref="Send"/>s created by a user.
/// </summary>
/// <param name="userId">
/// Identifies the user.
/// </param>
/// <returns>
/// A task that completes once the <see cref="Send"/>s have been loaded.
/// The task's result contains the loaded file-type <see cref="Send"/>s.
/// </returns>
Task<ICollection<Send>> GetManyFileSendsByUserIdAsync(Guid userId);
/// <summary>
/// Loads file-type <see cref="Send"/>s owned by an organization.
/// </summary>
/// <param name="organizationId">
/// Identifies the organization.
/// </param>
/// <returns>
/// A task that completes once the <see cref="Send"/>s have been loaded.
/// The task's result contains the loaded file-type <see cref="Send"/>s.
/// </returns>
Task<ICollection<Send>> GetManyFileSendsByOrganizationIdAsync(Guid organizationId);
/// <summary>
/// Updates encrypted data for sends during a key rotation
/// </summary>
/// <param name="userId">The user that initiated the key rotation</param>
/// <param name="sends">A list of sends with updated data</param>
UpdateEncryptedDataForKeyRotation UpdateForKeyRotation(Guid userId,
IEnumerable<Send> sends);
/// <summary>
/// Updates the 'Disabled' field for Sends by IDs in bulk
/// </summary>
/// <param name="ids">A list of Send IDs to update</param>
/// <param name="disabled">The value to set the 'Disabled' field to</param>
Task UpdateManyDisabledAsync(IEnumerable<Guid> ids, bool disabled);
/// <summary>
/// Fetches the IDs of all <see cref="Send"/>ss of all Users that are members of an Organization
/// </summary>
/// <param name="organizationId">The ID of the organization to fetch Sends for</param>
Task<IEnumerable<Guid>> GetIdsByOrganizationIdAsync(Guid organizationId);
/// <summary>
/// Load <see cref="Send"/>s in bulk by IDs
/// </summary>
/// <param name="ids">The IDs of the <see cref="Send"/>ss to load</param>
/// <returns></returns>
Task<ICollection<Send>> GetManyByIdsAsync(IEnumerable<Guid> ids);
/// <summary>
/// Update <see cref="Send"/> deletion dates in bulk by IDs
/// </summary>
/// <param name="ids">The IDs of the <see cref="Send"/>s to update</param>
/// <param name="deletionHours">The number of hours after the <see cref="Send"/>s' creation dates to set the deletion date</param>
/// <returns></returns>
Task UpdateManyDeletionDatesByIdsAsync(IEnumerable<Guid> ids, int deletionHours);
}