Files
Wino-Mail/Wino.Core.Domain/Interfaces/IRequestBundle.cs

67 lines
2.1 KiB
C#
Raw Normal View History

2024-11-26 20:03:10 +01:00
using Wino.Core.Domain.Entities.Mail;
2024-04-18 01:44:37 +02:00
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
{
/// <summary>
/// Represents a group of requests.
/// </summary>
public interface IRequestBundle
{
string BundleId { get; set; }
2024-11-26 20:03:10 +01:00
IUIChangeRequest UIChangeRequest { get; }
2024-04-18 01:44:37 +02:00
}
/// <summary>
/// Represents a group of requests with their native response types.
/// </summary>
/// <typeparam name="TRequest">Native request type from each synchronizer to store.</typeparam>
public interface IRequestBundle<TRequest> : IRequestBundle
{
TRequest NativeRequest { get; }
2024-11-26 20:03:10 +01:00
IRequestBase Request { get; }
2024-04-18 01:44:37 +02:00
}
2024-11-26 20:03:10 +01:00
public interface IRequestBase : IClientMessage, IUIChangeRequest
2024-04-18 01:44:37 +02:00
{
/// <summary>
2024-11-26 20:03:10 +01:00
/// Whether synchronizations should be delayed after executing this request.
/// Specially Outlook sometimes don't report changes back immidiately after sending the API request.
/// This results following synchronization to miss the changes.
/// We add small delay for the following synchronization after executing current requests to overcome this issue.
/// Default is false.
2024-04-18 01:44:37 +02:00
/// </summary>
2024-11-26 20:03:10 +01:00
int ResynchronizationDelay { get; }
2024-04-18 01:44:37 +02:00
2024-11-26 20:03:10 +01:00
object GroupingKey();
}
public interface IUIChangeRequest
{
2024-04-18 01:44:37 +02:00
/// <summary>
/// UI changes to apply to the item before sending the request to the server.
/// Changes here only affect the UI, not the item itself.
/// Changes here are reverted if the request fails by calling <see cref="RevertUIChanges"/>.
/// </summary>
void ApplyUIChanges();
/// <summary>
/// Reverts the UI changes applied by <see cref="ApplyUIChanges"/> if the request fails.
/// </summary>
void RevertUIChanges();
}
2024-11-26 20:03:10 +01:00
public interface IMailActionRequest : IRequestBase
2024-04-18 01:44:37 +02:00
{
MailCopy Item { get; }
2024-11-26 20:03:10 +01:00
MailSynchronizerOperation Operation { get; }
2024-04-18 01:44:37 +02:00
}
2024-11-26 20:03:10 +01:00
public interface IFolderActionRequest : IRequestBase
2024-04-18 01:44:37 +02:00
{
MailItemFolder Folder { get; }
2024-11-26 20:03:10 +01:00
FolderSynchronizerOperation Operation { get; }
2024-04-18 01:44:37 +02:00
}
}