forked from jscarle/OnePassword.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSection.cs
More file actions
32 lines (27 loc) · 1.01 KB
/
Section.cs
File metadata and controls
32 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace OnePassword.Items;
/// <summary>Represents a 1Password item section.</summary>
public sealed class Section
{
/// <summary>The section ID.</summary>
[JsonInclude]
[JsonPropertyName("id")]
public string Id { get; internal set; } = "";
/// <summary>The section label.</summary>
[JsonInclude]
[JsonPropertyName("label")]
public string Label { get; internal set; } = "";
/// <summary>Initializes a new instance of <see cref="Section" />.</summary>
public Section()
{
}
/// <summary>Initializes a new instance of <see cref="Section" /> with the specified label.</summary>
/// <param name="label">The section label.</param>
[SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase")]
public Section(string label)
{
Id = label?.ToLower(CultureInfo.InvariantCulture)?.Replace(" ", "_", StringComparison.InvariantCulture) ?? "";
Label = label ?? "";
}
}