Initial commit.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Synchronization
|
||||
{
|
||||
public class SynchronizationOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique id of synchronization.
|
||||
/// </summary>
|
||||
public Guid Id { get; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Account to execute synchronization for.
|
||||
/// </summary>
|
||||
public Guid AccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of the synchronization to be performed.
|
||||
/// </summary>
|
||||
public SynchronizationType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Collection of FolderId to perform SynchronizationType.Custom type sync.
|
||||
/// </summary>
|
||||
public List<Guid> SynchronizationFolderIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A listener to be notified about the progress of the synchronization.
|
||||
/// </summary>
|
||||
public ISynchronizationProgress ProgressListener { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When doing a linked inbox synchronization, we must ignore reporting completion to the caller for each folder.
|
||||
/// This Id will help tracking that. Id is unique, but this one can be the same for all sync requests
|
||||
/// inside the same linked inbox sync.
|
||||
/// </summary>
|
||||
public Guid? GroupedSynchronizationTrackingId { get; set; }
|
||||
|
||||
public override string ToString() => $"Type: {Type}, Folders: {(SynchronizationFolderIds == null ? "None" : string.Join(",", SynchronizationFolderIds))}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Synchronization
|
||||
{
|
||||
public class SynchronizationResult
|
||||
{
|
||||
protected SynchronizationResult() { }
|
||||
|
||||
public IEnumerable<IMailItem> DownloadedMessages { get; set; } = new List<IMailItem>();
|
||||
public SynchronizationCompletedState CompletedState { get; set; }
|
||||
|
||||
public static SynchronizationResult Empty => new() { CompletedState = SynchronizationCompletedState.Success };
|
||||
|
||||
public static SynchronizationResult Completed(IEnumerable<IMailItem> downloadedMessages)
|
||||
=> new() { DownloadedMessages = downloadedMessages, CompletedState = SynchronizationCompletedState.Success };
|
||||
|
||||
public static SynchronizationResult Canceled => new() { CompletedState = SynchronizationCompletedState.Canceled };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user