|
1 | 1 | using OpenFeature.Constant;
|
2 | 2 |
|
3 | 3 | namespace OpenFeature.Model
|
4 |
| -{ |
| 4 | +{ |
| 5 | + /// <summary> |
| 6 | + /// Defines the contract that the <see cref="FeatureProvider"/> is required to return |
| 7 | + /// Describes the details of the feature flag being evaluated |
| 8 | + /// </summary> |
| 9 | + /// <typeparam name="T">Flag value type</typeparam> |
| 10 | + /// <seealso href="https://github.com/open-feature/spec/blob/v0.7.0/specification/types.md#resolution-details"/> |
| 11 | + public sealed class ResolutionDetails<T> |
| 12 | + { |
5 | 13 | /// <summary>
|
6 |
| - /// Defines the contract that the <see cref="FeatureProvider"/> is required to return |
7 |
| - /// Describes the details of the feature flag being evaluated |
| 14 | + /// Feature flag evaluated value |
8 | 15 | /// </summary>
|
9 |
| - /// <typeparam name="T">Flag value type</typeparam> |
10 |
| - /// <seealso href="https://github.com/open-feature/spec/blob/v0.7.0/specification/types.md#resolution-details"/> |
11 |
| - public sealed class ResolutionDetails<T> |
12 |
| - { |
13 |
| - /// <summary> |
14 |
| - /// Feature flag evaluated value |
15 |
| - /// </summary> |
16 |
| - public T Value { get; } |
17 |
| - |
18 |
| - /// <summary> |
19 |
| - /// Feature flag key |
20 |
| - /// </summary> |
21 |
| - public string FlagKey { get; } |
22 |
| - |
23 |
| - /// <summary> |
24 |
| - /// Error that occurred during evaluation |
25 |
| - /// <see cref="ErrorType"/> |
26 |
| - /// </summary> |
27 |
| - public ErrorType ErrorType { get; } |
28 |
| - |
29 |
| - /// <summary> |
30 |
| - /// Message containing additional details about an error. |
31 |
| - /// </summary> |
32 |
| - public string? ErrorMessage { get; } |
33 |
| - |
34 |
| - /// <summary> |
35 |
| - /// Describes the reason for the outcome of the evaluation process |
36 |
| - /// <see cref="Reason"/> |
37 |
| - /// </summary> |
38 |
| - public string? Reason { get; } |
39 |
| - |
40 |
| - /// <summary> |
41 |
| - /// A variant is a semantic identifier for a value. This allows for referral to particular values without |
42 |
| - /// necessarily including the value itself, which may be quite prohibitively large or otherwise unsuitable |
43 |
| - /// in some cases. |
44 |
| - /// </summary> |
45 |
| - public string? Variant { get; } |
46 |
| - |
47 |
| - /// <summary> |
48 |
| - /// A structure which supports definition of arbitrary properties, with keys of type string, and values of type boolean, string, or number. |
49 |
| - /// </summary> |
50 |
| - public ImmutableMetadata? FlagMetadata { get; } |
51 |
| - |
52 |
| - /// <summary> |
53 |
| - /// Initializes a new instance of the <see cref="ResolutionDetails{T}"/> class. |
54 |
| - /// </summary> |
55 |
| - /// <param name="flagKey">Feature flag key</param> |
56 |
| - /// <param name="value">Evaluated value</param> |
57 |
| - /// <param name="errorType">Error</param> |
58 |
| - /// <param name="reason">Reason</param> |
59 |
| - /// <param name="variant">Variant</param> |
60 |
| - /// <param name="errorMessage">Error message</param> |
61 |
| - /// <param name="flagMetadata">Flag metadata</param> |
62 |
| - public ResolutionDetails(string flagKey, T value, ErrorType errorType = ErrorType.None, string? reason = null, |
63 |
| - string? variant = null, string? errorMessage = null, ImmutableMetadata? flagMetadata = null) |
64 |
| - { |
65 |
| - this.Value = value; |
66 |
| - this.FlagKey = flagKey; |
67 |
| - this.ErrorType = errorType; |
68 |
| - this.Reason = reason; |
69 |
| - this.Variant = variant; |
70 |
| - this.ErrorMessage = errorMessage; |
71 |
| - this.FlagMetadata = flagMetadata; |
72 |
| - } |
73 |
| - } |
| 16 | + public T Value { get; } |
| 17 | + |
| 18 | + /// <summary> |
| 19 | + /// Feature flag key |
| 20 | + /// </summary> |
| 21 | + public string FlagKey { get; } |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// Error that occurred during evaluation |
| 25 | + /// <see cref="ErrorType"/> |
| 26 | + /// </summary> |
| 27 | + public ErrorType ErrorType { get; } |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Message containing additional details about an error. |
| 31 | + /// </summary> |
| 32 | + public string? ErrorMessage { get; } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// Describes the reason for the outcome of the evaluation process |
| 36 | + /// <see cref="Reason"/> |
| 37 | + /// </summary> |
| 38 | + public string? Reason { get; } |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// A variant is a semantic identifier for a value. This allows for referral to particular values without |
| 42 | + /// necessarily including the value itself, which may be quite prohibitively large or otherwise unsuitable |
| 43 | + /// in some cases. |
| 44 | + /// </summary> |
| 45 | + public string? Variant { get; } |
| 46 | + |
| 47 | + /// <summary> |
| 48 | + /// A structure which supports definition of arbitrary properties, with keys of type string, and values of type boolean, string, or number. |
| 49 | + /// </summary> |
| 50 | + public ImmutableMetadata? FlagMetadata { get; } |
| 51 | + |
| 52 | + /// <summary> |
| 53 | + /// Initializes a new instance of the <see cref="ResolutionDetails{T}"/> class. |
| 54 | + /// </summary> |
| 55 | + /// <param name="flagKey">Feature flag key</param> |
| 56 | + /// <param name="value">Evaluated value</param> |
| 57 | + /// <param name="errorType">Error</param> |
| 58 | + /// <param name="reason">Reason</param> |
| 59 | + /// <param name="variant">Variant</param> |
| 60 | + /// <param name="errorMessage">Error message</param> |
| 61 | + /// <param name="flagMetadata">Flag metadata</param> |
| 62 | + public ResolutionDetails(string flagKey, T value, ErrorType errorType = ErrorType.None, string? reason = null, |
| 63 | + string? variant = null, string? errorMessage = null, ImmutableMetadata? flagMetadata = null) |
| 64 | + { |
| 65 | + this.Value = value; |
| 66 | + this.FlagKey = flagKey; |
| 67 | + this.ErrorType = errorType; |
| 68 | + this.Reason = reason; |
| 69 | + this.Variant = variant; |
| 70 | + this.ErrorMessage = errorMessage; |
| 71 | + this.FlagMetadata = flagMetadata; |
| 72 | + } |
| 73 | + } |
74 | 74 | }
|
0 commit comments