43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using LaDOSE.Entity;
|
|
|
|
namespace LaDOSE.Business.Interface
|
|
{
|
|
public interface ISheetsExportService
|
|
{
|
|
/// <summary>What the export panel needs to render. Never includes a secret.</summary>
|
|
SheetsConfig GetConfig();
|
|
|
|
/// <summary>
|
|
/// Resolves the target spreadsheet from configuration, validates the tables, sanitises
|
|
/// and de-duplicates the tab titles, then hands off to the configured
|
|
/// <see cref="ISheetsWriter"/>. Throws <see cref="SheetsExportException"/> for anything
|
|
/// the caller can act on.
|
|
/// </summary>
|
|
Task<SheetExportResult> ExportAsync(SheetExportRequest request, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// A failure with a message meant for the person who pressed the button, plus the status
|
|
/// the API should answer with. The API has no exception middleware, so anything that escapes
|
|
/// reaches the browser as an HTML developer page the client can only report as a bare status
|
|
/// — hence every foreseeable failure is raised as one of these instead.
|
|
/// </summary>
|
|
public class SheetsExportException : Exception
|
|
{
|
|
public SheetsExportException(int statusCode, string message) : base(message)
|
|
{
|
|
StatusCode = statusCode;
|
|
}
|
|
|
|
public SheetsExportException(int statusCode, string message, Exception inner) : base(message, inner)
|
|
{
|
|
StatusCode = statusCode;
|
|
}
|
|
|
|
public int StatusCode { get; }
|
|
}
|
|
}
|