Files
duplicati/proprietary/GoogleWorkspace/SourceItems/CalendarAclSourceEntry.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

23 lines
901 B
C#

// Copyright (c) 2026 Duplicati Inc. All rights reserved.
using Duplicati.Library.Common.IO;
using System.Text.Json;
namespace Duplicati.Proprietary.GoogleWorkspace.SourceItems;
internal class CalendarAclSourceEntry(SourceProvider provider, string parentPath, string calendarId)
: StreamResourceEntryBase(SystemIO.IO_OS.PathCombine(parentPath, "acl.json"), DateTime.UnixEpoch, DateTime.UnixEpoch)
{
public override long Size => -1;
public override async Task<Stream> OpenRead(CancellationToken cancellationToken)
{
var service = provider.ApiHelper.GetCalendarService();
var request = service.Acl.List(calendarId);
var acl = await request.ExecuteAsync(cancellationToken);
var json = JsonSerializer.Serialize(acl, new JsonSerializerOptions { WriteIndented = true });
return new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json));
}
}