All Downloads are FREE. Search and download functionalities are using the official Maven repository.

csharp-netcore.libraries.generichost.ApiResponseEventArgs.mustache Maven / Gradle / Ivy

using System;
using System.Net;

namespace {{packageName}}.{{clientPackage}}
{
    /// 
    /// Useful for tracking server health.
    /// 
    {{>visibility}} class ApiResponseEventArgs : EventArgs
    {
        /// 
        /// The time the request was sent.
        /// 
        public DateTime RequestedAt { get; }

        /// 
        /// The time the response was received.
        /// 
        public DateTime ReceivedAt { get; }

        /// 
        /// The HttpStatusCode received.
        /// 
        public HttpStatusCode HttpStatus { get; }

        /// 
        /// The path requested.
        /// 
        public string PathFormat { get; }

        /// 
        /// The elapsed time from request to response.
        /// 
        public TimeSpan ToTimeSpan => this.ReceivedAt - this.RequestedAt;

        /// 
        /// The path
        /// 
        public string Path { get; }

        /// 
        /// The event args used to track server health.
        /// 
        /// 
        /// 
        /// 
        /// 
        /// 
        public ApiResponseEventArgs(DateTime requestedAt, DateTime receivedAt, HttpStatusCode httpStatus, string pathFormat, string path)
        {
            RequestedAt = requestedAt;
            ReceivedAt = receivedAt;
            HttpStatus = httpStatus;
            PathFormat = pathFormat;
            Path = path;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy