Files

47 lines
1.5 KiB
C#

using EonaCat.Json;
namespace EonaCat.DoxaApi.Models
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
/// <summary>
/// Metadata for tracking requests and responses.
/// </summary>
public class RequestMetadata
{
[JsonProperty("id")]
public string Id { get; set; } = Guid.NewGuid().ToString();
[JsonProperty("method")]
public string Method { get; set; } = string.Empty;
[JsonProperty("path")]
public string Path { get; set; } = string.Empty;
[JsonProperty("statusCode")]
public int StatusCode { get; set; }
[JsonProperty("responseTimeMs")]
public long ResponseTimeMs { get; set; }
[JsonProperty("requestSize")]
public long RequestSize { get; set; }
[JsonProperty("responseSize")]
public long ResponseSize { get; set; }
[JsonProperty("timestamp")]
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
[JsonProperty("userAgent", NullValueHandling = NullValueHandling.Ignore)]
public string? UserAgent { get; set; }
[JsonProperty("ipAddress", NullValueHandling = NullValueHandling.Ignore)]
public string? IpAddress { get; set; }
[JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)]
public string? Error { get; set; }
}
}