Skip to content

Commit

Permalink
adding-events-endpoint (#99)
Browse files Browse the repository at this point in the history
* Split ApplicationEvent to separate file. Changed Events to readonlylist
  • Loading branch information
jrmccannon authored Dec 21, 2023
1 parent 3b284d6 commit c7f651d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 39 deletions.
40 changes: 40 additions & 0 deletions src/Passwordless/Models/ApplicationEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;

namespace Passwordless.Models;

/// <summary>
/// An event that occured using Passwordless library.
/// </summary>
public class ApplicationEvent
{
public Guid Id { get; set; }
/// <summary>
/// When the record was performed. This will be in UTC.
/// </summary>
public DateTime PerformedAt { get; set; }

/// <summary>
/// The type of event <see href="https://github.com/passwordless/passwordless-server/blob/main/src/Common/EventLog/Enums/EventType.cs" />
/// </summary>
public string EventType { get; set; } = string.Empty;

/// <summary>
/// Description of the event
/// </summary>
public string Message { get; set; } = string.Empty;

/// <summary>
/// Severity of the event <see href="https://github.com/passwordless/passwordless-server/blob/main/src/Common/EventLog/Enums/Severity.cs"/>
/// </summary>
public string Severity { get; set; } = string.Empty;

/// <summary>
/// The target of the event. Can be in reference to a user or the application.
/// </summary>
public string Subject { get; set; } = string.Empty;

/// <summary>
/// Last 4 characters of the api key (public/secret) used to perform the event.
/// </summary>
public string ApiKeyId { get; set; } = string.Empty;
}
40 changes: 1 addition & 39 deletions src/Passwordless/Models/GetEventLogResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;

namespace Passwordless.Models;
Expand All @@ -15,46 +14,9 @@ public class GetEventLogResponse
/// <summary>
/// List of events for the application based on the request pagination parameters. This will always be sorted by PerformedAt in descending order.
/// </summary>
public IEnumerable<ApplicationEvent> Events { get; set; } = new List<ApplicationEvent>();
public IReadOnlyList<ApplicationEvent> Events { get; set; } = new List<ApplicationEvent>();
/// <summary>
/// Total number of events for the application.
/// </summary>
public int TotalEventCount { get; set; }
}

/// <summary>
/// An event that occured using Passwordless library.
/// </summary>
public class ApplicationEvent
{
public Guid Id { get; set; }
/// <summary>
/// When the record was performed. This will be in UTC.
/// </summary>
public DateTime PerformedAt { get; set; }

/// <summary>
/// The type of event <see href="https://github.com/passwordless/passwordless-server/blob/main/src/Common/EventLog/Enums/EventType.cs" />
/// </summary>
public string EventType { get; set; } = string.Empty;

/// <summary>
/// Description of the event
/// </summary>
public string Message { get; set; } = string.Empty;

/// <summary>
/// Severity of the event <see href="https://github.com/passwordless/passwordless-server/blob/main/src/Common/EventLog/Enums/Severity.cs"/>
/// </summary>
public string Severity { get; set; } = string.Empty;

/// <summary>
/// The target of the event. Can be in reference to a user or the application.
/// </summary>
public string Subject { get; set; } = string.Empty;

/// <summary>
/// Last 4 characters of the api key (public/secret) used to perform the event.
/// </summary>
public string ApiKeyId { get; set; } = string.Empty;
}

0 comments on commit c7f651d

Please sign in to comment.