-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
- Loading branch information
Showing
3 changed files
with
164 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,75 @@ | ||
using OpenFeature.Constant; | ||
|
||
namespace OpenFeature.Model | ||
{ | ||
{ | ||
/// <summary> | ||
/// The contract returned to the caller that describes the result of the flag evaluation process. | ||
/// </summary> | ||
/// <typeparam name="T">Flag value type</typeparam> | ||
/// <seealso href="https://github.com/open-feature/spec/blob/v0.7.0/specification/types.md#evaluation-details"/> | ||
public sealed class FlagEvaluationDetails<T> | ||
{ | ||
/// <summary> | ||
/// The contract returned to the caller that describes the result of the flag evaluation process. | ||
/// Feature flag evaluated value | ||
/// </summary> | ||
/// <typeparam name="T">Flag value type</typeparam> | ||
/// <seealso href="https://github.com/open-feature/spec/blob/v0.7.0/specification/types.md#evaluation-details"/> | ||
public sealed class FlagEvaluationDetails<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 | ||
/// </summary> | ||
public ErrorType ErrorType { get; } | ||
|
||
/// <summary> | ||
/// Message containing additional details about an error. | ||
/// <para> | ||
/// Will be <see langword="null" /> if there is no error or if the provider didn't provide any additional error | ||
/// details. | ||
/// </para> | ||
/// </summary> | ||
public string? ErrorMessage { get; } | ||
|
||
/// <summary> | ||
/// Describes the reason for the outcome of the evaluation process | ||
/// </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="FlagEvaluationDetails{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 FlagEvaluationDetails(string flagKey, T value, ErrorType errorType, string? reason, string? variant, | ||
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; | ||
} | ||
} | ||
public T Value { get; } | ||
|
||
/// <summary> | ||
/// Feature flag key | ||
/// </summary> | ||
public string FlagKey { get; } | ||
|
||
/// <summary> | ||
/// Error that occurred during evaluation | ||
/// </summary> | ||
public ErrorType ErrorType { get; } | ||
|
||
/// <summary> | ||
/// Message containing additional details about an error. | ||
/// <para> | ||
/// Will be <see langword="null" /> if there is no error or if the provider didn't provide any additional error | ||
/// details. | ||
/// </para> | ||
/// </summary> | ||
public string? ErrorMessage { get; } | ||
|
||
/// <summary> | ||
/// Describes the reason for the outcome of the evaluation process | ||
/// </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="FlagEvaluationDetails{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 FlagEvaluationDetails(string flagKey, T value, ErrorType errorType, string? reason, string? variant, | ||
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,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> | ||
/// Defines the contract that the <see cref="FeatureProvider"/> is required to return | ||
/// Describes the details of the feature flag being evaluated | ||
/// Feature flag evaluated value | ||
/// </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; | ||
} | ||
} | ||
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; | ||
} | ||
} | ||
} |