Add account context menu actions
This commit is contained in:
@@ -1724,6 +1724,17 @@ public class GmailSynchronizer : WinoSynchronizer<IClientServiceRequest, Message
|
||||
return [new HttpRequestBundle<IClientServiceRequest>(networkCall, request, request)];
|
||||
}
|
||||
|
||||
public override List<IRequestBundle<IClientServiceRequest>> CreateRootFolder(CreateRootFolderRequest request)
|
||||
{
|
||||
var label = new Label()
|
||||
{
|
||||
Name = request.NewFolderName
|
||||
};
|
||||
|
||||
var networkCall = _gmailService.Users.Labels.Create(label, "me");
|
||||
return [new HttpRequestBundle<IClientServiceRequest>(networkCall, request, request)];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Request Execution
|
||||
|
||||
@@ -317,6 +317,15 @@ public class ImapSynchronizer : WinoSynchronizer<ImapRequest, ImapMessageCreatio
|
||||
}, request, request);
|
||||
}
|
||||
|
||||
public override List<IRequestBundle<ImapRequest>> CreateRootFolder(CreateRootFolderRequest request)
|
||||
{
|
||||
return CreateSingleTaskBundle(async (client, item) =>
|
||||
{
|
||||
var rootFolder = client.GetFolder(client.PersonalNamespaces[0]);
|
||||
await rootFolder.CreateAsync(request.NewFolderName, true).ConfigureAwait(false);
|
||||
}, request, request);
|
||||
}
|
||||
|
||||
public override List<IRequestBundle<ImapRequest>> CreateCalendarEvent(CreateCalendarEventRequest request)
|
||||
{
|
||||
var handler = ResolveCalendarOperationHandler();
|
||||
|
||||
@@ -2003,6 +2003,17 @@ public class OutlookSynchronizer : WinoSynchronizer<RequestInformation, Message,
|
||||
return [new HttpRequestBundle<RequestInformation>(networkCall, request)];
|
||||
}
|
||||
|
||||
public override List<IRequestBundle<RequestInformation>> CreateRootFolder(CreateRootFolderRequest request)
|
||||
{
|
||||
var requestBody = new MailFolder
|
||||
{
|
||||
DisplayName = request.NewFolderName
|
||||
};
|
||||
|
||||
var networkCall = _graphClient.Me.MailFolders.ToPostRequestInformation(requestBody);
|
||||
return [new HttpRequestBundle<RequestInformation>(networkCall, request)];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override async Task ExecuteNativeRequestsAsync(List<IRequestBundle<RequestInformation>> batchedRequests, CancellationToken cancellationToken = default)
|
||||
|
||||
@@ -222,6 +222,9 @@ public abstract class WinoSynchronizer<TBaseRequest, TMessageType, TCalendarEven
|
||||
case FolderSynchronizerOperation.CreateSubFolder:
|
||||
nativeRequests.AddRange(CreateSubFolder(group.ElementAt(0) as CreateSubFolderRequest));
|
||||
break;
|
||||
case FolderSynchronizerOperation.CreateRootFolder:
|
||||
nativeRequests.AddRange(CreateRootFolder(group.ElementAt(0) as CreateRootFolderRequest));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -658,6 +661,7 @@ public abstract class WinoSynchronizer<TBaseRequest, TMessageType, TCalendarEven
|
||||
public virtual List<IRequestBundle<TBaseRequest>> MarkFolderAsRead(MarkFolderAsReadRequest request) => throw new NotSupportedException(string.Format(Translator.Exception_UnsupportedSynchronizerOperation, this.GetType()));
|
||||
public virtual List<IRequestBundle<TBaseRequest>> DeleteFolder(DeleteFolderRequest request) => throw new NotSupportedException(string.Format(Translator.Exception_UnsupportedSynchronizerOperation, this.GetType()));
|
||||
public virtual List<IRequestBundle<TBaseRequest>> CreateSubFolder(CreateSubFolderRequest request) => throw new NotSupportedException(string.Format(Translator.Exception_UnsupportedSynchronizerOperation, this.GetType()));
|
||||
public virtual List<IRequestBundle<TBaseRequest>> CreateRootFolder(CreateRootFolderRequest request) => throw new NotSupportedException(string.Format(Translator.Exception_UnsupportedSynchronizerOperation, this.GetType()));
|
||||
public virtual List<IRequestBundle<TBaseRequest>> UpdateCategories(BatchMailCategoryAssignmentRequest request) => throw new NotSupportedException(string.Format(Translator.Exception_UnsupportedSynchronizerOperation, this.GetType()));
|
||||
public virtual List<IRequestBundle<TBaseRequest>> CreateCategory(MailCategoryCreateRequest request) => throw new NotSupportedException(string.Format(Translator.Exception_UnsupportedSynchronizerOperation, this.GetType()));
|
||||
public virtual List<IRequestBundle<TBaseRequest>> UpdateCategory(MailCategoryUpdateRequest request) => throw new NotSupportedException(string.Format(Translator.Exception_UnsupportedSynchronizerOperation, this.GetType()));
|
||||
|
||||
Reference in New Issue
Block a user