< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Security.ApiKey
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Security/ApiKey.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 56
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Data/Entities/Security/ApiKey.cs

#LineLine coverage
 1using System;
 2using System.ComponentModel.DataAnnotations;
 3using System.ComponentModel.DataAnnotations.Schema;
 4using System.Globalization;
 5
 6namespace Jellyfin.Data.Entities.Security
 7{
 8    /// <summary>
 9    /// An entity representing an API key.
 10    /// </summary>
 11    public class ApiKey
 12    {
 13        /// <summary>
 14        /// Initializes a new instance of the <see cref="ApiKey"/> class.
 15        /// </summary>
 16        /// <param name="name">The name.</param>
 17        public ApiKey(string name)
 18        {
 019            Name = name;
 20
 021            AccessToken = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
 022            DateCreated = DateTime.UtcNow;
 023        }
 24
 25        /// <summary>
 26        /// Gets the id.
 27        /// </summary>
 28        /// <remarks>
 29        /// Identity, Indexed, Required.
 30        /// </remarks>
 31        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 32        public int Id { get; private set; }
 33
 34        /// <summary>
 35        /// Gets or sets the date created.
 36        /// </summary>
 37        public DateTime DateCreated { get; set; }
 38
 39        /// <summary>
 40        /// Gets or sets the date of last activity.
 41        /// </summary>
 42        public DateTime DateLastActivity { get; set; }
 43
 44        /// <summary>
 45        /// Gets or sets the name.
 46        /// </summary>
 47        [MaxLength(64)]
 48        [StringLength(64)]
 49        public string Name { get; set; }
 50
 51        /// <summary>
 52        /// Gets or sets the access token.
 53        /// </summary>
 54        public string AccessToken { get; set; }
 55    }
 56}

Methods/Properties

.ctor(System.String)