New change request abstractions.

This commit is contained in:
Burak Kaan Köse
2024-11-26 20:03:10 +01:00
parent e81b7e2e61
commit a9fffd44d2
38 changed files with 769 additions and 1051 deletions

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Enums;
namespace Wino.Core.Domain.Interfaces
@@ -10,7 +9,7 @@ namespace Wino.Core.Domain.Interfaces
public interface IRequestBundle
{
string BundleId { get; set; }
IRequestBase Request { get; }
IUIChangeRequest UIChangeRequest { get; }
}
/// <summary>
@@ -20,15 +19,25 @@ namespace Wino.Core.Domain.Interfaces
public interface IRequestBundle<TRequest> : IRequestBundle
{
TRequest NativeRequest { get; }
IRequestBase Request { get; }
}
public interface IRequestBase : IClientMessage
public interface IRequestBase : IClientMessage, IUIChangeRequest
{
/// <summary>
/// Synchronizer option to perform.
/// 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.
/// </summary>
MailSynchronizerOperation Operation { get; }
int ResynchronizationDelay { get; }
object GroupingKey();
}
public interface IUIChangeRequest
{
/// <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.
@@ -40,30 +49,18 @@ namespace Wino.Core.Domain.Interfaces
/// Reverts the UI changes applied by <see cref="ApplyUIChanges"/> if the request fails.
/// </summary>
void RevertUIChanges();
/// <summary>
/// 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.
/// </summary>
int ResynchronizationDelay { get; }
}
public interface IRequest : IRequestBase
public interface IMailActionRequest : IRequestBase
{
MailCopy Item { get; }
IBatchChangeRequest CreateBatch(IEnumerable<IRequest> requests);
MailSynchronizerOperation Operation { get; }
}
public interface IFolderRequest : IRequestBase
public interface IFolderActionRequest : IRequestBase
{
MailItemFolder Folder { get; }
}
public interface IBatchChangeRequest : IRequestBase
{
IEnumerable<IRequest> Items { get; }
FolderSynchronizerOperation Operation { get; }
}
}