Files
duplicati/proprietary/GoogleWorkspace/SourceItems/DriveSourceEntry.cs
T

34 lines
1.3 KiB
C#

// Copyright (c) 2026 Duplicati Inc. All rights reserved.
using Duplicati.Library.Common.IO;
using Duplicati.Library.Interface;
using System.Runtime.CompilerServices;
namespace Duplicati.Proprietary.GoogleWorkspace.SourceItems;
internal class DriveSourceEntry(SourceProvider provider, string parentPath, string userId)
: MetaEntryBase(Util.AppendDirSeparator(SystemIO.IO_OS.PathCombine(parentPath, "Drive")), null, null)
{
public override async IAsyncEnumerable<ISourceProviderEntry> Enumerate([EnumeratorCancellation] CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested) yield break;
yield return new DriveFolderSourceEntry(provider, this.Path, userId, "My Drive", "root");
if (cancellationToken.IsCancellationRequested) yield break;
yield return new SharedDrivesSourceEntry(provider, this.Path, userId);
}
public override Task<Dictionary<string, string?>> GetMinorMetadata(CancellationToken cancellationToken)
{
return Task.FromResult(new Dictionary<string, string?>
{
{ "gsuite:v", "1" },
{ "gsuite:Type", SourceItemType.Drive.ToString() },
{ "gsuite:Name", "Drive" },
{ "gsuite:Id", "Drive" }
}
.Where(kv => !string.IsNullOrEmpty(kv.Value))
.ToDictionary(kv => kv.Key, kv => kv.Value));
}
}