Appearance
Report Delivery
GrydReports stores delivery options on recurring schedules and supports a built-in webhook provider. The built-in email provider only validates and logs intent; no report email is sent. The one-shot async endpoint is unavailable by default and does not execute delivery.
Delivery Methods
| Method | Enum | Description |
|---|---|---|
| Download | DeliveryMethod.Download (1) | Files are stored through GrydFiles and exposed by the separate download URL endpoint; there is no IReportDelivery provider. |
DeliveryMethod.Email (2) | Built-in placeholder validates and logs intent, then returns success without sending mail. | |
| Storage | DeliveryMethod.Storage (3) | Enum value only; no shipped provider copies files to a target path. |
| Webhook | DeliveryMethod.Webhook (4) | Built-in provider sends a multipart POST containing metadata and the report stream. |
DeliveryOptions
csharp
public class DeliveryOptions
{
public DeliveryMethod Method { get; set; }
// Email
public List<string>? Recipients { get; set; }
public List<string>? CcRecipients { get; set; }
public string? EmailSubject { get; set; }
public string? EmailBody { get; set; }
// Webhook
public string? WebhookUrl { get; set; }
public Dictionary<string, string>? WebhookHeaders { get; set; }
// Storage
public string? TargetPath { get; set; }
}Email Delivery
The built-in EmailReportDelivery does not send messages. It validates recipients, logs the delivery intent, and returns success without calling an email sender. Configuring SMTP options or registering AddGrydNotifications() does not change that behavior. To send report mail, the host must supply an IReportDelivery implementation backed by its real email sender.
Delivery options can still be stored on schedules, but success from the placeholder is not evidence that a recipient received anything.
json
{
"delivery": {
"method": 2,
"recipients": ["manager@company.com", "director@company.com"],
"ccRecipients": ["archive@company.com"],
"emailSubject": "Monthly Financial Report - February 2026",
"emailBody": "Please find the attached monthly financial report."
}
}Use the registered-provider guidance below to replace the placeholder. The delivery options contain recipients and subject/body values; transport configuration belongs to the host's mail provider.
Webhook Delivery
POST report metadata to an external endpoint:
json
{
"delivery": {
"method": 4,
"webhookUrl": "https://api.company.com/webhooks/reports",
"webhookHeaders": {
"Authorization": "Bearer token-123",
"X-Correlation-Id": "req-456"
}
}
}The form fields are fileName, contentType, format, fileSizeBytes, and reportTitle; the file itself is sent as a file part. See the maintained WebhookReportDelivery implementation for the wire format.
Webhook Configuration
The provider uses ReportDeliveryOptions.WebhookTimeout. The declared RetryCount option is not consumed by the shipped webhook implementation, so failed requests are not retried automatically.
There is no shipped storage-copy provider. The Storage enum and TargetPath option alone do not copy a report to a filesystem or object store.
IReportDelivery Interface
Each delivery method is implemented as an IReportDelivery:
csharp
public interface IReportDelivery
{
DeliveryMethod Method { get; }
Task<Result> DeliverAsync(
ReportOutput output,
DeliveryOptions options,
CancellationToken ct = default);
}Built-in Implementations
| Class | Method | Description |
|---|---|---|
EmailReportDelivery | Validates and logs intent, then returns success; no email is sent. | |
WebhookReportDelivery | Webhook | HTTP multipart POST with metadata and the report stream. |
The Reports download route is separate from IReportDelivery: it asks IFileStore<ReportFileScope> for a short-lived URL, then the client downloads directly from object storage. Registering AddGrydReportsScheduling() enables recurring generation only when the host also configures its job infrastructure; it does not add one-shot async processing or mail transport.
Provider selection uses the first registered IReportDelivery whose Method matches. Since AddGrydReports registers the built-in email placeholder, a later email registration does not override it. Replace/remove that descriptor or arrange the host provider first in the service list.
Custom Delivery Channel
Implement IReportDelivery when the host needs actual email transport or another channel. Return success only when the host provider has accepted/completed its own operation; this does not prove that a recipient received or opened a message.
Use the actual IReportDelivery contract and DeliveryOptions when implementing the host provider. Set Method to DeliveryMethod.Email for a replacement email transport and pass the report stream and configured recipients to the host's existing sender. Register the host implementation before AddGrydReports, so its matching provider is first in DI enumeration. The built-in providers are registered by AddGrydReports; delivery lookup selects the first provider matching the method. Do not add another email provider after registration and assume it overrides the placeholder.
Delivery with Scheduling
Combine delivery with scheduling for fully automated workflows:
csharp
await mediator.Send(new CreateReportScheduleCommand(
TemplateId: "daily-kpis",
Name: "Daily KPI Report",
CronExpression: "0 7 * * MON-FRI",
Format: ReportFormat.Pdf,
Delivery: new DeliveryOptions
{
Method = DeliveryMethod.Email,
Recipients = ["leadership@company.com"],
EmailSubject = "Daily KPIs - {date}",
EmailBody = "Good morning! Here are today's KPI metrics."
}
));With the built-in email placeholder, this schedule validates/logs email intent but does not send mail. Replace the provider first if the schedule must use a real mail transport. When a provider returns a failed Result, generation still returns the stored report as Completed; only a successful provider result changes it to Delivered. A thrown provider exception propagates.
Delivery with Async Generation
The delivery field remains on the public one-shot async request for host compatibility, but the built-in handler rejects the request with REPORT_ASYNC_GENERATION_UNAVAILABLE; it does not queue, generate, or deliver the report. Delivery is available to a host-provided async handler or a configured recurring schedule with delivery options.
bash
POST /api/v1/reports/generate-async
{
"templateId": "audit-export",
"format": 3,
"delivery": {
"method": 2,
"recipients": ["compliance@company.com"]
}
}The built-in one-shot endpoint returns 503 Service Unavailable and does not create an execution.
Multiple Delivery Channels
The generator selects the first registered IReportDelivery whose Method matches DeliveryOptions.Method. A later registration does not override an earlier matching provider.