Files
duplicati/proprietary/GoogleWorkspace/SourceItems/CalendarMetadataSourceEntry.cs
T
Kenneth Skovhede da246874ec Initial implementation of Google Workspace backup.
This is a WIP and still needs the restore part implemented.

Not all resources are fully tested but basic elements work.
2026-02-04 15:44:23 +01:00

20 lines
774 B
C#

// Copyright (c) 2026 Duplicati Inc. All rights reserved.
using Duplicati.Library.Common.IO;
using Google.Apis.Calendar.v3.Data;
using System.Text.Json;
namespace Duplicati.Proprietary.GoogleWorkspace.SourceItems;
internal class CalendarMetadataSourceEntry(string parentPath, CalendarListEntry calendar)
: StreamResourceEntryBase(SystemIO.IO_OS.PathCombine(parentPath, "metadata.json"), DateTime.UnixEpoch, DateTime.UnixEpoch)
{
public override long Size => -1;
public override Task<Stream> OpenRead(CancellationToken cancellationToken)
{
var json = JsonSerializer.Serialize(calendar, new JsonSerializerOptions { WriteIndented = true });
return Task.FromResult<Stream>(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json)));
}
}