2026-01-14 10:23:49 +01:00
|
|
|
// Copyright (c) 2026 Duplicati Inc. All rights reserved.
|
|
|
|
|
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using Duplicati.Library.Common.IO;
|
|
|
|
|
using Duplicati.Library.Interface;
|
|
|
|
|
using Duplicati.Library.Utility;
|
|
|
|
|
|
|
|
|
|
namespace Duplicati.Proprietary.Office365.SourceItems;
|
|
|
|
|
|
2026-01-23 11:28:02 +01:00
|
|
|
internal class NotebookSectionGroupSourceEntry(SourceProvider provider, string path, GraphOnenoteSectionGroup sectionGroup)
|
2026-01-14 10:23:49 +01:00
|
|
|
: MetaEntryBase(Util.AppendDirSeparator(SystemIO.IO_OS.PathCombine(path, sectionGroup.Id)), sectionGroup.CreatedDateTime.FromGraphDateTime(), sectionGroup.LastModifiedDateTime.FromGraphDateTime())
|
|
|
|
|
{
|
|
|
|
|
public override async IAsyncEnumerable<ISourceProviderEntry> Enumerate([EnumeratorCancellation] CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
await foreach (var section in provider.OnenoteApi.ListSectionGroupSectionsAsync(sectionGroup.Id, cancellationToken).ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
|
|
yield break;
|
|
|
|
|
|
|
|
|
|
yield return new NotebookSectionSourceEntry(provider, this.Path, section);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-23 11:28:02 +01:00
|
|
|
await foreach (var childSectionGroup in provider.OnenoteApi.ListSectionGroupSectionGroupsAsync(sectionGroup.Id, cancellationToken).ConfigureAwait(false))
|
2026-01-14 10:23:49 +01:00
|
|
|
{
|
|
|
|
|
if (cancellationToken.IsCancellationRequested)
|
|
|
|
|
yield break;
|
|
|
|
|
|
2026-01-23 11:28:02 +01:00
|
|
|
yield return new NotebookSectionGroupSourceEntry(provider, this.Path, childSectionGroup);
|
2026-01-14 10:23:49 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override Task<Dictionary<string, string?>> GetMinorMetadata(CancellationToken cancellationToken)
|
|
|
|
|
=> Task.FromResult(new Dictionary<string, string?>
|
|
|
|
|
{
|
|
|
|
|
{ "o365:v", "1" },
|
|
|
|
|
{ "o365:Id", sectionGroup.Id },
|
|
|
|
|
{ "o365:Type", SourceItemType.NotebookSectionGroup.ToString() },
|
|
|
|
|
{ "o365:Name", sectionGroup.DisplayName ?? "" },
|
|
|
|
|
{ "o365:DisplayName", sectionGroup.DisplayName ?? "" }
|
|
|
|
|
}
|
|
|
|
|
.WhereNotNull()
|
|
|
|
|
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value));
|
|
|
|
|
|
|
|
|
|
}
|