diff --git a/src/Seq.Api/Model/Alerting/AlertActivityPart.cs b/src/Seq.Api/Model/Alerting/AlertActivityPart.cs index f869be3..97f25f5 100644 --- a/src/Seq.Api/Model/Alerting/AlertActivityPart.cs +++ b/src/Seq.Api/Model/Alerting/AlertActivityPart.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; + // ReSharper disable UnusedAutoPropertyAccessor.Global namespace Seq.Api.Model.Alerting @@ -39,9 +40,21 @@ public class AlertActivityPart /// public List RecentOccurrences { get; set; } = new List(); + /// + /// Minimal metrics for the most recent occurrences of the alert that triggered notifications. + /// The metrics in this list are a superset of . + /// + public List RecentOccurrenceRanges { get; set; } = + new List(); + /// /// The number of times this alert has been triggered since its creation. /// public int TotalOccurrences { get; set; } + + /// + /// The detection time of the most recent occurrence not included in . + /// + public DateTime? LastEarlierOccurrence { get; set; } } } diff --git a/src/Seq.Api/Model/Alerting/AlertOccurrenceRangePart.cs b/src/Seq.Api/Model/Alerting/AlertOccurrenceRangePart.cs new file mode 100644 index 0000000..bd2df84 --- /dev/null +++ b/src/Seq.Api/Model/Alerting/AlertOccurrenceRangePart.cs @@ -0,0 +1,16 @@ +using Seq.Api.Model.LogEvents; +using Seq.Api.Model.Shared; + +namespace Seq.Api.Model.Alerting +{ + /// + /// An occurrence metric of an alert that triggered notifications. + /// + public class AlertOccurrenceRangePart + { + /// + /// The time grouping that triggered the alert. + /// + public DateTimeRange DetectedOverRange { get; set; } + } +} diff --git a/src/Seq.Api/Model/Apps/AppPackagePart.cs b/src/Seq.Api/Model/Apps/AppPackagePart.cs index 6064781..8cd87ee 100644 --- a/src/Seq.Api/Model/Apps/AppPackagePart.cs +++ b/src/Seq.Api/Model/Apps/AppPackagePart.cs @@ -40,12 +40,7 @@ public class AppPackagePart /// Package authorship information. /// public string Authors { get; set; } - - /// - /// URL of an icon for the app package. - /// - public string IconUrl { get; set; } - + /// /// URL of the package license. /// diff --git a/src/Seq.Api/ResourceGroups/AlertsResourceGroup.cs b/src/Seq.Api/ResourceGroups/AlertsResourceGroup.cs index 6961422..1d26cc1 100644 --- a/src/Seq.Api/ResourceGroups/AlertsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/AlertsResourceGroup.cs @@ -18,6 +18,7 @@ using System.Threading.Tasks; using Seq.Api.Model; using Seq.Api.Model.Alerting; +using Seq.Api.Model.Signals; using Seq.Api.Model.Users; namespace Seq.Api.ResourceGroups @@ -55,17 +56,25 @@ public async Task FindAsync(string id, CancellationToken cancellati public async Task> ListAsync(string ownerId = null, bool shared = false, CancellationToken cancellationToken = default) { var parameters = new Dictionary { { "ownerId", ownerId }, { "shared", shared } }; - return await GroupListAsync("Items", parameters, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GroupListAsync("Items", parameters, cancellationToken).ConfigureAwait(false); } /// /// Construct a alert with server defaults pre-initialized. /// /// allowing the operation to be canceled. + /// The source of events that will contribute to the alert. + /// An SQL query that will supply default clauses to the new alert. /// The unsaved alert. - public async Task TemplateAsync(CancellationToken cancellationToken = default) + public async Task TemplateAsync(SignalExpressionPart signal = null, string query = null, CancellationToken cancellationToken = default) { - return await GroupGetAsync("Template", cancellationToken: cancellationToken).ConfigureAwait(false); + var parameters = new Dictionary + { + ["signal"] = signal?.ToString(), + ["q"] = query + }; + + return await GroupGetAsync("Template", parameters, cancellationToken).ConfigureAwait(false); } /// diff --git a/src/Seq.Api/Seq.Api.csproj b/src/Seq.Api/Seq.Api.csproj index 643cb0b..6976adc 100644 --- a/src/Seq.Api/Seq.Api.csproj +++ b/src/Seq.Api/Seq.Api.csproj @@ -1,7 +1,7 @@ Client library for the Seq HTTP API. - 2021.3.0 + 2021.3.1 Datalust;Contributors netstandard2.0 true