-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathFlagEvaluationOptions.cs
44 lines (40 loc) · 1.98 KB
/
FlagEvaluationOptions.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
using System.Collections.Immutable;
namespace OpenFeature.Model
{
/// <summary>
/// A structure containing the one or more hooks and hook hints
/// The hook and hook hints are added to the list of hooks called during the evaluation process
/// </summary>
/// <seealso href="https://github.com/open-feature/spec/blob/v0.5.2/specification/types.md#evaluation-options">Flag Evaluation Options</seealso>
public sealed class FlagEvaluationOptions
{
/// <summary>
/// An immutable list of <see cref="Hook"/>
/// </summary>
public IImmutableList<Hook> Hooks { get; }
/// <summary>
/// An immutable dictionary of hook hints
/// </summary>
public IImmutableDictionary<string, object> HookHints { get; }
/// <summary>
/// Initializes a new instance of the <see cref="FlagEvaluationOptions"/> class.
/// </summary>
/// <param name="hooks">An immutable list of hooks to use during evaluation</param>
/// <param name="hookHints">Optional - a list of hints that are passed through the hook lifecycle</param>
public FlagEvaluationOptions(IImmutableList<Hook> hooks, IImmutableDictionary<string, object>? hookHints = null)
{
this.Hooks = hooks;
this.HookHints = hookHints ?? ImmutableDictionary<string, object>.Empty;
}
/// <summary>
/// Initializes a new instance of the <see cref="FlagEvaluationOptions"/> class.
/// </summary>
/// <param name="hook">A hook to use during the evaluation</param>
/// <param name="hookHints">Optional - a list of hints that are passed through the hook lifecycle</param>
public FlagEvaluationOptions(Hook hook, ImmutableDictionary<string, object>? hookHints = null)
{
this.Hooks = ImmutableList.Create(hook);
this.HookHints = hookHints ?? ImmutableDictionary<string, object>.Empty;
}
}
}