1
+ using System ;
2
+ using System . Collections . Generic ;
1
3
using System . Threading . Tasks ;
2
4
using OpenFeature . SDK . Model ;
3
5
@@ -8,13 +10,26 @@ namespace OpenFeature.SDK
8
10
/// A provider acts as the translates layer between the generic feature flag structure to a target feature flag system.
9
11
/// </summary>
10
12
/// <seealso href="https://github.com/open-feature/spec/blob/main/specification/providers.md">Provider specification</seealso>
11
- public interface IFeatureProvider
13
+ public abstract class FeatureProvider
12
14
{
15
+ /// <summary>
16
+ /// Gets a immutable list of hooks that belong to the provider.
17
+ /// By default return a empty list
18
+ ///
19
+ /// Executed in the order of hooks
20
+ /// before: API, Client, Invocation, Provider
21
+ /// after: Provider, Invocation, Client, API
22
+ /// error (if applicable): Provider, Invocation, Client, API
23
+ /// finally: Provider, Invocation, Client, API
24
+ /// </summary>
25
+ /// <returns></returns>
26
+ public virtual IReadOnlyList < Hook > GetProviderHooks ( ) => Array . Empty < Hook > ( ) ;
27
+
13
28
/// <summary>
14
29
/// Metadata describing the provider.
15
30
/// </summary>
16
31
/// <returns><see cref="Metadata"/></returns>
17
- Metadata GetMetadata ( ) ;
32
+ public abstract Metadata GetMetadata ( ) ;
18
33
19
34
/// <summary>
20
35
/// Resolves a boolean feature flag
@@ -24,7 +39,7 @@ public interface IFeatureProvider
24
39
/// <param name="context"><see cref="EvaluationContext"/></param>
25
40
/// <param name="config"><see cref="FlagEvaluationOptions"/></param>
26
41
/// <returns><see cref="ResolutionDetails{T}"/></returns>
27
- Task < ResolutionDetails < bool > > ResolveBooleanValue ( string flagKey , bool defaultValue ,
42
+ public abstract Task < ResolutionDetails < bool > > ResolveBooleanValue ( string flagKey , bool defaultValue ,
28
43
EvaluationContext context = null , FlagEvaluationOptions config = null ) ;
29
44
30
45
/// <summary>
@@ -35,7 +50,7 @@ Task<ResolutionDetails<bool>> ResolveBooleanValue(string flagKey, bool defaultVa
35
50
/// <param name="context"><see cref="EvaluationContext"/></param>
36
51
/// <param name="config"><see cref="FlagEvaluationOptions"/></param>
37
52
/// <returns><see cref="ResolutionDetails{T}"/></returns>
38
- Task < ResolutionDetails < string > > ResolveStringValue ( string flagKey , string defaultValue ,
53
+ public abstract Task < ResolutionDetails < string > > ResolveStringValue ( string flagKey , string defaultValue ,
39
54
EvaluationContext context = null , FlagEvaluationOptions config = null ) ;
40
55
41
56
/// <summary>
@@ -46,7 +61,7 @@ Task<ResolutionDetails<string>> ResolveStringValue(string flagKey, string defaul
46
61
/// <param name="context"><see cref="EvaluationContext"/></param>
47
62
/// <param name="config"><see cref="FlagEvaluationOptions"/></param>
48
63
/// <returns><see cref="ResolutionDetails{T}"/></returns>
49
- Task < ResolutionDetails < int > > ResolveIntegerValue ( string flagKey , int defaultValue ,
64
+ public abstract Task < ResolutionDetails < int > > ResolveIntegerValue ( string flagKey , int defaultValue ,
50
65
EvaluationContext context = null , FlagEvaluationOptions config = null ) ;
51
66
52
67
/// <summary>
@@ -57,7 +72,7 @@ Task<ResolutionDetails<int>> ResolveIntegerValue(string flagKey, int defaultValu
57
72
/// <param name="context"><see cref="EvaluationContext"/></param>
58
73
/// <param name="config"><see cref="FlagEvaluationOptions"/></param>
59
74
/// <returns><see cref="ResolutionDetails{T}"/></returns>
60
- Task < ResolutionDetails < double > > ResolveDoubleValue ( string flagKey , double defaultValue ,
75
+ public abstract Task < ResolutionDetails < double > > ResolveDoubleValue ( string flagKey , double defaultValue ,
61
76
EvaluationContext context = null , FlagEvaluationOptions config = null ) ;
62
77
63
78
/// <summary>
@@ -69,7 +84,7 @@ Task<ResolutionDetails<double>> ResolveDoubleValue(string flagKey, double defaul
69
84
/// <param name="config"><see cref="FlagEvaluationOptions"/></param>
70
85
/// <typeparam name="T">Type of object</typeparam>
71
86
/// <returns><see cref="ResolutionDetails{T}"/></returns>
72
- Task < ResolutionDetails < T > > ResolveStructureValue < T > ( string flagKey , T defaultValue ,
87
+ public abstract Task < ResolutionDetails < T > > ResolveStructureValue < T > ( string flagKey , T defaultValue ,
73
88
EvaluationContext context = null , FlagEvaluationOptions config = null ) ;
74
89
}
75
90
}
0 commit comments