Skip to content

Commit aa44ff2

Browse files
weyertrenovate[bot]askptbeeme1mrericpattison
authored
feat: add OpenFeature Remote Evaluation Protocol (OFREP) Provider (#428)
Signed-off-by: Weyert de Boer <[email protected]> Signed-off-by: Weyert de Boer <[email protected]> Signed-off-by: André Silva <[email protected]> Signed-off-by: Todd Baert <[email protected]> Signed-off-by: Kyle Julian <[email protected]> Signed-off-by: Piotr Kiełkowicz <[email protected]> Signed-off-by: Mark Johnson <[email protected]> Signed-off-by: OpenFeature Bot <[email protected]> Signed-off-by: Michael Beemer <[email protected]> Signed-off-by: James Thompson <[email protected]> Signed-off-by: Weyert de Boer <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: André Silva <[email protected]> Co-authored-by: Michael Beemer <[email protected]> Co-authored-by: ericpattison <[email protected]> Co-authored-by: Kyle <[email protected]> Co-authored-by: Todd Baert <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Piotr Kiełkowicz <[email protected]> Co-authored-by: Mark Johnson <[email protected]> Co-authored-by: OpenFeature Bot <[email protected]> Co-authored-by: James Thompson <[email protected]>
1 parent 8db227f commit aa44ff2

20 files changed

+2918
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,6 @@ ASALocalRun/
348348
!.vscode/tasks.json
349349
!.vscode/launch.json
350350
!.vscode/extensions.json
351+
352+
# asdf version manager
353+
.tool-versions

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"src/OpenFeature.Contrib.Providers.FeatureManagement": "0.1.1",
88
"src/OpenFeature.Contrib.Providers.Statsig": "0.1.0",
99
"src/OpenFeature.Contrib.Providers.Flipt": "0.0.5",
10-
"src/OpenFeature.Contrib.Providers.EnvVar": "0.0.7"
10+
"src/OpenFeature.Contrib.Providers.EnvVar": "0.0.7",
11+
"src/OpenFeature.Providers.Ofrep": "0.0.1"
1112
}

DotnetSdkContrib.slnx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<Project Path="src/OpenFeature.Contrib.Providers.Flipt/OpenFeature.Contrib.Providers.Flipt.csproj" />
1010
<Project Path="src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj" />
1111
<Project Path="src/OpenFeature.Contrib.Providers.Statsig/OpenFeature.Contrib.Providers.Statsig.csproj" />
12+
<Project Path="src/OpenFeature.Providers.Ofrep/OpenFeature.Providers.Ofrep.csproj" />
1213
</Folder>
1314
<Folder Name="/test/">
1415
<Project Path="test/OpenFeature.Contrib.Hooks.Otel.Test/OpenFeature.Contrib.Hooks.Otel.Test.csproj" />
@@ -23,5 +24,6 @@
2324
<Project Path="test/OpenFeature.Contrib.Providers.Flipt.Test/OpenFeature.Contrib.Providers.Flipt.Test.csproj" />
2425
<Project Path="test/OpenFeature.Contrib.Providers.GOFeatureFlag.Test/OpenFeature.Contrib.Providers.GOFeatureFlag.Test.csproj" />
2526
<Project Path="test/OpenFeature.Contrib.Providers.Statsig.Test/OpenFeature.Contrib.Providers.Statsig.Test.csproj" />
27+
<Project Path="test/OpenFeature.Providers.Ofrep.Test/OpenFeature.Providers.Ofrep.Test.csproj" />
2628
</Folder>
2729
</Solution>

release-please-config.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@
9393
"extra-files": [
9494
"OpenFeature.Contrib.Providers.EnvVar.csproj"
9595
]
96+
},
97+
"src/OpenFeature.Providers.Ofrep": {
98+
"package-name": "OpenFeature.Providers.Ofrep",
99+
"release-type": "simple",
100+
"bump-minor-pre-major": true,
101+
"bump-patch-for-minor-pre-major": true,
102+
"versioning": "default",
103+
"extra-files": [
104+
"OpenFeature.Providers.Ofrep.csproj"
105+
]
96106
}
97107
},
98108
"changelog-sections": [
@@ -150,4 +160,4 @@
150160
}
151161
],
152162
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
153-
}
163+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace OpenFeature.Providers.Ofrep.Client.Constants;
2+
3+
internal static class ErrorCodes
4+
{
5+
// Error codes
6+
internal const string ProviderNotReady = "provider_not_ready";
7+
internal const string ParseError = "parse_error";
8+
internal const string GeneralError = "general_error";
9+
internal const string FlagNotFound = "flag_not_found";
10+
internal const string TypeMismatch = "type_mismatch";
11+
internal const string General = "general";
12+
internal const string InvalidContext = "invalid_context";
13+
internal const string TargetingKeyMissing = "targeting_key_missing";
14+
internal const string ProviderFatal = "provider_fatal";
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace OpenFeature.Providers.Ofrep.Client.Constants;
2+
3+
internal static class OfrepPaths
4+
{
5+
// OFREP API paths
6+
internal const string Evaluate = "/ofrep/v1/evaluate/flags/";
7+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using OpenFeature.Model;
2+
using OpenFeature.Providers.Ofrep.Models;
3+
4+
namespace OpenFeature.Providers.Ofrep.Client;
5+
6+
/// <summary>
7+
/// Interface for the OFREP HTTP client.
8+
/// </summary>
9+
internal interface IOfrepClient : IDisposable
10+
{
11+
/// <summary>
12+
/// Evaluates a flag value using the OFREP API.
13+
/// </summary>
14+
/// <typeparam name="T">The type of the flag value.</typeparam>
15+
/// <param name="flagKey">The key of the flag to evaluate.</param>
16+
/// <param name="defaultValue">The default value to return if evaluation fails.</param>
17+
/// <param name="context">The evaluation context.</param>
18+
/// <param name="cancellationToken">A token to cancel the operation.</param>
19+
/// <returns>The evaluated flag response.</returns>
20+
Task<OfrepResponse<T>> EvaluateFlag<T>(string flagKey, T defaultValue, EvaluationContext? context,
21+
CancellationToken cancellationToken);
22+
}

0 commit comments

Comments
 (0)