- Implemented EmailChannelTestProvider to generate email preview payloads. - Implemented SlackChannelTestProvider to create Slack message previews. - Implemented TeamsChannelTestProvider for generating Teams Adaptive Card previews. - Implemented WebhookChannelTestProvider to create webhook payloads. - Added INotifyChannelTestProvider interface for channel-specific preview generation. - Created ChannelTestPreviewContracts for request and response models. - Developed NotifyChannelTestService to handle test send requests and generate previews. - Added rate limit policies for test sends and delivery history. - Implemented unit tests for service registration and binding. - Updated project files to include necessary dependencies and configurations.
56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using System.Linq;
|
|
using StellaOps.Concelier.Models;
|
|
|
|
namespace StellaOps.Concelier.Exporter.Json;
|
|
|
|
public sealed class JsonExportResult
|
|
{
|
|
public JsonExportResult(
|
|
string exportDirectory,
|
|
DateTimeOffset exportedAt,
|
|
IEnumerable<JsonExportFile> files,
|
|
int advisoryCount,
|
|
long totalBytes,
|
|
IEnumerable<Advisory>? advisories = null)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(exportDirectory))
|
|
{
|
|
throw new ArgumentException("Export directory must be provided.", nameof(exportDirectory));
|
|
}
|
|
|
|
var list = (files ?? throw new ArgumentNullException(nameof(files)))
|
|
.Where(static file => file is not null)
|
|
.ToImmutableArray();
|
|
|
|
var advisoryList = (advisories ?? Array.Empty<Advisory>())
|
|
.Where(static advisory => advisory is not null)
|
|
.ToImmutableArray();
|
|
|
|
ExportDirectory = exportDirectory;
|
|
ExportedAt = exportedAt;
|
|
TotalBytes = totalBytes;
|
|
|
|
Files = list;
|
|
FilePaths = list.Select(static file => file.RelativePath).ToImmutableArray();
|
|
Advisories = advisoryList;
|
|
AdvisoryCount = advisoryList.IsDefaultOrEmpty ? advisoryCount : advisoryList.Length;
|
|
}
|
|
|
|
public string ExportDirectory { get; }
|
|
|
|
public DateTimeOffset ExportedAt { get; }
|
|
|
|
public ImmutableArray<JsonExportFile> Files { get; }
|
|
|
|
public ImmutableArray<string> FilePaths { get; }
|
|
|
|
public ImmutableArray<Advisory> Advisories { get; }
|
|
|
|
public int AdvisoryCount { get; }
|
|
|
|
public long TotalBytes { get; }
|
|
}
|