-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathResolutionDetails.cs
74 lines (66 loc) · 2.84 KB
/
ResolutionDetails.cs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using OpenFeature.Constant;
namespace OpenFeature.Model
{
/// <summary>
/// Defines the contract that the <see cref="FeatureProvider"/> is required to return
/// Describes the details of the feature flag being evaluated
/// </summary>
/// <typeparam name="T">Flag value type</typeparam>
/// <seealso href="https://github.com/open-feature/spec/blob/v0.7.0/specification/types.md#resolution-details"/>
public sealed class ResolutionDetails<T>
{
/// <summary>
/// Feature flag evaluated value
/// </summary>
public T Value { get; }
/// <summary>
/// Feature flag key
/// </summary>
public string FlagKey { get; }
/// <summary>
/// Error that occurred during evaluation
/// <see cref="ErrorType"/>
/// </summary>
public ErrorType ErrorType { get; }
/// <summary>
/// Message containing additional details about an error.
/// </summary>
public string? ErrorMessage { get; }
/// <summary>
/// Describes the reason for the outcome of the evaluation process
/// <see cref="Reason"/>
/// </summary>
public string? Reason { get; }
/// <summary>
/// A variant is a semantic identifier for a value. This allows for referral to particular values without
/// necessarily including the value itself, which may be quite prohibitively large or otherwise unsuitable
/// in some cases.
/// </summary>
public string? Variant { get; }
/// <summary>
/// A structure which supports definition of arbitrary properties, with keys of type string, and values of type boolean, string, or number.
/// </summary>
public ImmutableMetadata? FlagMetadata { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ResolutionDetails{T}"/> class.
/// </summary>
/// <param name="flagKey">Feature flag key</param>
/// <param name="value">Evaluated value</param>
/// <param name="errorType">Error</param>
/// <param name="reason">Reason</param>
/// <param name="variant">Variant</param>
/// <param name="errorMessage">Error message</param>
/// <param name="flagMetadata">Flag metadata</param>
public ResolutionDetails(string flagKey, T value, ErrorType errorType = ErrorType.None, string? reason = null,
string? variant = null, string? errorMessage = null, ImmutableMetadata? flagMetadata = null)
{
this.Value = value;
this.FlagKey = flagKey;
this.ErrorType = errorType;
this.Reason = reason;
this.Variant = variant;
this.ErrorMessage = errorMessage;
this.FlagMetadata = flagMetadata;
}
}
}